How to prove $\sum_{r=0}^{n}\left(-1\right)^r\binom{n}{r}\left(n-r\right)^n=n!$ Part of a problem I've been trying to solve for the past few days requires me to prove the following result:
$$\sum_{r=0}^{n}{\left(-1\right)^r\binom{n}{r}\left(n-r\right)^n}=n!,\ \ n\in\mathbb{N}$$
I attempted to solve this using induction. I'm an A-Level student, so I'm quite new to proof by induction (and proof generally, for that matter), so I'm not sure whether my proof is valid. The parts that I'm least confident about are the manipulation of $(k+1-r)^k$ and the proof that $\sum_{r=0}^{k}\frac{(-1)^r(k+1)^k}{r!(k-r)!}=0$ (see below). I think the main difficulty arises from the fact that both $r$, the variable being iterated, and $n$, the limit of the summation, are part of the expression being summed; were it just one or the other, the inductive step would be considerably simpler.
My question is two-fold really:

*

*Is my attempt a valid proof?

*Is there an easier way to prove it which I have missed, or an easier way to solve summation proofs in general where the limit and the iterating variable are included in the expression being summed?

Help would be greatly appreciated.
Edit 5th Aug 2021: Thank you all for the responses. I'm going to go away and do further research into some of the approaches suggested, both on this post and a similar one pointed out by Steven Stadnicki in the comments, since a lot of maths goes over my head at the moment! The only additional thing I would like is some feedback on my approach, in particular the two parts of it mentioned above that I'm the least confident are valid.

My attempt:
By the definition of $\binom{n}{r}$:
$$\sum_{r=0}^{n}{\left(-1\right)^r\binom{n}{r}\left(n-r\right)^n}$$
$$=\sum_{r=0}^{n}\frac{(-1)^r n! (n-r)^n}{r!(n-r)!}=n!$$
Dividing through by $n!$ (since $n!\neq0$):
$$\sum_{r=0}^{n}\frac{(-1)^r (n-r)^n}{r!(n-r)!}=1$$
When $r=n$, $(n-r)^n=0$. This means that the final iteration of the summation evaluates to $0$, so is redundant.
$$\therefore\sum_{r=0}^{n}\frac{(-1)^r (n-r)^n}{r!(n-r)!}\equiv\sum_{r=0}^{n-1}\frac{(-1)^r (n-r)^n}{r!(n-r)!}$$
Hence if we prove that $\sum_{r=0}^{n-1}\frac{(-1)^r (n-r)^n}{r!(n-r)!}=1$ for all positive integers $n$, we prove the original statement.
For $n=1$:
$$LHS=\sum_{r=0}^{1-1}\frac{(-1)^r (1-r)^1}{r!(1-r)!}=1=RHS$$
$LHS=RHS\therefore$ true when $n=1$.
Assume the statement is true for $n=k,\ \ k\in\mathbb{N}$:
$$\sum_{r=0}^{k-1}\frac{(-1)^r (k-r)^k}{r!(k-r)!}$$
For $n=k+1$:
\begin{align*}
\
\sum_{r=0}^{(k+1)-1}\frac{(-1)^r ((k+1)-r)^{(k+1)}}{r!((k+1)-r)!}&=\sum_{r=0}^{k}\frac{(-1)^r (k+1-r)^{k+1}}{r!(k+1-r)!}=1\\
&=\sum_{r=0}^{k}\frac{(-1)^r (k+1-r)^{k}(k+1-r)}{r!(k-r)!(k+1-r)}=1\\
&=\sum_{r=0}^{k}\frac{(-1)^r (k+1-r)^{k}}{r!(k-r)!}=1
\
\end{align*}
Manipulating $(k+1-r)^k$:
\begin{align*}
\
\sum(k+1-r)^k=(k+1)^k+&k^k+(k-1)^k+(k-2)^k+...+2^k+1^k\\
\sum(k-r)^k=\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ &k^k+(k-1)^k+(k-2)^k+...+2^k+1^k+0^k
\end{align*}
$$\therefore\sum(k+1-r)^k=\sum(k-r)^k+(k+1)^k$$


\begin{align*}
\
\sum_{r=0}^{k}\frac{(-1)^r (k+1-r)^{k}}{r!(k-r)!}&=\sum_{r=0}^{k}\frac{(-1)^r((k-r)^k+(k+1)^k)}{r!(k-r)!}\\
&=\sum_{r=0}^{k}\frac{(-1)^r(k-r)^k+(-1)^r(k+1)^k}{r!(k-r)!}\\
&=\sum_{r=0}^{k}\frac{(-1)^r(k-r)^k}{r!(k-r)!}+\sum_{r=0}^{k}\frac{(-1)^r(k+1)^k}{r!(k-r)!}\\
&=1+\sum_{r=0}^{k}\frac{(-1)^r(k+1)^k}{r!(k-r)!}
\
\end{align*}
The $1$ comes from the assumption step and the fact that for this expression, $\sum_{r=0}^{n}\equiv\sum_{r=0}^{n-1}$, explained above.
So if we can show that $\sum_{r=0}^{k}\frac{(-1)^r(k+1)^k}{r!(k-r)!}=0$ for all positive integers $k$, we have proven that original statement. I will attempt to prove this by contradiction.
Assume that:
$$\sum_{r=0}^{k}\frac{(-1)^r(k+1)^k}{r!(k-r)!}=a,\ a\in\mathbb{R},\ a\neq0$$
Then:
$$\sum_{r=0}^{k}\frac{(-1)^r}{r!(k-r)!}=\frac{a}{(k+1)^k}\neq\sum_{r=0}^{k}\frac{(-1)^r(k+1)^k}{r!(k-r)!}$$
provided that $(k+1)^k\neq1$. Since $k\geq1$, this is never the case.
But when $n=1$, $\sum_{r=0}^{k}\frac{(-1)^r}{r!(k-r)!}=0$ and $\sum_{r=0}^{k}\frac{(-1)^r(k+1)^k}{r!(k-r)!}=0$, which is a contradiction. 
$\therefore a=0$ and the original statement is proven.
 A: An alternative approach.
First note that by putting $s=n-r$ we get
\begin{align}
\sum_{r=0}^{n}{(-1)^r\binom{n}{r}\left(n-r\right)^n}
&=\sum_{s=0}^{n}{(-1)^{n-s}\binom{n}{n-s}s^n}\\
&=\sum_{s=0}^{n}{(-1)^{n-s}\binom{n}{s}s^n}\\
&=(-1)^n\sum_{s=0}^{n}(-1)^s\binom{n}{s}s^n
\end{align}
hence it is equivalent to show:
$$\sum_{s=0}^{n}(-1)^s\binom{n}{s}s^n=(-1)^nn!$$
Let consider the linear mapping
\begin{align}
\varphi&:\Bbb Z[x]\to\Bbb Z[x]&
&f\mapsto (x+1)f'(x)
\end{align}
Then $\varphi^{\circ n}((x+1)^s)=s^n(x+1)^s$, hence
\begin{align}
\sum_{s=0}^{n}(-1)^s\binom{n}{s}s^n(x+1)^s
&=\varphi^{\circ n}\left(\sum_{s=0}^{n}(-1)^s\binom{n}{s}(x+1)^s\right)\\
&=\varphi^{\circ n}((-x)^n)\\
&=(-1)^n\varphi^{\circ n}(x^n)
\end{align}
We claim that
$$\varphi^{\circ k}(x^n)\equiv(x+1)^k\frac{n!}{(n-k)!}x^{n-k}\pmod{x^{n-k+1}}$$
This is easily proven by induction since:
\begin{align}
\varphi^{\circ(k+1)}(x^n)
&\equiv k(x+1)^k\frac{n!}{(n-k)!}x^{n-k}+(x+1)^{k+1}\frac{n!}{(n-k)!}(n-k)x^{n-k-1}\\
&\equiv(x+1)^{k+1}\frac{n!}{(n-k-1)!}x^{n-k-1}\pmod{x^{n-k}}
\end{align}
Consequently, $\varphi^{\circ n}(x^n)=(x+1)^nn!$ and evaluating at $x=0$ the identity will follows.
A: Let $\nabla_h$ be the backward finite difference operator with step size $h>0$:
$$\nabla_hf(x)=f(x)-f(x-h)$$
Then the $n$-th iteration of this operator is given by
$$\nabla_h^nf(x)=\sum_{r=0}^n(-1)^r {n \choose r}f(x-rh)\tag{1}$$
Finally, it's not too hard to prove that derivatives and finite differences are related when $h\rightarrow 0$:
$$f^{(n)}(x)=\lim_{h\rightarrow 0}\frac{\nabla_h^nf(x)}{h^n}\tag{2}$$
Applying $(1)$ and $(2)$ at $x=0$ for $f(x)=x^n$,
$$n!=\lim_{h\rightarrow 0}\sum_{r=0}^n(-1)^r {n \choose r}\left(\frac 0 h - r\right)^n=\sum_{r=0}^n(-1)^r {n \choose r}\left(- r\right)^n$$
In other words
$$n!=\sum_{r=0}^n(-1)^{n-r} {n \choose r}r^n=\sum_{r=0}^n(-1)^{r} {n \choose r}(n-r)^n$$
A: By the first answer in this question about the number of surjective functions we have
$$|S| = n^m - {n \choose 1}(n-1)^m + {n \choose 2}(n-2)^m - \dots \pm {n \choose n}(n-n)^m,$$
where  $S=S_{m,n}$ denotes the number of surjective functions $f\colon M\to N$ and $M, N$ have cardinalities $m,n$ respectively. Since every surjective function from the finite set $N$ to itself is bijective we have $|S_{n,n}|=n!$. This is the desired result.
