The probability of having $k$ successes before $r$ failures in a sequence of independent Bernoulli trials
Problem
Find the probability of having $k$ successes before $r$ failures in a sequence of independent Bernoulli trials with $p$ being the probability of success.
I thought of using the Binomial distribution, the random variable $X$ is the number of successes, only this time I am interested not only in the number of successes but also in which order they are obtained. If the number of trials was $n$, then obviously I suppose $r+k \leq n$, I don't quite get the problem: the $k$ successes have to be one after the other, I mean, have to be $k$ successive successes?. I would like some explanation on the problem and suggestions of how could I calculate the probability I am being asked.
Solution 1:
Interpretation A
What is the probability of observing $k$ consecutive successes followed by $r$ consecutive failures?
It's a rather simple solution:
The probability of succeeding is $p$, thus succeeding $k$ times independently has probability $p^k$. Same for failing $r$ times independently: $(1-p)^r$.
In total we have
$$P = p^k (1-k)^r$$
Interpretation B
What is the probability that exactly $k$ successes occur before the $r$-th failure?
We need to put these $k$ successes in order with $r-1$ failures and obtain an additional failure (the $r$-th) giving $$P = \binom{k+r-1}k p^k (1-p)^{r-1} \cdot (1-p) = \binom{k+r-1}k p^k (1-p)^r$$
Interpretation C
What is the probability that (at least) $k$ successes are observed before the $r$-th failure occurs?
This is requesting at most $r-1$ failures before $k$ successes (see @Thursdays comment). In this case we have $$P = \sum_{j=0}^{r-1} \binom{k-1+j}{k-1} p^k (1-p)^j$$ as a solution
Thanks to @DilipSarvate for the interpretation titles
Thanks to @BrianMScott and @robjohn for spotting an error in the formula for interpretation C (after all this time)
Solution 2:
I take this to mean the probability of getting $k$ successes before the $r^\text{th}$ failure. To keep the cases separate, we case on the $k^\text{th}$ success.
The probability of $k-1$ successes and $j$ failures followed by a success is $\binom{k+j-1}{j}p^k(1-p)^j$. Thus, the probability of $k$ successes before $r$ failures is $$ \sum_{j=0}^{r-1}\binom{k+j-1}{j}p^k(1-p)^j $$
As it should be, the limit as $r\to\infty$ is $1$ $$ \begin{align} \sum_{j=0}^\infty\binom{k+j-1}{j}p^k(1-p)^j &=\sum_{j=0}^\infty(-1)^j\binom{-k}{j}p^k(1-p)^j\\ &=p^k(1-(1-p))^{-k}\\[12pt] &=1 \end{align} $$