Combination proof for $n(n+1)2^{n-2}=\sum_{k=1}^{n}k^2\binom{n}{k}$

I have seen the exact same problem before in an exam. You know that

$$(1+x)^{n}=\sum\limits_{k=0}^{n}\binom{n}{k}x^k$$

Differentiate both sides twice, do some re-arranging, let x=1 and all should fall into place.


Both sides of the identity answer the question: "Given $n$ candidate members, how many ways are there to form a committee with a president and treasurer, if the same person is allowed to fill both roles?"

For the right-hand side, you pick $k$ members, and then choose one of them to be president and one to be treasurer. This immediately gives you the sum on the right-hand side.

For the left-hand side, you pick a president and a treasurer from the entire candidate pool, and then select the rest of the committee. There are two ways to do this:

  • Pick one person to be president-and-treasurer (in $n$ possible ways). Then, for each of the other $n-1$ candidate members, decide whether they're on the committee or not (in $2^{n-1}$ possible ways). There are a total of $n2^{n-1}$ ways to do this.
  • Pick a president (in $n$ possible ways), a treasurer distinct from the president (in $n-1$ possible ways) and decide whether each of the other $n-2$ candidates is on the committee (in $2^{n-2}$ possible ways). There are a total of $n(n-1)2^{n-2}$ ways to do this.

So there are a total of $n2^{n-1}+n(n-1)2^{n-2}=n(n+1)2^{n-2}$ ways to make your choices, which completes the proof.


$$\sum_{k=1}^{n}k^2\binom{n}{k}=\sum_{k=1}^{n}k^2\frac{n}{k}\binom{n-1}{k-1}$$ $$=\sum_{k=1}^{n}kn\binom{n-1}{k-1}=n\sum_{k=0}^{n-1}(k+1)\binom{n-1}{k}=$$ $$=n\sum_{k=0}^{n-1}k\binom{n-1}{k}+n\sum_{k=0}^{n-1}\binom{n-1}{k}=$$ $$=n\sum_{k=1}^{n-1}k\frac{n-1}{k}\binom{n-2}{k-1}+n2^{n-1}=$$ $$=n(n-1)\sum_{k=0}^{n-2}\binom{n-2}{k}+n2^{n-1}=$$ $$=n(n-1)2^{n-2}+2n2^{n-2}=n(n+1)2^{n-2}$$