Solving recurrence using analogy with continuous $x_{n+1} = \frac{r^2}{2d - x_n}$ What's up lovely friends, I'm facing a physics problem and felt on a recurrence that one does not see everyday. This one:
$x_{n+1} = \frac{r^2}{2d - x_n}$
or
$f(n+1) = \frac{a}{b-f(n)}$ if you will
the thing is, I know the solution for the continuous analogue of this:
$\frac{dy}{dx} = \frac{a}{b-y} - y$
I wonder if anyone can help me on how to solve it using the continuous comparison.
How to solve the integral case ?
$\frac{dy}{\frac{a}{b-y} - y} = dx$
the LHS is integrable it will give some log and arctan involving y. 
Does the discrete case I have to solve an ugly sum like this ?
Summation by parts looks really tempting here
 A: Long time ago, I faced a similar problem and, searching my notes, I found the following result (may I confess that I did not find how I arrived to it). It write $$x_n=\frac{a^n+K b^n}{a^{n+1}+K b^{n+1}}$$ with $$a=\frac{d-\sqrt{d^2-r^2}}{r^2}~~~~~~~~~~\,~~~~~~~~~~ b=\frac{d+\sqrt{d^2-r^2}}{r^2}$$ the constant $K$ being defined by initial conditions.
What you can notice is that $d\pm\sqrt{d^2-r^2}$ are the roots of equation $x = \frac{r^2}{2d - x}$
For the differential equation you seem to have solved it;  the result is $$x+C=\frac{b }{\sqrt{4
   a-b^2}}\tan ^{-1}\left(\frac{2 y-b}{\sqrt{4 a-b^2}}\right)-\frac{1}{2} \log \left(a-b y+y^2\right)$$ I wish you a lot of fun for extracting $y$ as a function of $x$.
A: An alternate way to solve the problem is rewrite $x_n$ as $\frac{p_n}{q_n}$ where $p_n, q_n$ are sequences to be determined. The recurrence relation becomes
$$\frac{p_{n+1}}{q_{n+1}} = \frac{r^2 q_n}{2d q_n - p_n}$$
We can transform this to a sort of linear equation
$$\begin{bmatrix}p_{n+1} \\ q_{n+1}\end{bmatrix}
\propto \begin{bmatrix}0 & r^2\\ -1 & 2d\end{bmatrix}
\begin{bmatrix}p_{n} \\ q_{n}\end{bmatrix}
\quad\implies\quad
\begin{bmatrix}x_{n} \\ 1\end{bmatrix}
\propto
\begin{bmatrix}p_{n} \\ q_{n}\end{bmatrix}
\propto \begin{bmatrix}0 & r^2\\ -1 & 2d\end{bmatrix}^{n-1}\begin{bmatrix}x_1 \\ 1\end{bmatrix}
$$
The matrix $\begin{bmatrix}0 & r^2\\ -1 & 2d\end{bmatrix}$ has eigenvalues 
$\alpha_{\pm} = d \pm \sqrt{d^2-r^2}$ with eigenvector $\begin{bmatrix} \alpha_{\mp} \\ 1 \end{bmatrix}$.
Since we can decompose the initial vector as
$$\begin{bmatrix}x_1 \\ 1\end{bmatrix}
= \frac{x_1 - \alpha_{-}}{\alpha_{+}-\alpha_{-}}
\begin{bmatrix}\alpha_{+}\\ 1 \end{bmatrix}
+ \frac{\alpha_{+} - x_1}{\alpha_{+}-\alpha_{-}}
\begin{bmatrix}\alpha_{-}\\ 1 \end{bmatrix}
$$
We get
$$\begin{bmatrix}x_n \\ 1\end{bmatrix}
\propto (x_1 - \alpha_{-})\alpha_{-}^{n-1}
\begin{bmatrix}\alpha_{+}\\ 1 \end{bmatrix}
+ (\alpha_{+} - x_1) \alpha_{+}^{n-1}
\begin{bmatrix}\alpha_{-}\\ 1 \end{bmatrix}
$$
This leads to
$$x_n = r^2 \frac{
(x_1 - \alpha_{-})\alpha_{-}^{n-2} + (\alpha_{+} - x_1)\alpha_{+}^{n-2}
}{
(x_1 - \alpha_{-})\alpha_{-}^{n-1} + (\alpha_{+} - x_1)\alpha_{+}^{n-1}
}
= r^2 \frac{f_{n-1} - x_1 f_{n-2}}{f_{n} - x_1 f_{n-1}}
$$
where $f_n = \alpha_{+}^n - \alpha_{-}^n$.
In particular, if $d > r > 0$, then $|\alpha_{+}| > |\alpha_{-}|$ and $f_n$ will be dominated by $\alpha_{+}^n$ term for large $n$. This implies
$$\lim_{n\to\infty} x_n = \frac{r^2}{\alpha_{+}} = \alpha_{-} = d - \sqrt{d^2-r^2}$$
