This is problem 2.38 from the book "Principles and Techniques in Combinatorics".
Prove $$\sum_{r=1}^{n-1}(n-r)^2\binom{n-1}{n-r}=n(n-1)2^{n-3}$$ I have have been trying different things on and off for two days and still can't derive RHS from LHS. what I have got so far: $$\sum_{r=1}^{n-1}(n-r)^2\cdot\frac{n-1}{n-r}\binom{n-2}{n-r-1} =(n-1)\sum_{r=1}^{n-1}(n-r)\cdot\binom{n-2}{n-r-1} =\\(n-1)\sum_{r=2}^{n}(n-r)\cdot\binom{n-2}{n-r} =(n-1)\sum_{r=2}^{n}(n-r)\cdot\binom{n-2}{n-r} =\\(n-1)\sum_{r=2}^{n}(n-r)\cdot\frac{n-2}{n-r}\binom{n-3}{n-r-1} =\\(n-1)(n-2)\sum_{r=2}^{n}\cdot\binom{n-3}{n-r-1} $$ any hints or solutions would be greatly appreciated.
A good skill for such problems is knowing how to rewrite expressions in simpler forms. I'd rather write the LHS as $\sum_{i=1}^{n-1}i^2\binom{n-1}{i}$, letting $i=n-r$. Instead of rewriting this side, I'm going to interpret this combinatorially, meaning I'm going to express it as counting something, and then I'll show that the RHS counts the same thing (hopefully, you've seen such techniques before). We start with a set of $n-1$ elements. The LHS says that we choose $i$ of those elements, where $1\leq i\leq n-1$, and we choose a pair $(a,b)$ of those $i$ elements we picked, where we can have $a=b$. Think of starting with $n-1$ people and forming a committee from some subset of them with a president and treasurer, and the president may also be the treasurer.
Now we need to show that the RHS counts the same thing. Observe that $n(n-1)2^{n-3}=(n-1)(n-2)2^{n-3}+(n-1)2^{n-2}$. Can you see how this also counts the same thing? Hint: consider the case when the president and treasurer are different people, and when they're the same person.