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?
3 Answers
$\begingroup$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.
$\endgroup$ $\begingroup$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$.
$\endgroup$ $\begingroup$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.
$\endgroup$ 2More in general
"Zoraya ter Beek, age 29, just died by assisted suicide in the Netherlands. She was physically healthy, but psychologically depressed. It's an abomination that an entire society would actively facilitate, even encourage, someone ending their own life because they had no hope. Th…"