# Flipping a fair coin until either H or TTTT appears; what is the probability of getting at most two T's?

We flip a fair coin repeatedly and independently, resulting in a sequence of heads (H) and tails (T). We stop flipping the coin as soon as this sequence contains H or T T T T. What is the probability that this sequence contains at most two Ts?

• If I read the problem correctly, there are only three possible sequences with at most two Ts: H, TH, TTH. Or am I missing something? – Harald Hanche-Olsen Dec 7 '14 at 8:29
• @Harald: I don’t think so. And given the stopping conditions, there are only two other possible outcomes. – Brian M. Scott Dec 7 '14 at 8:30

Flip the coin exactly three times (if the rules said to stop, just continue throwing for fun). Now if you've obtained TTT, then you've already got more than two T's, and will continue to have them regardless of what follows. So in this case getting at most two T's fails. In all other cases you've got a H, so the game has stopped, and you have at most two T's (in all, of which only those before the first H really matter). In these cases getting at most two T's succeeds.
So you can compute the probability of success as that of getting something else than TTT after three throws. (So that probability would be the same even if the rule for stopping at $4$ T's were replaced by stopping at say $97$ T's).
• Actually my answer say it suffices looking at three flips, so the denominator is $8$ rather than $16$. But yes, the answer you suggest has the correct value (and you can arrange the denominator to be $8$). – Marc van Leeuwen Dec 7 '14 at 10:52