# $\sum_{m=0}^n (m-np)^2 {n \choose m} p^m q^{n-m} = npq$

How to show that:

$\sum_{m=0}^n (m-np)^2 {n \choose m} p^m q^{n-m} = npq$

-

3
do you really want to show it this way or can you use the binomial random variable? – Jean-Sébastien Dec 8 '12 at 18:11

## 2 Answers

Here is a way to see it without having to expand anything in the sum. Consider a random variable $X$ following a binomial distribution with parameters $n,p$. By definition, it is the sum of $n$ i.i.d. Bernoulli$(p)$ random variable, who have expectation $p$ and variance $pq$. So since $$X=X_1+X_2+\cdots X_n,$$ it's expectation is the sum of the expectation of all $X_m$, so $E[X]=\sum_{m=0}^nE[X_m]=np$. Since the $X_m's$ are independant, the variance of their sum is the sum of their variance so $$Var[X]=npq,$$ $(q=1-p)$. By definition of the variance, you also have $$Var[X]=\sum_{k=0}^{n}(m-np)^2\binom{n}{m}p^{m}q^{n-m}.$$ thus, both are equal.

-

$(m-np)^2\binom n m=\{m(m-1)+(1-2np)m+n^2p^2\}\binom n m=n(n-1)\binom{n-2}{m-2}+(1-2np)n\binom {n-1}{m-1}+n^2p^2\binom n m$

as $m\binom n m=m\frac{n!}{m!(n-m)!}=mn\frac{(n-1)!}{m\cdot(m-1)!\{(n-1)-(m-1)\}!}=n\binom{n-1}{m-1}$ for $m\ge 1$

and $m(m-1)\binom n m=m(m-1)\frac{n!}{m!(n-m)!}$ $=m(m-1)n(n-1)\frac{(n-1)!}{m(m-1)\cdot(m-2)!\{(n-2)-(m-2)\}!}=n(n-1)\binom{n-2}{m-2}$ for $m\ge 2$

-
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 18, "mathjax_display_tex": 3, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 20, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "github"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.9328073263168335, "perplexity_flag": "head"}