Example 3.14 Solve the recurrence relation
$$
\left\{\begin{array}{l}
a_{n}=3 a_{n-1}-3 a_{n-2}+a_{n-3}+24 n-6 \quad(n \geqslant 3), \\
a_{0}=-4, \quad a_{1}=-2, \quad a_{2}=2 .
\end{array}\right.
$$
The characteristic equation of the recurrence relation
$$
a_{n}=3 a_{n-1}-3 a_{n-2}+a_{n-3} \quad(n \geqslant 3)
$$

is $x^{3}-3 x^{2}+3 x-1=0$, with characteristic roots $x_{1}=x_{2}=x_{3}=1$. Therefore, the general solution is
$$
a_{n}=c_{1}+c_{2} n+c_{3} n^{2} .
$$

Since 1 is a triple root of equation (3.9), the recurrence relation
$$
a_{n}=3 a_{n-1}-3 a_{n-2}+a_{n-3}+24 n-6 \quad(n \geqslant 3)
$$

has a particular solution $a_{n}=n^{3}(A n+B)=A n^{4}+B n^{3}$, where $A$ and $B$ are constants to be determined. Substituting into equation (3.10) gives
$$
\begin{aligned}
A n^{4}+B n^{3}= & 3\left[A(n-1)^{4}+B(n-1)^{3}\right]- \\
& 3\left[A(n-2)^{4}+B(n-2)^{3}\right]+ \\
& {\left[A(n-3)^{4}+B(n-3)^{3}\right]+24 n-6, }
\end{aligned}
$$

simplifying to
$$
-24 A n+36 A-6 B=-24 n+6 .
$$

Thus,
$$
\left\{\begin{array}{l}
24 A=24, \\
36 A-6 B=6
\end{array}\right.
$$

Solving these, we get $A=1, B=5$. Therefore,
$$
a_{n}=c_{1}+c_{2} n+c_{3} n^{2}+n^{4}+5 n^{3},
$$

where $c_{1}, c_{2}$ are constants to be determined. Using the initial conditions, we have
$$
\left\{\begin{array}{l}
c_{1}=-4, \\
c_{1}+c_{2}+c_{3}+6=-2, \\
c_{1}+2 c_{2}+4 c_{3}+56=2 .
\end{array}\right.
$$

Solving these, we get $c_{1}=-4, c_{2}=17, c_{3}=-21$. Therefore,
$$
a_{n}=-4+17 n-21 n^{2}+5 n^{3}+n^{4} \quad(n \geqslant 0) .
$$