I was stuck while finding the given summation.
$$\sum_{k=1}^rk^2\binom {n-k}{r-k}$$
Since $n$ and $r$ are both constants, so I have first converted the above summation into this:
$$\sum_{k=1}^rk^2\binom {n-k}{n-r}$$
I have no idea how to proceed next. Any help will be appreciated.
One method is to use $k^2 = (r-k)(r-k-1) - (2r-1)(r-k) + r^2$ and $$P_{r}^{n} = \sum_{k=1}^{n} \binom{n-k}{r-k} = \frac{n}{n-r+1} \, \binom{n-1}{r-1}.$$ With this one can show that, for $r\geq 2$: \begin{align} S_{r}^{n} &= \sum_{k=1}^{n} k^2 \, \binom{n-k}{r-k} \\ &= \frac{(n-r+2)!}{(n-r)!} \, P_{r-2}^{n} - \frac{(2r-1) \, (n-r+1)!}{(n-r)!} \, P_{r-1}^{n} + r^2 \, P_{r}^{n} \\ &= \frac{n! \, (n^2 + (r+2) \, n + r + 1)}{(r-1)! \, (n-r+3)!} \hspace{5mm} \text{after some reduction} \\ &= \binom{n+1}{r-1} + 2 \, \binom{n+1}{r-2} \hspace{5mm} \text{after further reduction} \end{align}
A similar result occurs when use is made of $$\sum_{k=1}^{r} \binom{n-k}{r-k} = \frac{n}{n-r+1} \, \binom{n-1}{r-1}.$$