# Calculating the Second Moment of a Binomial Random Variable

The first step in calculating the variance of a Binomial Random Variable is calculating the second moment.

I have no idea as to how the last two steps have happened. Why is a n(n-1)p^2 outside the first summation and a similar expression outside the second? Also, how did the expression turn out to be the last equation?

First term is obtained as follows:

\begin{align} \sum_{j=0}^{n} \frac{n!(j^2-j)}{(n-j)!j!}p^j(1-p)^{n-j} &= \sum_{j=2}^{n} \frac{n!(j^2-j)}{(n-j)!j!}p^j(1-p)^{n-j}\tag{1}\\&=\sum_{j=2}^{n} \frac{n!(j(j-1))}{(n-j)!j!}p^j(1-p)^{n-j} \tag{2}\\ &= \sum_{j=2}^{n} \frac{n!}{(n-j)!(j-2)!}p^j(1-p)^{n-j} \tag{3} \\ &= n(n-1)\sum_{j=2}^{n} \frac{(n-2)!}{(n-j)!(j-2)!}p^j(1-p)^{n-j} \tag{4}\\ &= n(n-1)p^2\sum_{j=2}^{n} \frac{(n-2)!}{(n-j)!(j-2)!}p^{j-2}(1-p)^{n-j} \tag{5} \\ &= n(n-1)p^2\sum_{j'=0}^{n-2} \frac{(n-2)!}{(n-2-j')!(j')!}p^{j'}(1-p)^{n-2-j'} \tag{6} \\ &= n(n-1)p^2 \tag{7} \\ \end{align}

where equation $(1)$ is due to $j^2-j=0$ if $j=0$ or $j=1$, hence we can start summing from $2$ rather than $0$.

Equation $(2)$ is just $j^2-j=j(j-1)$.

Equation $(3)$ is due to $j!=(j-2)!j(j-1)$

Equation $(4)$ is due to $n!=(n-2)!n(n-1)$.

Equation $(5)$ is just factorize $p^2$ outside.

Equation $(6)$ is a change of variable of $j'=j-2$

To obtain equation $(7)$, notice that in equation $(6)$, the term inside the sum if the pmf of binomial distribution with parameter $n-2$ and $p$.

I will leave the second term as an exercise.

They distributed out constant factors from series so that a change of variables would make it the series of probabilities for a binomial expansion $(p+1-p)^{n-1}$.   They did not show their work, thinking it would be obvious.   Clearly it is not.

I'll just do one of the terms $${ \quad \sum_{j=0}^n\dfrac{n!\ j}{(n-j)!\ j!}p^j(1-p)^{n-j} \\ = \sum_{j=0}^n \dfrac{n(n-1)!\,j}{(n-1-j+1)!\, j\, (j-1)!} p\, p^{j-1}(1-p)^{n-1-j+1} \\ = np \sum_{j=0}^n\dfrac{(n-1)!}{(n-1-(j-1))!\,(j-1)!}p^{j-1}(1-p)^{n-1-(j-1)} \\ = np \sum_{j-1=-1}^{n-1}\binom{n-1}{j-1}p^{j-1}(1-p)^{n-1-(j-1)} \\ = np \sum_{j-1=0}^{n-1}\binom{n-1}{j-1}p^{j-1}(1-p)^{n-1-(j-1)} \\ = np \sum_{k=0}^{n-1}\binom{n-1}k p^k(1-p)^{n-1-k} \\ = np (p+(1-p))^{n-1} \\ = np }$$

The other term follows likewise. Of particular note we use the conveniention that $\binom{r}{-1}=0$.

The $n$ and $n-1$ are coming out of the $n!$ remember that $n!=n*(n-1)*(n-2)!$. The $p^2$ came from the $p^j$ since $p^j=p^{j-2}*p^2$. Once this terms are out both sums (separately) are equal to the probability mass function of a binomial random variable hence they sum to 1. Hence the result.

• In that case, why have the numbers on the summations changed?
– SDG
Oct 18, 2017 at 3:27
• For the first sum when $j=0$ or $1$ the term is 0 since $j^2-j=0$, for the second sum when $j=0$ the term is 0. So you don't have to consider those. Oct 18, 2017 at 3:30