Download Continued Fractions

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
7-4-2008
Continued Fractions
• A finite continued fraction is an expression of the form
1
a0 +
a1 +
1
a2 +
..
.
.
+
1
an−1 +
1
an
It can also be written as [a0 ; a1 , a2 , . . . , an ].
• Finite continued fractions with integer terms represent rational numbers.
• Every rational number can be expressed as a finite continued fraction using the Euclidean Algorithm,
but the expression is not unique.
• The kth convergent of [a0 ; a1 , a2 , . . . , an ] is (the value of) the continued fraction [a0 ; a1 , a2 , . . . , ak ].
• The convergents oscillate about the value of the continued fraction.
• The convergents of a continued fraction may be computed from the continued fraction using a recursive
algorithm. The algorithm produces rational numbers in lowest terms.
Definition. Let a0 , . . . an be real numbers, with a1 , . . . , an positive. A finite continued fraction is an
expression of the form
1
a0 +
1
a1 +
a2 +
.
..
.
1
+
1
an−1 +
an
To make the writing easier, I’ll denote the continued fraction above by [a0 ; a1 , a2 , . . . , an ]. In most cases,
the ai ’s will be integers.
Example.
47
13
1
1
1
1
=2+
=2+
= 2+
.
= 2+
=2+
17
4
1
1
17
17
1+
1+
1+
13
1
13
13
3+
4
4
47
In short form,
= [2; 1, 3, 4].
17
A little bit of thought should convince you that you can express any rational number as a finite continued
fraction in this way. In fact, the expansion corresponds to the steps in the Euclidean algorithm. First,
47 = 2 · 17 + 13
1
17 = 1 · 13 + 4
13 = 3 · 4 + 1
4=4·1+0
Rewrite these equations as
47
13
=2+
17
17
17
4
=1+
13
13
1
13
=3+
4
4
You can get the continued fraction I found above by substituting the third equation into the second,
and then substituting the result into the first.
Since this is just the Euclidean algorithm, I can use the first two columns of the Extended Euclidean
Algorithm table to get the numbers in the continued fraction expansion:
a
q
47
-
17
2
13
1
4
3
1
4
Notice that the successive quotients 2, 1, 3, and 4 are the numbers in the continued fraction expansion.
117
.
17
Example. Find the finite continued fraction expansion for
a
q
117
-
17
6
15
1
2
7
1
2
117
= [6; 1, 7, 2] = 6 +
17
1
1+
.
1
7+
1
2
Lemma. Every finite continued fraction with integer terms represents a rational number.
Proof. If a0 ∈ Z, then [a0 ] is rational.
2
Inductively, suppose that a finite continued fraction with n − 1 “levels” is a rational number. I want to
show that
1
a0 +
1
a1 +
a2 +
..
.
1
+
1
an
an−1 +
is rational.
By induction,
1
x = a1 +
1
a2 +
a3 +
..
.
1
+
an−1 +
is rational.
So
1
a0 +
a1 +
1
an
= a0 +
1
1
x
a2 +
..
.
1
+
an−1 +
1
an
is the sum of two rational numbers, which is rational as well.
Example. The continued fraction expansion of a rational number is not unique. For example,
47
= 2+
17
1
1+
1
=2+
1
3+
1
4
.
1
1+
3+
1
3+
1
1
And in general,
[a0 ; a1 , a2 , . . . , an−1 , an ] = [a0 ; a1 , a2 , . . . , an−1 , an − 1, 1].
I want to talk about infinite continued fractions — things that look like
1
a0 +
1
a1 +
a2 +
1
a3 +
..
3
.
In preparation for this, I’ll look at the effect of truncating a continued fraction.
Definition. The kth convergent of the continued fraction [a0 ; a1 , a2 , . . . , an ] is
ck = [a0 ; a1 , a2 , . . . , ak ].
Note that for k ≥ n, ck = [a0 ; a1 , a2 , . . . , an ].
Example. [1; 2, 3, 2]
c0 = 1
1
3
=
2
2
10
1
=
c2 = 1 +
1
7
2+
3
1
23
c3 = 1 +
=
1
16
2+
1
3+
2
c1 = 1 +
And c4 = c5 = · · · =
23
as well.
16
The next result gives an algorithm for computing the convergents of a continued fraction. It’s important
for theoretical reasons, too — I’ll need it for several of the proofs that follow. For the theorem, I won’t assume
that the ai ’s are integers, since I will need the general result later on.
Theorem. Let a0 , a1 , . . . , an be positive real numbers. Let
p 0 = a0 ,
q0 = 1
p1 = a1 a0 + 1,
q1 = a1
pk = ak pk−1 + pk−2 ,
qk = ak qk−1 + qk−2 ,
pk
Then the k-th convergent of [a0 ; a1 , a2 , . . . , an ] is ck =
.
qk
k ≥ 2.
Proof. First, note that
1
[b0 ; b1 , . . . , bk , bk+1 ] = b0 +
b1 +
= b0 ; b1 , . . . , bk +
1
1
bk+1
b2 +
..
.
1
+
bk−1 +
1
bk +
1
bk+1
by regarding the last two terms as a single term.
Note also that p0 , . . . , pk−1 and q0 , . . . , qk−1 are the same for these two fractions, since they only differ
in the k-th term.
4
Now I’ll start the proof — it will go by induction on k. For k = 0,
c0 = a 0 =
p0
a0
= .
1
q0
And for k = 1,
c1 = a 0 +
a1 a0 + 1
p1
1
=
= .
a1
a1
q1
Suppose k ≥ 2, and assume that result holds through the k-th convergent. Then
ck+1 = [a0 ; a1 , . . . , ak , ak+1 ] = a0 ; a1 , . . . , ak +
1
ak+1
.
pk
, where pk and qk
Now this is the k-th convergent of a continued fraction, so by induction this is
qk
1
(as opposed to [a0 ; a1 , . . . , ak , ak+1 ]). But what are the pk and qk for this
refer to a0 ; a1 , . . . , ak +
ak+1
fraction? They’re given inductively by
pk = (k-th term)pk−1 + pk−2 ,
qk = (k-th term)qk−1 + qk−2 .
1
Now pk−2 , pk−1 , qk−2 , qk−1 are the same for a0 ; a1 , . . . , ak +
and [a0 ; a1 , . . . , ak , ak+1 ], as I noted
ak+1 1
1
at the start. On the other hand, the k-th term of a0 ; a1 , . . . , ak +
is ak +
. So
ak+1
ak+1
ck+1
1
pk−1 + pk−2
ak +
ak+1 (ak pk−1 + pk−2 ) + pk−1
ak+1 pk + pk−1
pk+1
ak+1
=
=
=
.
= 1
ak+1 (ak qk−1 + qk−2 ) + qk−1
ak+1 qk + qk−1
qk+1
qk−1 + qk−2
ak +
ak+1
(The next to the last equality also follows by induction.) This shows that the result holds for k + 1, so
the induction step is complete.
Example. [1; 2, 1, 2, 1]
ak
pk
qk
ck
1
1
1
2
3
2
1
3
= 1.5
2
1
4
3
2
11
8
1
15
11
4
≈ 1.33333
3
11
= 1.375
8
15
≈ 1.36364
11
There is a pattern to the computation of the p’s and q’s which makes things pretty easy. To get the
5
next p, for instance, multiply the current a by the last p and add the next-to-the-last p.
a
p
q
a
p
q
1
2
1
3
1
2
1
2
1
3
1
2
4
3
1
1
2
2
1
1
Fill in the a's, p0 , q0,
p1 , and q1 .
p 2= (1)(3) + 1 = 4
q 2= (1)(2) + 1 = 3
a
p
q
a
p
q
1
2
1
3
1
2
1
2
1
3
2
1
4
11
3
8
1
2
4
11
8
1
15
11
2
1
1
3
p 4= (1)(11) + 4 = 15
q 4= (1)(8) + 3 = 11
p 3= (2)(4) + 3 = 11
q 3= (2)(3) + 2 = 8
Notice that the convergents oscillate, and that the fractions which give the convergents are always in
lowest terms.
Example. [1; 1, 3, 1, 3]
ak
pk
qk
ck
1
1
1
1
1
2
1
2
3
7
4
1
9
5
3
34
19
7
= 1.75
4
9
= 1.8
5
34
≈ 1.78947
19
Again, notice that the convergents oscillate, and that the fractions for the convergents are always in
lowest terms.
I’ll prove that the convergent fractions are in lowest terms first.
Theorem. Let a0 , a1 , . . . , an be positive real numbers. Let
p 0 = a0 ,
p1 = a1 a0 + 1,
pk = ak pk−1 + pk−2 ,
q0 = 1
q1 = a1
qk = ak qk−1 + qk−2 ,
Then
pk qk−1 − pk−1 qk = (−1)k−1 .
6
k ≥ 2.
Corollary. Let a0 , a1 , . . . , an be positive integers. Let
p 0 = a0 ,
q0 = 1
p1 = a1 a0 + 1,
pk = ak pk−1 + pk−2 ,
pk
is in lowest terms.
For k ≥ 1,
qk
q1 = a1
qk = ak qk−1 + qk−2 ,
k ≥ 2.
Proof. pk qk−1 − pk−1 qk = (−1)k−1 = ±1 implies that (pk , qk ) = 1.
Proof of the Theorem. I’ll induct on k. For k = 1,
p1 q0 − p0 q1 = (a1 a0 + 1)(1) − (a0 )(a1 ) = 1 = 11−1 .
Take k > 1, and assume the result holds for k. Then
pk+1 qk − pk qk+1 = (ak+1 pk + pk−1 )qk − pk (ak+1 qk + qk−1 ) = pk−1 qk − pk qk−1 =
− pk qk−1 − pk−1 qk = (−1)k−1 = −(−1)k−1 = (−1)k .
This proves the result for k + 1, so the general result is true by induction.
√
1+ 5
Example. I’ll show later that
(the golden ratio) has the infinite continued fraction expansion
2
[1; 1, 1, . . .]. Here are the first ten convergents:
ak
pk
qk
ck
1
1
1
1
1
2
1
2
1
3
2
1.5
1
5
3
1.66667
1
8
5
1.6
1
13
8
1.625
1
21
13
1.61538
1
34
21
1.61905
1
55
34
1.61765
1
89
55
1.61818
√
1+ 5
1+ 5
≈ 1.61803. In this case, you can see formally that [1; 1, 1, . . .] should be
. Let
In fact,
2
2
1
x =1 +
1
1+
1
1+
1+
√
..
.
Notice that x contains a copy of itself as the bottom of the first fraction! So
1
x = 1 + , x2 = x + 1, x2 − x − 1 = 0.
x
√
√
1± 5
1+ 5
The roots are
. Since the fraction is positive, take the positive root to obtain x =
.
2
2
c 2008 by Bruce Ikenaga
7
Related documents