Solving an inhomogenous linear recurrence with two approaches gives back inconsistent results.

Solution 1:

\begin{align} a_n &= 4a_{n-1} + 3^n \\ \frac{a_n}{3^n} &= \frac{4}{3}\cdot\frac{a_{n-1}}{3^{n-1}} + 1 \\ \frac{a_n}{3^n} + k &= \frac{4}{3}\left(\frac{a_{n-1}}{3^{n-1}}+k\right) + 1-\frac{k}{3} \\ \end{align} Now choose $k=3$ so that $1-k/3=0$, and let $b_n=\frac{a_n}{3^n} + 3$. Then $$b_n = \begin{cases} \frac{4}{3}b_{n-1} &\text{if $n > 1$}\\ \frac{a_1}{3^1} + 3 = \frac{10}{3} &\text{if $n = 1$}\\ \end{cases} $$ So $$b_n=\frac{10}{3}\left(\frac{4}{3}\right)^{n-1},$$ which implies that $$a_n=3^n(b_n-3)=3^n\left(\frac{10}{3}\left(\frac{4}{3}\right)^{n-1}-3\right)=10\cdot4^{n-1}-3^{n+1}=\frac{5}{2}4^n-3^{n+1}$$


An alternative approach is to let $A(z)=\sum_{n \ge 1} a_n z^n$ be the ordinary generating function and deduce \begin{align} a_1 z^1 + \sum_{n \ge 2} a_n z^n &= a_1 z^1 + 4\sum_{n \ge 2}a_{n-1}z^n + \sum_{n \ge 2} 3^n z^n \\ A(z) &= z + 4zA(z) + \frac{(3z)^2}{1-3z}. \end{align} So \begin{align} A(z) &= \frac{z + \frac{(3z)^2}{1-3z}}{1-4z} \\ &= \frac{z+6z^2}{(1-4z)(1-3z)} \\ &= \frac{1}{2} + \frac{5/2}{1-4z} - \frac{3}{1-3z} \\ &= \frac{1}{2} + \frac{5}{2}\sum_{n \ge 0}(4z)^n - 3\sum_{n \ge 0} (3z)^n \\ &= \frac{5}{2}\sum_{n \ge 1}(4z)^n - 3\sum_{n \ge 1} (3z)^n \\ &= \sum_{n \ge 1}\left(\frac{5}{2}4^n - 3^{n+1}\right) z^n, \end{align} which immediately implies that $$a_n = \frac{5}{2}4^n - 3^{n+1}.$$