Solve the recurrence relation $a_n - 5a_{n-1} +8a_{n-2} -4a_{n-3} = 3^n$ Solve the recurrence
$a_n - 5a_{n-1} +8a_{n-2} -4a_{n-3} = 3^n$
with initial conditions $a_1 = 1, a_2 =5$ and $a_3 = 17$ How this was calculated? any hint or idea highly appreciated

Let $a_n=b_n \, 3^n$ to make
$$b_n-\frac{5}{3} b_{n-1}+\frac{8}{9} b_{n-2}-\frac{4}{27} b_{n-3}=1$$ Now, make $b_n=c_n+k$ to make
$$c_n-\frac{5}{3} c_{n-1}+\frac{8}{9} c_{n-2}-\frac{4}{27} c_{n-3}=1-\frac{2 k}{27}$$ Chose $k=\frac{27}{2}$ to make the rhs equal to $0$.
Solve
$$c_n-\frac{5}{3} c_{n-1}+\frac{8}{9} c_{n-2}-\frac{4}{27} c_{n-3}=0$$ When done, go back to $b_n=c_n+\frac{27}{2}$ and to $a_n=b_n \, 3^n$.
