A coin with probability of getting head $0.6$ is tossed repeatedly till two heads appear. Let $X$ be the number of tosses needed to get exactly 2 heads. Describe the sample space. Find the mean and variance of $X$.

What I've tried so far:

Let $P(H)=p$ and $P(T)=q$ such that $p+q=1$. $\displaystyle P(X=n)=\binom{n}{2}p^2q^{n-2}\tag*{}$ Is this even correct because $\sum\limits_{n} P(X=n)=\frac{p^2}{(1-q)^3}>1$?

I am absolute beginner. Any help would be appreciated.

Update: Reading about negative binomial distribution, I realised the point I was missing. It's that we have to necessarily get the second head on the last toss. The correct P.M.F. would be: $\displaystyle\boxed{ P(X=n)=\binom{n-1}{1}p^2q^{n-2}}\tag*{}$

  • 3
    $\begingroup$ Take a look at the negative binomial distribution. $\endgroup$
    – jblood94
    Feb 15, 2023 at 17:14
  • $\begingroup$ @jblood94 Thank you! I've understood my mistakes. Everything now makes sense. $\displaystyle P(X=n)=\binom{n-1}{1}p^2q^{n-2}\tag*{}$ Also, $\sum\limits_{n\geqslant 2}P(X=n)=\frac{p^2}{(1-q)^2}=1\tag*{}$ $\endgroup$ Feb 15, 2023 at 19:45
  • 1
    $\begingroup$ I posted my answer as you were posting your update. $\endgroup$
    – Mkanders
    Feb 15, 2023 at 20:18

1 Answer 1


I see you learned that your formula was incorrect because you know the last (nth) trial must be a success (heads). That means you have $n-1$ trials to get $r-1$ successes and $n-r$ failures. $$P(n;r) = p\binom{n-1}{r-1}p^{r-1}q^{n-r}$$ In your case, $r=2$, so $$P(n;2) = p\binom{n-1}{1}pq^{n-2}$$

Did you figure out the mean and variance? Here's what I did.

The First Success distribution is the number of trials $Y$ until the first success. $$P(Y=k) = q^{k-1}p$$ $$E(Y) = \sum_{k=1}^{\infty}kq^{k-1}p = \frac{1}{p}$$ $$Var(Y) = \frac{q}{p^2}$$ To get the variance, first get the second moment: $$E(Y^2) = \sum_{k=1}^{\infty}k^2q^{k-1}p = \frac{1+q}{p^2}$$ Then use $$Var(Y) = E(Y^2) -(EY)^2 =\frac{1+q}{p^2} - \frac{1}{p^2} = \frac{q}{p^2}$$ Consider the number of trials until success $r$. This is the sum of $r$ independent variables $Y_1, Y_2, ..., Y_r$ $$E(Y_1 + ... + Y_r) = E(Y_1) + ... +E(Y_r) = r \cdot \frac{1}{p} = \frac{r}{p}$$ Since they're independent, you can add their variances. $$Var(Y_1 + ... + Y_r) = r \cdot \frac{q}{p^2}$$ In your case, $r=2, p = 0.6, q = 0.4$. $$E(Y_1 + Y_2) = \frac{2}{0.6} = \frac{10}{3} = 3.333$$ $$Var(Y_1 + Y_2) = 2 \cdot \frac{0.4}{0.6^2} = 2 \cdot \frac{10}{9} = 2.222$$

  • $\begingroup$ I had managed to get the mean & the variance using $E(X)$ and $E(X^2)$ but it was quite lengthy... This is much easier! Thank you for this interesting approach. $\endgroup$ Feb 15, 2023 at 22:29
  • 1
    $\begingroup$ variance should have been 2.222. Correct now. $\endgroup$
    – Mkanders
    Feb 16, 2023 at 4:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.