Solving $a_n=3a_{n-1}-2a_{n-2}+3$ for $a_0=a_1=1$ I'm trying to solve the recurrence $a_n=3a_{n-1}-2a_{n-2}+3$ for $a_0=a_1=1$.  First I solved for the homogeneous equation $a_n=3a_{n-1}-2a_{n-2}$ and got $\alpha 1^n+\beta 2^n=a_n^h$.  Solving this gives $a_n^h =1$.  The particular solution, as I understand, will be $a_n^*=B$ since $f(n)=3\times 1^n$.  But then I get $B=a^*=3a^*_{n-1}-2a^*_{n-2}+3=B+3$.  This has to be a mistake, but I don't see what I did wrong.

Because of the constant term, define $$b_n=a_n+c n +d$$ Replacing in $$a_n=3a_{n-1}-2a_{n-2}+3$$ leads to $$b_n=3 b_{n-1}-2 b_{n-2}+c+3$$ So, choose $c=-3$ and the recurrence becomes $$b_n=3 b_{n-1}-2 b_{n-2}$$ Then, as usual, the characteristic equation $r^2-3r+2=0$ which has roots $r_1=1$, $r_2=2$. So $$b_n=C_1 \,1^n+C_2 \,2^n=C_1+C_2 \,2^n$$ $$a_n=C_1+C_2 \,2^n-3n$$ Apply the initial conditions $$a_0=C_1+C_2=1\quad \quad  \quad a_1=C_1+2C_2-3=1$$ which give $C_1=-2$ and $C_2=3$ which finally give $$a_n=-2+3 \times 2^n-3n$$
