Consecutive Coin Flips Problem

expected valueprobability

I managed to solve this problem the way the book wanted me to do so, but I'm having trouble understanding why the following method won't work.

Toss a coin until we get five consecutive heads. $P(\text{Heads}) = p$. Find the expected number of tosses it takes.

We can solve this problem using the law of total expectation and conditioning on where the first Tails lands, which is exactly what leads to the right answer. I'm wondering if the following approach works as well.

The probability of a single heads is $p$, so the probability that we have five heads is $p^5$.
We want the expected number of flips to get five consecutive heads. We model this as a geometric random variable with parameter $p^5$. Therefore, we can simply take the expectation of a geometric random variable with parameter $p^5$ which is $\frac{1}{p^5}$.

However, let's take (by some miracle) $P(\text{Heads}) = p = 1$. Then my approach clearly doesn't work mathematically because expected number of tosses would then just be one. Can someone propose a more logical explanation of why this doesn't work.

Best Answer

As @lulu commented, you evaluated the expected count for groups of five tosses until all are heads, and that was not what you sought.


You want the expected count for tosses until we have five consecutive heads (the termination criteria) . Let this expected count equal $E$.

When counting tosses until termination, we might either immediately obtain five consecutive heads (a count of $5$ tosses with probability of $p^5$), or else we will obtain between none to four consecutive heads, and subsequent a tail and then must start counting again (ref: "reiteration"). In the later parts, we expect $(k+1+E)$ tosses with probabilities $p^k(1-p)$ for each case of $k$ in $\{0,1,2,3,4\}$.

Apply the Law of Total Expectation.

This will actually solve to a nice closed form for $p\neq 0$.