# Probability…coin toss

A coin having probability $p$ of coming up heads is successively flipped until the $r^{th}$ head appears. Let $X$ be the number of flips required. Find the probability $P(X=n)$.

So this means I need to find the probability that $n$ flips are needed to get the $r^{th}$ head. I am not sure how to proceed. Any help/clarification please?

Thank you.

-

If $n$ flips are required to get $r$ heads, it means in $n-1$ flips you already have $r-1$ heads and the $n^{th}$ flip is a head. Assuming successive flips are independent,

$P(X=n)=P(r-1 \text{ heads in } n-1 \text{ flips})*p$

$P(X=n)=\binom{n-1}{r-1}p^{r-1}{(1-p)}^{n-r}*p$

-

I'm quite sure this question involves some sort of distribution. You might want to search about the Negative Binomial distribution. Given the probability of a success $p$, calculate the number of times, $n$, you will need to achieve $r$ successes.

I will shamelessly copy the equation from Shyam

$$P(X=n)=\binom{n-1}{r-1}p^{r-1}{(1-p)}^{n-r}\times p$$

There are 3 parts to this equation (RHS), namely:

• Basically, the $\binom{n-1}{r-1}$ means there are these number of ways where you can select $r-1$ successes, out of $n-1$ tries.
• The next part, $p^{r-1}{(1-p)}^{n-r}$ means, assuming the event of success is independent, once again, $r-1$ successes and $n-r$ failures. Consider that $(n-r) + (r-1) = (n-1)$, which is the total number of tries so far.
• Multiply that with $p$, which is the probability of the last success, and you get your answer.
-