Example 1 Let $[x]$ denote the greatest integer not exceeding the real number $x$. For a given positive integer $n$, calculate $\sum_{k=0}^{\left[\frac{n}{2}\right]} \mathrm{C}_{n}^{2 k} 3^{n-2 k}$.


【Analysis】From the combinatorial meaning of the term $\mathrm{C}_{n}^{2 k} 3^{n-2 k}$, we think of constructing the following combinatorial problem: How many $n$-digit numbers can be formed using $1,2,3,4$ that contain an even number of 1s?

On one hand, suppose there are $2 k\left(0 \leqslant k \leqslant\left[\frac{n}{2}\right]\right)$ 1s. Then, from $n$ positions, choose $2 k$ positions to place 1s, which can be done in $\mathrm{C}_{n}^{2 k}$ ways. The remaining $n-2 k$ positions can be filled with $2,3,4$, each having 3 ways. Therefore, the number of $n$-digit numbers containing $2 k$ 1s is $\mathrm{C}_{n}^{2 k} 3^{n-2 k}$.
Note that, $0 \leqslant k \leqslant\left[\frac{n}{2}\right]$.
Thus, the number of $n$-digit numbers that meet the condition is
$a_{n}=\sum_{k=0}^{\left[\frac{n}{2}\right]} \mathrm{C}_{n}^{2 k} 3^{n-2 k}$.
On the other hand, we can calculate $a_{n}$ using a "recursive" method.
Let the $n$-digit number be $\left(x_{1} x_{2} \cdots x_{n}\right)_{n}$, and consider the first digit $x_{1}$.
If the first digit is 1, then the remaining $n-1$ digits contain an odd number of 1s. Since the number of $n-1$-digit numbers with an even number of 1s is $a_{n-1}$, the number of $n-1$-digit numbers with an odd number of 1s is $4^{n-1}-a_{n-1}$;

If the first digit is not 1, then there are 3 ways to place it, and the remaining $n-1$ digits have an even number of 1s, which can be done in $a_{n-1}$ ways. In this case, there are $3 a_{n-1}$ ways.
$$
\begin{array}{l}
\text { Hence } a_{n}=\left(4^{n-1}-a_{n-1}\right)+3 a_{n-1} \\
=4^{n-1}+2 a_{n-1} \text {. }
\end{array}
$$

From equation (1), we know that the sequence $\left\{a_{n}-2 a_{n-1}\right\}$ is a geometric sequence with a common ratio of 4. Therefore,
$$
a_{n}-2 a_{n-1}=4\left(a_{n-1}-2 a_{n-2}\right) \text {. }
$$

By transforming this, we get
$$
\begin{array}{l}
a_{n}-4 a_{n-1}=2\left(a_{n-1}-4 a_{n-2}\right) \\
=\left(a_{2}-4 a_{1}\right) 2^{n-2}=(10-4 \times 3) 2^{n-2} \\
=-2^{n-1} .
\end{array}
$$

Combining equations (1) and (2), we solve to get
$$
\begin{array}{l}
a_{n}=2 \times 4^{n-1}+2^{n-1} . \\
\text { Therefore, } \sum_{k=0}^{\left[\frac{n}{2}\right]} \mathrm{C}_{n}^{2 k} 3^{n-2 k}=2 \times 4^{n-1}+2^{n-1} .
\end{array}
$$

Of course, solving this recurrence relation can also be done in another way: dividing both sides of equation (1) by $4^{n}$, we get
$$
\frac{a_{n}}{4^{n}}=\frac{1}{4}+\frac{1}{2} \times \frac{a_{n-1}}{4^{n-1}},
$$

which is a common recurrence form $x_{n}=a x_{n-1}+b$, and can be solved by converting it to a geometric sequence.