If we have the inhomogenous recurrence relation $$f(n+2) - 6f(n+1)+9f(n) = 6*3^{n} + 2^{n} = 2 * 3^{n+1} + 2^n, f(0) = 0, f(1) = 1, n \ge 1$$ Step 1: Find the homogenous solution
$f(n) = C_13^n + C_23^nn$
Step 2: Find the particular solution
$f(n) = n^2a3^n + b2^n$
$(n+2)^2a3^{n+2}+b2^{n+2} - 6((n+1)^2a3^{n+1}+b2^{n+1}) + 9(n^2a3^n + b2^n) \stackrel{?}{=} 6*3^n + 2^n$
How do I proceed from here?
I also know the particular solution to a recurrence relation very similar to this one. Although I can't figure out if it even helps me much, it just seems to make the equation a lot harder if I use it in the particular solution above.
$f(n+2)-6f(n+1)+9f(n)= 2*3^{n+1}$
Particular solution:
$f(n)=\frac{1}{3}n^23^n$
Consider the equation \begin{align} f_{n+2} - 6 f_{n+1} + 9 f_{n} = 6 \cdot 3^{n} + 2^{n} \end{align} where $f_{0} = 1$ and $f_{1} = 1$. Considering a form of $f_{n} \approx r^{n}$ then it is seen that the homogenous equation leads to $r^{2} - 6r + 9 =0$ which yields $r = 3, 3$. Due to this consider the form $f_{n}^{h} = A_{1} \, 3^{n} + A_{2} \, 3^{n} \, n$. Now, since the particular form also contains a factor in the homogenous solution then consider the form $f_{n}^{p} = B_{1} \, 3^{n} \, n^{2} + 2^{n}$. Combining these two components in the proper form suggests the total solution \begin{align} f_{n} = A_{1} \, 3^{n} + A_{2} \, 3^{n} \, n + B_{1} \, 3^{n} \, n^{2} + B_{2} \, 2^{n}. \end{align} Working out the terms yields \begin{align} 18 B_{1} \, 3^{n} + B_{2} \, 2^{n} = 6 \cdot 3^{n} + 2^{n} \end{align} which provides $B_{1} = 1/3$ and $B_{2} = 1$. Hence \begin{align} f_{n} = A_{1} \, 3^{n} + A_{2} \, 3^{n} \, n + 3^{n-1} \, n^{2} + 2^{n}. \end{align} Applying the initial conditions provides $0 = A_{1} + 1$ and $1 = 3 A_{2}+ 3$ which become $A_{1} = -1$ and $A_{2} = -2/3$. Hence \begin{align} f_{n} &= - 3^{n} - 2 \cdot 3^{n-1} \, n + 3^{n-1} \, n^{2} + 2^{n} \end{align} and upon some changes the final result is \begin{align} f_{n} = 3^{n-1} \left( n^{2} - 2n - 3 \right) + 2^{n}. \end{align}