Three identical fair coins are thrown simultaneously until all three show the same face. What is the probability that they are thrown more than three times?When three coins are tossed there are 8 possible outcomes, two of which are (HHH and TTT) have all three coins showing the same face. Therefore, the probability of getting all three coins with the same face is 2 out of 8, or 1/4.
I solved this problem two different ways. First, I used a formula derived in an earlier problem and calculated P(X>3) directly and got ~.4219. Wanting to check this, I next used the "brute force and ignorance" method and calculated P(X>3) = 1-[P(X=1) + P(X=2) + P(X=3)] and again got an answer of ~.4219.
The math department chair at my school enjoys programming so I asked him to program this, run it 10,000 times, and see how the experimental probability matches up with the theoretical probability. Here is the text of the email I just received from him:
I just finished coding the program to test your coin flipping problem. The program considers 10,000 test cases. I ran it 10 times with the following results. Also, I've included the program if you want to see what it looks like. I wrote it in Python.Nice!
Pretty good results. I'd say your answer is correct.
i = 0
s = 0
x = int(np.random.random_sample() + .5)
y = int(np.random.random_sample() + .5)
z = int(np.random.random_sample() + .5)
while i < 10000:
t = True
c = 0
while t == True:
r = role()
c += 1
if r == (1,1,1) or r == (0,0,0):
t = False
if c > 3:
s += 1
i += 1p = s / 10000.00print p