Closed form for this continued fraction [closed]
Is there a closed form for this continued fraction?
$$x+\frac{1}{x+\frac{1}{x+\frac{1}{...}}}$$
Solution 1:
Here's a cute, handwavy way to do it:
$$ f(x) = x + \cfrac{1}{x+\cfrac{1}{x+\cfrac{1}{x+\dots}}}$$
Notice then that
$$ \frac{1}{f(x)} = \cfrac{1}{x+\cfrac{1}{x+\cfrac{1}{x+\dots}}} $$
Thus
\begin{align} x+\frac{1}{f(x)} &= x+\cfrac{1}{x+\cfrac{1}{x+\cfrac{1}{x+\dots}}} \\ &=f(x) \end{align}
So, we have a functional relationship
$$ x + \frac{1}{f(x)} = f(x) $$
or equivalently
$$ xf(x) + 1 = f(x)^{2} $$
This quadratic equation may be solved quite simply, we have candidate solutions:
$$ f_{\pm}(x) = \frac{x\pm\sqrt{x^{2}+4}}{2}$$
We should note that $f(1)$ as a continued fraction is precisely the golden ratio. Hence we deduce
$$ f(x) = \frac{x+\sqrt{x^{2}+4}}{2}. $$
Solution 2:
The continued fraction $[x;x,x,...]$ converges for any $x \in \mathbb{C} \backslash i(-2,2) = \{ z : z \in \mathbb{C} \wedge z \not\in \{ ir : r \in(-2,2) \} \}$, and here is my proof:
If $[x;x,x,...]$ converges to $c$,
$c = x + 1/c$ and hence $c$ is a root of the quadratic $t \mapsto t^2 - x t - 1$
Let $r$,$s$ be the roots of the quadratic $t \mapsto t^2 - x t - 1$ and so $r + s = x$ and $r s = -1$
Let the sequence of approximants be $(a_n)$ where $a_1 = x$ (and the sequence stops if it becomes $0$)
Let $b_n = a_n b_{n-1}$ where $b_0 = 1$ and so $a_n = \frac{b_n}{b_{n-1}}$ (if $a_n$ is defined)
$b_{n+1} = a_{n+1} b_n = ( x + \frac{1}{a_n} ) b_n = ( x + \frac{b_{n-1}}{b_n} ) b_n = x b_n + b_{n-1}$ (if $a_n \ne 0$)
$b_{n+1} - r b_n = s ( b_n - r b_{n-1} ) = s^n ( b_1 - r b_0 ) = (x-r) s^n = s^{n+1}$
$b_n - r^n b_0 = \sum_{k=1}^n r^{n-k} s^k$ and hence $b_n = \sum_{k=0}^n r^{n-k} s^k$
If $r \ne s$,
$b_n = {\large \frac{ r^{n+1} - s^{n+1} }{r-s} }$ [Or we can subtract $b_{n+1} - r b_n = s^{n+1}$ and $b_{n+1} - s b_n = r^{n+1}$]
$a_n = {\large \frac{ r^{n+1} - s^{n+1} }{ r^n - s^n } }$ (if $a_n$ is defined)
If $r = s$,
$b_n = (n+1) r^n$
$a_n = \frac{n+1}{n} r$ (if $a_n$ is defined)
If $x \not\in i[-2,2]$,
$|r| \ne 1$ otherwise $x = r - \frac{1}{r} = r - r^* = 2i~Im(r) \in i[-2,2]$
Permute $r$,$s$ such that $|r| > 1 > |s|$ because $|r| \cdot |s| = |rs| = 1$
$a_n \ne 0$ for any $n \in \mathbb{N}$ because $b_n = {\large \frac{ r^{n+1} - s^{n+1} }{r-s} } \ne 0$ for any $n \in \mathbb{Z}_{\ge 0}$ since $|r^{n+1}| > 1 > |s^{n+1}|$
$a_n = {\large \frac{ r^{n+1} - s^{n+1} }{ r^n - s^n } } = r + {\large \frac{ (r-s) s^n } { r^n - s^n } } = r + {\large \frac{r-s}{ (\frac{r}{s})^n - 1 } } \to r$ as $n \to \infty$ because $(\frac{r}{s})^n \to \infty$
If $x \in \{2i,-2i\}$,
$r = s \in \{i,-i\}$ because $(r-s)^2 = (r+s)^2 - 4rs = 0$
$a_n \ne 0$ for any $n \in \mathbb{N}$ because $b_n = (n+1) r^n \ne 0$ for any $n \in \mathbb{Z}_{\ge 0}$
$a_n = \frac{n+1}{n} r \to r$ as $n \to \infty$
If $x \in i(-2,2)$,
$a_n \in i\mathbb{R}$ (if $a_n$ is defined) because $x,\frac{1}{a_{n-1}} \in i\mathbb{R}$
If $a_n \to c$ as $n \to \infty$,
$c \in i\mathbb{R}$ because $i\mathbb{R}$ is closed
But $c \in \{r,s\} = {\large \frac{ x \pm \sqrt{x^2+4} }{2} }$ and hence $c \not\in i\mathbb{R}$ since $x^2+4 > 0$
$\Rightarrow\Leftarrow$
Therefore $( a_n )$ either terminates in a $0$ or does not converge