Variance of negative binomial distribution - proof I am testing the variance of a negative binomial distribution, but I have problems in the derivative.
$$ V(x) = E(x(x-1))+E(x)-E(x)^{2} $$
$$ E(x(x-1)) =  \displaystyle\sum^{\infty}_{\substack{x=0}} x (x-1) \; P(X=x) $$
$$ E(x(x-1)) =  \displaystyle\sum^{\infty}_{\substack{x=0}} x (x-1) \displaystyle\binom{x-1}{r-1} \; p^{r} \; (1-p)^{x-r} $$
$$ E(x(x-1)) =  \displaystyle\sum^{\infty}_{\substack{x=0}} x (x-1) \dfrac{(x-1)!}{(x-r)!\;(r-1)!} \; p^{r} \; (1-p)^{x-r} $$
$$ E(x(x-1)) =  \displaystyle\sum^{\infty}_{\substack{x=0}} (x-1)r \dfrac{x!}{(x-r)!\;(r)!} \; p^{r} \; (1-p)^{x-r}  $$
$$ E(x(x-1)) = r\;(\dfrac{p}{1-p})^{r} \displaystyle\sum^{\infty}_{\substack{x=0}} \displaystyle\binom{x}{r} \; (x-1) (1-p)^{x}$$
$$ E(x(x-1)) = r\left(\frac{p}{1-p}\right)^r\left[\sum^{\infty}_{x=r} \binom{x}{r} (x-1)y^{x}\right]_{y=1-p}$$
$$ E(x(x-1)) = r\left(\frac{p}{1-p}\right)^r\left[\sum^{\infty}_{x=r} \binom{x}{r} (xy^x-y^x)\right]_{y=1-p}$$
$$ E(x(x-1)) = r\left(\frac{p}{1-p}\right)^r\left[\sum^{\infty}_{x=r}\binom{x}{r}xy^x-\sum_{x=r}^{\infty }\binom{x}{r}y^x\right]_{y=1-p}
 $$
$$E(x(x-1)) =r\left(\frac{p}{1-p}\right)^r\left[y\frac{d}{dy}\sum^{\infty}_{x=r}\binom{x}{r} y^x-\sum_{x=r}^{\infty }\binom{x}{r}y^x\right]_{y=1-p}
 $$
Help me, please, Thanks
 A: Your trouble is due to using $x(x-1)$ instead of $x(x+1)$. You can verify the identity
$$
x(x+1){x-1\choose r-1}=r(r+1){x+1\choose r+1}\tag1
$$
which implies that
$$E(X(X+1))= \sum_{x=r}^\infty r(r+1){x+1\choose r+1}p^r(1-p)^{x-r}
=r(r+1)\sum_{x=r}^\infty {x+1\choose r+1}p^r(1-p)^{x-r}.\tag2
$$
To evaluate the rightmost sum in (2), the simplest approach is to use the fact that the negative binomial distribution sums to $1$:
$$
1 = \sum_{x=r}^\infty {x-1\choose r-1}p^r(1-p)^{x-r}\tag{*}
$$
How? Try renaming the variables appearing in the right-hand sum of (2) to arrive at something that looks more like ($*$). The obvious choice is to define $w$ and $s$ such that:
$$x+1 = w-1\qquad\text{and}\qquad r+1 = s-1.$$
In terms of these new variables $w:=x+2$ and $s:=r+2$, you can now recognize ($*$):
$$\sum_{x=r}^\infty {x+1\choose r+1}p^r(1-p)^{x-r}=\sum_{w=s}^\infty {w-1\choose s-1}p^{s-2}(1-p)^{w-s}=p^{-2}\underbrace{\sum_{w=s}^\infty {w-1\choose s-1}p^{s}(1-p)^{w-s}}_{1}\tag3$$
Having found $E(X(X+1))$, you can now calculate
$$\operatorname{Var}(X)=E(X(X+1)) - E(X) - [E(X)]^2.$$
