TITLE: Prove that $\sum_{k=0}^n k^2{n \choose k} = {(n+n^2)2^{n-2}}$
QUESTION [6 upvotes]: Prove that: $$\sum_{k=0}^n k^2{n \choose k} = {(n+n^2)2^{n-2}}$$  i know that: $$\sum_{k=0}^n {n \choose k} = {2^n}$$ how to get the (n + n^2)?

REPLY [5 votes]: Alternative proof using no calculus, no combinatorics, just pure algebraic manipulation starting from the special case of the binomial theorem:  $$\sum_{k=0}^n \binom{n}{k} = 2^n.$$  We also note the identity $$\begin{align*} \binom{k}{r} \binom{n}{k} &= \frac{k!}{r! \, (k-r)!} \cdot \frac{n!}{k! \, (n-k)!} = \frac{n!}{r! \, (n-r)!} \cdot \frac{(n-r)!}{(k-r)! \, (n-k)!} \\ &= \binom{n}{r} \binom{n-r}{k-r}. \end{align*}$$
Then $$S_1 = \sum_{k=0}^n k \binom{n}{k} = \sum_{k=1}^n \binom{k}{1}\binom{n}{k} = \binom{n}{1} \sum_{k=1}^n \binom{n-1}{k-1} = n 2^{n-1}.$$
Similarly, $$S_2 = \sum_{k=0}^n k(k-1) \binom{n}{k} = 2 \sum_{k=2}^n \binom{k}{2} \binom{n}{k} = 2 \binom{n}{2} \sum_{k=2}^n \binom{n-2}{k-2} = n(n-1) 2^{n-2}.$$
Consequently, $$\sum_{k=0}^n k^2 \binom{n}{k} = S_1 + S_2 = n(n+1)2^{n-2}.$$  In this manner, we can recursively evaluate sums of the form $$\sum_{k=0}^n k^m \binom{n}{k},$$ using the general identity $$\sum_{k=r}^n \binom{k}{r}\binom{n}{k} = \binom{n}{r} 2^{n-r}.$$