How to algebraically prove that $$n!=\sum\limits_{r=0}^n (-1)^r \binom{n}{r} (n-r)^n$$
I was trying to find number of onto functions from $A$ to $A$ containing $n$ elements.
Using the inclusion-exclusion principle I am getting $$\sum\limits_{r=0}^n (-1)^r \binom{n}{r} (n-r)^n.$$
We can also do it by simple combinatorics, as every element has to have a pre-image and number of elements in the domain equal to the number of elements in the codomain, the number of functions is $n!.$
Is there an algebraic way to prove these two are equal?
Actually, we have that $$ n! = \sum\limits_{\left( {0\, \le } \right)\,k\,\left( { \le \,n} \right)} {\left( { - 1} \right)^{\,k} \left( \matrix{ n \hfill \cr k \hfill \cr} \right)\left( {n - k} \right)^{\,n} } = \left. {\sum\limits_{\left( {0\, \le } \right)\,k\,\left( { \le \,n} \right)} {\left( { - 1} \right)^{\,k} \left( \matrix{ n \hfill \cr k \hfill \cr} \right)\left( {x - k} \right)^{\,n} \;} } \right|_{\,x\, = \,n} = \left. {\sum\limits_{\left( {0\, \le } \right)\,k\,\left( { \le \,n} \right)} {\left( { - 1} \right)^{\,k} \left( \matrix{ n \hfill \cr k \hfill \cr} \right)p_{\,n} (x - k)\;} } \right|_{\,x\, = \,n} $$ for any $x \in \mathbb R$ or even $x \in \mathbb C$, and for any polynomial in $x$ of degree $n$, with leading coefficient $1$.
That's because the Backward Difference, defined as $$ \nabla _x f(x) = f(x) - f(x - 1) $$ and which reiterates as $$ \nabla _x ^{\,n} f(x) = \nabla _x ^{\,n - 1} f(x) - \nabla _x ^{\,n - 1} f(x - 1) = \sum\limits_{\left( {0\, \le } \right)\,k\,\left( { \le \,n} \right)} {\left( { - 1} \right)^{\,k} \left( \matrix{ n \hfill \cr k \hfill \cr} \right)f\left( {x - k} \right)} $$ when applied to a polynomial of degree $n$ $$ p_{\,n} (x) = \sum\limits_{0\, \le \,m\, \le \,n} {a_{\,n} x^{\,n} } $$ gives $$ \nabla _n ^{\,n} p_{\,n} (n) = \left. {\nabla _x ^{\,n} p_{\,n} (x)\,} \right|_{\,x\, = \,n} = a_{\,n} \,n! $$ as it is easy to verify, if you know Stirling Numbers and Falling factorials.