We are given this recursive function: $a_n - 4a_{n-2} = 3^n$, starting with $a_0 = 1$ and $a_1 = 3$, and we have to find a closed formula for $a_n$, for every $n = 0,1,..$ using generating functions.
What is the thought process for questions like this?
Let $A(z)=\sum_{n=0}^\infty a_n z^n$ be the ordinary generating function. Now use the recurrence relation and initial conditions to obtain $$a_0 z^0 + a_1 z^1 + \sum_{n=2}^\infty (a_n-4a_{n-2})z^n = 1 + 3 z + \sum_{n=2}^\infty 3^n z^n,$$ equivalently, $$A(z)-4z^2 A(z) = 1+3z+\frac{(3z)^2}{1-3z}.$$ Solving for $A(z)$ yields $$A(z) = \frac{1}{(1-3z)(1-4z^2)}=\frac{1}{(1-3z)(1-2z)(1+2z)}.$$ Now use partial fraction decomposition to obtain \begin{align} A(z) &= \frac{9/5}{1-3z}-\frac{1}{1-2z}+\frac{1/5}{1+2z} \\ &= \sum_{n=0}^\infty \left(\frac{9}{5}\cdot3^n-2^n+\frac{1}{5}\cdot(-2)^n\right)z^n, \end{align} which implies that $$a_n= \frac{9}{5}\cdot3^n-2^n+\frac{1}{5}\cdot(-2)^n.$$