Example 12 If $n$ letters are to be put into $n$ envelopes addressed to $n$ different people, and each letter is placed in the wrong envelope, how many different ways are there to do this?
Explanation: This problem is about the wrong envelope problem, which can be solved using the principle of inclusion-exclusion, bipartite graphs (bipartite graphs), and other methods. Here, we use the recursive method.
Let $a_{n}$ be the number of ways to place the letters incorrectly, then $a_{1}=0, a_{2}=1$.
We will find the recursive relation for $a_{n}$ in two steps.
(1) The first letter is placed incorrectly, which can be done in $n-1$ ways. Let the first envelope contain the content of the $k$-th letter $(k \neq 1)$.
(2) The other $n-1$ letters are placed incorrectly, which can be divided into two cases:
(i) The $k$-th envelope contains the content of the first letter, which is equivalent to the number of ways to place $n-2$ letters incorrectly, excluding the first and $k$-th letters, which is $a_{n-2}$ ways;
(ii) The $k$-th envelope does not contain the content of the first letter. In this case, we can treat the content of the first letter as the content of the $k$-th letter, and ensure it is not placed in the $k$-th envelope, which forms a problem of placing $n-1$ letters incorrectly, with $a_{n-1}$ ways.

By the principle of addition, (2) has $a_{n-1}+a_{n-2}$ ways.
By the principle of multiplication, we have
$$
a_{n}=(n-1)\left(a_{n-1}+a_{n-2}\right)
$$

ways to place the letters incorrectly.
Dividing both sides by $n!$, we get
$$
\frac{a_{n}}{n!}=\left(1-\frac{1}{n}\right) \frac{a_{n-1}}{(n-1)!}+\frac{1}{n} \cdot \frac{a_{n-2}}{(n-2)!} \text {. }
$$

Rearranging and using recursion, we have
$$
\begin{array}{l}
\frac{a_{n}}{n!}-\frac{a_{n-1}}{(n-1)!} \\
=\left(-\frac{1}{n}\right)\left[\frac{a_{n-1}}{(n-1)!}-\frac{a_{n-2}}{(n-2)!}\right] \\
=\left(-\frac{1}{n}\right)\left(-\frac{1}{n-1}\right)\left[\frac{a_{n-2}}{(n-2)!}-\frac{a_{n-3}}{(n-3)!}\right] \\
=\left(-\frac{1}{n}\right)\left(-\frac{1}{n-1}\right) \cdots\left(-\frac{1}{3}\right)\left(\frac{a_{2}}{2!}-\frac{a_{1}}{1!}\right) \\
=\frac{(-1)^{n}}{n!} .
\end{array}
$$

Taking $n=2,3, \cdots$ and summing, we get
$$
\frac{a_{n}}{n!}=\frac{(-1)^{n}}{n!}+\frac{(-1)^{n-1}}{(n-1)!}+\cdots+\frac{(-1)^{2}}{2!} \text {. }
$$

Thus, $a_{n}=n!\left[1-\frac{1}{1!}+\frac{1}{2!}-\cdots+(-1)^{n} \frac{1}{n!}\right]$.
Note: From equation (1), we can also derive
$$
a_{n}=n a_{n-1}+(-1)^{n}(n>1) \text {, }
$$

which is a formula that facilitates step-by-step recursion.