Show this equality (The factorial as an alternate sum with binomial coefficients). Why does the following equality hold?
$$n!=\sum_{k=1}^n (-1)^{n-k} \binom{n}{k} k^n$$
 A: Recalling the identity

$$ \left\{\begin{matrix} n \\ k \end{matrix}\right\} =\frac{1}{k!}\sum_{j=0}^{k}(-1)^{k-j}{k \choose j} j^n ,  $$

where $ \left\{\begin{matrix} n \\ k \end{matrix}\right\} $ is the Stirling numbers of the second kind. Now, substituting $k=n$ in the above identity gives the desired result

$$ \left\{\begin{matrix} n \\ n \end{matrix}\right\}=1 =\frac{1}{n!}\sum_{j=0}^{n}(-1)^{n-j}{n \choose j} j^n \implies n!= \sum_{j=0}^{n}(-1)^{n-j}{n \choose j} j^n. $$

A: Consider if we were to permute numbers $1$ to $n$. Obviously left hand side $n!$ denotes the number of such permutations.
Using the complement version of inclusion-exclusion principle: (Link to Wikipedia, formula copied from Wikipedia)

$$\begin{align*}
\biggl|\bigcap_{i=1}^n \overline{A_i}\biggr| &= \biggl|S - \bigcup_{i=1}^n A_i\biggr|\\
&= \left| S \right| - \sum_{i=1}^n\left|A_i\right|
+\sum_{1 \le i < j \le n}\left|A_i\cap A_j\right|
- \ldots + \left(-1\right)^{n} \left|A_1\cap\cdots\cap A_n\right|
\end{align*}$$

If we let $A_i$ be the set of $n$-length sequences that have no $i$s (for $i = 1 \ldots\ n$), and $\overline{A_i}$ be the set of $n$-length sequences that have some $i$s, then the intersection $\bigcap_{i=1}^n \overline{A_i}$ gives all those sequences that have some $1$s, some $2$s, ..., and some $n$s. In other words, the intersection gives all $n$-length permutations.
And when we simplify the right hand side of the above formula, we get the right hand side of your question, where first term is for $k = n$ and the second-last term for $k = 1$. The last term of the above formula is zero in this case.
A: Apply $\left(x \frac{d}{dx}\right)^n$ to both sides of the identity $(1-x)^n = \sum_{0 \leq k \leq n} \binom{n}{k} (-1)^k x^k $, then evaluate at $x=1$.
