JiscMail Logo
Email discussion lists for the UK Education and Research communities

Help for ALLSTAT Archives

ALLSTAT Archives

ALLSTAT Archives













By Topic:










By Author:











Monospaced Font








Subscribe or Unsubscribe

Subscribe or Unsubscribe

Log In

Log In

Get Password

Get Password


Responses to Probability Challenge


"Miland A I Joshi" <[log in to unmask]>


[log in to unmask]


Tue, 23 Feb 1999 09:37:23 GMT





text/plain (18 lines) , text/plain (261 lines)

I've had an error report on trting to send this to allstat. Whether
it was because of the attached Word document I do not know, but to
play safe only the text file is attached here.
Again, my thanks for all who contributed and apologies to any not
selected for the list of main contributions (many people had similar
I will not be posting any more contributions, though I still welcome
hearing from anyone with an exact, elegant answer to this problem.

Miland Joshi

You may find it simpler to use the following e-mail address in replying:
[log in to unmask]

Contributions on ‘Probability Challenge’

The problem was:

Have one pack of cards (shuffled), ask a person to name any two types
 of card, eg. jack and two (suits not included). Then just go
 through the pack of cards placing the cards face up on the table and
 aparently there's a good chance that these cards will turn up next to
 each other.
 Is this true?

My original approximate answer was:

Suppose the numbers specified are different, say 7
and 3. Suppose for simplicity that apart from the four 3's, of the 48
cards laid out the 7s are not at the ends, and have at least two
spaces between them. Then there are 49 possible 'slots' in which the
3's can go, and of these 8 will result in a 7 and a 3 being next to
each other. Hence the probability that this will not happen is
((41/49)^4) = 0.49. Hence, bearing in mind the simplifications, the
chance that we will get a 3 and a 7 together is about even.

>From Magnus Peterson
A Approximate solution (rather like yours I believe).

Let the cards be dealt out after shuffling in a straight line. Then there are
51 gaps between pairs of cards, and each may lie between a desirable pair or
not. Hence the number of desirable pairs X[i] associated with the i-th
gap is either 0 or 1, and the expected value of X[i] is just Pr(X[i]=1), which
by elementary probability theory is

Pr(Card on left is A)*Pr(Card on right is B|card on left is A) +
Pr(Card on left is B)*Pr(Card on right is A|card on left is B)
=(4/52)*(4/51)+(4/52)*(4/51) = 8/(13*51).

But the expected number of desirable pairs in the whole deal (D say) is then
E(D) = E(X[1])+E(X[2])+...+E(X[51]) = 8/13 = 0.6154 approx.

However also E(D) = 0*p[0]+1*p[1]+...+7*p[7]
where p[i] is the probability that there are i desirable pairs in all in the
deal. Hence we can obtain bounds on p[0] by assuming (falsely in each case)
(1) that p[2]=p[3]=...=p[7]=0, yielding p[0]=1-8/13=5/13=0.3846 approx
(too small)
(2) that p[1]=p[2]=...=p[6]=0, yielding p[0]=1-8/(13*7)=0.912 (much too big).

B Exact solution

My solution here depends on the result that with the pack in any FIXED order
if the cards are dealt out so that when k cards have already been placed
and then the (k+1)th is located with equal probability in any one of the
(k+1) available positions between those already dealt (including the two end
positions) then each of the 52! deals is equally likely to occur.

Let then the pack be organised so that the 8 "desirable" cards are at the top,
and then let the deal proceed. After the first eight cards have been dealt
there will just be the eight desirable cards on the table in one of
(8 choose 4) equiprobable distinguishable arrangements with the numbers of
desirable pairs at that stage having the following probabilities (as is
easily verified by simple enumeration):

No prs 0 1 2 3 4 5 6 7
Probs 0 1/35 3/35 9/35 9/35 9/35 3/35 1/35.

Thus the Probability Generating Function for the distribution of the number
of desirable pairs at this stage is

f[8](s)= s+3s^2+9s^3+9s^4+9s^5+3s^6+s^7.

Let f[k](s) be the PGF for this number after k cards (8<k<53). Since when
any other card is dealt it will either split a desirable pair with probability
r/k given that there are r desirable pairs in the previous stage, or fail
to do
so with probability 1-r/k, it is "easy to see" that


or equivalently that there is a recursion among the corresponding coefficients
(probabilities) of the form


A little work either with a computer algebra package (for the GF) or a
spreadsheet (for the recursion) then yields the answers

p[52,0]=0.513721 p[52,1]=0.371932 p[52,2]=0.100492
p[52,3]=0.01298 p[52,4]=0.000848 p[52,5]=2.72E-05
p[52,6]=3.81E-07 p[52,7]=1.71E-09.

Hence your original approximation was close to the truth.

I send as an attachment to this message the Excel spreadsheet which I used to
calculate the numbers above. (next page)

>From Kenneth Butler:

I got an answer just over 0.5 (actually 0.514) of failing to get any 3's
and 7's adjacent, and thus a probability of just under 0.5 of "success" --
very close to even, though.

Your approximation certainly takes care of much the commonest case, where
none of the 7's are next to each other. I think it is unnecessary to
worry about ends, because your 49 "slots" include the ones outside the
current outermost cards. Also, if you have the 7's separated only by one
of the 44 "plain cards", that still gives you two places to put a 3 next
to each 7.

My failure probability is about 2% higher than yours for two reasons:

1. I was thinking of placing the 3's one at a time. So, when you're
placing the 1st 3, you have 49 slots available, with 8 to avoid for a
probability of 41/49, as you said, but the first 3 has to go somewhere,
and so when you come to the second one, you now have 50 slots available
and 8 to avoid (assuming the 7's are separated). This makes the
probability of failure (41/49)(42/50)(43/51)(44/52)=0.501.

2. I calculated that the four 7's will be separated about 76.5% of the
time. It could be that some of the 7's are next to each other, but the
only case that is at all likely (it happens about 21.9% of the time) is
that you get one pair of adjacent 7's and the other two separated from
each other and this pair. This gives you only 7 slots to avoid, since the
pair only gives three (before it, after it, or between the two 7's), which
makes it a bit easier to fail: (42/49)(43/50)(44/51)(45/52)=0.550 by my

If you assume that all the cases with any neighbouring 7's have a pair of
7's and two singles, the approximate probability of failure is


which is very close to my accurate answer.

I then went on and figured the probabilities of all the arrangements of
7's, and the probability of not getting any 3's next to them. The more
bunched-up the 7's, the fewer the slots that have to be avoided (down to 5
when the 7's are in a group of four), but this is very nearly irrelevant
considering that the other possibilities (2 pairs of 7's, 3 7's and one
odd one, 4 7's) are all very unlikely. (The chance of 3 adjacent 7's and
one odd one is about 1%.)

(While I was working this out, I had a simulation running, which yielded
4813 successes and 5187 failures out of 10000 trials, which is entirely
consistent with my calculations.)

It's rather a shame that the probability of getting the cards to come out
adjacent is just less than 50%, rather than just more: you, as a card
shark, would love to be able to say "Shuffle these cards, and name me two
ranks, such as 3 and 7. I bet you I can get a 3 next to a 7 when I deal
the cards out". But this is a losing bet. Too bad.

>From John Whittington:

I'm a great empiricist, so
just ran a quick simulation in SAS. As you'll see from the following log, I
got 485,546 successes out of 1,000,000 random placements of the four 3's and
four 7's - pretty close to your 0.49 answer:

179 data _null_ ;
180 retain count total success 0 ;
181 array deck(*) c1-c52 ;
182 do trial = 1 to 1000000 ;
183 do i = 1 to dim(deck) ; deck(i) = . ; end ;
184 count = 0 ;
185 do until (count = 8) ;
186 place = ceil(ranuni(3456357)*52) ;
187 if deck(place) = . then do ;
188 count = count + 1 ;
189 if count <4.5 then deck(place) = 7 ; else deck(place) = 3 ;
190 end ;
191 end ;
192 do i = 1 to 51 ;
193 found = 0 ;
194 if (deck(i) = 3 and deck(i+1) = 7) or (deck(i) = 7 and
deck(i+1) = 3) then do ;
195 success = success + 1 ; found = 1 ;
196 end ;
197 if found = 1 then leave ;
198 end ;
199 total = total + 1 ;
200 end ;
201 put total= success= ;
202 run ;

TOTAL=1000000 SUCCESS=485546
NOTE: The DATA statement used 4 minutes 17.53 seconds.

>From Ian Saunders:

Version 1:
There are only 78 possible pairs, including 'identical' pairs
(Ace,Ace) etc. So in 51 tries there's a pretty good chance of getting the
chosen one.

There's a bit of sleight of hand in the above. The following is more
careful, but longer!

Version 2 (N.B. this is representative of a number of contributors who have suggested this approach,
though a list is not given here):
There are 13*13 = 169 possible ordered pairs of cards. Assuming
that the chosen pair has two distinct cards, there are 2 ways for it to
occur, so a random choice of a pair has probability 167/169 of NOT being the
chosen pair.

In laying out 52 cards you have 51 goes at picking the chosen pair. On the
large and untrue assumption that the pairs are independent, the probability
of missing it on all 51 is (167/169)^51 = 54.4%. Since the dependence
reduces the number of possible repeats of a pair, the number of distinct
pairs in a real deal will be greater than that for random generation of 51
pairs, so the probability of getting the chosen pair will be greater than
100%-54.4% = 45.6%.

>From David Lovell:

With regards to your card problem, call the two types of cards A and B.
Deal the cards in a circle (this will give you an approximate answer
without having to deal with any "edge effects").

Go to the first A card (A1)

P(left(A1) != B) = (51 - 4) / 51
P(right(A1) != B | left(A1) != B) = (50 - 4) / 50

Now go to A2

P(left(A2) != B | left(A1) != B && right(A1) != B) = (49 - 4) / 49

P(left(A1) != B && right(A1) != B && left(A2) != B && ...) =

47 x 46 x 45 x 44 x 43 x 42 x 41 x 40
51 x 50 x 49 x 48 x 47 x 46 x 45 x 44

which is 0.494.

So the probability of at least one instance of adjacent A's and B's
will be just over a half.

>From Peter Donnelly:

We are trying to calculate the probability that none of the
8 slots next to the 7's contained a 3. There are 48 choose 8 ways of
assigning cards to these slots, with no restrictions. There are 44
choose 8 ways of filling the slots if we are not allowed to use any of
the 3's.
Thus the probability required is 1-(44C8/48C8) = 0.530

Top of Message | Previous Page | Permalink

JiscMail Tools

RSS Feeds and Sharing

Advanced Options


November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007

JiscMail is a Jisc service.

View our service policies at https://www.jiscmail.ac.uk/policyandsecurity/ and Jisc's privacy policy at https://www.jisc.ac.uk/website/privacy-notice

For help and support help@jisc.ac.uk

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager