# Deriving Closed Form for a Recursion via Generating Functions

Consider (1) $a_{n+2} = 2a_{n+1} - a_n + 4n3^n$ with $a_0 = a_1 = 1$.

Using generating functions and setting $A(x) = \sum a_nx^n$ we obtain

\begin{align*}&\quad\sum a_{n+2}x^{n+2} = \sum2a_{n+1}x^{n+2} - \sum a_nx^{n+2} + \sum 4n3^nx^{n+2}\\ &\implies [A(x) - a_0 - a_1x] = 2x[A(x)-a_0] - x^2A(x) + \sum_n 4n3^nx^{n+2}\end{align*}

Is this correct so far? Is there always a best way to go about rearranging the obtained generating function, or does it vary from problem to problem? Further, is it simpler to use this method here or to instead obtain a particular solution through undetermined coefficients? Any help is much appreciated.