The characteristic equation associated with the recurrence relation$$a_n+A\,a_{n-1}+B\,a_{n-2}=0$$is$$t^2+At+B=0$$It has to complex (conjugate) solutions : $r\,e^{\pm i\theta}$ ($r>0$).
If $a_0,a_1$ are also real numbers, then there exist $(\lambda,\mu)\in\mathbb{R^2}$ such that :
$$\forall n\in\mathbb{N},\,a_n=r^n\left(\lambda\cos(n\theta)+\mu\sin(n\theta)\right)$$
Hence, for all $x\in\mathbb{R}$ such that $\vert x\vert<1/r$ :
$$\sum_{n=0}^\infty a_nx^n=\lambda f(x)+\mu g(x)$$
where :
$$f(x)=\sum_{n=0}^\infty(rx)^n\cos(n\theta)=Re\left(\frac{1}{1-rxe^{i\theta}}\right)=Re\left(\frac{1-rxe^{-i\theta}}{(1-rx\cos(\theta))^2+(rx\sin(\theta))^2}\right)$$
that is :
$$f(x)=\frac{1-rx\cos(\theta)}{1-2rx\cos(\theta)+r^2x^2}$$
and, after a similar calculation :
$$g(x)=\frac{rx\sin(\theta)}{1-2rx\cos(\theta)+r^2x^2}$$
The constants $\lambda$ and $\mu$ are obtained by solving the system $\cases{\lambda=a_0\cr r(\lambda\cos(\theta)+\mu\sin(\theta)=a_1}$