If A has m=12 coins and B has n=13 coins. Coins are fair and the same. Both players throw their coins and observe the number of heads. What is the probability that B obtains more heads than A?

answer:

Obviously the probability is 0.5. I solve it with simulation of tossing coins for two persons. The simulation has parameters m and n and number of simulate step k. I use binomial random numbers and answer is the confidence interval of the above probability, winning B.

# R code for answer of The probability

m=12; n=13; k=1000

a=rep(0, times=k)

for(i in 1:k)

a[i] = sum(rbinom(k, n, 0.5) > rbinom(k, m, 0.5))

print('95% Confidence Interval for the winning probability: ')

print(paste(mean(a) / k ,' +- ', sd(a/k) / sqrt(k) * 1.96))

# answer: 0.5 +- 0.01

More Seyed mahmoud Mirkhan's questions See All
Similar questions and discussions