A problem for complete beginners (1/2006)



Problem:
In a 52 cards pack what is the probability to get (drawings without replacement), two *pairs* in a five cards *hand* (a pair = two cards of the same value).

Resolution:

There are 13 different values in each suit (Ace, King, Queen, … 4, 3, 2); let be A, B, C. We must to take in account all the permutations of these 3 symbols: two A´s , two B´s and one C, for example AABBC, CABAB, etc. Its number is 5! / (2! 2! 1!) = 30.
Let´s suppose we have the result AABBC obtained by this order. Because A is not defined the probability to have t is 52/52; to get the second A has the probability 3/51. To the first B the probability is (52-4)/50 and to the second 3/49. Because C could be any value (but different from A and B) the probability to get it is (52-8)/48. Therefore
p(AABBC) = (52/52)*(3/51)*(48/50)*(3/49)*(44/48)
= 0.003169268
This quantity must be multiplied by 30, as it was explained above) and divided by 2 (because no matters the order by which the cards forming the pair occurs).

Finally
___p(two pairs) = (30/2)*p(AABBC) = 0.047539__

This value was checked by simulation giving
0.047745__0.047136__mean value= 0.0474


REM "TWOPAIRS"
CLS
vv = 1000000
DIM card(52), hasvalue(13)
FOR v = 1 TO vv: RANDOMIZE TIMER
LOCATE 10, 10
PRINT USING "########"; vv - v
FOR c = 1 TO 52: card(c) = 1: NEXT c
FOR va = 1 TO 13: hasvalue(va) = 0: NEXT va
twopairs = 0
FOR i = 1 TO 5
10 w = INT(52 * RND) + 1
IF card(w) = 0 THEN GOTO 10
REM finding the value (1, 2, ... , 13)
c1 = w: card(w) = 0
IF c1 < 14 THEN GOTO 33
FOR g = 1 TO 3
c1 = c1 - 13
IF c1 < 14 THEN GOTO 33
NEXT g
33 hasvalue(c1) = hasvalue(c1) + 1
NEXT i
FOR U = 1 TO 13
IF hasvalue(U) = 2 THEN twopairs = twopairs + 1
NEXT U
IF twopairs = 2 THEN YES = YES + 1
freq = YES / v
NEXT v
PRINT freq : END

_______________licas_@xxxxxxxxxxx
.


Quantcast