How do I solve a recurrence relation of the type $a_{n+1} = K(n)a_{n} + P(n)a_{n-1}$ where $K(n)$ and $P(n)$ are rational functions? I've been stuck on a problem for days now and was able to boil it down to this recurrence relation. I researched a bit about ways to solve it -- generating functions, characteristic polynomials, homogenous and non-homogenous recurrence relations -- but couldn't find a method of tackling this specific one. Any tips, solutions, or suggestions would be welcomed. Thanks.
Edit: As made clear in the comments, treating the functions as any rational function is too general to solve. The specific problem I am solving requires $K(n) = (2n+5)/(n+2)$ and $P(n) = (n+1)(n+3)^2/(n+2)$
Edit #2: As requested, $a_1 = 5 ; a_2 = 33 ; a_3 = 168$
 A: 
$a_{n+1} = \dfrac{2n+5}{n+2} a_{n} + \dfrac{(n+1)(n+3)^2}{n+2} a_{n-1}$

Rewriting $\,2n+5 = (n+3)^2 - (n+2)^2\,$:
$$
\quad\quad a_{n+1} = \frac{(n+3)^2 - (n+2)^2}{n+2} a_{n} + \frac{(n+1)(n+3)^2}{n+2} a_{n-1}
\\ \iff\quad\quad a_{n+1} + (n+2) a_n = \frac{(n+3)^2}{n+2} \big(a_n + (n+1) a_{n-1}\big)
$$
With $\,b_n = a_{n} + (n+1) a_{n-1}\,$, this telescopes to:
$$
\require{cancel}
b_{n+1} = \frac{(n+3)^2}{n+2} \,b_n = \frac{(n+3)^2}{\bcancel{n+2}} \,\frac{(n+2)^{\bcancel{2}}}{n+1}  \, b_{n-1} = \dots = (n+3)\,\frac{(n+3)!}{2} \, b_0
$$
Once $\,b_n\,$ is determined, what's left to solve is the simpler recurrence:
$$
a_{n} + (n+1) a_{n-1} = b_n \quad\iff\quad \frac{a_n}{(n+1)!} = -\frac{a_{n-1}}{n!} + \frac{b_n}{(n+1)!}
$$
A: Based on the result by 2 False I suppose we can set $a_n=(n+1)!\ b_n$
This results in $$(n+2)^2b_{n+1}=(2n+5)b_n+(n+3)^2b_{n-1}=0$$
Applying now the idea by dxiv leads to an easier relation
$$(n+2)^2(b_{n+1}+b_n)=(n+3)^2(b_n+b_{n-1})$$
So we can set $c_n=b_n+b_{n-1}$ and get
$$c_{n+1}=\frac{(n+3)^2}{(n+2)^2}c_n$$
This is telescopic as well and $c_n=(n+3)^2\,C$
The equation $b_{n+1}+b_n=0$ has root $-1$

*

*general solution of homegeneous equation is $\alpha(-1)^n$

*RHS is $(n+3)^2\,C\,(1)^n$ so a particular solution is of the same degree $2$ as RHS.

Conducting the calculation gives $\frac 12C(n+2)(n+3)$.
In the end $$a_n=(n+1)!\Big(\alpha(-1)^n+\beta(n+2)(n+3)\Big)$$
We now have to apply initial conditions $a_1=5$ and $a_2=33$ and we find
$\begin{cases}-2\alpha+24\beta=5\\6\alpha+120\beta=33\end{cases}\iff\begin{cases}\alpha=\frac 12\\\beta=\frac 14\end{cases}$

$$a_n=(-1)^n\frac{(n+1)!}{2}+\frac{(n+3)!}{4}$$

Verification: $a_3=-\frac{4!}{2}+\frac{6!}{4}=-\frac{24}{2}+\frac{720}{4}=-12+180=168\ \checkmark$
