TITLE: Calculating the Second Moment of a Binomial Random Variable
QUESTION [7 upvotes]: 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?

REPLY [2 votes]: 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$.