Trying to solve a recurrence relation by using generating functions: $a_n=3a_{n-1} + a_{n-2}$

I'm going to rewrite the problem as $$a_{n+2} = 3a_{n+1} + a_n; \; a_0 = 2,\; a_1=1.$$ Multiply by $x^n$, sum, and let $A(x) = \sum_{n\ge 0}a_nx^n$. So, $$\sum_{n\ge 0}a_{n+2}x^n = 3\sum_{n\ge 0}a_{n+1}x^n + \sum_{n\ge 0}a_n x^n,$$ and we can see that $\sum_{n\ge 0}a_{n+2}x^n = a_2 + a_3x + \cdots = (1/x^2)(A(x)-a_0-a_1x)$ and similarly $\sum_{n\ge 0}a_{n+1}x^n = a_1 + a_2x + \cdots = (1/x)(A(x)-a_0)$, so we obtain $$\frac{1}{x^2}(A(x) - a_0 - a_1x) = \frac{3}{x} (A(x)-a_0 ) + A(x).$$

Substituting for $a_0$ and $a_1$ and solving for $A(x)$ yields your $F(x)$, ie $$A(x) = \frac{2-5x}{1-3x-x^2}.$$

Now the for the partial fraction decomposition, which is not so ugly if we keep our heads straight. Note that $1-3x-x^2$ has roots $\alpha_1 = -\frac{3}{2} - \frac{\sqrt{13}}{2}$ and $\alpha_2 = -\frac{3}{2} + \frac{\sqrt{13}}{2}$ and we want $$\frac{1}{1-3x-x^2} = \frac{1}{(x-\alpha_1)(x-\alpha_2)} = \frac{A}{(x-\alpha_1)} + \frac{B}{(x-\alpha_2)}.$$ Using this equation and solving for $A$ and $B$ yields \begin{align} \frac{1}{1-3x-x^2} &= \frac{1}{(\alpha_1-\alpha_2)(x-\alpha_1)} + \frac{1}{(\alpha_2-\alpha_1)(x-\alpha_2)}\\ &=\frac{1}{-\sqrt{13}(x-\alpha_1)} + \frac{1}{\sqrt{13}(x-\alpha_2)} \end{align}

So we have

\begin{align} A(x) &= (2-5x)\left(\frac{1}{-\sqrt{13}(x-\alpha_1)} + \frac{1}{\sqrt{13}(x-\alpha_2)} \right)\\ &=(2-5x) \left( \frac{1}{\alpha_1\sqrt{13}} \cdot \frac{1}{1-(x/\alpha_1)} + \frac{1}{-\alpha_2\sqrt{13}} \cdot \frac{1}{1-(x/\alpha_2)} \right)\\ &= (2-5x) \left( \frac{1}{\alpha_1\sqrt{13}} \sum_{n\ge 0} \left(\frac{1}{\alpha_1} \right)^n x^n + \frac{1}{-\alpha_2\sqrt{13}} \sum_{n\ge 0} \left(\frac{1}{\alpha_2} \right)^n x^n \right)\\ &= \frac{(2-5x)}{\sqrt{13}} \left(\sum_{n\ge 0} \left[ \left(\frac{1}{\alpha_1} \right)^{n+1} - \left(\frac{1}{\alpha_2} \right)^{n+1}\right] x^n \right) \end{align}

Can you take it from here?


By using another method I got the closed-form as follows:

$$a_n = \left( 1 - \frac{2}{\sqrt{13}}\right)\left( \frac{3+\sqrt{13}}{2}\right)^n + \left( 1 + \frac{2}{\sqrt{13}}\right)\left( \frac{3-\sqrt{13}}{2}\right)^n$$

However I need to find $a_n$ by using the generating function $F(x)$ as described earlier.