2.2. Convergents
Next, we define the “workhorses” of the theory of continued fractions.
Definition 2. $\left[{a}_{0};{a}_{1},\dots ,{a}_{m}\right]$ is called m-th convergent of the continued fraction $\left[{a}_{0};{a}_{1},\dots ,{a}_{N}\right]$ for 0 ≤ m ≤ N, or m-th convergent of the infinite regular continued fraction $\left[{a}_{0};{a}_{1},\dots \right]$.
Convergents can be computed recursively based on the following theorem:
Theorem 1. (Recursion Theorem)
Define:
and define:
Then, for every convergent
$\left[{a}_{0};{a}_{1},\dots ,{a}_{n}\right]$, it is: Proof (by induction). Let n = 0, 1: Then, $\left[{\mathrm{a}}_{0}\right]={\mathrm{a}}_{0}=\frac{{\mathrm{p}}_{0}}{{\mathrm{q}}_{0}}$ and $\left[{\mathrm{a}}_{0};{\mathrm{a}}_{1}\right]={\mathrm{a}}_{0}+\frac{1}{{\mathrm{a}}_{1}}=\frac{{\mathrm{a}}_{0}{\mathrm{a}}_{1}+1}{{\mathrm{a}}_{1}}=\frac{{\mathrm{p}}_{1}}{{\mathrm{q}}_{1}}$.
Induction hypothesis: $\left[{a}_{0};{a}_{1},\dots ,{a}_{n}\right]=\frac{{p}_{n}}{{q}_{n}}=\frac{{a}_{n}{p}_{n-1}+{p}_{n-2}}{{a}_{n}{q}_{n-1}+{q}_{n-2}}$.
Induction step n → n + 1: According to Note 1, it is
and the last continued fraction has n elements, i.e., the induction hypothesis applies:
Here, (A) is valid because of the induction hypothesis, and (B) is the definition of ${p}_{n+1}$ and ${q}_{n+1}$. □
The recursion theorem implies the often used.
Corollary 1. Numerators and denominators of convergents of a continued fraction
$\left[{a}_{0};{a}_{1},\dots ,{a}_{N}\right]$ with
${a}_{0}\ge 0$ are strictly monotonically increasing:
Proof (by induction). Let n = 1: By definition, ${p}_{0}={a}_{0}$, ${p}_{1}={a}_{1}{a}_{0}+1$. Because ${a}_{i}\ge 1$ for i ≥ 1, and ${a}_{0}\ge 0$, it is ${p}_{1}>{p}_{0}\ge 0$. Similarly, ${q}_{1}>{q}_{0}>0$
Now, ${p}_{n}={a}_{n}{p}_{n-1}+{p}_{n-2}$ and ${q}_{n}={a}_{n}{q}_{n-1}+{q}_{n-2}$ for n ≥ 2. With ${a}_{n}\ge 1$ by definition, and ${p}_{n-1}>{p}_{n-2}$ (≥1) as well as ${q}_{n-1}>{q}_{n-2}$ (≥1) by induction hypothesis, the claim follows. □
The next theorem is about the sign of a combination of the numerators and denominators of consecutive convergents of a continued fraction.
Theorem 2. (Sign Theorem)
For $\left[{a}_{0};{a}_{1},\dots ,{a}_{n}\right]=\frac{{p}_{n}}{{q}_{n}}$,
the following holds: Proof (by induction). Induction step n → n + 1:
(A) uses the induction hypothesis. □
In case the numerators and denominators stem from the n-th convergent and the (n − 2)-nd convergent, the last n-th element of the convergent becomes part of the equation.
Theorem 3. (Second Sign Theorem)
For $\left[{a}_{0};{a}_{1},\dots ,{a}_{n}\right]=\frac{{p}_{n}}{{q}_{n}}$,
the following holds: Proof. It is ${\mathrm{p}}_{\mathrm{n}}={\mathrm{a}}_{\mathrm{n}}{\mathrm{p}}_{\mathrm{n}-1}+{\mathrm{p}}_{\mathrm{n}-2}$ and ${\mathrm{q}}_{\mathrm{n}}={\mathrm{a}}_{\mathrm{n}}{\mathrm{q}}_{\mathrm{n}-1}+{\mathrm{q}}_{\mathrm{n}-2}$.
Multiplying the first equation by
${q}_{n-2}$ and the second equation by
${p}_{n-2}$ results in
${q}_{n-2}{p}_{n}={q}_{n-2}{a}_{n}{p}_{n-1}+{q}_{n-2}{p}_{n-2}$ and
${p}_{n-2}{q}_{n}={p}_{n-2}{a}_{n}{q}_{n-1}+{p}_{n-2}{q}_{n-2}$. Next, both equations are subtracted:
where (A) is implied by the sign theorem (Theorem 2) and considering
${(-1)}^{n-2}={(-1)}^{n}$. □
The sign theorem immediately yields the important.
Corollary 2. Numerator and denominator of a convergent are co-prime.
Proof. Let t be a divisor of ${\mathrm{p}}_{\mathrm{n}}$ and ${\mathrm{q}}_{\mathrm{n}}$, i.e., $t|{p}_{n}$ and $t|{q}_{n}$. Then, $t|\left({p}_{n}{q}_{n-1}-{p}_{n-1}{q}_{n}\right)$, but $\left({p}_{n}{q}_{n-1}-{p}_{n-1}{q}_{n}\right)={\left(-1\right)}^{n-1}$ according to the sign theorem. Thus, t = ±1. □
Convergents can be represented as a sum of fractions with alternating sign and whose denominators consist of products of two consecutive denominators from the recursion theorem.
Theorem 4. (Representation as a Sum)
Each convergent can be represented as a sum: Proof. Let
$\left[{\mathrm{a}}_{0};{\mathrm{a}}_{1},\dots ,{\mathrm{a}}_{\mathrm{n}}\right]=\frac{{\mathrm{p}}_{\mathrm{n}}}{{\mathrm{q}}_{\mathrm{n}}}$. Since
$-\frac{{p}_{i}}{{q}_{i}}+\frac{{p}_{i}}{{q}_{i}}=0$, we can write
Computing the differences results in
where the sign theorem is applied in (
A) and the last term
${a}_{0}={p}_{0}/{q}_{0}$ is the recursion theorem. □
The next theorem is key for many estimations in the domain of continued fractions.
Theorem 5. (Monotony Theorem)
Let ${x}_{n}\stackrel{\underset{def}{}}{=}\frac{{p}_{n}}{{q}_{n}}=\left[{a}_{0};{a}_{1},\dots ,{a}_{n}\right]$ denote the n-th convergent. Then:and I.e., even convergents are strictly monotonically increasing, and odd convergents are strictly monotonically decreasing.
Proof. We compute the following difference, where (
A) again uses
$-\frac{{p}_{i}}{{q}_{i}}+\frac{{p}_{i}}{{q}_{i}}=0$:
(B) is because of the sign theorem, and (C) follows from ${q}_{n}={a}_{n}{q}_{n-1}+{q}_{n-2}$, i.e., the recursion theorem.
Now, because of ${a}_{n},{q}_{n},{q}_{n-2}>0$, it is $\frac{{a}_{n}}{{q}_{n}{q}_{n-2}}>0$. Thus, $\frac{{(-1)}^{n}{a}_{n}}{{q}_{n}{q}_{n-2}}>0$ for n even and $\frac{{(-1)}^{n}{a}_{n}}{{q}_{n}{q}_{n-2}}<0$ for n odd. This implies ${x}_{n}=\frac{{(-1)}^{n}{a}_{n}}{{q}_{n}{q}_{n-2}}+{x}_{n-2}>{x}_{n-2}$ for n even as well as ${x}_{n}=\frac{{(-1)}^{n}{a}_{n}}{{q}_{n}{q}_{n-2}}+{x}_{n-2}<{x}_{n-2}$ for n odd. □
While even convergents are increasing and odd convergence are decreasing, all even convergents are smaller than all odd convergents. This is the content of the next very important theorem.
Theorem 6. (Convergents Comparison Theorem)
For $0\le 2n,2m+1\le N$, it is ${x}_{2n}<{x}_{2m+1}$
Proof. As before, using the sign theorem in
(A), we obtain
with
${\beta}_{n}:={q}_{n}{q}_{n-1}$. Because
${q}_{n},{q}_{n-1}>0$, it is β
_{n} > 0, i.e., the sign of
$\frac{{(-1)}^{n-1}}{{\beta}_{n}}$ is in fact
${(-1)}^{n-1}$.
Thus, ${x}_{2n+1}-{x}_{2n}=\frac{{(-1)}^{2n}}{{\beta}_{2n+1}}>0$, and we get ${x}_{2n+1}=\frac{{(-1)}^{2n}}{{\beta}_{2n+1}}+{x}_{2n}>{x}_{2n}$. This shows that an even convergent ${x}_{2n}$ is strictly smaller than its immediate succeeding odd convergent ${x}_{2n+1}$.
But what about an arbitrary odd convergent ${x}_{2m+1}$? For n < m, the monotony theorem (Theorem 6) yields ${x}_{2n}<{x}_{2m}$ and we showed before that ${x}_{2m}<{x}_{2m+1}$; thus, ${x}_{2n}<{x}_{2m+1}$.
For n > m, the monotony theorem yields ${x}_{2m+1}>{x}_{2n+1}$ and with ${x}_{2n+1}>{x}_{2n}$ we see ${x}_{2n}<{x}_{2m+1}$. □
The following often-used corollary computes the difference of two immediately succeeding convergents by mean of the denominators of the convergents, while the difference of the n-th convergent and the (n − 2)-nd convergent adds the n-th element of the n-th convergent as a factor.
Proof. Equation (10) is the first equation from the proof of Theorem 6. The second equation follows because of
where
(A) is because of the second sign theorem (Theorem 3). □
We already saw that the even convergents are strictly monotonically increasing, that the odd convergents are strictly monotonically decreasing, and that each even convergent is less than all odd convergents. According to the next theorem, the value of a continued fraction lies between the even convergents and the odd convergents, i.e., this value is larger than all even convergents and smaller than all odd convergents. The situation is depicted in
Figure 4.
Note that the notion of the value of a continued fraction is defined for finite continued fractions. In
Section 4, this notion will also be defined for regular infinite continued fractions.
Theorem 7. (Nesting Theorem)
Let x be the value of the continued fraction $\left[{a}_{0};{a}_{1},\dots ,{a}_{N}\right]$ and let ${x}_{k}$ be its convergents. Then: Proof. The value of x is the convergent with the highest index N, i.e., $x={x}_{N}=\left[{a}_{0};{a}_{1},\dots ,{a}_{N}\right]$.
Let N = 2k be even. Since even convergents are strictly monotonically increasing, we know that $\forall 2m<N:{x}_{2m}<{x}_{2k}={x}_{N}=x$, and according to the convergent comparison theorem (Theorem 6), we know $\forall 2n+1:x={x}_{N}={x}_{2k}<{x}_{2n+1}$.
Let N = 2k + 1 be odd. Since odd convergents are strictly monotonically decreasing, we know that $\forall 2n+1<N:{x}_{2n+1}>{x}_{2k+1}={x}_{N}=x$, and according to the convergent comparison theorem (Theorem 6), we know $\forall 2m:x={x}_{N}={x}_{2k+1}>{x}_{2m}$. □
Because the value of a continued fraction is nested within its even convergents and odd convergents, the distance of this value from any of its convergents can be estimated by the distance of two consecutive convergents:
Theorem 8. (Distance Theorem)
Let $x=\left[{a}_{0};{a}_{1},\dots ,{a}_{N}\right]$ and let ${x}_{k}$ be its convergents. Then:and Proof. Let n be even. Then, ${x}_{n}<x<{x}_{n-1}$, i.e., $x-{x}_{n}<{x}_{n-1}-{x}_{n}$. Additionally, it is $x-{x}_{n}>0$ and ${x}_{n-1}-{x}_{n}>0$. Thus, $\left|x-{x}_{n}\right|<\left|{x}_{n-1}-{x}_{n}\right|$ for n even.
Now, let n be odd. It is ${x}_{n-1}<x<{x}_{n}$, which implies $x-{x}_{n}>{x}_{n-1}-{x}_{n}\iff -\left({x}_{n}-x\right)>-\left({x}_{n}-{x}_{n-1}\right)$ $\iff {x}_{n}-x<{x}_{n}-{x}_{n-1}$. Because of ${x}_{n}-x>0$ and ${x}_{n}-{x}_{n-1}>0$, it is $\left|{x}_{n}-x\right|<\left|{x}_{n}-{x}_{n-1}\right|$ ⇔ $\left|x-{x}_{n}\right|<\left|{x}_{n-1}-{x}_{n}\right|$ for n odd.
Together, this proves Equation (13). Equation (14) is proven similarly. □
Figure 5 shows the corresponding geometric situation for an even n.
Similarly, the difference between any two arbitrary convergents can be estimated by the difference of the convergent with the smaller index and its immediate predecessor:
Theorem 9. (Difference Theorem)
Let $x=\left[{a}_{0};{a}_{1},\dots ,{a}_{N}\right]$ and let ${x}_{k}$ be its convergents. Then: Proof. Let n be even, e.g., n = 2k.
Let m = 2t be even. By Theorem 6, even convergents are smaller than all odd convergents, i.e., ${x}_{2t}<{x}_{2k-1}$ for any $t\in \mathbb{N}$. Thus, ${x}_{m}-{x}_{n}={x}_{2t}-{x}_{2k}<<{x}_{2k-1}-{x}_{2k}={x}_{n-1}-{x}_{n}$.
Let m = 2t − 1 be odd. By the monotony theorem (Theorem 5), odd convergents are strictly monotonically decreasing, i.e., ${x}_{2t-1}<{x}_{2k-1}$ for each t > k. Thus, ${x}_{m}-{x}_{n}={x}_{2t-1}-{x}_{2k}<{x}_{2k-1}-{x}_{2k}={x}_{n-1}-{x}_{n}$.
For n odd, the proof is analogous. □
The geometry of the last theorem is depicted in
Figure 6.
In several calculations, the size of the denominator of a convergent must be estimated:
Lemma 1. (Size of Denominators)
For the denominator
${q}_{n}$ of a convergent
$\frac{{p}_{n}}{{q}_{n}}=\left[{a}_{0};{a}_{1},\dots ,{a}_{n}\right]$, the following holds:
and
Proof. By definition,
${q}_{0}=1>0$, and
${q}_{1}={a}_{1}\ge 1$ because
${a}_{i}\in \mathbb{N}$, and finally,
(A) holds because of the recursion theorem (Theorem 1), (B) is by definition of ${q}_{0}$, (C) is because ${a}_{2}\in \mathbb{N}$, and (D) has been seen just before (i.e., ${q}_{1}\ge 1$). This proves the lemma for $n\le 2$.
The proof for n ≥ 3 is by induction. It is
where
(A) is the recursion theorem,
(B) is because of
${a}_{n}\in \mathbb{N}$,
(C) is by induction hypothesis applied to
${q}_{n-2}$,
(D) is because n ≥ 3, and
(E) is by induction hypothesis applied to
${q}_{n-1}$. This proves Equation (16).
Equation (17) is proven by induction again. Let n > 3. The argumentation is exactly as before, with the exception of
(D):
(D) holds because n > 3, i.e., $n-2>1$. □
In fact, denominators of a convergent grow much faster than the inequation ${q}_{n}>n$ may indicate:
Lemma 2. (Geometric Growth of Denominators)
Let ${q}_{n}$ (
$n\ge 2$)
be the denominator of the convergent $\frac{{p}_{n}}{{q}_{n}}=\left[{a}_{0};{a}_{1},\dots ,{a}_{n}\right]$.
Then: Proof. It is ${\mathrm{q}}_{\mathrm{k}}={\mathrm{a}}_{\mathrm{k}}{\mathrm{q}}_{\mathrm{k}-1}+{\mathrm{q}}_{\mathrm{k}-2}>{\mathrm{q}}_{\mathrm{k}-1}+{\mathrm{q}}_{\mathrm{k}-2}\stackrel{\left(\mathrm{A}\right)}{>}2{\mathrm{q}}_{\mathrm{k}-2}$, with (A) because, according to corollary 1, denominators are strictly monotonically increasing, i.e., ${q}_{k-1}>{q}_{k-2}$.
By induction, it is
${q}_{2k}\ge {2}^{k}{q}_{0}$, and then
${2}^{k}{q}_{0}\stackrel{\left(A\right)}{=}{2}^{k}\stackrel{\left(B\right)}{\ge}{2}^{\frac{\left(2k\right)-1}{2}}$ with
(A) because
${q}_{0}=1$, and
(B) follows from
Similarly, by induction, it is ${q}_{2k+1}\ge {2}^{k}{q}_{1}$ and then ${2}^{k}{q}_{1}\stackrel{\left(A\right)}{\ge}{2}^{k}={2}^{\frac{\left(2k+1\right)-1}{2}}$ with (A) because of ${q}_{1}\in \mathbb{N}$.
With $n=2k$ and $n=2k+1$, respectively, Equation (18) is implied. □
2.4. Bounds Expressed by Denominators of Convergents
In the following, we give upper bounds and lower bounds of the approximations of a number by the convergents of its continued fraction representation by means of the denominators of the convergents.
First, we start with estimations of upper bounds:
Lemma 3. (Upper Bounds)
Let
${p}_{n}/{q}_{n}$ be a convergent of the continued fraction representation of x. Then:
Proof. With
${x}_{n}={p}_{n}/{q}_{n}$, it is
$\left|x-{x}_{n}\right|<\left|{x}_{n+1}-{x}_{n}\right|$ (see Theorem 8, Equation (14)). According to Corollary 3 (Equation (10)), it is
Thus,
where (
A) holds because of
${q}_{n+1}>{q}_{n}$ (Corollary 1), and (
B) is true because of
${q}_{n}\ge n$ (Lemma 1). □
An immediate consequence of this theorem is the convergence of the sequence of the convergents of a continued fraction to the value of the continued fraction. This, by the way, is the origin of the name “convergents”.
Corollary 4. The series
$\left({p}_{n}/{q}_{n}\right)$ of the convergents of the continued fraction representation of
$x\in \mathbb{R}\setminus \mathbb{Q}$ converges to x:
Proof. The claim follows immediately from $\left|x-\frac{{p}_{n}}{{q}_{n}}\right|<\frac{1}{{n}^{2}}$. □
Often, two fractions are compared by means of their mediant (“mediant” means “somewhere in between”).
Definition 3. For $\mathrm{a}/\mathrm{b},\mathrm{c}/\mathrm{d}\in \mathbb{Q}$ and b, d > 0, the term $\frac{\mathrm{a}+\mathrm{c}}{\mathrm{b}+\mathrm{d}}$ is called the mediant of the two fractions.
The following simple inequation is often used.
Note 3. (Mediant Property)
Let $a/b,c/d\in \mathbb{Q}$ and b, d > 0 and $\frac{a}{b}<\frac{c}{d}$.
Proof. It is $\frac{a}{b}<\frac{c}{d}\Rightarrow ad<bc\Rightarrow bc-ad>0$ and $b,d>0\Rightarrow b\left(b+d\right)>0$. This implies $\frac{a+c}{b+d}-\frac{a}{b}=\frac{b\left(a+c\right)-a\left(b+d\right)}{b\left(b+d\right)}=\frac{bc-ad}{b\left(b+d\right)}>0$ and thus $\frac{a}{b}<\frac{a+c}{b+d}$. The inequation $\frac{a+c}{b+d}<\frac{c}{d}$ follows similarly. □
Mediants of convergents that are weighted in a certain way are another important concept for computing bounds:
Definition 4. The term ${x}_{n,t}=\frac{t{p}_{n+1}+{p}_{n}}{t{q}_{n+1}+{q}_{n}}$ with $1\le t\le {a}_{n+2}$ is called the (n,t)-th semiconvergent.
Semiconvergents of an even n are strictly monotonically increasing, and semiconvergents of an odd n are strictly monotonically decreasing. This is the content of the following lemma.
Lemma 4. (Monotony of Semiconvergents)
Let n be even. Then, ${x}_{n,t}<{x}_{n,t+1}$.
Let n be odd. Then, ${x}_{n,t}>{x}_{n,t+1}$.
Proof. A simple calculation and the use of the sign theorem (Theorem 2) results in
The denominator of the last fraction is always positive. Thus, the last term is positive iff n is even (i.e., ${x}_{n,t+1}-{x}_{n,t}>0$), and it is negative iff n is odd (i.e., ${x}_{n,t+1}-{x}_{n,t}<0$). □
In order to simplify proofs in what follows, the following conventions are used:
With this, ${x}_{-1,1}=\frac{{p}_{0}+{p}_{-1}}{{q}_{0}+{q}_{-1}}=\frac{{a}_{0}+1}{1+0}={a}_{0}+1$ becomes a semiconvergent. Now, ${x}_{1}=\frac{{p}_{1}}{{q}_{1}}\stackrel{\left(A\right)}{=}\frac{{a}_{1}{a}_{0}+1}{{a}_{1}}={a}_{0}+\frac{1}{{a}_{1}}\stackrel{\left(B\right)}{\le}{a}_{0}+1={x}_{-1,1}$ where (A) is the recursion theorem and (B) follows because ${a}_{1}\ge 1$; thus, ${x}_{1}\le {x}_{-1,1}$.
Furthermore, it is ${x}_{-1,t}=\frac{t{p}_{0}+{p}_{-1}}{t{q}_{0}+{q}_{-1}}=\frac{t{a}_{0}+1}{t\cdot 1+0}=\frac{t{a}_{0}+1}{t}={a}_{0}+\frac{1}{t}$ for $1\le t\le {a}_{1}$.
Putting things together, it is
Based on this, we can refine
Figure 4, which depicts the nesting and ordering of convergents by including semiconvergents: Between two succeeding convergents (e.g.,
${x}_{n}$ and
${x}_{n+2}$ in
Figure 8, the corresponding semiconvergents ordered according to Lemma 4 are nested (in increasing order as shown for an even n in
Figure 8). Furthermore, beyond
${x}_{1}={a}_{0}+\frac{1}{{a}_{1}}$, the semiconvergents
${x}_{-1,t}$ are added.
Now, we are prepared to prove a lower bound of the approximation of a number by the convergents of its continued fraction representation by means of the denominators of the convergents.
Lemma 5. (Lower Bounds)
Let
${p}_{n}/{q}_{n}$ be a convergent of the continued fraction representation of x. Then:
Proof. The proof is based on the following claims:
Claim 1.
n even ⇒ $\frac{{p}_{n}}{{q}_{n}}<\frac{{p}_{n+1}+{p}_{n}}{{q}_{n+1}+{q}_{n}}<x<\frac{{p}_{n+1}}{{q}_{n+1}}$.
Proof. $\frac{{p}_{n+1}+{p}_{n}}{{q}_{n+1}+{q}_{n}}$ is the mediant of
$\frac{{p}_{n+1}}{{q}_{n+1}}$ and
$\frac{{p}_{n}}{{q}_{n}}$. Thus, the mediant property (Note 3) shows that
$\frac{{p}_{n}}{{q}_{n}}<\frac{{p}_{n+1}+{p}_{n}}{{q}_{n+1}+{q}_{n}}<\frac{{p}_{n+1}}{{q}_{n+1}}$. Then:
where (
A) follows by the monotony of even semiconvergents (Lemma 4), and (
B) is the recursion theorem. Because of Theorem 7 (note that n + 2 is even and n + 1 is odd), it is
$\frac{{p}_{n+2}}{{q}_{n+2}}<x<\frac{{p}_{n+1}}{{q}_{n+1}}$. This proves Claim 1.
${\square}_{\left(claim1\right)}$ Claim 2. n odd ⇒ $\frac{{p}_{n-1}}{{q}_{n-1}}<x<\frac{{p}_{n+1}+{p}_{n}}{{q}_{n+1}+{q}_{n}}<\frac{{p}_{n}}{{q}_{n}}$.
Proof. As before,
$\frac{{p}_{n+1}+{p}_{n}}{{q}_{n+1}+{q}_{n}}$ is the mediant of
$\frac{{p}_{n+1}}{{q}_{n+1}}$ and
$\frac{{p}_{n}}{{q}_{n}}$. Because n is odd, it is
$\frac{{p}_{n+1}}{{q}_{n+1}}<\frac{{p}_{n}}{{q}_{n}}$ (Theorem 7). Thus,
$\frac{{p}_{n+1}}{{q}_{n+1}}<\frac{{p}_{n+1}+{p}_{n}}{{q}_{n+1}+{q}_{n}}<\frac{{p}_{n}}{{q}_{n}}$ because of the mediant property (Note 3). Then:
where (
A) follows by the monotony of odd semiconvergents (Lemma 4), and (
B) is the recursion theorem. Because of Theorem 7 (note that n − 1 is even and n + 2 is odd), it is
$\frac{{p}_{n-1}}{{q}_{n-1}}<x<\frac{{p}_{n+2}}{{q}_{n+2}}$, and because n is odd, it is
$\frac{{p}_{n+2}}{{q}_{n+2}}<\frac{{p}_{n}}{{q}_{n}}$. This proves Claim 2.
${\square}_{\left(claim2\right)}$ With Claim 1, for even n, it is $\frac{{p}_{n}}{{q}_{n}}<\frac{{p}_{n+1}+{p}_{n}}{{q}_{n+1}+{q}_{n}}<x$ ⇒ $x-\frac{{p}_{n}}{{q}_{n}}>\frac{{p}_{n}+{p}_{n+1}}{{q}_{n}+{q}_{n+1}}-\frac{{p}_{n}}{{q}_{n}}$.
With Claim 2, for n odd, it is $x<\frac{{p}_{n+1}+{p}_{n}}{{q}_{n+1}+{q}_{n}}<\frac{{p}_{n}}{{q}_{n}}$ ⇒ $\frac{{p}_{n}}{{q}_{n}}-x>\frac{{p}_{n}}{{q}_{n}}-\frac{{p}_{n}+{p}_{n+1}}{{q}_{n}+{q}_{n+1}}$ ⇔ $-\left(x-\frac{{p}_{n}}{{q}_{n}}\right)>-\left(\frac{{p}_{n}+{p}_{n+1}}{{q}_{n}+{q}_{n+1}}-\frac{{p}_{n}}{{q}_{n}}\right)$.
Thus, for any k ∈ ℕ:
$\left|x-\frac{{p}_{k}}{{q}_{k}}\right|\left|\frac{{p}_{k+1}+{p}_{k}}{{q}_{k+1}+{q}_{k}}-\frac{{p}_{k}}{{q}_{k}}\right|$. Next, we compute
where (
A) is the sign theorem (Theorem 2).
This implies $\left|x-\frac{{p}_{k}}{{q}_{k}}\right|>\left|\frac{{\left(-1\right)}^{k}}{\left({q}_{k}+{q}_{k+1}\right){q}_{k}}\right|=\frac{1}{\left({q}_{k}+{q}_{k+1}\right){q}_{k}}$. □
Because of
${q}_{k+1}>{q}_{k}$ (Corollary 1), it is
Using the last inequality in Lemma 5 (Lower Bounds) and using Lemma 3 (Upper Bounds), we obtain the concluding theorem of this section:
In summary, we have proved the following:
Theorem 10. (Bounds of Approximations by Convergents)
Let${p}_{k}/{q}_{k}$ be a convergent of the continued fraction representation of x. Then: □
2.5. Best Approximations
Our goal is to approximate a real number by a rational number as good as possible while keeping the denominator of the rational number “small”. Keeping the denominator small is important because in practice, every real number can only be given up to a certain degree of precision, and this is achieved by means of a huge denominator and corresponding numerator. i.e., approximating a real number by a rational number with a huge denominator is canonical, but finding a small denominator is a problem.
This is captured by the following:
Definition 5. A fraction $p/q\in \mathbb{Q}$ is called a best approximation (of the first kind) of $\alpha \in \mathbb{R}$:⇔ $\forall c/d\in \mathbb{Q}:d\le q\Rightarrow \left|\alpha -\frac{c}{d}\right|>\left|\alpha -\frac{p}{q}\right|$ (assuming c/d ≠ p/q).
Often, the addition “of the first kind” is omitted. By definition, a best approximation of a real number can only be improved if the denominator of the given approximation is increased.
If p/q is a best approximation of α, then $\left|\alpha -\frac{p}{q}\right|=\frac{1}{q}\left|q\alpha -p\right|$ is small and, thus, $\left|q\alpha -p\right|$ is small. Measuring the goodness of an approximation this way results in the following:
Definition 6. A fraction $p/q\in \mathbb{Q}$ is called a best approximation of the second kind of $\alpha \in \mathbb{R}$:⇔ $\forall c/d\in \mathbb{Q}:d\le q\Rightarrow \left|d\alpha -c\right|>\left|q\alpha -p\right|$ (assuming c/d ≠ p/q).
The question is whether every best approximation is also a best approximation of the second kind. Now, 1/3 is a best approximation of 1/5 because the only possible fractions for c/d, with d ≤ 3 = q, are 0, 1/2, 2/3, and 1, and these numbers satisfy $\left|\frac{1}{5}-\frac{c}{d}\right|>\left|\frac{1}{5}-\frac{1}{3}\right|$.
Next, we observe that $\left|1\cdot \frac{1}{5}-0\right|<\left|3\cdot \frac{1}{5}-1\right|$ with 1 < 3. Thus, with $d=1$ and $q=3$ (i.e., $d<q$) and $\alpha =1/5$, we found a fraction $c/d=0/1$ with $\left|d\alpha -c\right|<\left|q\alpha -p\right|$! As a consequence, although 1/3 is a best approximation of the first kind of 1/5, it is not a best approximation of the second kind.
Thus, not all best approximations of the first kind are best approximations of the second kind. But the reverse holds true:
Lemma 6. (Every 2nd Kind Best Approximation is a 1st Kind Best Approximation)
If $p/q\in \mathbb{Q}$ is a best approximation of the second kind of $\alpha \in \mathbb{R}$, then $p/q$ is also a best approximation of the first kind of α.
Proof (by contradiction). Assume p/q is not a best approximation of the first kind. Then, $\left|\alpha -\frac{c}{d}\right|\le \left|\alpha -\frac{p}{q}\right|$ for a fraction c/d with d < q. Multiplying both inequations results in $d\left|\alpha -\frac{c}{d}\right|\le q\left|\alpha -\frac{p}{q}\right|$ ⇔ $\left|d\alpha -c\right|\le \left|q\alpha -p\right|$, which is a contradiction because p/q is a best approximation of the second kind. □
The next simple estimation about the distance of two fractions by means of the product of their denominators is often used.
Note 4. (Distance of Fractions)
Let
$\frac{a}{b},\frac{p}{q}\in \mathbb{Q}$ with
$\frac{a}{b}\ne \frac{p}{q}$. Then:
Proof. With
$a,p\in \mathbb{Z}$ and
$b,q\in \mathbb{N}$, it is
$pb-aq\in \mathbb{Z}$. Also,
$pb-aq\ne 0$ because otherwise
$pb=aq\iff \frac{p}{q}=\frac{a}{b}$ which contradicts the premise. Thus,
$\left|pb-aq\right|\in \mathbb{N}$, i.e.,
$\left|pb-aq\right|\ge 1$. This implies
where
$\left|qb\right|=qb$ because
$b,q\in \mathbb{N}$. □
Next, we prove that every best approximation of the second kind is a convergent.
Theorem 11. (2nd Kind Best Approximations are Convergents)
Let $a/b$ be a best approximation of the second kind of $x\in \mathbb{R}$, and let $x=\left[{a}_{0};{a}_{1},\cdots \right]$ be the continued fraction representation of x.
Then $a/b$ is a convergent of x.
Proof. Being a best approximation of the second kind of x, $a/b$ satisfies, by definition, $\left|dx-c\right|>\left|bx-a\right|$ for d ≤ b.
Claim 1. $\frac{a}{b}\ge {a}_{0}={x}_{0}$.
Proof (by contradiction). Assume $\frac{a}{b}<{a}_{0}\Rightarrow -{a}_{0}<-\frac{a}{b}\Rightarrow x-{a}_{0}<x-\frac{a}{b}$; thus, $\left|x-{a}_{0}\right|<\left|x-\frac{a}{b}\right|\stackrel{\left(A\right)}{\le}b\left|x-\frac{a}{b}\right|=\left|bx-a\right|$, where (A) holds because $b\in \mathbb{N}$, i.e., 1 ≤ b. This implies $\left|1\cdot x-{a}_{0}\right|\le \left|bx-a\right|$, which contradicts $\left|dx-c\right|>\left|bx-a\right|$ for d ≤ b (with $d=1\le b$ and $c={a}_{0}$). This means that $\frac{a}{b}\ge {a}_{0}=\frac{{a}_{0}}{1}\stackrel{\left(B\right)}{=}\frac{{q}_{0}}{{q}_{0}}={x}_{0}$, (B) is because of the recursion theorem. ${\square}_{\left(claim1\right)}$
Thus, the geometric situation is as depicted in
Figure 9, i.e.,
$a/b$ is in the grey shaded area being greater than or equal to the convergent
${x}_{0}$. This will be refined in what follows.
Next, we proceed with a proof by contradiction assuming that $a/b$ is not a convergent of x.
Assumption. $\frac{a}{b}\ne \frac{{q}_{k}}{{q}_{k}}={x}_{k}$ for $k\in \mathbb{N}$.
According to Claim 1,
$\frac{a}{b}\ge {a}_{0}={x}_{0}$. Thus, one of the following must hold:
or
Case (1). If (i) is true, then
where (Th8) is Theorem 8, Equation (14), and (
C) is from Corollary 3, Equation (10). Furthermore,
$\left|\frac{a}{b}-\frac{{p}_{k-1}}{{q}_{k-1}}\right|\stackrel{\left(D\right)}{\ge}\frac{1}{b{q}_{k-1}}$, with (
D) because of Note 4 (Distance of Fractions).
Together, $\frac{1}{b{q}_{k-1}}\le \left|\frac{a}{b}-\frac{{p}_{k-1}}{{q}_{k-1}}\right|<\frac{1}{{q}_{k}{q}_{k-1}}$ ⇒ $\frac{1}{b}<\frac{1}{{q}_{k}}$ ⇒ $b>{q}_{k}$ (iii).
Also, if (i) is true, then $\left|x-\frac{a}{b}\right|\ge \left|\frac{{p}_{k+1}}{{q}_{k+1}}-\frac{a}{b}\right|\stackrel{\left(E\right)}{\ge}\frac{1}{b{q}_{k+1}}$, where (E) is again using Note 4. This implies $b\left|x-\frac{a}{b}\right|\ge \frac{1}{{q}_{k+1}}$ ⇒ $\left|bx-a\right|\ge \frac{1}{{q}_{k+1}}$ (iv).
Lemma 3 (Upper Bounds) tells us that $\left|x-\frac{{p}_{k}}{{q}_{k}}\right|<\frac{1}{{q}_{k}{q}_{k+1}}$ which is equivalent to ${q}_{k}\left|x-\frac{{p}_{k}}{{q}_{k}}\right|<\frac{1}{{q}_{k+1}}$ ⇔ $\left|{q}_{k}x-{p}_{k}\right|<\frac{1}{{q}_{k+1}}$ ⇒ $\left|{q}_{k}x-{p}_{k}\right|<\left|bx-a\right|$ (see (iv) just before). Since ${q}_{k}<b$ (see (iii) above), this is a contradiction to $a/b$ being a best approximation of the second kind of x. Thus, Case (1) does not occur.
Case (2). This case is shown in
Figure 11. Then,
$\left|x-\frac{a}{b}\right|>\left|\frac{{p}_{1}}{{q}_{1}}-\frac{a}{b}\right|\stackrel{\left(F\right)}{=}\frac{1}{b{q}_{1}}$, where (
F) again uses Note 4. This implies
$\left|bx-a\right|>\frac{1}{{q}_{1}}\stackrel{\left(G\right)}{=}\frac{1}{{a}_{1}}$ (v) with (
G) using the recursion theorem.
Now, $x-{a}_{0}=\frac{1}{{a}_{1}+\frac{1}{{a}_{2}+\ddots}}\le \frac{1}{{a}_{1}}$, where the last inequality holds because of $\frac{1}{{a}_{2}+\ddots}>0$; thus, $\left|x-{a}_{0}\right|\le \frac{1}{{a}_{1}}\stackrel{\left(H\right)}{<}\left|bx-a\right|$, (H) based on (v) before. This means that $\left|1\cdot x-{a}_{0}\right|<\left|bx-a\right|$ with $1\le b$, i.e., $a/b$ is not a best approximation of the second kind of x, which is a contradiction. Thus, Case (2) does not occur either.
Consequently, the assumption is wrong and there is a $k\in \mathbb{N}$ with $\frac{a}{b}=\frac{{q}_{k}}{{q}_{k}}={x}_{k}$, i.e., $a/b$ is a convergent. □
So, every best approximation of the second kind is a convergent. The next theorem proves the reverse, i.e., that every convergent is a best approximation of the second kind.
Theorem 12. (Lagrange, 1798—Convergents are 2nd Kind Best Approximations)
Let ${p}_{n}/{q}_{n}$ be a convergent of $x=\left[{a}_{0};{a}_{1},\cdots ,{a}_{N}\right]$, $x\ne {a}_{0}+\frac{1}{2}$, and $n\ne 0$. Then, for $d\le {q}_{n}$ and $\frac{c}{d}\ne \frac{{p}_{n}}{{q}_{n}}$ it is $\left|dx-c\right|>\left|{q}_{n}x-{p}_{n}\right|$, i.e., the convergent is a best approximation of the second kind of x.
The cases $x={a}_{0}+\frac{1}{2}$ and $n=0$ are excluded because the convergent $\frac{{p}_{0}}{{q}_{0}}=\frac{{a}_{0}}{1}$ is not a best approximation of the second kind of $x={a}_{0}+\frac{1}{2}$: it is $\left|1\cdot x-\left({a}_{0}+1\right)\right|=\left|{a}_{0}+\frac{1}{2}-{a}_{0}-1\right|=\frac{1}{2}$ and $\left|1\cdot x-{a}_{0}\right|=\left|{a}_{0}+\frac{1}{2}-{a}_{0}\right|=\frac{1}{2}$, which implies $\left|1\cdot x-\left({a}_{0}+1\right)\right|=\left|1\cdot x-{a}_{0}\right|$. Setting $d:=1\le {q}_{0}$, $c:={a}_{0}+1$ results in $\left|d\cdot x-c\right|$ = $\left|1\cdot x-\left({a}_{0}+1\right)\right|=\left|1\cdot x-{a}_{0}\right|$ = $\left|{q}_{0}\cdot x-{p}_{0}\right|$. If $\frac{{p}_{0}}{{q}_{0}}$ would be a best approximation of the second kind of x, then $\left|1\cdot x-\left({a}_{0}+1\right)\right|$ > $\left|1\cdot x-{a}_{0}\right|$ would hold.
The proof of Lagrange’s theorem is very technical. First, the expression $\left|{y}_{0}x-{z}_{0}\right|$ is analyzed to find the smallest integral numbers ${y}_{0}$ and ${z}_{0}$ such that the expression is minimized under the constraint ${y}_{0}\in \left\{{q}_{0},\dots ,{q}_{k}\right\}$, i.e., ${y}_{0}$ is a denominator of a convergent. It is shown both that ${z}_{0}/{y}_{0}$ is a best approximation of the second kind of x, and that ${z}_{0}={p}_{k}$ and ${y}_{0}={q}_{k}$.
Proof. Let $k\in \mathbb{Z}$ and let ${p}_{k}/{q}_{k}$ be a convergent. First, we are looking for the smallest numbers ${y}_{0},{z}_{0}\in \mathbb{Z}$ with ${y}_{0}\in \left\{{q}_{0},\dots ,{q}_{k}\right\}$ such that $\left|{y}_{0}x-{z}_{0}\right|$ is minimal.
Step 1. Pick an arbitrary $z\in \mathbb{Z}$, and based on this we determine ${y}_{0}\in \left\{{q}_{0},\dots ,{q}_{k}\right\}$.
It is
$\underset{y}{min}\left|yx-z\right|=0\iff y=\frac{z}{x}$, but in general
$y\notin \mathbb{Z}$. Looking for a solution
${y}_{0}\in \left\{{q}_{0},\dots ,{q}_{k}\right\}\subseteq \mathbb{Z}$ that minimizes
$\left|{y}_{0}x-z\right|$ results in the following potential positions of
$z/x$ with respect to the denominators
${q}_{0},\dots ,{q}_{k}$ (see
Figure 12):
Case 1: $z/x>{q}_{k}$. Then, ${y}_{0}={q}_{k}$ is the solution;
Case 2: $z/x<{q}_{0}$. Then, ${y}_{0}={q}_{0}$ is the solution;
Let ${q}_{i}\le z/x\le {q}_{i+1}$ for 1 ≤ i ≤ k.
Case 3: For $\left|{q}_{i+1}x-z\right|<\left|{q}_{i}x-z\right|$ (i.e., $z/x$ is closer to ${q}_{i+1}$ than to ${q}_{i}$), ${y}_{0}={q}_{i+1}$ is the solution, and for $\left|{q}_{i+1}x-z\right|>\left|{q}_{i}x-z\right|$ (i.e., $z/x$ is closer to ${q}_{i}$ than to ${q}_{i+1}$), ${y}_{0}={q}_{i}$ is the solution;
Case 4: For $\left|{q}_{i+1}x-z\right|=\left|{q}_{i}x-z\right|$ (i.e., $z/x$ is exactly in the middle between ${q}_{i}$ and ${q}_{i+1}$), ${y}_{0}={q}_{i}$ is the solution because ${q}_{i}<{q}_{i+1}$, and we are looking for the smallest ${y}_{0}$, especially ${y}_{0}\ge {q}_{0}=1$. ${\square}_{\left(step1\right)}$
Step 2. Based on the
${y}_{0}$ found, we determine
${z}_{0}$ next. It is
$\underset{z}{min}\left|{y}_{0}x-z\right|=0$ $\iff z={y}_{0}x$, but in general,
$z\notin \mathbb{Z}$. In solving the minimization problem within
$\mathbb{Z}$ (i.e.,
${z}_{0}:=\underset{z\in \mathbb{Z}}{argmin}\left|{y}_{0}x-z\right|$), the following cases can be distinguished (see
Figure 13):
Case 0: It may happen that ${y}_{0}x\in \mathbb{Z}$. Then, choose ${z}_{0}={y}_{0}x$;
Case 1: ${y}_{0}x$ is between two integral numbers s and t, i.e., $s<{y}_{0}x<t$. For $\left|{y}_{0}x-s\right|>\left|{y}_{0}x-t\right|$ (i.e., ${y}_{0}x$ is closer to t than to s), ${z}_{0}=t$ is the solution; and for $\left|{y}_{0}x-s\right|<\left|{y}_{0}x-t\right|$ (i.e., ${y}_{0}x$ is closer to s than to t), ${z}_{0}=s$ is the solution;
Case 2: For $\left|{y}_{0}x-s\right|=\left|{y}_{0}x-t\right|$ (i.e., ${y}_{0}x$ is exactly in the middle between t and s), ${z}_{0}=s$ is the solution because $s<t$, and we are looking for the smallest ${z}_{0}$. ${\square}_{\left(step2\right)}$
Claim 1. ${z}_{0}$ is uniquely determined.
Proof (by contradiction). Assume there exists a ${\tilde{z}}_{0}\in \mathbb{Z}$ with ${\tilde{z}}_{0}\ne {z}_{0}$ and $\left|x-\frac{{z}_{0}}{{y}_{0}}\right|=\left|x-\frac{{\tilde{z}}_{0}}{{y}_{0}}\right|$. This can only happen iff one term is positive and the other is negative, i.e., for example, if $x-\frac{{z}_{0}}{{y}_{0}}>0$ and $x-\frac{{\tilde{z}}_{0}}{{y}_{0}}<0$, and then $x-\frac{{z}_{0}}{{y}_{0}}=\frac{{\tilde{z}}_{0}}{{y}_{0}}-x$, i.e., $x=\frac{{z}_{0}+{\tilde{z}}_{0}}{2{y}_{0}}$.
As an intermediate step we prove:
Claim 2. ${z}_{0}+{\tilde{z}}_{0}$ and $2{y}_{0}$ are co-prime, i.e., $gcd\left({z}_{0}+{\tilde{z}}_{0},2{y}_{0}\right)=1$
Proof (by contradiction). Let
${\tilde{z}}_{0}+{z}_{0}=Lp$ and
$2{y}_{0}=Lq$ with
$L>1$. Then,
$x=\frac{{z}_{0}+{\tilde{z}}_{0}}{2{y}_{0}}=\frac{Lp}{Lq}\Rightarrow x=\frac{p}{q}$ and thus
Assume
$L>2$. Then, with
$2{y}_{0}=Lq$ and
$L/2>1$, it follows:
Now, ${y}_{0}$ has been determined in Step 1 to satisfy ${y}_{0}=\underset{y}{argmin}\left|yx-z\right|$ for a given z, especially for $z=p$, i.e., ${y}_{0}=\underset{y}{argmin}\left|yx-p\right|$. Because $0=\underset{y}{min}\left|yx-p\right|$ and $\left|qx-p\right|=0$, it must be $q={y}_{0}$. This is a contradiction because $q<{y}_{0}$ according to (ii) before. Thus, $1<L\le 2$, i.e., L = 2.
With $L=2$ and $2{y}_{0}=Lq$, we get ${y}_{0}=q$, which implies. By definition of ${z}_{0}$, $\left|qx-p\right|=\left|{y}_{0}x-p\right|>\left|{y}_{0}x-{z}_{0}\right|$. However, $\left|qx-p\right|=0$ (see (i) above); thus, $0>\left|{y}_{0}x-{z}_{0}\right|$, which is a contraction.${\square}_{\left(claim2\right)}$
We continue the proof of Claim 1: It is $\frac{{z}_{0}+{\tilde{z}}_{0}}{2{y}_{0}}=x$ and also $x=\frac{{p}_{N}}{{q}_{N}}$, i.e., $\frac{{z}_{0}+{\tilde{z}}_{0}}{2{y}_{0}}=\frac{{p}_{N}}{{q}_{N}}$. Because $gcd\left({z}_{0}+{\tilde{z}}_{0},2{y}_{0}\right)=1$ according to Claim 2, it follows that ${p}_{N}={z}_{0}+{\tilde{z}}_{0}$ and ${q}_{N}=2{y}_{0}$.
Now, let
$N\ge 2$. Then, it is
$2{y}_{0}={q}_{N}\stackrel{\left(A\right)}{=}{a}_{N}{q}_{N-1}+{q}_{N-2}$ ((
A) uses the recursion theorem (Theorem 1)), and with Note 1, it is
${a}_{N}\ge 2$. Thus,
$2{y}_{0}\ge 2{q}_{N-1}+{q}_{N-2}$ $\Rightarrow {y}_{0}\ge {q}_{N-1}+\frac{{q}_{N-2}}{2}$ $\Rightarrow {q}_{N-1}\le {y}_{0}-\frac{{q}_{N-2}}{2}\stackrel{\left(B\right)}{<}{y}_{0}$ ((
B) is because
${q}_{N-2}>0$). Now:
where (
C) holds because of the sign theorem and (
D) because
${y}_{0}\ge 1$ (see the end of the proof of Step 1).
Furthermore,
where (
E) is true because
${\tilde{z}}_{0}\ne {z}_{0}$ and, thus,
$\left|{\tilde{z}}_{0}-{z}_{0}\right|\ge 1$ for integral numbers
${\tilde{z}}_{0}$ and
${z}_{0}$. Together, we obtained
$\left|{y}_{0}x-{z}_{0}\right|\ge \frac{1}{2}\ge \left|{q}_{N-1}x-{p}_{N-1}\right|$, which is a contradiction to the choice of
${y}_{0}$ and
${z}_{0}$! This proves Claim 1 for
$N\ge 2$.
Now, let
$N=1$ and choose
${a}_{1}=2$ (based on Note 1, the highest element of a continued fraction is always greater than or equal 2, thus
${a}_{1}\ge 2$). Then
((F) is the recursion theorem) which has been excluded from the theorem.
Thus, let
$N=1$ and
${a}_{1}>2$. Then
where (
G) applies the recursion theorem and (
H) the sign theorem. Because of (iii), it is
$\left|{y}_{0}x-{z}_{0}\right|\ge \frac{1}{2}$, i.e., together,
$\left|{q}_{0}x-{p}_{0}\right|<\left|{y}_{0}x-{z}_{0}\right|$ which contradicts the definition of
${y}_{0}$ and
${z}_{0}$! This proves Claim 1 for
$N=1$.
${\square}_{\left(claim1\right)}$Next, we observe
Claim 3. $\frac{{z}_{0}}{{y}_{0}}$ is a best approximation of the second kind of x.
Otherwise: $\left|bx-a\right|\le \left|{y}_{0}x-{z}_{0}\right|$ for an $\frac{a}{b}\ne \frac{{z}_{0}}{{y}_{0}}$ with $b\le {y}_{0}$, which contradicts the definition of ${y}_{0}$ and ${z}_{0}$!${\square}_{\left(claim3\right)}$
According to Theorem 11, $\frac{{z}_{0}}{{y}_{0}}$ is a convergent of x, i.e., $\frac{{z}_{0}}{{y}_{0}}=\frac{{p}_{s}}{{q}_{s}}$ for an $s\le k$. If $s=k$, the proof is done. Thus, we assume $s<k$.
Claim 4. For $s<k$, it is $\frac{1}{{q}_{s}+{q}_{s+1}}\ge \frac{1}{{q}_{k}+{q}_{k-1}}$.
Proof. $s<k$ ⇒ $s\le k-1$ ⇒ ${q}_{s}\le {q}_{k-1}$ (Corollary 1: denominators are monotonically increasing). Similarly, $s<k$ ⇒ $s+1\le k$ ⇒ ${q}_{s+1}\le {q}_{k}$. Together, this implies ${q}_{k}+{q}_{k-1}\ge {q}_{s}+{q}_{s+1}$. ${\square}_{\left(claim4\right)}$
Next, we get
where (
I) is Lemma 5 (Lower Bounds) and (
J) is Claim 4.
Furthermore, $\left|{q}_{k}x-{p}_{k}\right|={q}_{k}\left|x-\frac{{p}_{k}}{{q}_{k}}\right|\stackrel{\left(K\right)}{<}{q}_{k}\frac{1}{{q}_{k}{q}_{k+1}}=\frac{1}{{q}_{k+1}}$, where (K) holds because of Lemma 3 (Upper Bounds).
With $\frac{{z}_{0}}{{y}_{0}}=\frac{{p}_{s}}{{q}_{s}}$ and the definition of ${y}_{0}\left(={q}_{s}\right)$ and ${z}_{0}\left(={p}_{s}\right)$ (i.e., the minimizing property), it is $\left|{q}_{s}x-{p}_{s}\right|=\left|{y}_{0}x-{z}_{0}\right|\le \left|{q}_{k}x-{p}_{k}\right|$ ⇒ $\frac{1}{{q}_{k}+{q}_{k-1}}\le \frac{1}{{q}_{k+1}}$, which implies ${q}_{k+1}<{q}_{k}+{q}_{k-1}$. This is a contradiction; because of the recursion theorem, it is ${q}_{k+1}={a}_{k+1}{q}_{k}+{q}_{k-1}\stackrel{\left(L\right)}{\ge}{q}_{k}+{q}_{k-1}$, where (L) holds with ${a}_{k}\ge 1$. Thus, $s=k$ which proves the overall theorem. □
Putting the last two theorems together yields:
Corollary 5. $a/b$ is a best approximation of the second kind of x ⇔ x is a convergent of x. □
According to Theorem 12, every convergent is a best approximation of the second kind, and each best approximation of the second kind is also a best approximation of the first kind (Lemma 6). We keep this observation as:
Note 5. Every convergent is a best approximation of the first kind. □
But are best approximations of the first kind also always convergents? Not quite: the next theorem proves that a best approximation of the first kind is a convergent or a semiconvergent.
Theorem 13. (Lagrange, 1798—1st Kind Best Approximations are Convergents or Semiconvergents)
Let $a/b$ be a best approximation of the first kind of $x=\left[{a}_{0};{a}_{1},\cdots ,{a}_{N}\right]$. Then$a/b$ is a convergent or a semiconvergent of x.
Proof. By definition, it is $\left|x-\frac{c}{d}\right|>\left|x-\frac{a}{b}\right|$ for $\frac{c}{c}\ne \frac{a}{b}$ and $d\le b$.
Claim 1. $a/b>{a}_{0}$.
Otherwise: $\frac{a}{b}\le {a}_{0}=\frac{{a}_{0}}{1}$; thus, $x-{a}_{0}\le x-\frac{a}{b}$. Now, $x-{a}_{0}=\frac{1}{{a}_{1}+\ddots}>0$; thus, $0<x-{a}_{0}\le x-\frac{a}{b}$ ⇒ $\left|x-\frac{{a}_{0}}{1}\right|\le \left|x-\frac{a}{b}\right|$. Because $1\le b$, we obtained a contradiction since $a/b$ is a best approximation of the first kind.${\square}_{\left(claim1\right)}$
Claim 2. $a/b<{a}_{0}+1$.
Otherwise:
$\frac{a}{b}\ge {a}_{0}+1$ and based on the geometric situation depicted in
Figure 8, it follows that
$\left|x-\frac{{a}_{0}+1}{1}\right|\le \left|x-\frac{a}{b}\right|$ with
$1\le b$, which contradicts
$a/b$ being a best approximation of the first kind.
${\square}_{\left(claim2\right)}$ Consequently,
$a/b$ lies between
${x}_{0}={a}_{0}$ and
${x}_{-1,1}={a}_{0}+1$ (see Equation (22)), i.e.,
and is, thus, covered by the set of intervals defined by the convergents and semiconvergents of x (see
Figure 8).
Assumption. $a/b$ is neither a convergent nor a semiconvergent.
This results in the following cases:
Case 1: $a/b$ lies between two semiconvergents ${x}_{k-1,r}$ and ${x}_{k-1,r+1}$;
Case 2: $a/b$ lies between two convergents ${x}_{k}$ and ${x}_{k+2}$;
Case 3: $a/b$ lies between a convergent and a semiconvergent.
We will show that all three cases lead to a contradiction, i.e., the assumption must be false; thus, the theorem is proven.
Case 1. $a/b$ lies between ${x}_{k-1,r}=\frac{r{p}_{k}+{p}_{k-1}}{r{q}_{k}+{q}_{k-1}}$ and ${x}_{k-1,r+1}=\frac{\left(r+1\right){p}_{k}+{p}_{k-1}}{\left(r+1\right){q}_{k}+{q}_{k-1}}$.
Then,
where (
A) results from the same computation performed in the proof of Lemma 4.
Furthermore, it is
where (
B) is seen to be valid as follows:
$a\left(r{q}_{k}+{q}_{k-1}\right)-b\left(r{p}_{k}+{p}_{k-1}\right)\in \mathbb{Z}$ and, thus,
$\left|a\left(r{q}_{k}+{q}_{k-1}\right)-b\left(r{p}_{k}+{p}_{k-1}\right)\right|\in {\mathbb{N}}_{0}$; if it would be zero, the first modulus in (i) would be zero, i.e.,
$a/b={x}_{k-1,r}$ which contradicts the assumption of the claim, which in turn implies
$\left|a\left(r{q}_{k}+{q}_{k-1}\right)-b\left(r{p}_{k}+{p}_{k-1}\right)\right|\ge 1$.
Because of the monotony of the sequence of semiconvergents
${({x}_{s,t})}_{t}$ (Lemma 4), it is for an odd
$k$ (i.e.,
$k-1$ even)
${x}_{k-1,r}<{x}_{k-1,r+1}$ (see the geometric situation in
Figure 14);
But with (ii), it is $\left(r+1\right){q}_{k}+{q}_{k-1}<b$; thus, $a/b$ is not a best approximation of the first kind to x, which is a contradiction. $k$ even leads to a contradiction too, i.e., Case (1) is not possible ${\square}_{\left(case1\right)}$
Case 2. $a/b$ lies between ${x}_{k}$ and ${x}_{k+2}$.
Then, $\left|\frac{a}{b}-\frac{{p}_{k}}{{q}_{k}}\right|<\left|\frac{{p}_{k}}{{q}_{k}}-\frac{{p}_{k+2}}{{q}_{k+2}}\right|\stackrel{\left(C\right)}{=}\frac{{a}_{k+2}}{{q}_{k}{q}_{k+2}}<\frac{1}{{q}_{k}{q}_{k+2}}$ where (C) is Equation (11) from Corollary 3, and with Note 4, it is $\left|\frac{a}{b}-\frac{{p}_{k}}{{q}_{k}}\right|\ge \frac{1}{b{q}_{k}}$.
Together,
$\frac{1}{b{q}_{k}}<\frac{1}{{q}_{k}{q}_{k+2}}$ ⇒
$\frac{1}{b}<\frac{1}{{q}_{k+2}}$ ⇒
$b>{q}_{k+2}$. Because of the geometric situation shown in
Figure 15, it is
$\left|x-\frac{a}{b}\right|>\left|x-\frac{{p}_{k+2}}{{q}_{k+2}}\right|$, which is a contradiction to
$a/b$ being a best approximation of the first kind to x and
$b>{q}_{k+2}$.
${\square}_{\left(case2\right)}$ Case 3. $a/b$ lies between a convergent and a semiconvergent.
This implies that
$a/b$ lies between
${x}_{k}$ and
${x}_{k,1}$ (see
Figure 8), otherwise
$a/b$ would lie between two semiconvergents, which has already been covered in Case 1.
Thus,
$\left|\frac{a}{b}-\frac{{p}_{k}}{{q}_{k}}\right|<\left|{x}_{k}-{x}_{k,1}\right|$, but
where (
D) is the sign theorem. I.e., it is
$\left|\frac{a}{b}-\frac{{p}_{k}}{{q}_{k}}\right|<\frac{1}{{q}_{k}\left({q}_{k+1}+{q}_{k}\right)}$. As before, with Note 4, it is
$\left|\frac{a}{b}-\frac{{p}_{k}}{{q}_{k}}\right|\ge \frac{1}{b{q}_{k}}$ ⇒
$\frac{1}{b{q}_{k}}<\frac{1}{{q}_{k}\left({q}_{k+1}+{q}_{k}\right)}$ ⇒
$b>{q}_{k+1}+{q}_{k}$.
The geometric situation from
Figure 16 reveals
$\left|x-\frac{a}{b}\right|>\left|x-\frac{{p}_{k}+{p}_{k-1}}{{q}_{k}+{q}_{k-1}}\right|$, which is a contradiction to
$a/b$ being a best approximation of the first kind to x and
$b>{q}_{k+1}+{q}_{k}$.
${\square}_{\left(case3\right)}$ □
Finally, we give a simple criterion that allows us to prove that a given fraction is a convergent of another real number. This theorem is a cornerstone of computing a prime factor with Shor’s algorithm.
Theorem 14. (Legendre, 1798—Convergent Criterion)
Let $\left|x-\frac{a}{b}\right|<\frac{1}{2{b}^{2}}$ ⇒ $a/b$ is a convergent of x.
Proof. We show that $a/b$ is a best approximation of the second kind of x. Theorem 11 then proves the claim.
Let $\left|dx-c\right|\le \left|bx-a\right|$ for $\frac{a}{b}\ne \frac{c}{d}$ and $d>0$. We need to prove $d>b$.
Now, $\left|bx-a\right|=b\left|x-\frac{a}{b}\right|<b\frac{1}{2{b}^{2}}=\frac{1}{2b}$. This implies $\left|dx-c\right|<\frac{1}{2b}$ ⇔ $d\left|x-\frac{c}{d}\right|<\frac{1}{2b}$ ⇔ $\left|x-\frac{c}{d}\right|<\frac{1}{2db}$. Thus,
$\left|\frac{c}{d}-\frac{a}{b}\right|=\left|\frac{c}{d}-x+x-\frac{a}{b}\right|\le \left|\frac{c}{d}-x\right|+\left|x-\frac{a}{b}\right|<\frac{1}{2db}+\frac{1}{2{b}^{2}}=\frac{b+d}{2d{b}^{2}}$
With Note 4 (Distance of Fractions), it is also
$\left|\frac{c}{d}-\frac{a}{b}\right|\ge \frac{1}{db}$. Together, it is