# Binomial sum - generating functions

Find a closed form for $a_n:=\sum_{k=0}^{n}\binom{n}{k}(n-k)^n(-1)^k$ using generating functions.

-
With that tone of question, it might help if you showed us what you have tried. –  Henry Jun 27 '12 at 20:17
@akotronis: (+1) for the interesting question. –  user26872 Jun 28 '12 at 6:24
We have $$\begin{eqnarray*} \sum_{k=0}^{n}(-1)^k \binom{n}{k}(n-k)^n &=& \sum_{k=0}^{n}(-1)^k \binom{n}{n-k}(n-k)^n \\ &=& \sum_{k=0}^{n} (-1)^{n-k} \binom{n}{k} k^n \\ &=& \left.\sum_{k=0}^{n} (-1)^{n-k} \binom{n}{k} (x D)^n x^k\right|_{x=1} \\ &=& \left.(x D)^n \sum_{k=0}^{n} (-1)^{n-k} \binom{n}{k} x^k\right|_{x=1} \\ &=& \left.(x D)^n (x-1)^n\right|_{x=1}, \end{eqnarray*}$$ where $D = \partial/\partial x$. But $$(x D)^n = x^n D^n + (\mathrm{const}) x^{n-1}D^{n-1} + \ldots.$$ and $D^k(x-1)^n|_{x=1} = 0$ unless $k\ge n$. Therefore, $\left.(x D)^n (x-1)^n\right|_{x=1} = D^n(x-1)^n|_{x=1} = n!,$ and so $$\begin{equation*} \sum_{k=0}^{n}(-1)^k \binom{n}{k}(n-k)^n = n!.\tag{1} \end{equation*}$$
The argument above immediately implies that $$\sum_{k=0}^{n}(-1)^k \binom{n}{k}(n-k)^m = 0$$ if $m\in\mathbb{N}$ and $m<n$. It also gives us a method to calculate the sum for $m>n$. Sums of this type are related to the Stirling numbers of the second kind, $$\begin{eqnarray*} \sum_{k=0}^{n}(-1)^k \binom{n}{k}(n-k)^m &=& \sum_{k=0}^{n}(-1)^{n-k} \binom{n}{k}k^m \\ &=& n! \left\{m\atop n\right\}. \end{eqnarray*}$$ The operator $(x D)^n$ and it's connection to the Stirling numbers has been discussed here.