Siddharth and Alok have 10 coins and 9 coins respectively. They are playing a game in which they throw up all their coins simultaneously and observe the number of coins which land heads up. The person with more heads wins. If there are no trick coins, what is the probability that Siddharth wins?
Additionally, calculate the probabity that Siddharth loses?
There are 2^10 ways Siddharth's coins can land and 2^9 ways of Alok's coins landing. The number of ways a given number, r, of coins being heads out of n coins is C(n,r), each with a 1/2^n probability of happening. So the probabilities of given numbers of heads for the two contestants is:
Siddharth Alok
0 1/1024 1/512
1 5/512 9/512
2 45/1024 9/128
3 15/128 21/128
4 105/512 63/256
5 63/256 63/256
6 105/512 21/128
7 15/128 9/128
8 45/1024 9/512
9 5/512 1/512
10 1/1024
A grid could be made showing all the products of the probabilities of any given score for Alok and any given score for Siddharth, and add up those probabilities that make for an Alok win or a Siddharth win respectively, but to ease the calculation, the following program does this for us:
4 dim Sidd(10),Alok(9)
5 N=9
10 Allways=2^N
20 for R=0 to N
30 Alok(R)=combi(N,R)//Allways
40 next
105 N=10
110 Allways=2^N
120 for R=0 to N
130 Sidd(R)=combi(N,R)//Allways
140 next
200 for S=1 to 10
210 for A=0 to S-1
220 Stot=Stot+Sidd(S)*Alok(A)
230 next
240 next
250 print Stot,Stot/1
300 for A=1 to 9
310 for S=0 to A-1
320 Atot=Atot+Sidd(S)*Alok(A)
330 next
340 next
350 print Atot,Atot/1
400 print 1-Atot-Stot,(1-Atot-Stot)/1
It finds that Siddharth has a 1/2 probability of winning and Alok has 84883/262144 ~= 0.323802947998046875 probability of winning, leaving a 46189/262144 ~= 0.176197052001953125 probability of a tie.
|
Posted by Charlie
on 2010-11-09 15:26:53 |