[Math] Expected Value for coin flips for five heads.

expectationprobability

Consider a coin that comes up heads with probability $p$ and tails with probability $1-p$ We
flip this coin (independently) and stop as soon as it comes up heads for the 5th time. Let X be the random variable whose value is the total number of times we
flip the coin. What is the expected value E(X) of X?


I'm unsure on how to find the expected value of this.

Can we use the $E(X) = np$ rule for this type of question, if so then the answer would be $5p$.

Possible answers (one of the following): $$\frac{5}{p},5p,\frac{1}{p^5}, p^5$$

Best Answer

The average amount of time you need to wait til the first heads is $\frac{1}{p}$ (this is the mean of a geometric distribution with parameter $p$ - the time it takes for the first head to appear when iid coins are flipped with heads probability $p$). After you get the first heads, you wait on average another $\frac{1}{p}$ for the second heads, since the geometric distribution si memoryless. So on so forth, and you get $\frac{5}{p}$. Alternatively, you can use the negative binomial distribution as suggested in the comments.