# $E[X(X-1)]$ of a Binomial random variable

Let $X~\sim B(n,p)$ be a binomial random variable. Calculate $E[X(X-1)]$.

Do I need to use the Binomial theorem? If yes, how?

Hint: It is $E(X(X-1))=E(X^2)-E(X)$.

And $Var(X)=E(X^2)- [E(X)]^2 \Rightarrow E(X^2)=Var(X)+[E(X)]^2$

• I don't understand why $E(X(X-1))=E(X^2)-E(X)$. Could you help me see it?
– E Be
May 13, 2015 at 16:42
• @UdiBehar It's true in general that $E[X+Y]=E[X]+E[Y]$. That's true even if $X$ and $Y$ are dependent. May 13, 2015 at 16:43
• @UdiBehar $E(X(X-1))=E(X^2-X)=E(X^2)-E(X)$ May 13, 2015 at 16:46

$$E[X(X-1)]$$ $$=\sum_{x=0}^nx(x-1){n\choose x}p^xq^{n-x}$$ $$=\sum_{x=2}^nx(x-1)\frac{n!}{x!(n-x)!}p^xq^{n-x}$$ $$=n(n-1)p^2\sum_{x=2}^n\frac{(n-2)!}{(x-2)!(n-x)!}p^{x-2}q^{n-x}$$ $$=n(n-1)p^2(p+q)^{n-2}$$ $$=n(n-1)p^2$$ Note that $x(x-1)=0$ for both $x=0$ and $x=1$, so the range of summation an be taken as $x=2,3,\dots,n$; after factoring $n(n-1)p^2$ through the summation, the remaining sum is just $(p+q)^{n-2}$ from the binomial theorem.

• Thank you. Now what is $X$'s variance?
– E Be
May 13, 2015 at 16:43
• The variance is $E[X(X-1)]+\mu_X-\mu_X^2=E[X(X-1)]-\mu_X(\mu_X-1)$. Thus it is $n(n-1)p^2-np(np-1)=np(1-p)=npq$. May 13, 2015 at 16:45
• I'm using $\sigma_X^2=E[X^2]-E[X]^2$. Where $\mu_X=E[X]$. May 13, 2015 at 16:47