How to prove that $\sum_{k=0}^n \binom nk k^2=2^{n-2}(n^2+n)$ I know that $$\sum_{k=0}^n \binom nk k^2=2^{n-2}(n^2+n),$$ but I cannot find a way how to prove it. I tried induction but it did not work. On wiki they say that I should use differentiation but I do not know how to apply it to binomial coefficient. 
Thanks for any response.
(Presumptive) Source: Theoretical Exercise 1.12(b), P18, A First Course in Pr, 8th Ed, by S Ross

One common way to deal with this is using generating function.
In this problem, the key is to generate the $k^2$ factor in the sum.
Notice if you have a polynomial $P(z) = \sum_{k=0}^n a_k z^k$ in $z$, everytime
you apply the operator $z\frac{d}{dz}$ to it, the $z^k$ term will pick up an extra factor $k$. More precisely, you will have
$$\left(z\frac{d}{dz}\right)^m P(z) = \sum_{k=0}^n a_k k^m z^k$$
With these in mind, one find
$$\begin{align}
\sum_{k=0}^n \binom{n}{k} k^2 z^k = &
\sum_{k=0}^n \binom{n}{k} \left(z\frac{d}{dz}\right)^2 z^k =
\left(z\frac{d}{dz}\right)^2 \sum_{k=0}^n \binom{n}{k} z^k\\
= & \left(z\frac{d}{dz}\right)^2 (1+z)^n
= z\frac{d}{dz} nz(1+z)^{n-1}\\
= & z \left( n(1+z)^{n-1} + n(n-1)z(1+z)^{n-2}\right)
\end{align}$$
Taking $z = 1$ on both sides, one get
$$\sum_{k=0}^n \binom{n}{k} k^2 = n 2^{n-1} + n(n-1) 2^{n-2} = (n^2 + n) 2^{n-2}$$
