Variance of Negative Binomial Distribution/Second Form

Theorem
Let $X$ be a discrete random variable with the negative binomial distribution (second form) with parameters $n$ and $p$.

Then the variance of $X$ is given by:
 * $\var X = \dfrac {n q} {p^2}$

where $q = 1 - p$.

Proof
From Variance of Discrete Random Variable from PGF:
 * $\var X = \map {\Pi''_X} 1 + \mu - \mu^2$

where $\mu = \expect X$ is the expectation of $X$.

From the Probability Generating Function of Negative Binomial Distribution (Second Form):
 * $\map {\Pi_X} s = \dfrac {p s} {1 - q s}$

From Expectation of Negative Binomial Distribution/Second Form:
 * $\mu = \dfrac n p$

From Second Derivative of PGF of Negative Binomial Distribution/Second Form:
 * $\dfrac {\d^2} {\d s^2} \map {\Pi_X} s = \paren {\dfrac {p s} {1 - q s} }^{n + 2} \paren {\dfrac {n \paren {n - 1} + 2 n q s} {\paren {p s^2}^2} }$

Putting $s = 1$ and using the formula $\map {\Pi''_X} 1 + \mu - \mu^2$: