# How to calculate sum of negative binomial distribution ? it E[X] Var[x] and P(X = n |1 st event occurs on the 5 th try)

How to calculate sum of negative binomial distribution ? it $E[X], Var[x]$ and $P\{X = n |\text {first event occurs on the 5-th try}\}$

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

-
I want to prove that sum of negative probability distributions sum upto 1 – user669083 Nov 9 '12 at 19:40

Suppose that the probability of "success" is $p\ne 0$. Let $r$ be a fixed positive integer, and let $X$ be the number of trials until the $r$-th success. Then $$\Pr(X=k)=\binom{k-1}{r-1}p^r(1-p)^{k-r}.$$ We want to show that the sum of these probabilities over all $k$ is $1$. In a sense, this is obvious, since with probability $1$ the process will terminate. But probably it is intended that the sum be evaluated "analytically," without the use of probabilistic notions. So we will do it by manipulation of power series.
First note that the smallest possible value of $k$ is $r$, so we want to evaluate $$\sum_{k=r}^\infty \binom{k-1}{r-1}p^r(1-p)^{n-r}.$$
Let $f(x)=\dfrac{1}{1-x}$. If $|x|\lt 1$, then $f(x)$ has the power series expansion $$f(x)=\sum_{k=1}^\infty x^{k-1}.$$ Differentiate $f(x)$ a total of $r-1$ times with respect to $x$. We have $f'(x)=(1)(1-x)^{-2}$, $f''(x)=(2)(1)(1-x)^{-3})$, $f'''(x)=(3)(2)(1)(1-x)^{-4}$, and so on. So the $(r-1)$-th derivative of $f(x)$, usually denoted by $f^{(r-1)}(x)$, is given by the formula $$f^{(r-1)}(x)=(r-1)!(1-x)^{-r}.$$ Now differentiate the power series expansion of $f(x)$ a total of $r-1$ times, term by term. For $k-1\ge r-1$ (i.e.: $k\ge r$), the $(r-1)$-th derivative of $x^{k-1}$ is equal to $(k-1)(k-2)\cdots(k-r+1)x^{k-r}$. It is useful to note that $(k-1)(k-2)\cdots(k-r+1)x^{k-r}=\dfrac{(k-1)!}{(k-r)!}x^{k-r}$. We conclude that $$f^{(r-1)}(x)=(r-1)!(1-x)^{-r}=\sum_{k=r}^\infty \frac{(k-1)!}{(k-r)!}x^{k-r}.$$ Dividing both sides by $(r-1)!(1-x)^{-r}$, we get $$1=\sum_{k=r-1}^\infty \binom{k-1}{r-1}(1-x)^r x^{k-r}.$$ Finally, put $x=1-p$. Then $1-x=p$, and we have the desired result.
I took the liberty of making a few corrections (which I believe are all correct, but if not, my apologies). Am I correct in my conclusion that the negative binomial distribution quite simply isn't a probability distribution when the probability of success is $0$, or am I missing something? – Cameron Buie Oct 29 '13 at 4:48
A comment about your corrections, which I just looked at. It is not unlikely that there was slippage among my indices, occupational hazard. However, the important thing to note is that there are two slightly different definitions of the negative binomial, one older and still present in many elementary books, and one newer. The older version counts the number of trials until the $r$-th success. The newer one counts the number of failures until the $r$-th success. – André Nicolas Oct 29 '13 at 5:16
True enough, though if we wanted $X$ to represent the number of failures until the $r$th success, then the minimum value of $k$ would not be dependent on $r,$ so I figured you were just mixing versions (and I've certainly goofed on my indices before). Thanks for clearing up my side question! – Cameron Buie Oct 29 '13 at 5:20