Expected Value for coin flips for five heads.

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$$

• Are you familiar with the negative-binomial distribution? Apr 18, 2014 at 2:49
• So I justed searched it up, what makes this NBD? Is expected value of NBD $\frac{r}{p}$ where $r=5$ and $p$ is my probability? Apr 18, 2014 at 2:52
• If $X\, is\,Negative-Binomial(5, p) \,then\, E(x)=5(1-p)/p$ Apr 18, 2014 at 2:54
• @undergrad I don't think it is a negative binomial distribution. The possible answers are: $\frac{5}{p}, 5p, \frac{1}{p^5}, p^5$ Apr 18, 2014 at 3:06
• Well $X > 5$, but $5p < 5$. I think what you need is $Xp=5$ Apr 18, 2014 at 3:09

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.