Probability – Expected Value of Flips Until HT Consecutively

probabilityrandom variables

Suppose you flip a fair coin repeatedly until you see a Heads followed by a
Tails. What is the expected number of coin flips you have to flip?

By manipulating an equation based on the result of the first flip, shown at this link:

http://www.codechef.com/wiki/tutorial-expectation

the answer is 6. This also makes sense intuitively since the expected value of the number flips until HH or TT is 3. But is there a way to tackle this problem by summing a series of probabilities multiplied by the values?

Thank you!

Best Answer

Let X be the random variable which counts the number of flips till we get a T (tails). Then: $$E[X] = \frac{1}{2}\cdot1 + \frac{1}{2}(1+E[X])$$ $$\implies E[X] = 2$$ The first term on LHS is if we get a T on a our first flip (with probability $\frac{1}{2}$). The second term is if we get a H (heads) on our first flip (with probability $\frac{1}{2}$), which means that we are effectively starting over with 1 extra flip.

Now let Y be the random variable which counts the number of flips till we get a HT sequence. Then: $$E[Y] = \frac{1}{2}(1+E[Y])+\frac{1}{2}(1+E[X])$$ $$\implies E[Y] = 4$$ The first term on LHS is if we get a T on our first flip (with probability $\frac{1}{2}$), which means we are effectively starting over with 1 extra flip. The second term if we get a H on our first flip (with probability $\frac{1}{2}$), then all we want is a T, which means we want to count 1 + expected number of flips to get a T.

Related Question