<s>[INST] If $a_{n+1}=\frac {a_n^2+5} {a_{n-1}}$ then $a_{n+1}=Sa_n+Ta_{n-1}$ for some $S,T\in \Bbb Z$. Question

Let $$a_{n+1}:=\frac {a_n^2+5} {a_{n-1}},\, a_0=2,a_1=3$$
Prove that there exists integers $S,T$ such that  $a_{n+1}=Sa_n+Ta_{n-1}$.

Attempt
I calculated the first few values of $a_n$: $a_2=7,a_3=18, a_4=47$ so I'd have the system of diophantine equations:
$$
7=3S+2T\\
18=7S+3T\\
47=18S+7T
$$
Now: it seems that all of the $a_i$ are pairwise coprime, so these equations should always have solutions, but how could I check that the intersection of all the solutions is not $\emptyset$?
 [/INST] Assume that $a_n$ can be expressed as $a_{n+1}=Sa_n+Ta_{n-1}$.
Then $a_n$ is expressed as
$$a_n=A\alpha^n+B\beta^n$$
Then
$$a_{n+1}a_{n-1}=(A\alpha^{n+1}+B\beta^{n+1})(A\alpha^{n-1}+B\beta^{n-1})$$
$$=A^2\alpha^{2n}+AB\alpha^{n-1}\beta^{n+1}+AB\alpha^{n+1}\beta^{n-1}+B^2\beta^{2n}$$
And
$$a_n^2+5=A^2\alpha^{2n}+2AB\alpha^n\beta^n+B^2\beta^{2n}+5$$
Therefore,
$$AB(\alpha^{n-1}\beta^{n+1}+\alpha^{n+1}\beta^{n-1})=2AB\alpha^n\beta^n+5$$
should hold for all $n$.
This is possible only when $\alpha\beta=1$ and if $\alpha\beta=1$,
$$AB(\alpha^2+\beta^2)=2AB+5$$
$$AB({\alpha-\beta})^2=5\tag{1}$$
Using initial conditions
$$a_0=A+B$$
$$a_1=A\alpha+B\beta$$
Solving linear equations,
$$A=\frac{a_1-a_0\beta}{\alpha-\beta}$$
$$B=\frac{a_0\alpha-a_1}{\alpha-\beta}$$
Applying to (1),
$$(a_0\beta-a_1)(a_0\alpha-a_1)+5=0$$
$$a_0^2-a_0a_1(\alpha+\beta)+a_1^2+5=0$$
$$\therefore \alpha+\beta=\frac{a_0^2+a_1^2+5}{a_0a_1}$$
As $\alpha$ and $\beta$ are roots of $x^2-Sx-T$,
$$S=\alpha+\beta=\frac{a_0^2+a_1^2+5}{a_0a_1}$$
$$T=-\alpha\beta=-1$$
(*) In our case, $a_0=2$ and $a_1=3$ gives us $\alpha+\beta=3$ that leads to lulu's solution.
</s>