<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] $$ a_n = 3a_{n-1} + n^2 - 3 = 3^ka_{n-k} + n^2 + 3(n - 1)^2 + \ldots + 3^{k - 1}(n - k + 1)^2 - (3 + \ldots + 3^k)   $$
$$ a_n = 3^ka_{n - k} + \sum_{m=0}^{k-1}3^m(n - m)^2 - \sum_{m = 0}^{k-1}3^{m+1}$$
Setting $k = n$, we have
$$a_n = 3^n + \sum_{m=0}^{n-1}3^m(n - m)^2 - \sum_{m = 0}^{n-1}3^{m+1} = \frac{1}{2}(-n^2 - 3n + 3^{n+1} - 3) - \frac{3}{2}(3^n - 1) + 3^n.$$ 
The last was calculated using numerical software. Simplifying we have,
$$\frac{1}{2}(-n^2 - 3n + 3^{n+1} - 3) - \frac{3}{2}(3^n - 1) + 3^n = 3^n - \frac{1}{2}n^2 - \frac{3}{2}n.$$
</s>