2.2. Convergents
Next, we define the “workhorses” of the theory of continued fractions.
Definition 2. is called m-th convergent of the continued fraction for 0 ≤ m ≤ N, or m-th convergent of the infinite regular continued fraction .
Convergents can be computed recursively based on the following theorem:
Theorem 1. (Recursion Theorem)
Define:
and define:
Then, for every convergent
, it is: Proof (by induction). Let n = 0, 1: Then, and .
Induction hypothesis: .
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 and . □
The recursion theorem implies the often used.
Corollary 1. Numerators and denominators of convergents of a continued fraction
with
are strictly monotonically increasing:
Proof (by induction). Let n = 1: By definition, , . Because for i ≥ 1, and , it is . Similarly,
Now, and for n ≥ 2. With by definition, and (≥1) as well as (≥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 ,
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 ,
the following holds: Proof. It is and .
Multiplying the first equation by
and the second equation by
results in
and
. Next, both equations are subtracted:
where (A) is implied by the sign theorem (Theorem 2) and considering
. □
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 and , i.e., and . Then, , but 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
. Since
, we can write
Computing the differences results in
where the sign theorem is applied in (
A) and the last term
is the recursion theorem. □
The next theorem is key for many estimations in the domain of continued fractions.
Theorem 5. (Monotony Theorem)
Let 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
:
(B) is because of the sign theorem, and (C) follows from , i.e., the recursion theorem.
Now, because of , it is . Thus, for n even and for n odd. This implies for n even as well as 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 , it is
Proof. As before, using the sign theorem in
(A), we obtain
with
. Because
, it is β
n > 0, i.e., the sign of
is in fact
.
Thus, , and we get . This shows that an even convergent is strictly smaller than its immediate succeeding odd convergent .
But what about an arbitrary odd convergent ? For n < m, the monotony theorem (Theorem 6) yields and we showed before that ; thus, .
For n > m, the monotony theorem yields and with we see . □
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 and let be its convergents. Then: Proof. The value of x is the convergent with the highest index N, i.e., .
Let N = 2k be even. Since even convergents are strictly monotonically increasing, we know that , and according to the convergent comparison theorem (Theorem 6), we know .
Let N = 2k + 1 be odd. Since odd convergents are strictly monotonically decreasing, we know that , and according to the convergent comparison theorem (Theorem 6), we know . □
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 and let be its convergents. Then:and Proof. Let n be even. Then, , i.e., . Additionally, it is and . Thus, for n even.
Now, let n be odd. It is , which implies . Because of and , it is ⇔ 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 and let 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., for any . Thus, .
Let m = 2t − 1 be odd. By the monotony theorem (Theorem 5), odd convergents are strictly monotonically decreasing, i.e., for each t > k. Thus, .
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
of a convergent
, the following holds:
and
Proof. By definition,
, and
because
, and finally,
(A) holds because of the recursion theorem (Theorem 1), (B) is by definition of , (C) is because , and (D) has been seen just before (i.e., ). This proves the lemma for .
The proof for n ≥ 3 is by induction. It is
where
(A) is the recursion theorem,
(B) is because of
,
(C) is by induction hypothesis applied to
,
(D) is because n ≥ 3, and
(E) is by induction hypothesis applied to
. 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., . □
In fact, denominators of a convergent grow much faster than the inequation may indicate:
Lemma 2. (Geometric Growth of Denominators)
Let (
)
be the denominator of the convergent .
Then: Proof. It is , with (A) because, according to corollary 1, denominators are strictly monotonically increasing, i.e., .
By induction, it is
, and then
with
(A) because
, and
(B) follows from
Similarly, by induction, it is and then with (A) because of .
With and , 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
be a convergent of the continued fraction representation of x. Then:
Proof. With
, it is
(see Theorem 8, Equation (14)). According to Corollary 3 (Equation (10)), it is
Thus,
where (
A) holds because of
(Corollary 1), and (
B) is true because of
(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
of the convergents of the continued fraction representation of
converges to x:
Proof. The claim follows immediately from . □
Often, two fractions are compared by means of their mediant (“mediant” means “somewhere in between”).
Definition 3. For and b, d > 0, the term is called the mediant of the two fractions.
The following simple inequation is often used.
Note 3. (Mediant Property)
Let and b, d > 0 and .
Proof. It is and . This implies and thus . The inequation follows similarly. □
Mediants of convergents that are weighted in a certain way are another important concept for computing bounds:
Definition 4. The term with 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, .
Let n be odd. Then, .
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., ), and it is negative iff n is odd (i.e., ). □
In order to simplify proofs in what follows, the following conventions are used:
With this, becomes a semiconvergent. Now, where (A) is the recursion theorem and (B) follows because ; thus, .
Furthermore, it is for .
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.,
and
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
, the semiconvergents
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
be a convergent of the continued fraction representation of x. Then:
Proof. The proof is based on the following claims:
Claim 1.
n even ⇒ .
Proof. is the mediant of
and
. Thus, the mediant property (Note 3) shows that
. 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
. This proves Claim 1.
Claim 2. n odd ⇒ .
Proof. As before,
is the mediant of
and
. Because n is odd, it is
(Theorem 7). Thus,
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
, and because n is odd, it is
. This proves Claim 2.
With Claim 1, for even n, it is ⇒ .
With Claim 2, for n odd, it is ⇒ ⇔ .
Thus, for any k ∈ ℕ:
. Next, we compute
where (
A) is the sign theorem (Theorem 2).
This implies . □
Because of
(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 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 is called a best approximation (of the first kind) of :⇔ (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 is small and, thus, is small. Measuring the goodness of an approximation this way results in the following:
Definition 6. A fraction is called a best approximation of the second kind of :⇔ (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 .
Next, we observe that with 1 < 3. Thus, with and (i.e., ) and , we found a fraction with ! 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 is a best approximation of the second kind of , then 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, for a fraction c/d with d < q. Multiplying both inequations results in ⇔ , 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
with
. Then:
Proof. With
and
, it is
. Also,
because otherwise
which contradicts the premise. Thus,
, i.e.,
. This implies
where
because
. □
Next, we prove that every best approximation of the second kind is a convergent.
Theorem 11. (2nd Kind Best Approximations are Convergents)
Let be a best approximation of the second kind of , and let be the continued fraction representation of x.
Then is a convergent of x.
Proof. Being a best approximation of the second kind of x, satisfies, by definition, for d ≤ b.
Claim 1. .
Proof (by contradiction). Assume ; thus, , where (A) holds because , i.e., 1 ≤ b. This implies , which contradicts for d ≤ b (with and ). This means that , (B) is because of the recursion theorem.
Thus, the geometric situation is as depicted in
Figure 9, i.e.,
is in the grey shaded area being greater than or equal to the convergent
. This will be refined in what follows.
Next, we proceed with a proof by contradiction assuming that is not a convergent of x.
Assumption. for .
According to Claim 1,
. 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,
, with (
D) because of Note 4 (Distance of Fractions).
Together, ⇒ ⇒ (iii).
Also, if (i) is true, then , where (E) is again using Note 4. This implies ⇒ (iv).
Lemma 3 (Upper Bounds) tells us that which is equivalent to ⇔ ⇒ (see (iv) just before). Since (see (iii) above), this is a contradiction to 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,
, where (
F) again uses Note 4. This implies
(v) with (
G) using the recursion theorem.
Now, , where the last inequality holds because of ; thus, , (H) based on (v) before. This means that with , i.e., 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 with , i.e., 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 be a convergent of , , and . Then, for and it is , i.e., the convergent is a best approximation of the second kind of x.
The cases and are excluded because the convergent is not a best approximation of the second kind of : it is and , which implies . Setting , results in = = . If would be a best approximation of the second kind of x, then > would hold.
The proof of Lagrange’s theorem is very technical. First, the expression is analyzed to find the smallest integral numbers and such that the expression is minimized under the constraint , i.e., is a denominator of a convergent. It is shown both that is a best approximation of the second kind of x, and that and .
Proof. Let and let be a convergent. First, we are looking for the smallest numbers with such that is minimal.
Step 1. Pick an arbitrary , and based on this we determine .
It is
, but in general
. Looking for a solution
that minimizes
results in the following potential positions of
with respect to the denominators
(see
Figure 12):
Case 1: . Then, is the solution;
Case 2: . Then, is the solution;
Let for 1 ≤ i ≤ k.
Case 3: For (i.e., is closer to than to ), is the solution, and for (i.e., is closer to than to ), is the solution;
Case 4: For (i.e., is exactly in the middle between and ), is the solution because , and we are looking for the smallest , especially .
Step 2. Based on the
found, we determine
next. It is
, but in general,
. In solving the minimization problem within
(i.e.,
), the following cases can be distinguished (see
Figure 13):
Case 0: It may happen that . Then, choose ;
Case 1: is between two integral numbers s and t, i.e., . For (i.e., is closer to t than to s), is the solution; and for (i.e., is closer to s than to t), is the solution;
Case 2: For (i.e., is exactly in the middle between t and s), is the solution because , and we are looking for the smallest .
Claim 1. is uniquely determined.
Proof (by contradiction). Assume there exists a with and . This can only happen iff one term is positive and the other is negative, i.e., for example, if and , and then , i.e., .
As an intermediate step we prove:
Claim 2. and are co-prime, i.e.,
Proof (by contradiction). Let
and
with
. Then,
and thus
Assume
. Then, with
and
, it follows:
Now, has been determined in Step 1 to satisfy for a given z, especially for , i.e., . Because and , it must be . This is a contradiction because according to (ii) before. Thus, , i.e., L = 2.
With and , we get , which implies. By definition of , . However, (see (i) above); thus, , which is a contraction.
We continue the proof of Claim 1: It is and also , i.e., . Because according to Claim 2, it follows that and .
Now, let
. Then, it is
((
A) uses the recursion theorem (Theorem 1)), and with Note 1, it is
. Thus,
((
B) is because
). Now:
where (
C) holds because of the sign theorem and (
D) because
(see the end of the proof of Step 1).
Furthermore,
where (
E) is true because
and, thus,
for integral numbers
and
. Together, we obtained
, which is a contradiction to the choice of
and
! This proves Claim 1 for
.
Now, let
and choose
(based on Note 1, the highest element of a continued fraction is always greater than or equal 2, thus
). Then
((F) is the recursion theorem) which has been excluded from the theorem.
Thus, let
and
. Then
where (
G) applies the recursion theorem and (
H) the sign theorem. Because of (iii), it is
, i.e., together,
which contradicts the definition of
and
! This proves Claim 1 for
.
Next, we observe
Claim 3. is a best approximation of the second kind of x.
Otherwise: for an with , which contradicts the definition of and !
According to Theorem 11, is a convergent of x, i.e., for an . If , the proof is done. Thus, we assume .
Claim 4. For , it is .
Proof. ⇒ ⇒ (Corollary 1: denominators are monotonically increasing). Similarly, ⇒ ⇒ . Together, this implies .
Next, we get
where (
I) is Lemma 5 (Lower Bounds) and (
J) is Claim 4.
Furthermore, , where (K) holds because of Lemma 3 (Upper Bounds).
With and the definition of and (i.e., the minimizing property), it is ⇒ , which implies . This is a contradiction; because of the recursion theorem, it is , where (L) holds with . Thus, which proves the overall theorem. □
Putting the last two theorems together yields:
Corollary 5. 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 be a best approximation of the first kind of . Then is a convergent or a semiconvergent of x.
Proof. By definition, it is for and .
Claim 1. .
Otherwise: ; thus, . Now, ; thus, ⇒ . Because , we obtained a contradiction since is a best approximation of the first kind.
Claim 2. .
Otherwise:
and based on the geometric situation depicted in
Figure 8, it follows that
with
, which contradicts
being a best approximation of the first kind.
Consequently,
lies between
and
(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. is neither a convergent nor a semiconvergent.
This results in the following cases:
Case 1: lies between two semiconvergents and ;
Case 2: lies between two convergents and ;
Case 3: 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. lies between and .
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:
and, thus,
; if it would be zero, the first modulus in (i) would be zero, i.e.,
which contradicts the assumption of the claim, which in turn implies
.
Because of the monotony of the sequence of semiconvergents
(Lemma 4), it is for an odd
(i.e.,
even)
(see the geometric situation in
Figure 14);
But with (ii), it is ; thus, is not a best approximation of the first kind to x, which is a contradiction. even leads to a contradiction too, i.e., Case (1) is not possible
Case 2. lies between and .
Then, where (C) is Equation (11) from Corollary 3, and with Note 4, it is .
Together,
⇒
⇒
. Because of the geometric situation shown in
Figure 15, it is
, which is a contradiction to
being a best approximation of the first kind to x and
.
Case 3. lies between a convergent and a semiconvergent.
This implies that
lies between
and
(see
Figure 8), otherwise
would lie between two semiconvergents, which has already been covered in Case 1.
Thus,
, but
where (
D) is the sign theorem. I.e., it is
. As before, with Note 4, it is
⇒
⇒
.
The geometric situation from
Figure 16 reveals
, which is a contradiction to
being a best approximation of the first kind to x and
.
□
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 ⇒ is a convergent of x.
Proof. We show that is a best approximation of the second kind of x. Theorem 11 then proves the claim.
Let for and . We need to prove .
Now, . This implies ⇔ ⇔ . Thus,
With Note 4 (Distance of Fractions), it is also
. Together, it is