Example 2.3.5 Derangement Problem: Find the number of permutations $\left\{x_{1}, x_{2}, \cdots, x_{n}\right\}$ that satisfy $\forall i$, $x_{i} \neq i,(i=1,2, \cdots, n)$, denoted as $D_{n}$.
Let $I$ be the set of all permutations of $\{1,2, \cdots, n\}$, and $A_{i}$ be the set of permutations in $I$ where $x_{i}=i$. Then,
$$
\begin{aligned}
\left|\overline{A_{1}} \cdot \overline{A_{2}} \cdots \overline{A_{n}}\right|= & \left|I-\bigcup_{i=1}^{n} A_{i}\right| \\
= & |I|-\sum_{i=1}^{n}\left|A_{i}\right|+\sum_{1 \leqslant i<j \leqslant n}\left|A_{i} A_{j}\right| \\
& -\cdots+(-1)^{n}\left|\bigcap_{i=1}^{n} A_{i}\right|,
\end{aligned}
$$
$$
|I|=n!.
$$
The permutations in $A_{i}$ are of the form $x_{1}, x_{2}, \cdots, x_{i-1}, i, x_{i+1}, \cdots, x_{n}$. Removing $i$, we have $x_{1}, x_{2}, \cdots, x_{i-1}, x_{i+1}, \cdots, x_{n}$ as a permutation of $\{1,2, \cdots, i-1, i+1, \cdots, n\}$, so $\left|A_{i}\right|=(n-1)!$.

Similarly, $\left|A_{i} A_{j}\right|=(n-2)!$,
$$
\text{Therefore, } \begin{aligned}
D_{n}= & \left|\bigcap_{i=1}^{n} \overline{A_{i}}\right|=n!-n(n-1)!+\mathrm{C}_{n}^{2}(n-2)!-\mathrm{C}_{n}^{3}(n-3)! \\
& +\cdots+(-1)^{n} \\
= & n!\left(1-\frac{1}{1!}+\frac{1}{2!}-\frac{1}{3!}+\cdots+(-1)^{n} \frac{1}{n!}\right).
\end{aligned}
$$