I threw a coin
n times, and never got three tails in a row. I calculated the odds of this event, and found out they were just about even; 50%50%. How many times did I throw the coin?
A second question: what were the chances of having not gotten three heads in a row either?
(In reply to
Markov chain solution  2nd part by Old Original Oskar!)
... how the question is being interpreted, I can understand and address Oskar's reasoning.
Oskar states:
For the second part, we need extra states [in addition to T and TT]:
HH (we got two heads in a row)[as the sofar last two] and HHH (we got three heads in a row [as the sofar last two]) [both assuming that neither HHH nor TTT has been achieved, HHH being the event that at some point HHH was achieved, and TTT that as some point TTT was achieved, and further tossing stopped].
Now the equations are
P(i+1,HHH)=P(i,HHH)+0.5xP(i,HH)
P(i+1,HH)=0.5xP(i,H)
P(i+1,H)=0.5x(P(i,T)+P(i,TT))
P(i+1,T)=0.5x(P(i,HH)+P(i,H))
P(i+1,TT)=0.5xP(i,T)
P(i+1,TTT)=P(i,TTT)+0.5xP(i,TT).
As there were i=10 tosses, calculating we get P(10,HHH)=P(10,TTT)=0.413 so the probability of not getting three heads or tails in a row are 0.174. As the problem asked for the probability of not getting three heads given that we didnt get three tails, the answer is 0.174/(10.413)=29.6%.
[I've reformatted to make the equations easier to read.]
... whose calculations result in (showing all the steps):
i h hh hhh t tt ttt
1 0.500000 0.000000 0.000000 0.500000 0.000000 0.000000
2 0.250000 0.250000 0.000000 0.250000 0.250000 0.000000
3 0.250000 0.125000 0.125000 0.250000 0.125000 0.125000
4 0.187500 0.125000 0.187500 0.187500 0.125000 0.187500
5 0.156250 0.093750 0.250000 0.156250 0.093750 0.250000
6 0.125000 0.078125 0.296875 0.125000 0.078125 0.296875
7 0.101563 0.062500 0.335938 0.101563 0.062500 0.335938
8 0.082031 0.050781 0.367188 0.082031 0.050781 0.367188
9 0.066406 0.041016 0.392578 0.066406 0.041016 0.392578
10 0.053711 0.033203 0.413086 0.053711 0.033203 0.413086
11 0.043457 0.026855 0.429688 0.043457 0.026855 0.429688
12 0.035156 0.021729 0.443115 0.035156 0.021729 0.443115
13 0.028442 0.017578 0.453979 0.028442 0.017578 0.453979
14 0.023010 0.014221 0.462769 0.023010 0.014221 0.462769
15 0.018616 0.011505 0.469879 0.018616 0.011505 0.469879
16 0.015060 0.009308 0.475632 0.015060 0.009308 0.475632
17 0.012184 0.007530 0.480286 0.012184 0.007530 0.480286
18 0.009857 0.006092 0.484051 0.009857 0.006092 0.484051
19 0.007975 0.004929 0.487097 0.007975 0.004929 0.487097
20 0.006452 0.003987 0.489561 0.006452 0.003987 0.489561
I've doublespaced row 10 for clarity.
Oskar correctly states that the probability of having done 10 tosses getting neither TTT nor HHH is .174, whether that's calculated as 1  .413  .413 or as .054 + .033 + .054 + .033 (the H, HH, T, and TT states that indicate that neither HHH nor TTT has yet been achievedas all these states are mutually exclusive and exhaustive (their probabilities add to 1)).
However he divides by something other than the probability that what was observed happening would happen, which is what should have been done to get the conditional probability. What we wanted was the probability that the tossing would continue to 10 without getting TTT. What Oskar gives the probability of is that TTT was not achieved because either 10 tosses took place without getting TTT OR because HHH was hit first and tossing stopped. The former is the case accounted for in the numeratorthe total of .054 + .033 + .054 + .033, plus, actually the case where the HHH first took place exactly at tosses 8, 9 and 10, which is the .413 in the HHH column of row 10 MINUS the .393 in that column (which is cumulative) in the row before. The latter (the stopping prior to 10) is the remaining .393 part of the .413.
Note that it does matter, when doing this calculation, that tossing would have stopped if HHH had been achieved earlier. For example, there was a 25% chance that that would have been accomplished by toss 5. Had tossing continued in this case, we could very well have gone on to get TTT before 10 tosses were complete, but we are saying tossing would stop, and that's the only way this whole table would be valid at all, as no provisions are made for continued tossing after HHH. If tossing had not stopped after an HHH possibility the other probabilities would have been affectedspecifically the probability of having gotten TTT would have increased, thereby decreasing the probability of not having gotten TTT.
So, getting back to the case of HHH capable of stopping the whole show before 10, the denominator, rather than being 1.413 = .587 (equivalently .054 + .033 + .054 + .033 + .413), should be .054 + .033 + .054 + .033 + (.413  .393) = .194, making the conditional probability that HHH (that is neither HHH nor TTT) was not achieved given that the tossing continued for 10 turns without getting TTT equal to .174/.194 = .897, consistent, given the rounding, with my previously posted answer for this version, enumerating cases that would count, of 178/199.
Edited on June 16, 2004, 9:07 pm

Posted by Charlie
on 20040616 21:04:17 