Let $a\neq b\neq c\in\Bbb R$ be given. Suppose that we are looking for a sequence of real numbers $f(1),f(2),\dots$ satisfying for all $n\in\Bbb N$
$$f(n+1) = \frac{(b-a)\cdot(a-c)}{f(n)} +2 a - b - c.$$
WolframAlpha provides the general solution $$f(n)=\frac{\lambda (a-c)^2 \frac1{(b-a)^n}+(a-b)^2 \frac1{(c-a)^n}}{\lambda (a-c)\frac1{(b-a)^n}+(a-b)\frac1{(c-a)^n}}$$
where $\lambda\in\Bbb R$ can be chosen arbitrarily as long as the above expression is well-defined.
My question. Is there some more general theory behind this? Because currently it is very surprising to me how my recurrence relation has such an explicit general solution. For example, is there a theory behind solutions to $$f(n+1)=\frac a{f(n)}+b$$ ?
There is, in fact, a general explicit solution to the recurrence relation $$x_{n+1}=b+\frac{a}{x_n}$$ and it is given by the following explicit formula in terms of $x_0$: $$x_n=\frac{(x_0-k)(\frac{k}{b-k}-1)}{(\frac{k}{b-k})^n(\frac{k}{b-k}-1)+\frac{1}{b-k}((\frac{k}{b-k})^n-1)(x_0-k)}+k$$ where $$k=\frac{b + \sqrt{b^2+4a}}{2}$$ For a proof of this assertion, see my blog post which treats a variety of first-order recurrences (using functional iteration).