<s>[INST] Solve the recurrence relation $a_n=3a_{n-1}+n^2-3$, with $a_0=1$. Solve the recurrence relation $a_n=3a_{n-1}+n^2-3$, with $a_0=1$.
My solutions: the homogeneous portion is $a_n=c3^n$, and the inhomogeneous portion is $a^*_n=-1/2n^2-3/4n+9/8$.
This results in a final recurrence relation of 
$$a_n=-\frac{1}{8}3^n-\frac{1}{2}n^2-\frac{3}{4}n+\frac{9}{8}.$$
I am just wondering if someone could check my work to make sure I have the procedure correct.
 [/INST] Given the homogenous solution: $a_n^{(h)} = c_03^n$ and the particular solution: $a_n^{(p)} = c_1n^2+c_2n+c_3$, and we have: $a_n = a_n^{(h)}+a_n^{(p)}$. First we find the coefficients to the particular solution:
$$
\begin{align}
&a_n^{(p)} \:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:- 3a_{n-1}^{(p)} &&= n^2+0n-3\\
\iff &c_1n^2+c_2n+c_3 -3\left(c_1(n-1)^2+c_2(n-1)+c_3\right) &&= n^2+0n-3\\
\iff &c_1n^2+c_2n+c_3 -3(c_1n^2-2c_1n+c_1+c_2n-c_2+c_3) &&= n^2+0n-3\\
\iff &\color{red}{c_1}n^2\color{green}{+c_2}n\color{blue}{+c_3}\color{red}{-3c_1}n^2\color{green}{+6c_1}n\color{blue}{-3c_1}\color{green}{-3c_2}n\color{blue}{+3c_2}\color{blue}{-3c_3} &&= n^2+0n-3\\
\iff &\color{red}{(-2c_1)}n^2+\color{green}{(6c_1-2c_2)}n+\color{blue}{(3c_1-3c_2+4c_3)} &&= \color{red}{1}n^2\color{green}{+0}n\color{blue}{-3}\\
\end{align}
$$
This gives three equations:
$$
\begin{matrix}
\color{red}{-2c_1}&&&= \color{red}{1}\\ \color{green}{6c_1}&\color{green}{-2c_2}&&= \color{green}{0}\\ \color{blue}{3c_1}&\color{blue}{-3c_2}&\color{blue}{+4c_3}&= \color{blue}{3}
\end{matrix}
$$
Solving this system yields:
$$
\begin{matrix}
c_1&&&=-\frac{1}{2}\\ &c_2&&= -\frac{3}{2}\\ &&c_3&= 0
\end{matrix}
$$
So we have $a_n^{(p)} = - \frac{1}{2}n^2-\frac{3}{2}n+0$
This means a solution is given by $a_n = c_03^n - \frac{1}{2}n^2-\frac{3}{2}n$, and given the initial condition $a_0 = 1$, we can solve this for $c_0$:
$a_0 = 1 = c_03^0 - \frac{1}{2}0^2 - \frac{3}{2}0 \iff c_0 = 1$
This means $a_n = 3^n - \frac{1}{2}n^2-\frac{3}{2}n$
</s>