

































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Theorem 2.1. Every rational number has a simple continued fraction expansion which is finite and every finite simple continued fraction ...
Typology: Lecture notes
1 / 41
This page cannot be seen from the preview
Don't miss anything!


































Continued Fractions are important in many branches of mathematics. They arise naturally in long division and in the theory of approximation to real numbers by rationals. These objects that are related to number theory help us find good approximations for real life constants.
Given two positive integers, this algorithm computes the greatest common divisor (gcd) of the two numbers.
Algorithm: Let the two positive integers be denoted by a and b.
This algorithm terminates and we end up finding the gcd of the two numbers we started with.
Example: Take a = 43, b = 19.
43 = 2 × 19 + 5 19 = 3 × 5 + 4 5 = 1 × 4 + 1 4 = 4 × 1 + 0
Hence, by Euclid’s algorithm, the gcd of 43 and 19 is 1.
Observe that the quotient at each step of the algorithm has been highlighted. Using these numbers we can present the fraction 4319 in the following manner:
43 19
In general, it is true that given two positive integers, we can write the fraction in the above format by using the successive quotients obtained from Euclid’s algorithm.
Lets look at the same example in a pictorial manner. Consider a rectangle whose length is 43 units and whose width is 19 units.
Divide it into squares of side length 19 units (coloured in blue) as shown:
We are left with a smaller rectangle of length 5 units and width 19 units (in red). Di- vide it further into squares of side length 5 units (in green).
This leaves us with a rectangular strip of length 5 units and width 4 units (in red). We continue this process of dividing the rectangle into squares of maximum possible side length. The number of squares in each step gives us precisely the successive quotients from the pre- vious section.
More generally, we have
[a 0 , a 1 , a 2 , ..., an] = [a 0 , a 1 , ...am− 1 , [am, am+1, ..., an]], for 1 ≤ m ≤ n
1.3.2 Convergents
Definition 1.2. We call [a 0 , ..., am] (for 0 ≤ m ≤ n) the mth convergent to [a 0 , ..., an].
In our example, the convergents are
2.1.1 Rational Numbers
Theorem 2.1. Every rational number has a simple continued fraction expansion which is finite and every finite simple continued fraction expansion is a rational number.
Proof. Suppose we start with a rational number, then Euclid’s algorithm terminates in finitely many steps. This is because the successive reminders are strictly decreasing as they have to be less than the respective quotients. By construction, the successive quotients in Euclid’s algorithm precisely gives us a simple continued fraction expansion for the rational number we started with. Conversely, if we have a simple finite continued fraction expansion [a 0 , a 1 , ..., an], then we can inductively see that [a 0 , a 1 , ..., an] = [a 0 , [a 1 , ..., an]] = (a 0 ([a 1 , ..., an]) + 1)/[a 1 , ..., an]. Hence, [a 0 , ..., an] is a rational number.
Q.E.D.
This theorem now says that we can continue working with finite simple continued frac- tions as long as we are only working with rational numbers. Henceforth, we will work with finite simple continued fractions until section 7 where we will deal with irrational numbers.
Exercise 2.2. (i) Find a simple continued fraction expansion of
(ii) Compute the gcd of (13, 8) using Euclid’s algorithm. (iii) What are its convergents? (iv) Write the continued fraction from part (i) in list notation.
2.1.2 Inverting a Fraction
Given a non-zero rational number, we simply interchange the numerator and denominator to get its reciprocal.
For example, the reciprocal of
is
Now we describe how to find the reciprocal of a rational number if it is described as a simple continued fraction:
Examples: 43 19
Given a rational number, we have seen one way of constructing a simple continued fraction (namely by Euclid’s algorithm). But is it the only way of getting a simple continued fraction? In this section and the next few sections we will see that there is essentially a unique way to write a rational number as a simple continued fraction.
Theorem 2.3. If x is representable by a simple continued fraction with an odd (even) number of convergents, it is also representable by one with an even (odd) number.
Proof. If an ≥ 2,
[a 0 , a 1 , ..., an] = [a 0 , a 1 , ..., an − 1 , 1]
If an = 1,
[a 0 , a 1 , ..., an− 1 , 1] = [a 0 , a 1 , ..., an− 1 + 1], [1] = [0, 1]
Q.E.D.
Thus, the proof of this theorem says that there are atleast 2 ways of writing a simple continued fraction for a rational number.
Examples:
[1, 2 , 3 , 4 , 5] = [1, 2 , 3 , 4 , 4 , 1] 3 2
pnqn− 1 − pn− 1 qn = (−1)n−^1 (p 1 q 0 − p 0 q 1 ) = (−1)n−^1 (1) = (−1)n−^1
Q.E.D.
Example:
225 157
Its convergents are
i.e.
The numerators and denominators of these convergents do satisfy
(3)(1) − (1)(2) = (−1)^1 −^1 = 1 (10)(2) − (3)(7) = (−1)^2 −^1 = − 1 (43)(7) − (10)(30) = (−1)^3 −^1 = 1 (225)(30) − (43)(157) = (−1)^4 −^1 = − 1
Definition 2.6. We call
a′ m = [am, am+1, ..., an]
the mth complete quotient of the continued fraction
[a 0 , a 1 , ..., an]
Let x = [a 0 , a 1 , ..., an]. Then
x = a′ 0 =
a′ 1 a 0 + 1 a′ 1
a′ npn− 1 + pn− 2 a′ nqn− 1 + qn− 2
This follows by the exact same steps as the proof of Theorem 2.4.
Theorem 2.7. am = [a′ m], the integral part of a′ m, except that an− 1 = [an− 1 ] − 1 when an = 1.
Proof. If n = 0, then a 0 = a′ 0 = [a′ 0 ]. If n > 0, then
a′ m = am +
a′ m+
for (0 ≤ m ≤ n − 1).
Now
a′ m+1 > 1 for (0 ≤ m ≤ n − 1)
except that a′ m+1 = 1 when m = n − 1 and an = 1. This is because a 1 , a 2 , ..., an are all non-negative integers and inductively one can see that the above statement is true. Hence
am < a′ m < am + 1 for (0 ≤ m ≤ n − 1)
and
am = [a′ m] for (0 ≤ m ≤ n − 1)
except in the case specified. And in any case
an = a′ n = [a′ n]
Q.E.D.
In this section we use all the properties seen in the above theorems to show that under some minor conditions, every rational number has a unique finite simple continued fraction.
Theorem 2.8. If two simple continued fractions
[a 0 , a 1 , ..., an], [b 0 , b 1 , ..., bN ]
have the same value x, and an > 1 , bN > 1 , then n = N and the fractions are identical.
Proof. By Theorem 2.7, a 0 = b 0 = integral part of x. Let us assume that the first m terms in the continued fractions are identical.Then
x = [a 0 , a 1 , ..., am− 1 , a′ m] = [b 0 , b 1 , ..., bm− 1 , b′ m]
If m = 1, then
a 0 +
a′ 1
= b 0 +
b′ 1
which implies a′ 1 = b′ 1 and by Theorem 2.7, a 1 = b 1. If m > 1, then
a′ mpm− 1 + pm− 2 a′ mqm− 1 + qm− 2
b′ mpm− 1 + pm− 2 b′ mqm− 1 + qm− 2
(a′ m − b′ m)(pm− 1 qm − 2 − pm− 2 qm− 1 ) = 0. But (pm− 1 qm − 2 − pm− 2 qm− 1 ) = (−1)m, by Theorem 2.5 and so a′ m = b′ m. By Theorem 2.7, am = bm. Suppose now, n ≤ N , then we have shown that am = bm∀m ≤ n. If N > n, then
where a 0 , a 1 , a 2 , ... are integers with a 1 > 0 , a 2 > 0 , ... Hence this indeed gives us the simple continued fraction for x.
The system of equations
x = a 0 + ξ 0 1 ξ 0
= a′ 1 = a 1 + ξ 1 1 ξ 1
= a′ 2 = a 2 + ξ 2 ...
is known as the continued fraction algorithm.
This algorithm also gives us a way of quickly computing the simple continued fraction by using a calculator. However, some rounding errors will creep in when calculating 1/ξm. Once these intermediate fractions become close to 0, we stop the calculations and that would give us a good approxiamtion of the number we started with.
Lets see how this works with the help of an example. Example: Let x = 2. 875 Its integral part is 2 and so the continued fraction starts as [2, ...].
If a rational number is given as a fraction, then we know how to use Euclid’s algorithm to get a simple continued fraction. If the number is given in terms of its decimal expansion, then the previous algorithm gives us a way of getting a simple continued fraction. Any rational number has a terminating or eventually repeating (periodic) decimal expansion. If we have a number with terminating decimal expansion, then we can always represent it as a proper fraction by using a denominator which is a big enough power of 10. The power of 10 required is just the number of digits to the right of the decimal point. For instance,
1 .2 is 12/ 10 2 .875 is 2875/ 1000 0 .00075 is 75/ 100000
Since all such decimal expansions can be converted to fractions, we can now use Euclid’s algorithm to express them as continued fractions.
Example: 2 .875 = 2875/1000. Using Euclid’s algorithm for (2875, 1000) gives us
2875 = 2 × 1000 + 875 1000 = 1 × 875 + 125 875 = 7 × 125
So, 2.875 = [2, 1 , 7]. There is no need to reduce the fraction to lowest terms to use Euclid’s algorithm as can be seen from the above example.
Given a finite simple continued fraction, we would now like to recover the rational number from it. The natural way to go about it, is to evaluate the continued fraction from the right-hand end, simplifying each part in turn
i.e. [2, 3 , 1 , 4] = [2, 3 , 1 + 1/4] = [2, 3 , 5 /4] = [2, 3 + 1/(5/4)] = [2, 19 /5] = [2 + 1/(19/5)] = [43/5]
There is another way to evaluate the simple continued fraction by going from left to right. Given [a 0 , a 1 , a 2 , ..., ], we can recursively compute its convergents [a 0 ], [a 0 , a 1 ], [a 0 , a 1 , a 2 ], ... from the previous convergent. If pm/qm denotes the mth convergent then pm/qm = (ampm− 1 + pm− 2 )/(amqm− 1 + qm− 2 ). This is the content of Theorem 2.4.
Thus, we have
CF a 0 a 1 a 2 a 3 Num a 0 a 1 × a 0 + 1 a 2 × (a 1 × a 0 + 1) + a 0 a 3 × (a 2 × (a 1 × a 0 + 1) + a 0 ) + (a 1 × a 0 + 1) Den 1 a 1 × 1 + 0 a 2 × a 1 + 1 a 3 × (a 2 × a 1 + 1) + a 1
It is easier to see this in an example.
Example: [1, 1 , 1 , 1]
Num 1 2 3 5 Den 1 1 2 3
From this table we see that [1, 1 , 1 , 1] =
Remark: Observe that the convergents in this example are ratios of Fibonacci numbers! In general it is true that if the list notation of the continued fraction contains only 1s, then the convergents that appear are ratios of consecutive Fibonacci numbers.
Remark: If you want to think in terms of examples, then all we are saying in the above proof is that if we want to show x 3 > x 8 then we simply use the chain of inequalities x 3 > x 5 > x 7 > x 8. Similarly, if we want to show x 7 > x 2 , we use the chain of inequalities x 7 > x 6 > x 4 > x 2.
Theorem 4.3. The value of the continued fraction is greater than that of any of its even convergents and less than that of any of its odd convergents(except that it is equal to the last convergent).
Proof. The value of the continued fraction is the last convergent i.e the nth convergent. If n is even, then it is the greatest of the even convergents by Theorem 4.1 and less than all odd convergents by Theorem 4.2. Simliarly, if n is odd, then it is the least of the odd convergents by Theorem 4.1 and greater than all even convergents by Theorem 4.2. Hence, the value of the convergent is between the even and odd convergents.
Q.E.D.
Looking back at some of the examples we have seen, we can quickly check the validity of these theorems in those specific examples. In doing so, we also begin to get an idea of why convergents to a continued fraction are called so. At this point, it would be instructive to go back to the examples and plot all their convergents on the real line to develop a geometric picture of what is happening (i.e. the convergents to x must oscillate around x ).
In this section we see how close the convergents are to the number that we started with. The next few theorems try to answer the following question:
What is the best approximation to a given number with small denominators?
For instance, Archimedes found that π is approximately
. This is a simple and good
approximation whose error is less that 0.002. For all fractions with denominators less than 10, this is the fraction with the least error. More generally, it is possible to find such approximations for any number.
Definition 4.4. The rational number p/q is the best approximation to a real number x if the distance from p/q to x on the real line is less than the distance from any other rational number to x (with denominator less than or equal to q).
Theorem 4.5. The convergents to a simple continued fraction are in their lowest terms.
Proof. If d divides pm and qm for some m, then d divides pm+1qm − pmqm+1 which is (−1)m by Theorem 2.5. So, pm and qm cannot have any common divisor other than ±1 which implies all the convergents are in their lowest terms.
Q.E.D.
Theorem 4.6. The denominators of the convergents satisfy the following inequalities
qn ≥ n, with strict inequality when n > 3.
Proof. q 0 = 1, q 1 = a 1 ≥ 1. For n ≥ 2,
qn = anqn− 1 + qn− 2 ≥ qn− 1 + 1
and inductively we see that qn ≥ n. For n > 3,
qn ≥ qn− 1 + qn− 2 > qn− 1 + 1 ≥ n
and hence qn > n.
Q.E.D.
Theorem 4.7. Every simple continued fraction can be written as an alternating sum in the following manner:
[a 0 , a 1 , ..., an] = a 0 +
q 1 q 0
q 2 q 1
qnqn− 1
Proof. Observe that for any m, the mth convergent
pm qm
can be written as
pm qm
pm qm
pm− 1 qm− 1
pm− 1 qm− 1
pm− 2 qm− 2
p 1 q 1
p 0 q 0
p 0 q 0
Using Theorem 2.5 and setting m = n gives us the desired result.
Q.E.D.
Theorem 4.8. For any number x with convergents
pm qm
x −
pm qm
qm+1qm
Proof. We will sketch the idea of the proof here. There are two way to see why the inequality holds. The first proof uses the previous theorem. Notice that x can be written as
x = c 0 − c 1 − c 2 − ...
where c 0 = a 0 and cm =
pm− 1 qm− 1
pm qm
. These cm become smaller and smaller and x minus the
first m terms is less than the value of cm+1. This will imply the inequality. Try to compute these cm for some explicit example to see why this result is true. The second proof is purely algebraic and uses complete quotients.
x =
a′ m+1pm + pm− 1 a′ m+1qm + qm− 1
and so
x −
pm qm
pmqm− 1 − pm− 1 qm qm(a′ m+1qm + qm− 1 )
(−1)m qm(a′ m+1qm + qm− 1 )
(−1)m qmq′ m+
where q′ m = a′ mqm− 1 + qm− 2. Since am is the integral part of a′ m, qm+1 < q m′+1 and this gives us the desired inequality.
Q.E.D.
Theorem 4.9.
pm qm
is the best approximation to x with denominator ≤ qm.
This leads us to the following two questions:
Lemma 4.10. If b, d > 0 , then
a b
c d
a b
a + c b + d
c d
Proof.
a b
c d
=⇒ ad − bc ≤ 0 =⇒ ad ≤ bc
ab + ad ≤ ab + bc =⇒
a b
a + c b + d
ad + cd ≤ bc + cd =⇒
a + c b + d
c d Q.E.D.
Definition 4.11. A semi-convergent or secondary convergent to x is a number of the form (pk + rpk+1)/(qk + rqk+1) where pk/qk and pk+1/qk+1 are two consecutive convergents to x = [a 0 , a 1 , a 2 , ...] and r is an integer between 0 and ak.
Note in particular, that the convergents to x are also semi-convergents.
Theorem 4.12. If x is any real number and a/b is not a semi-convergent to x, then a/b is not the best approximation to x with denominator less than or equal to b.
Proof. Lets assume for simplicity that a/b < x. Since a/b is not a semi-convergent, it should lie between two convergents of the form pk/qk and pk+2/qk+2 for some k. Lets say for simplic- ity that pk/qk < pk+1/qk+1 (a similar proof holds if pk/qk > pk+1/qk+1). Then by Lemma 4.10,
pk qk
pk + pk+ qk + qk+
pk + 2pk+ qk + 2qk+
pk + akpk+ qk + akqk+
pk+ qk+
Therefore,
pk + rpk+ qk + rqk+
a b
pk + (r + 1)pk+ qk + (r + 1)qk+ for some 0 ≤ r < ak.
b(qk + rqk+1)
a b
pk + rpk+ qk + rqk+
pk + (r + 1)pk+ qk + (r + 1)qk+
pk + rpk+ qk + rqk+
((r + 1)qk+1 + qk)(rqk+1 + qk)
b
qk + (r + 1)qk+
qk+ =⇒ qk+2 ≤ b
This says that
a b
is not the best approximation to x since
pk+ qk+
is closer to x than
a b
with
denominator less than b. An analogous argument holds when a/b > x.
This tells us that the only candidates for the best approximations are the semi-convergents. In fact, there is a precise statement which says which semi-convergents are the best approx- imations which we will not state here. Roughly speaking, about half the semi-convergents between pk/qk and pk+2/qk+2 which are closest to pk+2/qk+2 are the best approximations to x. Going back to our example, 5/27 is a semi-convergent to 7/38 but not a convergent. All the best approximations to 7/38 = [0, 5 , 2 , 3] are [0], [0, 3], [0, 4], [0,5], [0,5,2], [0, 5 , 2 , 2], [0,5,2,3] (and the highlighted terms are the convergents). When talking about best approximations we used the distance between a fraction p/q and x as a measure of how well it approximated x. However, if the denominator increases, then we should expect better approximations to have smaller distance from x. To take this into account, one could consider the product of the denominator and the distance between the fraction from x as measure of how well it approximates x (i.e. q
∣x − p/q
∣ (^) = |qx − p|).
Definition 4.13. A fraction p/q is a best approximation of the second kind to a real number x if for every fraction a/b with denominator less than or equal to q, we have |qx − p| < |bx − a|.
Theorem 4.14. The convergents to a real number x are precisely all the best approximations of the second kind to x.
Proof. We will only prove part of the theorem here by showing that any fraction which is not a convergent cannot be a best approximation of the second kind to x. Let us assume that a/b is a best approximation of the second kind to x and its not a convergent to x. We’ll further assume that a/b < x and it lies between two convergents pk/qk and pk+2/qk+2 for some k where pk/qk < pk+1/qk+1 (these assumptions are simply to make the proof easier to write and the proof can be modified for all cases).
1 bqk
a b
pk qk
pk+ qk+
pk qk
qkqk+
bqk
qkqk+ =⇒ qk+1 < b