21.3.9 $\star \star$ Let $a_{1}, a_{2}, \cdots, a_{n}$ be a permutation of $1,2, \cdots, n$, satisfying $a_{i} \neq i(i=1$, $2, \cdots, n)$, there are $D_{n}$ such groups of $a_{1}, a_{2}, \cdots, a_{n}$, find $D_{n}$.
Let the set of permutations of $a_{k}=k$ be denoted as $A_{k}(k=1,2, \cdots, n)$, then $\left|A_{i}\right|=(n-1)!$ $(i=1,2, \cdots, n), \sum_{i=1}^{n}\left|A_{i}\right|=\mathrm{C}_{n}^{1} \cdot(n-1)!$, similarly:
$\sum_{1 \leqslant i<i \leqslant n}\left|A_{i} \cap A_{j}\right|=\mathrm{C}_{n}^{2}(n-2)!, \cdots,\left|A_{1} \cap A_{2} \cap \cdots \cap A_{n}\right|=\mathrm{C}_{n}^{n} \cdot 0!$, therefore
$$
\begin{aligned}
D_{n} & =n!-\mathrm{C}_{n}^{1}(n-1)!+\mathrm{C}_{n}^{2} \cdot(n-2)!+\cdots+(-1)^{n} \cdot \mathrm{C}_{n}^{n} \\
& =\sum_{k=0}^{n} \mathrm{C}_{n}^{k} \cdot(n-k)!(-1)^{k}=\sum_{k=0}^{n} \frac{n!}{k!}(-1)^{k}=n!\cdot \sum_{k=0}^{n} \frac{(-1)^{k}}{k!} .
\end{aligned}
$$

Note: $D_{n}$ is referred to as the derangement number.