# variation of the binomial theorem

Why does:

$$\sum_{k=0}^{n} k \binom nk p^k (1-p)^{n-k} = np$$ ? Taking the derivative of:

$$\sum_{k=0}^{n} \binom nk p^k (1-p)^{n-k} = (1 + [1-P])^n = 1$$

does not seem useful, since you would get zero. And induction hasn't yet worked for me, since – during the inductive step – I am unable to prove that:

$$\sum_{k=0}^{n+1} k \binom {n+1}{k} p^k (1-p)^{n+1-k} = (n+1)p$$

assuming that:

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

-

Let $$f(x)=\sum_{k=0}^{n} \binom nk x^k y^{n-k}= (x+y)^n$$ then $$x\frac{\partial f}{\partial x}= \sum_{k=0}^{n} k \binom nk x^k y^{n-k}=nx(x+y)^{n-1}$$ so with $y=1-p$ and $x=p$ we find the desired result.

-

This is saying that the average number of coin flips if you flip $n$ fair coins each with heads probability $p$ is $np$ (you are calculating the mean of a Binomial(n,p) distribution).

You can use linearity of expectation - if $Y = \sum_i X_i$ where $X_i$ is Bernoulli(p) and there are $n$ such $X_i$, then $Y$ is Binomial(n,p) and has that distribution. Then, $E[Y] = \sum_i E[X_i]$ and you can easily show $E[X_i]=p$.

If you want to proceed in this manner, note $\binom{n}{k}=\frac{n}{k} \binom{n-1}{k-1}$. You can find the full details of the proof on Proof Wiki.

-

You don't need to use induction or take derivatives; just note that $k\binom{n\vphantom{1}}{k}=n\binom{n-1}{k-1}$ \begin{align} \sum_{k=0}^nk\binom{n}{k}p^k(1-p)^{n-k} &=\sum_{k=0}^nn\binom{n-1}{k-1}p^k(1-p)^{n-k}\\ &=np\sum_{k=0}^n\binom{n-1}{k-1}p^{k-1}(1-p)^{n-k}\\ &=np\,\Big(p+(1-p)\Big)^{n-1}\\[12pt] &=np \end{align}

-
would the downvoter care to comment? – robjohn Mar 8 '14 at 10:34

You can get rid of the $k$ by cancelling it with $k!$ from the binomial coefficient and simplifying like this: \begin{align} \sum_{k=0}^{n} k \binom nk p^k (1-p)^{n-k} &= \sum_{k=1}^{n} k\frac{n!}{k!(n-k)!} p^k (1-p)^{n-k} = n\sum_{k=1}^{n} \frac{(n-1)!}{(k-1)!(n-k)!} p^k (1-p)^{n-k}\\ &= n\sum_{k=1}^{n} \binom{n-1}{k-1} p^k (1-p)^{n-k}=n\sum_{k=0}^{n-1} \binom{n-1}{k} p^{k+1} (1-p)^{n-(k+1)}\\&={np\sum_{k=0}^{n-1} \binom{n-1}{k} p^{k} (1-p)^{n-1-k}}=np\cdot(p+1-p)^{n-1}=np\end{align}

-
It was a bit harder to read, but now that I have, I see that this is very similar to my approach (+1). – robjohn Mar 8 '14 at 16:52
@robjohn: Thanks, also thank you for your post, I learned the align trick because of it :) – user2345215 Mar 8 '14 at 16:56

There are many ways. Differentiation is one of them, not the simplest. We have $$(1+x)^n=\sum_0^n \binom{n}{k} x^k.$$ Differentiate. We get $$n(1+x)^{n-1}=\sum_0^n k\binom{n}{k}x^{k-1}.$$ Set $x=\frac{p}{1-p}$. Then the left-hand side is $n \frac{1}{(1-p)^{n-1}}$. Multiply through by $(1-p)^{n-1}$. We get $$\sum_0^n k\binom{n}{k}p^{k-1} (1-p)^{n-k}=n.$$ Finally, multiply through by $p$.

-
$p^p$?​​​​​​​​​ – user2345215 Mar 8 '14 at 0:36
Thank you. Typo fixed. I have been answering too many Fermat's little theorem questions! – André Nicolas Mar 8 '14 at 0:50