# Continued Fractions

A **continued fraction** is a general representation of a real number \(x\) in the form

\[a_{0}+\cfrac{b_{1}}{a_{1}+\cfrac{b_{2}}{a_2+\cfrac{b_{3}}{a_{3}+\cfrac{b_{4}}{a_{4}+\ddots}}}},\]

where \(a_{0},a_{1},\ldots\) and \( b_{1},b_{2},\ldots\) are all integers.

#### Contents

## Simple Continued Fraction

A simple continued fraction representation of a real number \(x\) is in the form

\[\large a_{0}+\frac{1}{a_{1}+\frac{1}{a_2+\frac{1}{a_{3}+\ldots}}},\] where \(a_{0},a_{1},\ldots\) are integers.

The real number \(x\) which is written in simple continued fraction can also be written in compact forms as follows:

\[ a_{0}+\frac{1}{a_{1}+} \frac{1}{a_{2}+} \frac{1}{a_{3}+} \cdots=[a_{0};a_{1},a_{2},a_{3},\ldots].\]

## Converting Rational Numbers

Let \(\dfrac{m}{n}\) be the given fraction. To convert \(\dfrac{m}{n}\) into a simple continued fraction, we have to divide \(m\) by \(n\). Let \(a_{0}\) be the quotient and \(p\) be the remainder, then

\[\dfrac{m}{n}=a_{0}+\dfrac{p}{n}=a_{0}+\dfrac{1}{\frac{n}{p}}.\]

Now, divide \(n\) by \(p\), and let \(a_{1}\) be the quotient and \(q\) be the remainder, then

\[\dfrac{n}{p}=a_{1}+\dfrac{q}{p}=a_{1}+\dfrac{1}{\frac{p}{q}}.\]

We just have to keep doing this until we reach to the simple continued fraction. Thus,

\[\dfrac{m}{n}=a_{0}+\frac{1}{a_{1}+\frac{1}{a_2+\frac{1}{a_{3}+\frac{1}{\ldots}}}}=a_{0}+\frac{1}{a_{1}+} \frac{1}{a_{2}+} \frac{1}{a_{3}+} \ldots=[a_{0};a_{1},a_{2},a_{3},\ldots].\]

If \(m<n\), then the first quotient \(a_{0}\) is zero and we can proceed as explained above.

## Reduce \(\dfrac{251}{802}\) to a simple continued fraction.

\[\dfrac{251}{802}=\dfrac{1}{\dfrac{802}{251}}=\dfrac{1}{3+\dfrac{49}{251}}=\dfrac{1}{3+\dfrac{1}{\dfrac{251}{49}}}=\dfrac{1}{3+\dfrac{1}{5+\dfrac{6}{49}}}=\dfrac{1}{3+\dfrac{1}{5+\dfrac{1}{\dfrac{49}{6}}}}=\dfrac{1}{3+\dfrac{1}{5+\dfrac{1}{8+\dfrac{1}{6}}}}=\dfrac{1}{3+} \dfrac{1}{5+} \dfrac{1}{8+} \dfrac{1}{6}.\]

## Infinite Continued Fractions

Infinite continued fractions look much like a simple continued fraction; they only go on forever. In many cases, there are patterns which we can look at in order to evaluate them.

The most basic case is

\[1+\frac{1}{1+\frac{1}{1+\frac{1}{1+\ddots}}}.\]

We can let the infinite continued fraction equal some value \(k\). Since the fraction is continued forever, we can actually look for \(k\) within the infinite fraction itself. This means we can rewrite the entire thing as follows:

\[\begin{align} 1+\frac{1}{1+\frac{1}{1+\frac{1}{1+...}}}&=k \\ 1+\frac{1}{k}&=k \\ k^{2}-k-1&=0. \end{align}\]

Have you seen that quadratic before? That's right! That continued fraction actually equals the golden ratio or \(\frac{1+\sqrt{5}}{2}\).

This same method can be used in the following case:

Solve the following for k:

\[2+\frac{1}{1+\frac{1}{2+\frac{1}{1+\frac{1}{2+\ddots}}}}=k.\]

\[\begin{align} 2+\frac{1}{1+\frac{1}{k}}&=k\\ 1+\frac{1}{k}&=\frac{1}{k-2}\\ (k)(k-2)+k-2&=k\\ k^{2}-2k-2&=0\\ k&=\frac{2+\sqrt{4-(4)(1)(-2)}}{2}\\ k&=1+\sqrt{3}.\ _\square \end{align}\]

Another nice use of infinite fractions is to be able to write messy square roots in terms of integers. Here is a proof of a helpful identity:

Prove that \[\sqrt{n}=1+\frac{n-1}{2+\frac{n-1}{2+\frac{n-1}{2+\ddots}}}.\]

By reflexive property \[\sqrt{n}=\sqrt{n}.\] Add \(n\) to both sides and \(1-1=0\) to the RHS: \[\sqrt{n}+n=\sqrt{n}+n+1-1.\] Factor the LHS: \[\sqrt{n}(1+\sqrt{n})=1+\sqrt{n}+n-1.\] Divide both sides by \(1+\sqrt{n}:\) \[\sqrt{n}=1+\frac{n-1}{1+\sqrt{n}}.\] Replace \(\sqrt{n}\) in the fraction with the RHS: \[\sqrt{n}=1+\frac{n-1}{2+\frac{n-1}{2+\ddots}},\] and this process can be continued infinitely. \(_\square\)

\[ \large a+\frac{1}{b+\frac{1}{c+\frac{1}{d}}}, \]

where \( a,b,c,d \) are positive integers. Find \( a+b+c+d\).

**Details and assumptions**

- Use the approximation \( \pi = 3.1416 \).

\[4+\frac{1}{2+\frac{1}{1+\frac{1}{3+\frac{1}{1+\frac{1}{2+\frac{1}{8+\frac{1}{\ldots} } } } } } } = \sqrt{ A} \]

Find the positive integer \(A\) in the equation above.

**Details and Assumptions:**
The pattern repeats \(2,1,3,1,2,8 \) infinitely, but the \(4\) comes only one time, i.e. in the beginning.

There are many other ways to write continued fractions for square roots. See if you can come up with any yourself.

## Irrational Numbers

We can turn irrational numbers into continued fractions by utilizing their minimum polynomial. For example, in the case of \(\sqrt{10},\) we have the following:

\[\begin{align} x&=\sqrt{10}\\ x^2-10&=0 \\ x^2-9&=1 \\ (x-3)(x+3)&=1 \\ x-3&=\dfrac{1}{x+3}\\ x&=3+\dfrac{1}{3+x}\\&=3+\cfrac{1}{6+\cfrac{1}{3+x}} \\ \Rightarrow \sqrt{10}&=3+\cfrac{1}{6+\cfrac{1}{6+\cfrac{1}{6+\ddots}}}. \end{align}\]

This is one easy case. Note that we could have also divided by \((x-3),\) which would have given us another continued fraction! Let's look at some examples:

Convert \(\sqrt{2}+2 \) into a continued fraction representation.

Let \(x=2+\sqrt{2}\), then \((x-2)^2=2\Rightarrow x^2-4x+2=0\).

Add 1 to both sides to find \(x^2-4x+3=1\Rightarrow (x-1)(x-3)=1.\).

We divide by either one as the question asks for

any, but \((x-1)\) looks nice, so let's divide by that:\[x-3=\cfrac{1}{x-1}\Rightarrow x=3+\cfrac{1}{-1+x}=3+\cfrac{1}{2+\cfrac{1}{-1+x}}=3+\cfrac{1}{2+\cfrac{1}{2+\cfrac{1}{2+\ddots}}}.\]

We have found

acontinued fraction expression for the given number. It is left for the reader as an exercise to find numerous other such expressions for the same number. \(_\square\)

Convert \(\sqrt[3]{10}\) into an infinite continued fraction with radicals.

We have \(x=\sqrt[3]{10}\Rightarrow x^3-10=0\). Add 2 to both sides to get \(x^3-8=2\Rightarrow(x-2)(x^2+2x+4)=2.\) Divide by \(x-2\) to get

\[\begin{align} x^2+2x+4&=\dfrac{2}{x-2}\\ (x+1)^2&=-3+\dfrac{2}{x-2} \\ x&=-1+\sqrt{-3+\dfrac{2}{x-2}}\\&=-1+\sqrt{-3+\dfrac{2}{-3+\sqrt{-3+\dfrac{2}{x-2}}}} \\ \Rightarrow \sqrt[3]{10}&=-1+\sqrt{-3+\dfrac{2}{-3+\sqrt{-3+\dfrac{2}{-3+\sqrt{-3+\dfrac{2}{-3+\cdots}}}}}}. \end{align}\]

Note: Since \(x\) is positive we are discarding the negative root.

Note that if we tried the same thing as we did with the square root case, the cube root would have a **long** period. It is best to do this to radicals.

**Cite as:**Continued Fractions.

*Brilliant.org*. Retrieved from https://brilliant.org/wiki/continued-fractions/