Continued fractions offer a means of concrete representation for arbitrary real numbers. The continued fraction expansion of a real number is an alternative to the representation of such a number as a (possibly infinite) decimal.
The reasons for including this topic in the course on Classical Algebra are:
Every real number $x$ is represented by a point on the real line and, as such, falls between two integers. For example, if $n$ is an integer and $$n\phantom{\rule{0.6em}{0ex}}\le \phantom{\rule{0.6em}{0ex}}x\phantom{\rule{0.6em}{0ex}}<\phantom{\rule{0.6em}{0ex}}n+1\phantom{\rule{0.6em}{0ex}},$$ $x$ falls between $n$ and $n+1$, and there is one and only one such integer $n$ for any given real $x$. In the case where $x$ itself is an integer, one has $n=x$. The integer $n$ is sometimes called the floor of $x$, and one often introduces a notation for the floor of $x$ such as $$n\phantom{\rule{0.6em}{0ex}}=\phantom{\rule{0.6em}{0ex}}\left[x\right]\text{.}$$
Examples:
For any real $x$ with $n=\left[x\right]$ the number $u=x-n$ falls in the unit interval $I$ consisting of all real numbers $u$ for which $0\le u<1$.
Thus, for given real $x$ there is a unique decomposition $$x\phantom{\rule{0.6em}{0ex}}=\phantom{\rule{0.6em}{0ex}}n+u$$ where $n$ is an integer and $u$ is in the unit interval. Moreover, $u=0$ if and only if $x$ is an integer. This decomposition is sometimes called the mod one decomposition of a real number. It is the first step in the process of expanding $x$ as a continued fraction.
The process of finding the continued fraction expansion of a real number is a recursive process that procedes one step at a time. Given $x$ one begins with the mod one decomposition $$x\phantom{\rule{0.6em}{0ex}}=\phantom{\rule{0.6em}{0ex}}{n}_{1}+{u}_{1}\phantom{\rule{0.6em}{0ex}},$$ where ${n}_{1}$ is an integer and $0\le {u}_{1}<1$.
If ${u}_{1}=0$, which happens if and only if $x$ is an integer, the recursive process terminates with this first step. The idea is to obtain a sequence of integers that give a precise determination of $x$.
If ${u}_{1}>0$, then the reciprocal $1\u2044{u}_{1}$ of ${u}_{1}$ satisfies $1\u2044{u}_{1}>1$ since ${u}_{1}$ is in $I$ and, therefore, ${u}_{1}<1$. In this case the second step in the recursive determination of the continued fraction expansion of $x$ is to apply the mod one decomposition to $1\u2044{u}_{1}$. One writes $$1\u2044{u}_{1}\phantom{\rule{0.6em}{0ex}}=\phantom{\rule{0.6em}{0ex}}{n}_{2}+{u}_{2}\phantom{\rule{0.6em}{0ex}},$$ where ${n}_{2}$ is an integer and $0\le {u}_{2}<1$. Combining the equations that represent the first two steps, one may write $$x={n}_{1}+\frac{1}{{n}_{2}+{u}_{2}}\text{.}$$
Either ${u}_{2}=0$, in which case the process ends with the expansion $$x={n}_{1}+\frac{1}{{n}_{2}}\phantom{\rule{0.6em}{0ex}},$$ or ${u}_{2}>0$. In the latter case one does to ${u}_{2}$ what had just been done to ${u}_{1}$ above under the assumption ${u}_{1}>0$. One writes $$1\u2044{u}_{2}\phantom{\rule{0.6em}{0ex}}=\phantom{\rule{0.6em}{0ex}}{n}_{3}+{u}_{3}\phantom{\rule{0.6em}{0ex}},$$ where ${n}_{3}$ is an integer and $0\le {u}_{3}<1$. Then combining the equations that represent the first three steps, one may write $$x={n}_{1}+\frac{1}{{n}_{2}+\frac{1}{{n}_{3}+{u}_{3}}}\text{.}$$
After $k$ steps, if the process has gone that far, one has integers ${n}_{1},{n}_{2},\dots ,{n}_{k}$ and real numbers ${u}_{1},{u}_{2},\dots ,{u}_{k}$ that are members of the unit interval $I$ with ${u}_{1},{u}_{2},\dots ,{u}_{k-1}$ all positive. One may write $$x={n}_{1}+\frac{1}{{n}_{2}+\frac{1}{{n}_{3}+\frac{1}{\dots +\frac{1}{{n}_{k}+{u}_{k}}}}}\text{.}$$ Alternatively, one may write $$x=\left[{n}_{1},{n}_{2},{n}_{3},\dots ,{n}_{k}+{u}_{k}\right]\text{.}$$ If ${u}_{k}=0$, the process ends after $k$ steps. Otherwise, the process continues at least one more step with $$1\u2044{u}_{k}\phantom{\rule{0.6em}{0ex}}=\phantom{\rule{0.6em}{0ex}}{n}_{k+1}+{u}_{k+1}\text{.}$$
In this way one associates with any real number $x$ a sequence, which could be either finite or infinite, ${n}_{1},{n}_{2},\dots $ of integers. This sequence is called the continued fraction expansion of $x$.
$$\begin{array}{cccc}\text{}& \hfill \phantom{\rule{0.6em}{0ex}}\frac{15}{11}& \hfill =\hfill & 1+\frac{4}{11}\hfill \\ \text{}& \hfill \phantom{\rule{0.6em}{0ex}}& \hfill =\hfill & 1+\frac{1}{\frac{11}{4}}\hfill \\ \text{}& \hfill \phantom{\rule{0.6em}{0ex}}& \hfill =\hfill & 1+\frac{1}{2+\frac{3}{4}}\hfill \\ \text{}& \hfill \phantom{\rule{0.6em}{0ex}}& \hfill =\hfill & 1+\frac{1}{2+\frac{1}{\frac{4}{3}}}\hfill \\ \text{}& \hfill \phantom{\rule{0.6em}{0ex}}& \hfill =\hfill & 1+\frac{1}{2+\frac{1}{1+\frac{1}{3}}}\hfill \\ \text{}& \hfill \phantom{\rule{0.6em}{0ex}}& \hfill =\hfill & \left[1,2,1,3\right]\phantom{\rule{0.6em}{0ex}}\text{.}\hfill \end{array}$$
$$\begin{array}{cccc}\text{}& \hfill \phantom{\rule{0.6em}{0ex}}\sqrt{10}& \hfill =\hfill & 3+\frac{1}{\frac{1}{\sqrt{10}-3}}\hfill \\ \text{}& \hfill \phantom{\rule{0.6em}{0ex}}& \hfill =\hfill & 3+\frac{1}{\sqrt{10}+3}\hfill \\ \text{}& \hfill \phantom{\rule{0.6em}{0ex}}& \hfill =\hfill & 3+\frac{1}{6+\frac{1}{\frac{1}{\sqrt{10}-3}}}\hfill \\ \text{}& \hfill \phantom{\rule{0.6em}{0ex}}& \hfill =\hfill & 3+\frac{1}{6+\frac{1}{\sqrt{10}+3}}\hfill \\ \text{}& \hfill \phantom{\rule{0.6em}{0ex}}& \hfill =\hfill & 3+\frac{1}{6+\frac{1}{6+\frac{1}{\dots}}}\hfill \\ \text{}& \hfill \phantom{\rule{0.6em}{0ex}}& \hfill =\hfill & \left[3,6,6,6,\dots \right]\phantom{\rule{0.6em}{0ex}}\text{.}\hfill \end{array}$$
$$\begin{array}{cccc}\text{}& \hfill \phantom{\rule{0.6em}{0ex}}\left[2,3,5,2\right]& \hfill =\hfill & 2+\frac{1}{\left[3,5,2\right]}\hfill \\ \text{}& \hfill \phantom{\rule{0.6em}{0ex}}& \hfill =\hfill & 2+\frac{1}{3+\frac{1}{\left[5,2\right]}}\hfill \\ \text{}& \hfill \phantom{\rule{0.6em}{0ex}}& \hfill =\hfill & 2+\frac{1}{3+\frac{1}{5+\frac{1}{2}}}\hfill \\ \text{}& \hfill \phantom{\rule{0.6em}{0ex}}& \hfill =\hfill & 2+\frac{1}{3+\frac{1}{\frac{11}{2}}}\hfill \\ \text{}& \hfill \phantom{\rule{0.6em}{0ex}}& \hfill =\hfill & 2+\frac{1}{3+\frac{2}{11}}\hfill \\ \text{}& \hfill \phantom{\rule{0.6em}{0ex}}& \hfill =\hfill & 2+\frac{1}{\frac{35}{11}}\hfill \\ \text{}& \hfill \phantom{\rule{0.6em}{0ex}}& \hfill =\hfill & 2+\frac{11}{35}\hfill \\ \text{}& \hfill \phantom{\rule{0.6em}{0ex}}& \hfill =\hfill & \frac{81}{35}\phantom{\rule{0.6em}{0ex}}\text{.}\hfill \end{array}$$
Let $$x=1+\frac{1}{2+\frac{1}{3+\frac{1}{2+\frac{1}{3+\frac{1}{2+\dots}}}}}\text{.}$$ In this case one finds that $$x=1+\frac{1}{y}\phantom{\rule{0.6em}{0ex}},$$ where $$y=2+\frac{1}{3+\frac{1}{2+\frac{1}{3+\frac{1}{2+\dots}}}}\text{.}$$ Further reflection shows that the continued fraction structure for $y$ is self-similar: $$y=2+\frac{1}{3+\frac{1}{y}}\text{.}$$ This simplifies to $$y=\frac{7y+2}{3y+1}$$ and leads to the quadratic equation $$3{y}^{2}-6y-2=0$$ with discriminant $60$. Since $y>2$, one of the two roots of the quadratic equation cannot be $y$, and, therefore, $$y=\frac{3+\sqrt{15}}{3}\text{.}$$ Finally, $$x=\frac{\sqrt{15}-1}{2}\text{.}$$
The idea of the calculation above leads to the conclusion that any continued fraction $\left[{n}_{1},{n}_{2},\dots \right]$ that eventually repeats is the solution of a quadratic equation with positive discriminant and integer coefficients. The converse of this statement is also true, but a proof requires further consideration.
The process of finding the continued fraction expansion of a rational number is essentially identical to the process of applying the Euclidean algorithm to the pair of integers given by its numerator and denominator.
Let $x=a\u2044b,\phantom{\rule{0.6em}{0ex}}b>0$, be a representation of a rational number $x$ as a quotient of integers $a$ and $b$. The mod one decomposition $$\frac{a}{b}={n}_{1}+{u}_{1}\phantom{\rule{0.3em}{0ex}},\phantom{\rule{0.6em}{0ex}}\phantom{\rule{0.6em}{0ex}}{u}_{1}=\frac{a-{n}_{1}b}{b}$$ shows that ${u}_{1}={r}_{1}\u2044b$, where ${r}_{1}$ is the remainder for division of $a$ by $b$. The case where ${u}_{1}=0$ is the case where $x$ is an integer. Otherwise ${u}_{1}>0$, and the mod one decomposition of $1\u2044{u}_{1}$ gives $$\frac{b}{{r}_{1}}={n}_{2}+{u}_{2}\phantom{\rule{0.3em}{0ex}},\phantom{\rule{0.6em}{0ex}}\phantom{\rule{0.6em}{0ex}}{u}_{2}=\frac{b-{n}_{2}{r}_{1}}{{r}_{1}}\text{.}$$ This shows that ${u}_{2}={r}_{2}\u2044{r}_{1}$, where ${r}_{2}$ is the remainder for division of $b$ by ${r}_{1}$. Thus, the successive quotients in Euclid's algorithm are the integers ${n}_{1},{n}_{2},\dots $ occurring in the continued fraction. Euclid's algorithm terminates after a finite number of steps with the appearance of a zero remainder. Hence, the continued fraction expansion of every rational number is finite.
Proof. It has just been shown that if $x$ is rational, then the continued fraction expansion of $x$ is finite because its calculation is given by application of the Euclidean algorithm to the numerator and denominator of $x$. The converse statement is the statement that every finite continued fraction represents a rational number. That statement will be demonstrated in the following section.
For arbitrary real numbers ${t}_{1},{t}_{2},\dots ,{t}_{r}$ with each ${t}_{j}\ge 1$ for $j\ge 2$ the symbol $\left[{t}_{1},{t}_{2},\dots ,{t}_{r}\right]$ is defined recursively by: $$\left[{t}_{1}\right]\phantom{\rule{0.6em}{0ex}}=\phantom{\rule{0.6em}{0ex}}{t}_{1}$$ $$\begin{array}{cc}\text{(1)}& \left[{t}_{1},{t}_{2},\dots ,{t}_{r}\right]\phantom{\rule{0.6em}{0ex}}=\phantom{\rule{0.6em}{0ex}}{t}_{1}+\frac{1}{\left[{t}_{2},\dots ,{t}_{r}\right]}\phantom{\rule{0.6em}{0ex}}\text{.}\end{array}$$ In order for this definition to make sense one needs to know that the denominator in the right-hand side of (1) is non-zero. The condition ${t}_{j}\ge 1$ for $j\ge 2$ guarantees, in fact, that $\left[{t}_{2},\dots ,{t}_{r}\right]>0$, as one may prove using induction.
It is an easy consequence of mathematical induction that the symbol $\left[{t}_{1},{t}_{2},\dots ,{t}_{r}\right]$ is a rational number if each ${t}_{j}$ is rational. In particular, each finite continued fraction is a rational number. (Note that the symbol $\left[{t}_{1},{t}_{2},\dots ,{t}_{r}\right]$ is to be called a continued fraction, according to the convention of the first section, only when each ${t}_{j}$ is an integer.)
Observe that the recursive nature of the symbol $\left[{t}_{1},\dots ,{t}_{r}\right]$ suggests that the symbol should be computed in a particular case working from right to left. Consider again, for example, the computation above showing that $\left[2,3,5,2\right]=81\u204435$. Working from right to left one has: $$\begin{array}{cccc}\text{}& \hfill \phantom{\rule{0.6em}{0ex}}\left[2\right]& \hfill =\hfill & 2\hfill \\ \text{}& \hfill \phantom{\rule{0.6em}{0ex}}\left[5,2\right]& \hfill =\hfill & 5+\frac{1}{\left[2\right]}=5+\frac{1}{2}=\frac{11}{2}\hfill \\ \text{}& \hfill \phantom{\rule{0.6em}{0ex}}\left[3,5,2\right]& \hfill =\hfill & 3+\frac{1}{\left[5,2\right]}=3+\frac{2}{11}=\frac{35}{11}\hfill \\ \text{}& \hfill \phantom{\rule{0.6em}{0ex}}\left[2,3,5,2\right]& \hfill =\hfill & 2+\frac{1}{\left[3,5,2\right]}=2+\frac{11}{35}=\frac{81}{35}\hfill \end{array}$$
There is, however, another approach to computing $\left[{t}_{1},{t}_{2},\dots ,{t}_{r}\right]$. Let, in fact, ${t}_{1},{t}_{2},\dots $ be any (finite or infinite) sequence of real numbers. One uses the double recursion $$\begin{array}{cc}\text{(2)}& {p}_{j}={t}_{j}{p}_{j-1}+{p}_{j-2}\phantom{\rule{0.3em}{0ex}},\phantom{\rule{0.6em}{0ex}}\phantom{\rule{0.6em}{0ex}}j\ge 1\phantom{\rule{0.3em}{0ex}},\phantom{\rule{0.6em}{0ex}}\phantom{\rule{0.6em}{0ex}}{p}_{0}=1\phantom{\rule{0.3em}{0ex}},\phantom{\rule{0.6em}{0ex}}\phantom{\rule{0.6em}{0ex}}{p}_{-1}=0\end{array}$$ to define the sequence $\left\{{p}_{j}\right\}\phantom{\rule{0.3em}{0ex}},\phantom{\rule{0.6em}{0ex}}j\ge -1$. The double recursion, differently initialized, $$\begin{array}{cc}\text{(3)}& {q}_{j}={t}_{j}{q}_{j-1}+{q}_{j-2}\phantom{\rule{0.3em}{0ex}},\phantom{\rule{0.6em}{0ex}}\phantom{\rule{0.6em}{0ex}}j\ge 1\phantom{\rule{0.3em}{0ex}},\phantom{\rule{0.6em}{0ex}}\phantom{\rule{0.6em}{0ex}}{q}_{0}=0\phantom{\rule{0.3em}{0ex}},\phantom{\rule{0.6em}{0ex}}\phantom{\rule{0.6em}{0ex}}{q}_{-1}=1\end{array}$$ defines the sequence $\left\{{q}_{j}\right\}\phantom{\rule{0.3em}{0ex}},\phantom{\rule{0.6em}{0ex}}j\ge -1$. Note that ${p}_{1}={t}_{1}$, ${p}_{2}={t}_{1}{t}_{2}+1$, $\dots $ and ${q}_{1}=1$, ${q}_{2}={t}_{2}$, ${q}_{3}={t}_{2}{t}_{3}+1$, $\dots \phantom{\rule{0.3em}{0ex}}$.
One now forms the matrix $$\begin{array}{cc}\text{(4)}& {M}_{j}=\left(\begin{array}{cc}\hfill {p}_{j}& \hfill {q}_{j}\\ \hfill {p}_{j-1}& \hfill {q}_{j-1}\end{array}\right)\text{for}j\ge 0\phantom{\rule{0.6em}{0ex}}\text{.}\end{array}$$ Thus, for example, $${M}_{0}=\left(\begin{array}{cc}\hfill 1& \hfill 0\\ \hfill 0& \hfill 1\end{array}\right)\phantom{\rule{0.3em}{0ex}},\text{and}{M}_{1}=\left(\begin{array}{cc}\hfill {t}_{1}& \hfill 1\\ \hfill 1& \hfill 0\end{array}\right)\text{.}$$ It is easy to see that the matrices ${M}_{j}$ satisfy the double recursion $$\begin{array}{cc}\text{(5)}& {M}_{j}=\left(\begin{array}{cc}\hfill {t}_{j}& \hfill 1\\ \hfill 1& \hfill 0\end{array}\right)\phantom{\rule{0.3em}{0ex}}{M}_{j-1}\phantom{\rule{0.3em}{0ex}},\phantom{\rule{0.6em}{0ex}}j\ge 1\end{array}$$ as a consequence of the double recursion formulas for the ${p}_{j}$ and ${q}_{j}$. Hence, a simple argument by mathematical induction shows that $$\begin{array}{cc}\text{(6)}& {M}_{r}=\left(\begin{array}{cc}\hfill {t}_{r}& \hfill 1\\ \hfill 1& \hfill 0\end{array}\right)\phantom{\rule{0.3em}{0ex}}\dots \phantom{\rule{0.3em}{0ex}}\left(\begin{array}{cc}\hfill {t}_{2}& \hfill 1\\ \hfill 1& \hfill 0\end{array}\right)\phantom{\rule{0.3em}{0ex}}\left(\begin{array}{cc}\hfill {t}_{1}& \hfill 1\\ \hfill 1& \hfill 0\end{array}\right)\phantom{\rule{0.3em}{0ex}},\phantom{\rule{0.6em}{0ex}}r\ge 1\text{.}\end{array}$$ This is summarized by:
Proof. The number ${p}_{r}{q}_{r-1}-{q}_{r}{p}_{r-1}$ is the determinant of the matrix ${M}_{r}$. From the formula (6) the matrix ${M}_{r}$ is the product of $r$ matrix factors, each of which has determinant $-1$. Since the determinant of the product of matrices is the product of the determinants of the factors, it is clear that $\mathrm{det}\left({M}_{r}\right)={\left(-1\right)}^{r}$.
Proof. First recall (i) that the product of a matrix and a (column) vector is defined by the relation $$\left(\begin{array}{cc}\hfill a& \hfill b\\ \hfill c& \hfill d\end{array}\right)\phantom{\rule{0.3em}{0ex}}\left(\begin{array}{c}\hfill x\\ \hfill y\end{array}\right)\phantom{\rule{0.6em}{0ex}}=\phantom{\rule{0.6em}{0ex}}\left(\begin{array}{c}\hfill ax+by\\ \hfill cx+dy\end{array}\right)\phantom{\rule{0.6em}{0ex}},$$ (ii) that the transpose of a matrix is the matrix whose rows are the columns of the given matrix, and (iii) that the transpose operation reverses matrix multiplication. One tranposes both sides of the relation (7) to obtain: $$\begin{array}{cc}\text{(9)}& \left(\begin{array}{cc}\hfill {p}_{r}& \hfill {p}_{r-1}\\ \hfill {q}_{r}& \hfill {q}_{r-1}\end{array}\right)\phantom{\rule{0.6em}{0ex}}=\phantom{\rule{0.6em}{0ex}}\left(\begin{array}{cc}\hfill {t}_{1}& \hfill 1\\ \hfill 1& \hfill 0\end{array}\right)\phantom{\rule{0.3em}{0ex}}\left(\begin{array}{cc}\hfill {t}_{2}& \hfill 1\\ \hfill 1& \hfill 0\end{array}\right)\phantom{\rule{0.3em}{0ex}}\dots \phantom{\rule{0.3em}{0ex}}\left(\begin{array}{cc}\hfill {t}_{r}& \hfill 1\\ \hfill 1& \hfill 0\end{array}\right)\text{.}\end{array}$$ To this relation one applies the principle that the first column of any $2\times 2$ matrix is the product of that matrix with the column $$\left(\begin{array}{c}\hfill 1\\ \hfill 0\end{array}\right)$$ in order to obtain the column identity (8).
Proof. What is slightly strange about this important result is that while the $\left\{{p}_{r}\right\}$ and the $\left\{{q}_{r}\right\}$ are defined by the front end recursions, albeit double recursions, (2) and (3), the symbol $\left[{t}_{1},\dots ,{t}_{r}\right]$ is defined by the back end recursion (1). The proof begins with the comment that the right-hand side of (10) does not make sense unless one can be sure that the denominator ${q}_{r}\ne 0$. One can show easily by induction on $r$ that ${q}_{r}\ge 1$ for $r\ge 1$ under the hypothesis ${t}_{j}\ge 1$ for $j\ge 2$.
The proof proceeds by induction on $r$. If $r=1$, the assertion of the theorem is simply the statement ${t}_{1}={p}_{1}\u2044{q}_{1}$, and, as noted above, ${p}_{1}={t}_{1}$ and ${q}_{1}=1$. Assume now that $r\ge 2$. By induction we may assume the correctness of the statement (10) for symbols of length $r-1$, and, therefore, for the symbol $\left[{t}_{2},\dots ,{t}_{r}\right]$. That case of the statement says that $\left[{t}_{2},\dots ,{t}_{r}\right]$ must be equal to $a\u2044c\phantom{\rule{0.3em}{0ex}}$, where by corollary 2 $$\left(\begin{array}{c}\hfill a\\ \hfill c\end{array}\right)=\left(\begin{array}{cc}\hfill a& \hfill b\\ \hfill c& \hfill d\end{array}\right)\phantom{\rule{0.3em}{0ex}}\left(\begin{array}{c}\hfill 1\\ \hfill 0\end{array}\right)$$ with $$\left(\begin{array}{cc}\hfill a& \hfill b\\ \hfill c& \hfill d\end{array}\right)\phantom{\rule{0.6em}{0ex}}=\phantom{\rule{0.6em}{0ex}}\left(\begin{array}{cc}\hfill {t}_{2}& \hfill 1\\ \hfill 1& \hfill 0\end{array}\right)\phantom{\rule{0.3em}{0ex}}\dots \phantom{\rule{0.3em}{0ex}}\left(\begin{array}{cc}\hfill {t}_{r}& \hfill 1\\ \hfill 1& \hfill 0\end{array}\right)\text{.}$$ Now by (1) $$\left[{t}_{1},\phantom{\rule{0.3em}{0ex}}{t}_{2},\phantom{\rule{0.3em}{0ex}}\dots ,\phantom{\rule{0.3em}{0ex}}{t}_{r}\right]\phantom{\rule{0.6em}{0ex}}=\phantom{\rule{0.6em}{0ex}}{t}_{1}+\frac{1}{a\u2044c}\phantom{\rule{0.6em}{0ex}}=\phantom{\rule{0.6em}{0ex}}{t}_{1}+\frac{c}{a}\phantom{\rule{0.6em}{0ex}}=\phantom{\rule{0.6em}{0ex}}\frac{a{t}_{1}+c}{a}\text{.}$$ But by corollary 2 again $$\left(\begin{array}{c}\hfill {p}_{r}\\ \hfill {q}_{r}\end{array}\right)\phantom{\rule{0.6em}{0ex}}=\phantom{\rule{0.6em}{0ex}}\left(\begin{array}{cc}\hfill {t}_{1}& \hfill 1\\ \hfill 1& \hfill 0\end{array}\right)\phantom{\rule{0.3em}{0ex}}\left(\begin{array}{cc}\hfill a& \hfill b\\ \hfill c& \hfill d\end{array}\right)\phantom{\rule{0.3em}{0ex}}\left(\begin{array}{c}\hfill 1\\ \hfill 0\end{array}\right)\phantom{\rule{0.6em}{0ex}}=\phantom{\rule{0.6em}{0ex}}\left(\begin{array}{cc}\hfill a{t}_{1}+c& \hfill b{t}_{1}+d\\ \hfill a& \hfill b\end{array}\right)\phantom{\rule{0.3em}{0ex}}\left(\begin{array}{c}\hfill 1\\ \hfill 0\end{array}\right)\phantom{\rule{0.6em}{0ex}}=\phantom{\rule{0.6em}{0ex}}\left(\begin{array}{c}\hfill a{t}_{1}+c\\ \hfill a\end{array}\right)\text{.}$$ Hence, $$\frac{{p}_{r}}{{q}_{r}}\phantom{\rule{0.6em}{0ex}}=\phantom{\rule{0.6em}{0ex}}\frac{a{t}_{1}+c}{a}\phantom{\rule{0.6em}{0ex}}=\phantom{\rule{0.6em}{0ex}}\left[{t}_{1},\phantom{\rule{0.3em}{0ex}}{t}_{2},\phantom{\rule{0.3em}{0ex}}\dots ,\phantom{\rule{0.3em}{0ex}}{t}_{r}\right]\text{.}$$
Recall that $\left[{n}_{1},{n}_{2},\dots \right]$ is called a continued fraction only when each ${n}_{j}$ is an integer and ${n}_{j}\ge 1$ for $j\ge 2$. The sequence ${n}_{1},{n}_{2},\dots $ may be finite or infinite. The symbol ${c}_{r}\phantom{\rule{0.3em}{0ex}}=\phantom{\rule{0.3em}{0ex}}\phantom{\rule{0.3em}{0ex}}\left[{n}_{1},{n}_{2},\dots ,{n}_{r}\right]$ formed with the first $r$ terms of the sequence, is called the ${r}^{\mathit{th}}$ convergent of the continued fraction. Associated with a given sequence ${n}_{1},{n}_{2},\dots $ are two sequences ${p}_{1},{p}_{2},\dots $ and ${q}_{1},{q}_{2},\dots $ that are given, according to the double recursions (2), (3) of the previous section with ${t}_{j}={n}_{j}$.
Proof. By Corollary 1 of the previous section ${p}_{r}{q}_{r-1}-{q}_{r}{p}_{r-1}={\left(-1\right)}^{r}$. Hence, any positive divisor of both ${p}_{r}$ and ${q}_{r}$ must divide the left-hand side of this relation, and, therefore, must also divide ${\left(-1\right)}^{r}$.
Proof. According to the theorem (formula 10) at the end of the last section the convergent ${c}_{r}$ is given by $${c}_{r}\phantom{\rule{0.6em}{0ex}}=\phantom{\rule{0.6em}{0ex}}\frac{{p}_{r}}{{q}_{r}}\text{.}$$ Hence, $$\begin{array}{cccc}\text{}& \hfill \phantom{\rule{0.6em}{0ex}}{c}_{r}-{c}_{r-1}& \hfill \phantom{\rule{0.6em}{0ex}}=\phantom{\rule{0.6em}{0ex}}\hfill & \frac{{p}_{r}}{{q}_{r}}\phantom{\rule{0.3em}{0ex}}-\phantom{\rule{0.3em}{0ex}}\frac{{p}_{r-1}}{{q}_{r-1}}\hfill \\ \text{}& \hfill \phantom{\rule{0.6em}{0ex}}& \hfill \phantom{\rule{0.6em}{0ex}}=\phantom{\rule{0.6em}{0ex}}\hfill & \frac{{p}_{r}{q}_{r-1}-{p}_{r-1}{q}_{r}}{{q}_{r}{q}_{r-1}}\hfill \\ \text{}& \hfill \phantom{\rule{0.6em}{0ex}}& \hfill \phantom{\rule{0.6em}{0ex}}=\phantom{\rule{0.6em}{0ex}}\hfill & \frac{{\left(-1\right)}^{r}}{{q}_{r}{q}_{r-1}}\phantom{\rule{0.6em}{0ex}}\text{.}\hfill \end{array}$$ (The last step is by Corollary 1 above.)
Proof. This is easily proved by induction from the recursive definition (3) of the sequence.
Proof. As one plots the convergents ${c}_{r}$ on the line of real numbers, one moves alternately right and left. The formula (11) for the difference between successive convergents elucidates not only the fact of alternate right and left movement but also the fact that each successive movement is smaller than the one preceding. Therefore, one has $${c}_{1}<{c}_{3}<{c}_{5}<\dots <{c}_{6}<{c}_{4}<{c}_{2}\text{.}$$ Since any strictly increasing sequence of positive integers must have infinite limit, the seqence ${q}_{j}{q}_{j-1}$ has infinite limit, and so the sequence of reciprocals $1\u2044{q}_{j}{q}_{j-1}$ must converge to zero. Hence, the sequences of odd- and even-indexed convergents must have the same limit, which is the limit of the sequence of all convergents.
Proof. For each $r\ge 1$ the continued fraction expansion $\left[{n}_{1},{n}_{2},\dots \right]$ of $x$ is characterized by the identity $$\begin{array}{cc}\text{(12)}& x=\left[{n}_{1},\phantom{\rule{0.3em}{0ex}}{n}_{2},\phantom{\rule{0.3em}{0ex}}\dots ,\phantom{\rule{0.3em}{0ex}}{n}_{r}+{u}_{r}\right]\phantom{\rule{0.6em}{0ex}},\end{array}$$ where ${u}_{r}$ is a real number with $0\le {u}_{r}<1$. The sequences of $p$'s and $q$'s for the symbol $\left[{n}_{1},{n}_{2},\dots ,{n}_{r}+{u}_{r}\right]$ agree with those for the symbol $\left[{n}_{1},{n}_{2},\dots ,{n}_{r}\right]$ except for the ${r}^{\mathrm{th}}$ terms. One has by (10) $$\left[{n}_{1},\phantom{\rule{0.3em}{0ex}}{n}_{2},\phantom{\rule{0.3em}{0ex}}\dots ,\phantom{\rule{0.3em}{0ex}}{n}_{r}+{u}_{r}\right]\phantom{\rule{0.6em}{0ex}}=\frac{{P}_{r}}{{Q}_{r}}\phantom{\rule{0.6em}{0ex}},$$ where by (3) $$\begin{array}{cccc}\text{}& \hfill \phantom{\rule{0.6em}{0ex}}{q}_{r}& \hfill \phantom{\rule{0.6em}{0ex}}=\phantom{\rule{0.6em}{0ex}}\hfill & {n}_{r}{q}_{r-1}\phantom{\rule{0.3em}{0ex}}+\phantom{\rule{0.3em}{0ex}}{q}_{r-2}\hfill \\ \text{}& \hfill \phantom{\rule{0.6em}{0ex}}{Q}_{r}& \hfill \phantom{\rule{0.6em}{0ex}}=\phantom{\rule{0.6em}{0ex}}\hfill & \left({n}_{r}+{u}_{r}\right){q}_{r-1}\phantom{\rule{0.3em}{0ex}}+\phantom{\rule{0.3em}{0ex}}{q}_{r-2}\hfill \end{array}$$ Hence, $${Q}_{r}\phantom{\rule{0.6em}{0ex}}=\phantom{\rule{0.6em}{0ex}}{q}_{r}\phantom{\rule{0.3em}{0ex}}+\phantom{\rule{0.3em}{0ex}}{u}_{r}{q}_{r-1}\text{.}$$ Therefore, the displacement from ${c}_{r-1}$ to $x$ is by (11) $$\frac{{\left(-1\right)}^{r}}{{Q}_{r}{q}_{r-1}}\phantom{\rule{0.6em}{0ex}}=\phantom{\rule{0.6em}{0ex}}\frac{{\left(-1\right)}^{r}}{\left({q}_{r}{q}_{r-1}+{u}_{r}{{q}_{r-1}}^{2}\right)}\phantom{\rule{0.6em}{0ex}},$$ which is in the same direction but of smaller magnitude than the displacement from ${c}_{r-1}$ to ${c}_{r}$. Therefore, $x$ must be larger than every odd-indexed convergent and smaller than every even-indexed convergent. But since all convergents have the same limit, that limit must be $x$.
It has already been observed that the process of finding the continued fraction expansion of a rational number $a\u2044b$ ($b>0$), involves the same series of long divisions that are used in the application of the Euclidean algorithm to the pair of integers $a$ and $b$. Recall that at each stage in the Euclidean algorithm the divisor for the current stage is the remainder from the previous stage and the dividend for the current stage is the divisor from the previous stage, or, equivalently, the dividend for the current stage is the remainder from the second previous stage. The Euclidean algorithm may thus be viewed as a double recursion that is used to construct the sequence of remainders. One starts the double recursion with $${r}_{-1}=a\text{and}{r}_{0}=b\text{.}$$ At the ${j}^{\mathrm{th}}$ stage one performs long division of ${r}_{j-2}$ by ${r}_{j-1}$ to obtain the integer quotient ${n}_{j}$ and the integer remainder ${r}_{j}$ that satisfies $0\le {r}_{j}<{r}_{j-1}$. Thus, $$\begin{array}{cc}\text{(13)}& {r}_{j}\phantom{\rule{0.6em}{0ex}}=\phantom{\rule{0.6em}{0ex}}{r}_{j-2}-{n}_{j}{r}_{j-1}\phantom{\rule{0.6em}{0ex}}\text{.}\end{array}$$ The Euclidean algorithm admits an additional stage if ${r}_{j}>0$. Since $$0\le {r}_{j}<{r}_{j-1}<\dots <{r}_{2}<{r}_{1}<{r}_{0}=b\phantom{\rule{0.6em}{0ex}},$$ there can be at most $b$ stages.
One may use the sequence of successive quotients ${n}_{j}$ ($j\ge 1$) to form sequences $\left\{{p}_{j}\right\}$ and $\left\{{q}_{j}\right\}$, as in the previous section, according to the double recursions: $$\begin{array}{cc}\text{(14)}& {p}_{j}={n}_{j}{p}_{j-1}+{p}_{j-2}\phantom{\rule{0.3em}{0ex}},\phantom{\rule{0.6em}{0ex}}j\ge 1\phantom{\rule{0.3em}{0ex}};\phantom{\rule{0.6em}{0ex}}\phantom{\rule{0.6em}{0ex}}{p}_{0}=1\phantom{\rule{0.3em}{0ex}},\phantom{\rule{0.6em}{0ex}}\phantom{\rule{0.6em}{0ex}}{p}_{-1}=0\phantom{\rule{0.6em}{0ex}}\text{.}\end{array}$$ $$\begin{array}{cc}\text{(15)}& {q}_{j}={n}_{j}{q}_{j-1}+{q}_{j-2}\phantom{\rule{0.3em}{0ex}},\phantom{\rule{0.6em}{0ex}}j\ge 1\phantom{\rule{0.3em}{0ex}};\phantom{\rule{0.6em}{0ex}}\phantom{\rule{0.6em}{0ex}}{q}_{0}=0\phantom{\rule{0.3em}{0ex}},\phantom{\rule{0.6em}{0ex}}\phantom{\rule{0.6em}{0ex}}{q}_{-1}=1\phantom{\rule{0.6em}{0ex}}\text{.}\end{array}$$ It has already been observed that ${q}_{j}\ge 1$ for $j\ge 1$ and $$\left[{n}_{1},\phantom{\rule{0.3em}{0ex}}{n}_{2},\phantom{\rule{0.3em}{0ex}}\dots ,\phantom{\rule{0.3em}{0ex}}{n}_{j}\right]\phantom{\rule{0.6em}{0ex}}=\phantom{\rule{0.6em}{0ex}}\frac{{p}_{j}}{{q}_{j}}\phantom{\rule{0.3em}{0ex}},\phantom{\rule{0.6em}{0ex}}\phantom{\rule{0.6em}{0ex}}j\ge 1\text{.}$$
Bezout's Identity says not only that the greatest common divisor of $a$ and $b$ is an integer linear combination of them but that the coefficents in that integer linear combination may be taken, up to a sign, as $q$ and $p$.
Proof. One uses induction on $j$. For $j=1$ the statement is ${r}_{1}={q}_{1}a-{p}_{1}b$. Since by (14, 15) ${q}_{1}=1$ and ${p}_{1}={n}_{1}$, this statement is simply the case $j=1$ in (13). Assume $j\ge 2$, and that the formula (16) has been established for indices smaller than $j$. By (13) one has $${r}_{j}\phantom{\rule{0.6em}{0ex}}=\phantom{\rule{0.6em}{0ex}}{r}_{j-2}-{n}_{j}{r}_{j-1}\text{.}$$ In this equation one may use (16) to expand the terms ${r}_{j-2}$ and ${r}_{j-1}$ to obtain: $$\begin{array}{cccc}\text{}& \hfill \phantom{\rule{0.6em}{0ex}}{r}_{j}& \hfill \phantom{\rule{0.6em}{0ex}}=\phantom{\rule{0.6em}{0ex}}\hfill & \left\{{\left(-1\right)}^{j-3}\left({q}_{j-2}a-{p}_{j-2}b\right)\right\}\phantom{\rule{0.3em}{0ex}}-\phantom{\rule{0.3em}{0ex}}{n}_{j}\left\{{\left(-1\right)}^{j-2}\left({q}_{j-1}a-{p}_{j-1}b\right)\right\}\hfill \\ \text{}& \hfill \phantom{\rule{0.6em}{0ex}}& \hfill \phantom{\rule{0.6em}{0ex}}=\phantom{\rule{0.6em}{0ex}}\hfill & \left\{{\left(-1\right)}^{j-1}\left({q}_{j-2}a-{p}_{j-2}b\right)\right\}\phantom{\rule{0.3em}{0ex}}+\phantom{\rule{0.3em}{0ex}}{n}_{j}\left\{{\left(-1\right)}^{j-1}\left({q}_{j-1}a-{p}_{j-1}b\right)\right\}\hfill \\ \text{}& \hfill \phantom{\rule{0.6em}{0ex}}& \hfill \phantom{\rule{0.6em}{0ex}}=\phantom{\rule{0.6em}{0ex}}\hfill & {\left(-1\right)}^{j-1}\left\{\left({q}_{j-2}a-{p}_{j-2}b\right)\phantom{\rule{0.3em}{0ex}}+\phantom{\rule{0.3em}{0ex}}{n}_{j}\left({q}_{j-1}a-{p}_{j-1}b\right)\right\}\hfill \\ \text{}& \hfill \phantom{\rule{0.6em}{0ex}}& \hfill \phantom{\rule{0.6em}{0ex}}=\phantom{\rule{0.6em}{0ex}}\hfill & {\left(-1\right)}^{j-1}\left\{\left({q}_{j-2}+{n}_{j}{q}_{j-1}\right)a-\left({p}_{j-2}+{n}_{j}{p}_{j-1}\right)b\right\}\hfill \\ \text{}& \hfill \phantom{\rule{0.6em}{0ex}}& \hfill \phantom{\rule{0.6em}{0ex}}=\phantom{\rule{0.6em}{0ex}}\hfill & {\left(-1\right)}^{j-1}\left\{{q}_{j}a-{p}_{j}b\right\}\phantom{\rule{0.6em}{0ex}}\text{.}\hfill \end{array}$$
Proof. One knows that $d$ is the last non-zero remainder ${r}_{m-1}$ in the Euclidean algorithm. This formula for $d$ is the case $j=m-1$ in (16).
Proof. The last remainder ${r}_{m}=0$. The case $j=m$ in (16) shows that $a\u2044b={p}_{m}\u2044{q}_{m}$. Since, by the first proposition of the preceding section, ${p}_{m}$ and ${q}_{m}$ have no common factor, this corollary is evident.
If $a$, $b$, $c$, $d$ are real numbers with $ad-bc\ne 0$ and $$M=\left(\begin{array}{cc}\hfill a& \hfill b\\ \hfill c& \hfill d\end{array}\right)$$ is the matrix with entries $a$, $b$, $c$, and $d$, then $M\xb7z$, for $z$ real, will denote the expression $$\begin{array}{cc}\text{(19)}& M\xb7z\phantom{\rule{0.6em}{0ex}}=\phantom{\rule{0.6em}{0ex}}\frac{az\phantom{\rule{0.6em}{0ex}}+\phantom{\rule{0.6em}{0ex}}b}{cz\phantom{\rule{0.6em}{0ex}}+\phantom{\rule{0.6em}{0ex}}d}\text{.}\end{array}$$ One calls $M\xb7z$ the action of $M$ on $z$.
$M\xb7z$ is a perfectly good function of $z$ except for the case $z=-d\u2044c$ where the denominator $cz+d$ vanishes. If it were also true that $az+b=0$ for the same $z$, then one would have $-b\u2044a=-d\u2044c$, in contradiction of the assumption $ad-bc\ne 0$. Thus, when $z=-d\u2044c$, the value of $|M\xb7w|$ increases beyond all bounds as $w$ approaches $z$, and it is convenient to say that $$M\xb7\left(-\frac{d}{c}\right)\phantom{\rule{0.6em}{0ex}}=\phantom{\rule{0.6em}{0ex}}\infty $$ where $\infty $ is regarded as large and signless. If further it is agreed to define $$M\xb7\infty \phantom{\rule{0.6em}{0ex}}=\phantom{\rule{0.6em}{0ex}}\frac{a}{c}\phantom{\rule{0.3em}{0ex}},$$ which is the limiting value of $M\xb7w$ as $\left|w\right|$ increases without bound, then one may regard the expression $M\xb7z$ as being defined always for all real $z$ and for $\infty $. The set consisting of all real numbers and also the object (not a number) $\infty $ is called the projective line. The projective line is therefore the union of the (ordinary) affine line with a single point $\infty $.
Proof. Let $z=\left[{n}_{r+1},\dots \right]$. Then $$\left[{n}_{1},{n}_{2},\dots ,{n}_{r},{n}_{r+1},\dots \right]\phantom{\rule{0.6em}{0ex}}=\phantom{\rule{0.6em}{0ex}}\left[{n}_{1},{n}_{2},\dots ,{n}_{r},z\right]\text{.}$$ The statement of the proposition now becomes $$\left[{n}_{1},{n}_{2},\dots ,{n}_{r},z\right]\phantom{\rule{0.6em}{0ex}}=\phantom{\rule{0.6em}{0ex}}M\xb7z\text{.}$$ This may be seen to follow by multiplying both sides in formula (9), after replacing ${t}_{j}$ with ${n}_{j}$, by the column $$\left(\begin{array}{c}\hfill z\\ \hfill 1\end{array}\right)\text{.}$$
The matrix $M$ in the preceding proposition is an integer matrix with determinant $\pm 1$. The notation ${\mathrm{GL}}_{2}\left(\mathbf{Z}\right)$ denotes the set of all such matrices. (The $2$ indicates the size of the matrices, and the $\mathbf{Z}$ indicates that the entries in such matrices are numbers in the set $\mathbf{Z}$ of integers.) It is easy to check that the product of two members of ${\mathrm{GL}}_{2}\left(\mathbf{Z}\right)$ is a member of ${\mathrm{GL}}_{2}\left(\mathbf{Z}\right)$ and that the matrix inverse of a member of ${\mathrm{GL}}_{2}\left(\mathbf{Z}\right)$ is a member of ${\mathrm{GL}}_{2}\left(\mathbf{Z}\right)$. Thus, ${\mathrm{GL}}_{2}\left(\mathbf{Z}\right)$ forms what is called a group. The formula (19) defines what is called the action of ${\mathrm{GL}}_{2}\left(\mathbf{Z}\right)$ on the projective line.
One says that two points $z$ and $w$ of the projective line are rationally equivalent if there is a matrix $M$ in ${\mathrm{GL}}_{2}\left(\mathbf{Z}\right)$ for which $w=M\xb7z$. Since (i) ${\mathrm{GL}}_{2}\left(\mathbf{Z}\right)$ is a group, (ii) ${M}_{1}\xb7\left({M}_{2}\xb7z\right)=\left({M}_{1}{M}_{2}\right)\xb7z$, and (iii) $w=M\xb7z$ if and only $z={M}^{-1}\xb7w$, it is easy to see that every point of the projective line belongs to one and only one rational equivalence class and that two points rationally equivalent to a third must be rationally equivalent to each other.
In one of the first examples of a continued fraction expansion, it was shown that $\sqrt{10}=\left[3,6,6,6,\dots \right]$. This is an example of a periodic continued fraction. After a finite number of terms the sequence of integers repeats cyclically. If a cyclic pattern is present from the very first term, then the continued fraction is called purely periodic. Evidently, $\left[6,6,6,\dots \right]=\sqrt{10}-3$ is an example of a purely periodic continued fraction.
Note that a periodic continued fraction cannot represent a rational number since the continued fraction expansion of a rational number is finite.
Proof. For clarity: it is being asserted that every periodic continued fraction represent a number of the form $$\frac{a+b\sqrt{m}}{c}$$ where $a$, $b$, $c$, and $m$ are all integers with $m>0$, $c\ne 0$, and $m$ not a perfect square.
Numbers of this form with fixed $m$ but varying integers $a$, $b$, and $c\ne 0$ may be added, subtracted, multiplied, and divided without leaving the class of such numbers. (The statement here about division becomes clear if one remembers always to rationalize denominators.) Consequently, for $M$ in ${\mathrm{GL}}_{2}\left(\mathbf{Z}\right)$ the number $M\xb7z$ will be a number of this form or $\infty $ if and only if $z$ is in the same class.
Since a periodic continued fraction is rationally equivalent to a purely periodic continued fraction, the question of whether any periodic continued fraction is a quadratic irrationality reduces to the question of whether a purely periodic continued fraction is such. Let $$x\phantom{\rule{0.6em}{0ex}}=\phantom{\rule{0.6em}{0ex}}\left[{n}_{1},\dots ,{n}_{r},{n}_{1},\dots ,{n}_{r},{n}_{1},\dots ,{n}_{r},\dots \right]$$ be a purely periodic continued fraction. By the proposition of the preceding section, $x=M\xb7x$ where $M$ is notationally identical to the $M$ in (20). Ignoring the computation (9) of $M$ in terms of convergents, let $$M\phantom{\rule{0.6em}{0ex}}=\phantom{\rule{0.6em}{0ex}}\left(\begin{array}{cc}\hfill a& \hfill b\\ \hfill c& \hfill d\end{array}\right)\text{.}$$ Then $$x\phantom{\rule{0.6em}{0ex}}=\frac{ax+b}{cx+d}\phantom{\rule{0.6em}{0ex}},$$ or, otherwise said, $x$ is a solution of the quadratic equation $$c{x}^{2}\phantom{\rule{0.3em}{0ex}}-\left(a-d\right)x-b\phantom{\rule{0.6em}{0ex}}=\phantom{\rule{0.6em}{0ex}}0\text{.}$$
This converse will not be proved here.