<s>[INST] Prove that $\sum_{k=0}^n k^2{n \choose k} = {(n+n^2)2^{n-2}}$ 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)?
 [/INST] Its a bit easiler to evaluate up to $n+1$.
I will use the identity that $\dbinom{a}k = \frac{a}k \dbinom{a-1}{k-1}$.
$\sum_{k = 0}^{n+1} k^2 \dbinom{n+1}k$
$ = 0+1 \dbinom{n+1}1 + 4 \dbinom{n+1}2 + 9 \dbinom{n+1}3 + \cdots + (n+1)^2 \dbinom{n+1}{n+1}$
$ = 0+(n+1) \dbinom{n}0 + 2(n+1) \dbinom{n}1 + 3 \dbinom{n}2 + \cdots + (n+1) \dbinom{n}n$
$ = (n+1) \left( \sum_{k = 0}^{n} (k+1) \dbinom{n}k \right)$.
This can be easily evaluated from the derivative of $x(1+x)^n$. 
</s>