Example 2.4.2 Find the number of n-digit positive integers that contain an even number of 5s.
Analysis: Start by analyzing the structure of n-digit decimal numbers that contain an even number of 5s. Let $d=d_{1} d_{2} \cdots d_{n-1} d_{n}$. If $d_{1}, d_{2}, \cdots, d_{n-1}$ contain an even number of 5s, then $d_{n}$ can take any one of the numbers 0, 1, 2, 3, 4, 6, 7, 8, 9 (excluding 5), making $d$ an n-digit decimal number with an even number of 5s; if $d_{1}, d_{2}, \cdots, d_{n-1}$ contain an odd number of 5s, then taking $d_{n}=5$ makes $d$ an n-digit decimal number with an even number of 5s.
Let $f_{n}$ be the number of $n$-digit decimal numbers that contain an even number of 5s, and $g_{n}$ be the number of $n$-digit decimal numbers that contain an odd number of 5s,

then we have: $f_{n}=9 f_{n-1}+g_{n-1}$,
$$
g_{n-1}=9 \times 10^{n-2}-f_{n-1},
$$

Thus, we have $\left\{\begin{array}{l}f_{n}=8 f_{n-1}+9 \times 10^{n-2}, \\ f_{1}=8 .\end{array}\right.$
$$
\begin{array}{l}
\frac{f_{n}}{10^{n}}=\frac{8}{10} \frac{f_{n-1}}{10^{n-1}}+\frac{9}{100}, \\
\frac{f_{n}}{10^{n}}-\frac{9}{20}=\frac{4}{5}\left(\frac{f_{n-1}}{10^{n-1}}-\frac{9}{20}\right)=\left(\frac{4}{5}\right)^{2}\left(\frac{f_{n-2}}{10^{n-2}}-\frac{9}{20}\right)=\cdots \\
=\left(\frac{4}{5}\right)^{n-1}\left(\frac{f_{1}}{10}-\frac{9}{20}\right)=\left(\frac{4}{5}\right)^{n-1}\left(\frac{8}{10}-\frac{9}{20}\right)=\left(\frac{4}{5}\right)^{n-1} \frac{7}{20}, \\
\frac{f_{n}}{10^{n}}=\left(\frac{4}{5}\right)^{n-1} \frac{7}{20}+\frac{9}{20}, \\
f_{n}=\frac{1}{2}\left(7 \cdot 8^{n-1}+9 \cdot 10^{n-1}\right) .
\end{array}
$$