# Expected Value of a Binomial distribution?

If $\mathrm P(X=k)=\binom nkp^k(1-p)^{n-k}$ for a binomial distribution, then from the definition of the expected value $$\mathrm E(X) = \sum^n_{k=0}k\mathrm P(X=k)=\sum^n_{k=0}k\binom nkp^k(1-p)^{n-k}$$ but the expected value of a Binomal distribution is $np$, so how is

$$\sum^n_{k=0}k\binom nkp^k(1-p)^{n-k}=np$$

-
Differentiating the binomial expansion for $(p+q)^n$ with respect to $p$ gives you the result very quickly. – wj32 Nov 1 '12 at 0:54

The main idea is to factor out $np$. I believe we can rewrite:

$$\sum^n_{k=0}k\binom nkp^k(1-p)^{n-k}= \sum^n_{k=1} k\binom nkp^k(1-p)^{n-k}$$

Factoring out an $np$, this gives (and cancelling the $k$'s):

$$\sum^n_{k=1} k\binom nkp^k(1-p)^{n-k} = np \sum^n_{k=1} \dfrac{(n-1)!}{(n-k)!(k-1)!}p^{k-1}(1-p)^{n-k}$$

Notice that the RHS is:

$$np \sum^n_{k=1} \dfrac{(n-1)!}{(n-k)!(k-1)!}p^{k-1}(1-p)^{n-k} = np \sum^n_{k=1} \binom {n-1}{k-1}p^{k-1}(1-p)^{n-k},$$

and since $\displaystyle \sum^n_{k=1} \binom {n-1}{k-1}p^{k-1}(1-p)^{n-k} = (p + (1-p))^{n-1} = 1$, we therefore indeed have

$$\sum^n_{k=0}k\binom nkp^k(1-p)^{n-k} = np$$.

-

Let $B_i=1$ if we have a success on the $i$-th trial, and $0$ otherwise. Then the number $X$ of successes is $B_1+B_2+\cdots +B_n$. But then by the linearity of expectation, we have $$E(X)=E(B_1+B_2+\cdots+B_n)=E(B_1)+E(B_2)+\cdots +E(B_n).$$ It is easy to verify that $E(B_i)=p$, so $E(X)=np$.

You wrote down another expression for the mean. So the above argument shows that the combinatorial identity of your problem is correct. You can think of it as a mean proof of a combinatorial identity.

Remark: A very similar argument to the one above can be used to compute the variance of the binomial.

The linearity of expectation holds even when the random variables are not independent. Suppose we take a sample of size $n$, without replacement, from a box that has $N$ objects, of which $G$ are good. The same argument shows that the expected number of good objects in the sample is $n\dfrac{G}{N}$. This is somewhat unpleasant to prove using combinatorial manipulation.

-
+1 for a simple and clear explanation using Linearity of Expectation. – buruzaemon yesterday

Use the fact that $$k\binom{n}k=\frac{kn!}{k!(n-k)!}=\frac{n!}{(k-1)!(n-k)!}=\frac{n(n-1)!}{(k-1)!(n-k)!}=n\binom{n-1}{k-1}\;:$$

\begin{align*} \sum^n_{k=0}k\binom nkp^k(1-p)^{n-k}&=\sum_{k=0}^nn\binom{n-1}{k-1}p^k(1-p)^{n-k}\\ &=n\sum_{k=0}^n\binom{n-1}{k-1}p^k(1-p)^{n-k}\\ &=n\sum_{k=0}^{n-1}\binom{n-1}kp^{k+1}(1-p)^{n-k-1}\\ &=np\sum_{k=0}^{n-1}\binom{n-1}kp^k(1-p)^{n-k-1}\\ &=np\Big(p+(1-p)\Big)^{n-1}&&\text{binomial theorem}\\ &=np\;. \end{align*}

-
Thank you, I still don't know why i didn't see it. – user31280 Oct 31 '12 at 19:10

Note that $$k \dbinom{n}{k} = n \dbinom{n-1}{k-1}$$ Hence, $$\mathbb{E}(X) = \sum_{k=1}^{n}n \dbinom{n-1}{k-1} p^k (1-p)^{n-k} = np \left(\sum_{r=0}^{n-1} \dbinom{n-1}{r} p^r (1-p)^{n-1-r} \right) = np$$

-