Expected Coin Flips – Is My Answer Correct for 5 Consecutive Heads?

probabilitypuzzlestatistics

I found this puzzle online. Before my question gets flagged or on hold, I know the question has already been answered here but since I tried to solve it on my own I want to check if it's correct or not.

The puzzle is "What is the expected Number of Coin Tosses to Get Five Consecutive Heads".

My answer is the following:

Because a coin has two sides, one for tails and one for heads, let $p$ be the probability of getting heads. Then the probability of getting tails is $1-p$. For obvious reasons I shall assume that the coin is fair, thus the probability of getting heads is $\dfrac{1}{2}$ and tails $\dfrac{1}{2}$ as well.

Let $X_i$ be a random variable indicating the number of flips required to get heads, when $i-1$ was heads.

What we are looking for is the number of tries for a single success, thus we shall assume the random variable $X_i$ is following the Geometric Distribution with Probability $P(X_i = x) = p (1-p)^{x-1}$.

The expected number of coin flips to get 5 consecutive heads is given by the expected average $E(X) = \dfrac{1}{p}$.

The probability of the random variable $X_i$ is $\dfrac{1}{2^{i}}$ since the coin is fair.

Thus for $5$ consecutive heads $E(X) = E(X_1) + … + E(X_5) = \sum_{i=1}^{5}E(X_i) = \sum_{i=1}^{5}2^i = 62$

So the expected number of coin flips to get $5$ consecutive heads is $62$.

Best Answer

I ask you for additional explanation. Meanwhile I'll post here another approach.

Denote by $\tau_i^5$ the random variable that counts the time required to get five heads starting from $i$ heads, ok?

What we want is exactly $E[\tau_0^5]$, right?

Now, you can evaluate $E[\tau_0^5]$ conditioning at the first step.

$$ E[\tau_0^5] = \frac{E[\tau_0^5]}{2} + \frac{E[\tau_1^5]}{2} +1 $$

Explaining the equation above. With probability $1/2$ you have a tail, so the time you will take to get five heads is the same, because you have any heads. On the other hand, with the same probability you get a head, and now, the number of flips needed to get 5 heads is $E[\tau_1^5]$, because now you that you have one head. The +1 it is because you have to count the first step.

Repeating the argument above you get

$$ E[\tau_1^5] = \frac{E[\tau_0^5]}{2} + \frac{E[\tau_2^5]}{2} +1 $$

Proceeding this way, and remembering $E[\tau_5^5]=0$, you get

$$ E[\tau_0^5] = 62 $$

This may seems more complicated at the first sight, but the idea of "to conditionate at what happens at the first time (or movement)" solve a big variety of problems.

Related Question