[Math] Probability of binomial n success before m failures

binomial-coefficientsnegative binomialprobability

problem of n success before m failures where binomial probability of success is p has a standard textbook solution as follows $$P = \sum_{k=n}^{m+n-1} \binom{m+n-1}k p^k (1-p)^{m+n-1-k}$$

I am however unable to come up with this solution and i am not sure where i deviate and how?

I start with combinatorial logic that for any t trials

(a) last trial has to be a success => probability of p

(b) in t-1 trials before last trial, n-1 have to be success and (t-1)-(n-1) failures => probability of $\binom{t-1}{n-1} p^{n-1} (1-p)^{t-n}$

Combining (a) and (b) gives me probability that t trials have t-n failures before n success
$P_{t} = \binom{t-1}{n-1} p^{n} (1-p)^{t-n}$
I understand that this is negative binomial pmf as well.

From here on, i say that total probability is sum of all the probabilities with various t i.e.
$P = \sum_{n}^{m+n-1} P_{t}$ that can be written as
$$P = \sum_{t=n}^{m+n-1} \binom{t-1}{n-1} p^{n-1} (1-p)^{t-n} $$

I believe something is off with my last step.. may be these events of different $t$ trials are not mutually exclusive but i am not able to see it.

For example: n = 3 success and m = 2 failures; p = binomial probability

(a) I can have a 3 trial solution SSS with probability $p^3$

(b) 4 trial solution {SSFS,SFSS,FSSS} with probability $ \binom{3}{2} p^{3} (1-p)^1$

(c) 5 trial solution is not possible since n=2 would have happened

I would therefore add probabilities from (a) and (b) as solution but that would give
$$ P = p^3 + \binom{3}{2} p^{3} (1-p)^1 $$

and of course, this is not right.
Can someone help and point out why this is not correct and what can i fix here?

Best Answer

The book answer (or your transcription of it) appears to be incorrect

By the way, it is simpler to count failures, and look at the results in reverse.
With $0 \le k < m$, the last trial must be a success, and the $k$ failures can be distributed any which way in the remaining $(k+n-1)$ trials, thus

$$P = \sum_{k=0}^{m} \binom{k+n-1}k p^n (1-p)^k$$

If you want to count successes (as the book has done), you should now be able to correct the formula you have transcribed.