I was trying to solve this recurrence relation using generating function
$a_n = a_{n-1} + 4a_{n-2} + 2a_{n-3} \qquad : \quad a_0 =1,a_1 =1,a_2 =5, $
I did in the following way
$ \begin{align*} &G(x) = \sum_{n=0}^{\infty}a_n.x^n \\ &G(x) = a_0x^0 +a_1x^1+a_2x^2+\sum_{n=3}^{\infty}a_n.x^n \\ &G(x) = 1.x^0 +1.x^1+5.x^2+\sum_{n=3}^{\infty}\left ( a_{n-1} +4.a_{n-2} + 2.a_{n-3} \right ).x^n \\ &G(x) = 1.x^0 +1.x^1+5.x^2+ x.\sum_{n=2}^{\infty}a_nx^n + 4x^2.\sum_{n=1}^{\infty}a_nx^n + 2x^3.\sum_{n=0}^{\infty}a_nx^n\\ &G(x) = 1.x^0 +1.x^1+5.x^2+ x.\left [ G(x) - 1 - x \right ] + 4x^2.\left [ G(x) - 1 \right ] + 2x^3.G(x)\\ &G(x) = \frac{1}{1-x-4x^2-2x^3} \\ \end{align*}$
Now how to get the closed form in terms of $n$ after this?
If any other methods available to find the closed form please mention.
Thanks !
Here are two variants to derive $a_n$. The first one gives a closed form, the other one an explicit expression, which results in a nice binomial identity.
Comment:
In (2) we use the linearity of the coefficient of operator and apply the rule \begin{align*} [x^{p-q}]A(x)=[x^p]x^qA(x) \end{align*} We also set the upper limit of the outer sum to $n$ since the exponent of $x^{n-j}$ is non-negative.
In (3) we select the coefficient of $x^{n-j-k}$.