# Expected value of negative binomial distribution

With $k$ representing number of successes of trials, $r$ is the number of failures, and $p$ is probability of successes. I derivated the expected value of negative binomial distribution like this:

$$\mu_x =\sum^\infty_{k=0} {k{k+r-1 \choose k}p^k(1-p)^r}\\ =\sum^\infty_{k=1}{\frac{(k-1+r)!}{(k-1)!(r-1)!}p^{k}(1-p)^r}\\ =rp\sum^\infty_{k=1}{\frac{(k-1+r)!}{(k-1)!r!}p^{k-1}(1-p)^r}\\ suppose\ n=k+r-1,then:{\sum^\infty_{n=r}{\frac{n!}{(n-r)!r!}p^{n-r}(1-p)^r}=(p+(1-p))^n=1},\\ \mu_x=rp$$

why is not same as: $\mu_x=\frac{rp}{1-p}$,where am I wrong?

You have the wrong series closed form.   Where $\lvert p\rvert <1$
\begin{align}\sum\limits_{\color{red}r=0}^{\color{blue}n} \binom{n}{r} p^{n-r}(1-p)^r ~=~& (p+(1-p))^n ~=~ 1 \\[1ex] ~\neq~& \\[1ex] \sum\limits_{\color{blue}n=\color{red}r}^\infty \binom{n}{r} p^{n-r}(1-p)^r ~=~ & \dfrac 1{1-p}\end{align}
• Nice answer. Would you be so kind as to tell me why the second series (starting from $n=r$) converges to $\frac{1}{1-p}$? – Bergson Jun 23 '19 at 2:18
• @ThomasBladt The Geometric Series is $\sum\limits_{n=0}^\infty p^n=(1-p)^{-1}$ . Take the differential to the $r$th degree for any positive integer $r$. \begin{align}\dfrac{\mathrm d^r ~~~}{\mathrm d p\,^r}\sum_{n=0}^\infty p^n ~&=~\dfrac{\mathrm d^r ~~~}{\mathrm d p\,^r}(1-p)^{-1}\\\sum_{n=0}^{r-1}0+\sum_{n=r}^\infty \dfrac{n!}{(n-r)!}\,p^{n-r}~&=~r!\,(1-p)^{-1-r}\\\sum_{n=r}^\infty\dfrac{n!}{r!\,(n-r)!}\,p^{n-r}(1-p)^r~&=~(1-p)^{-1}\end{align} – Graham Kemp Jun 23 '19 at 5:00
• Edit: convergent only when $\lvert p\rvert< 1$ , of course. – Graham Kemp Jun 23 '19 at 12:27