# Computing Infinite Continued Fractions

I am looking for "tricks" used to compute infinite continued fractions. For example, $$1+\cfrac{1}{1+\cfrac{1}{1+\cfrac{1}{\ddots}}}$$ is the golden ratio since if we denote it by $x$, then we have $$x=1+\frac{1}{x},$$ which simplifies to $$x^2-x-1=0$$

Are there any other (different/elegant) examples of ways to compute infinite continued fractions?

• This is the easiest example of the standard method for computing (ultimately) periodic continued fractions. In all cases we get a quadratic equation. – André Nicolas Sep 5 '13 at 5:50
• The computation of Pade' approximants of certain functions gives nice looking generalized continued fractions. The work is kind of backwards: You could recognize your generalized continued fraction as a particular case of a known one and then you get the value from evaluating the function. See examples here (en.wikipedia.org/wiki/Generalized_continued_fraction#Examples) – OR. Sep 5 '13 at 6:06
• No general method: every non rational real number can be written as an infinite continued fraction in a unique way (or many ways if you allow generalized continued fractions). – egreg Sep 5 '13 at 10:39
• @egreg, I'm not looking for a fix for every irrational, for I was just looking for relatively simple examples such as the one given above. – The Substitute Sep 6 '13 at 3:32

This is an expansion of @AndréNicolas’s excellent comment. If the c.f. repeats, then your method works equally well. Take the fraction $$x=\frac1{2+}\,\frac1{1+}\,\frac1{2+}\,\frac1{1+\cdots}\,,$$ in which you have $$x=\frac1{2+\frac1{1+x}}=\frac{1+x}{2+2x+1}\,,$$ which you can solve to get a quadratic whose only positive root is $(\sqrt3-1)/2$. If the repetition takes over only after a while, it’s only a little more complicated.

• cool, thanks for the example. – The Substitute Sep 5 '13 at 19:45
• Note that this works both ways; a number's continued fraction is eventually periodic if and only if the number is a linear expression in a quadratic surd (i.e., if it takes the form $a+b\sqrt{d}$ for $a, b\in\mathbb{Q}$ and $d\in\mathbb{N}$). – Steven Stadnicki Mar 7 '14 at 7:58

This Infinite Continued Fractions can be written in many different way. $$\frac{1}{1} ;\frac{1}{1+\frac{1}{1}};\frac{1}{1+ \frac{1}{1+\frac{1}{1}}};\frac{1}{1+ \frac{1}{1+ \frac{1}{1+\frac{1}{1}}}} ...$$

like this:

$$\frac{1}{1} ;\frac{1}{2};\frac{3}{2};\frac{5}{3};\frac{8}{5};\frac{13}{8};\frac{21}{13}...$$

there is a Infinite series: $$\frac{13}{8} + \sum_{n=0}^{\infty} \frac{(-1)^{n+1}(2n + 1)!}{(n + 2)!n!(4)^{2n+3}}$$

the limit of this sequance is $\phi=\frac{1 + \sqrt{5}}{2} = 1.680339887...$

also $\phi=\frac{1 + \sqrt{5}}{2}$ is a root of $\phi^{2}-\phi-1=0$

If you define $x_0=1$, $x_1=1+\frac{1}{1}=1+\frac1{x_0}$, $x_2=1+\frac{1}{1+\frac{1}{1}}= 1+\frac{1}{x_1}$, you can express the continued fraction as the limit of the sequence $x_{n+1}=1+\frac{1}{x_n}$.

Finally, this limit can be computed as the fixed point of the function $f(x)=1+\frac{1}{x}$; that is, $$x=1+\frac1x\quad \Rightarrow x^2-x-1=0.$$ So, the limit is the (positive) solution of this ecuation, that is, the golden ratio $$\Phi=\frac{1+\sqrt5}{2}$$

As you can see, it is easy to extend this principle to a wide set of similar problems.