What is the sum $\sum_{k=0}^{n}k^2\binom{n}{k}$? [duplicate]

Interesting question..... I know you'll get the traditional replies, which will probably help you solve the problem. However, if you get time, try to think of it this way:

Consider $n$ players. You want to make a team out of these $n$ players. Note that the team can have any number of players! (This would explain the $^nC_0 + ^nC_1 + ...$.)

Now consider that you have two positions up for take: Captain, and Vice-Captain. You need a player to fill in for those positions. Any player can fill for that position. Not only that, a single player can also occupy both positions! (This is for the coefficient, $0^2 , 1^2 , 2^2 , etc.$)

Now... Think of it in the reverse. For the first case, suppose you have to chose a single person to become captain and vice captain: $n$ choices. Now, we have $n-1$ players to distribute.. So: $2^{n-1}$. Total is: $n2^{n-1}$

For the second case, consider you have to chose two different players for captain and vice-captain. So number of choices: $n(n-1)$. Now we have $n-2$ players remaining to distribute: $2^{n-2}$. Total is: $n(n-1)2^{n-2}$

Thus, the total number of ways of doing something like this is: $$n2^{n-1} + n(n-1)2^{n-2}$$


Hint

Start with $$(1+x)^n = \sum_{k=0}^n \binom{n}{k}x^k$$ Differentiate, multiply by $x$ and differentiate again. What do you get?


Let $$\displaystyle S=\sum^{n}_{k=0}k^2 \binom{n}{k} \;,$$ Now using $\displaystyle \bullet \; \binom{n}{k} = \frac{n}{k}\cdot \binom{n-1}{k-1}$

So we get $$\displaystyle S = \sum^{n}_{k=0}k^2 \cdot \frac{n}{k}\binom{n-1}{k-1}\;,$$ Again using $\displaystyle \bullet \; \binom{n-1}{k-1} = \frac{n-1}{k-1}\cdot \binom{n-2}{k-2}$

So $$\displaystyle S = n\sum^{n}_{k=1}k\binom{n-1}{k-1} = n\sum^{n}_{k=0}[(k-1)+1]\binom{n-1}{k-1}$$

So we get $$\displaystyle S=n\sum^{n}_{k=1}(k-1)\binom{n-1}{k-1}+n\sum^{n}_{k=1} \binom{n-1}{k-1}$$

So we get $$\displaystyle S=n\sum^{n}_{k=2}(k-1)\cdot \frac{n-1}{k-1}\cdot \binom{n-2}{k-2}+n\sum^{n}_{k=1}\binom{n-1}{k-1}$$

So we get $$\displaystyle S=n(n-1)\sum^{n}_{k=0}\binom{n-2}{k-2}+n\sum^{n}_{k=0}\binom{n-1}{k-1}$$

Now Using $\displaystyle \bullet\; \sum^{n}_{k=0}\binom{n}{k} = 2^{k}$

So we get $$\displaystyle S = n(n-1)\cdot 2^{n-2}+n\cdot 2^{n-1}$$