Download Continued Fraction Notes (Merry Christmas!)

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

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

Document related concepts

Positional notation wikipedia , lookup

Mathematical proof wikipedia , lookup

Law of large numbers wikipedia , lookup

Vincent's theorem wikipedia , lookup

Recurrence relation wikipedia , lookup

Hyperreal number wikipedia , lookup

Georg Cantor's first set theory article wikipedia , lookup

Large numbers wikipedia , lookup

System of polynomial equations wikipedia , lookup

Real number wikipedia , lookup

Factorization wikipedia , lookup

Series (mathematics) wikipedia , lookup

Sequence wikipedia , lookup

Collatz conjecture wikipedia , lookup

Fundamental theorem of algebra wikipedia , lookup

Addition wikipedia , lookup

P-adic number wikipedia , lookup

Proofs of Fermat's little theorem wikipedia , lookup

Elementary mathematics wikipedia , lookup

Transcript
Notes on Continued Fractions
for Math 4400
1. Continued fractions.
The continued fraction expansion converts a positive real number α
into a sequence of natural numbers. Conversely, a sequence of natural
numbers:
a0 , a1 , a2 , a3 , . . .
is converted into a sequence of rational numbers via:
1
1
1
(∗)
a0 , a0 + , a0 +
, ···
1 , a0 +
a1
a1 + a2
a1 + a2 +1 1
a3
Thus, for example, the sequence 3, 7, 15, 1 is converted into:
3
1
22
1
333
1
355
3= , 3+ = , 3+
, 3+
=
1 =
1
1
7
7
106
113
7 + 15
7 + 15+ 1
1
which are excellent approximations of π.
We will find some useful general properties of continued fractions by
replacing numbers a0 , a1 , a2 , a3 , . . . with a sequence of variables:
q0 , q1 , q2 , q3 , . . .
and considering the sequence of rational functions in many variables:
1
q0
q0 q 1 + 1
1
q 0 q1 q 2 + q0 + q 2
q 0 = , q0 +
=
, q0 +
1 =
1
q1
q1
q1 q2 + 1
q1 + q2
Definition. Define polynomials fn and gn by:
q0 +
1
1
q1 + .
. .+ 1
qn
=
fn (q0 , . . . , qn )
gn (q1 , . . . , qn )
(in lowest terms).
Examples. (o) f0 (q0 ) = q0 and g0 = 1.
(i) f1 (q0 , q1 ) = q0 q1 + 1 and g1 (q1 ) = q1 .
(ii) f2 (q0 , q1 , q2 ) = q0 q1 q2 + q0 + q2 and g2 (q1 , q2 ) = q1 q2 + 1.
Proposition 1.
(a) (Each g is an f ) gn (q1 , · · · , qn ) = fn−1 (q1 , . . . , qn ).
(b) (Recursion) fn (q0 , · · · , qn ) = q0 fn−1 (q1 , · · · , qn )+fn−2 (q2 , · · · , qn ).
1
2
Proof. By definition of the polynomials fn−1 and gn−1 , we have:
q1 +
1
1
q2 + .
. .+ 1
qn
=
fn−1 (q1 , . . . , qn )
gn−1 (q2 , . . . , qn )
hence:
q0 +
1
1
q1 + .
. .+ 1
qn
= q0 + 1
fn−1 (q1 ,...,qn )
gn−1 (q2 ,...,qn )
= q0 +
gn−1 (q2 , . . . , qn )
fn−1 (q1 , . . . , qn )
q0 fn−1 (q1 , . . . , qn ) + gn−1 (q2 , . . . , qn )
fn−1 (q1 , . . . , qn )
and the denominator gives us (a), and the numerator gives us:
=
fn (q0 , . . . , qn ) = q0 fn−1 (q1 , . . . , qn ) + gn−1 (q2 , . . . , qn )
which, with gn−1 (q2 , . . . , qn ) = fn−2 (q2 , . . . , qn ) from (a), gives us (b).
Using the recursion, we can get a few more of these polynomials:
Example.
(iii) f3 (q0 , q1 , q2 , q3 ) = q0 (q1 q2 q3 + q1 + q3 ) + (q2 q3 + 1)
= q0 q1 q2 q3 + q0 q1 + q0 q3 + q2 q3 + 1
(iv) f4 (q0 , q1 , q2 , q3 , q4 ) =
= q0 (q1 q2 q3 q4 + q1 q2 + q1 q4 + q3 q4 + 1) + q2 q3 q4 + q2 + q4
= q 0 q1 q 2 q3 q 4 + q0 q 1 q2 + q 0 q1 q 4 + q0 q 3 q4 + q 2 q3 q 4 + q0 + q 2 + q4
Notice that the first term is always the product of all the q’s. In fact:
Euler’s Continued Fraction Criterion:
X q0 · · · qn
X
q0 · · · qn
f n = q0 · · · q n +
+
+ ···
q
q
q
q
q
q
i
i+1
i
i+1
j
j+1
i
|i−j|>1
i.e. the other terms are obtained by removing consecutive pairs of q’s
from the product of all the q’s.
Example.
f 5 = q0 · · · q5 + q2 q3 q4 q5 + q0 q3 q4 q5 + q0 q1 q4 q5 + q0 q1 q2 q5 + q0 q1 q2 q3 +
+q4 q5 + q2 q5 + q2 q3 + q0 q5 + q0 q3 + q0 q1 + 1
Proof. The criterion is true for f0 (q0 ) = q0 and f1 (q0 q1 ) = q0 q1 + 1.
By the recursive formula (b) above:
fn (q0 , . . . , qn ) = q0 fn−1 (q1 , . . . , qn ) + fn−2 (q2 , . . . , qn )
3
By induction, fn−1 and fn−2 may be assumed to satisfy the criterion,
and it then follows from the formula that fn also satisfies the criterion!
Corollary 1. (The palindrome corollary)
fn (q0 , . . . , qn ) = fn (qn , . . . , q0 )
Proof. Euler’s criterion defines the same polynomial when the order
of the variables is reversed.
The most important corollary is now the following.
Corollary 2. (An even better recursion)
fn (q0 , . . . , qn ) = qn fn−1 (q0 , . . . , qn−1 ) + fn−2 (q0 , . . . , qn−2 )
Proof. Using Corollary 1 and Proposition 1 (b), we have:
fn (q0 , . . . , qn ) = fn (qn , . . . , q0 ) = qn fn−1 (qn−1 , . . . , q0 )+fn−2 (qn−2 , . . . , q0 ) =
= qn fn (q0 , . . . , qn−1 ) + fn−2 (q0 , . . . , qn−2 )
This corollary, together with the initial conditions:
f0 (q0 ) = q0 , f1 (q0 , q1 ) = q0 q1 + 1
is going to turn out to be extremely useful.
Back to Numbers. We now apply the polynomial results to continued
fractions associated to natural numbers.
Definition. Given a sequence of natural numbers a0 , a1 , a2 , . . . , let:
(a) An := fn (a0 , a1 , . . . , an ) and (b) Bn := gn (a1 , . . . , an ) = fn−1 (a1 , . . . , an )
Gathering together what we have done with polynomials, we have:
Proposition 2. (a) The sequence of rational numbers (*) coming from
the sequence of natural numbers a0 , a1 , a2 , . . . is:
A0
a0 A1
a0 a1 + 1 A2 A3
= ,
=
,
,
, ...
B0
1
B1
a1
B2 B3
(b) The numbers An and Bn satisfy the Fibonacci-like rule:
An = an An−1 + An−2 and Bn = an Bn−1 + Bn−2 for n ≥ 2
Proof. (a) is from the definition, and (b) follows from Corollary 2.
Example. Taking the sequence 3, 7, 15, 1 again, we have:
A0 = 3, A1 = 22, A2 = 15 · 22 + 3 = 333, A3 = 1 · 333 + 22 = 355
B0 = 1, B1 = 7, B2 = 15 · 7 + 1 = 106, B3 = 1 · 106 + 6 = 113
giving the sequence of rational approximations to π that we saw earlier.
4
Another Example. Take the sequence 1, 1, 1, 1, . . . . We have:
A0 = 1, A1 = 2, A2 = 2+1 = 3, A3 = 3+2 = 5, A4 = 5+3 = 8, . . .
B0 = 1, B1 = 1, B2 = 1+1 = 2, B3 = 2+1 = 3, B4 = 3+2 = 5, . . .
which are two copies of the Fibonacci sequence offset by one.
The associated sequence of rational numbers:
3 5 8 13 21
1, 2,
,
,
,
,
,...
2 3 5
8
13
√
converges pretty rapidly to the golden mean φ = (1 + 5)/2.
2. Convergence. We now have some powerful tools for analyzing the
sequence of rational numbers that arise from a continued fraction.
Proposition 3. Let a0 , a1 , a2 , . . . be a sequence of natural numbers,
and let An and Bn be the natural numbers from Proposition 2. Then:
(a) Each quadruple of numbers An , Bn , An+1 , Bn+1 satisfies:
An+1 Bn − An Bn+1 = (−1)n
(b) Each pair (An , Bn ) is relatively prime so An /Bn is in lowest terms.
(c) If the sequence a0 , a1 , a2 , . . . is infinite, then there is a limit:
An 1
1
An
= α and each α −
<
< 2
lim
n→∞ Bn
Bn
Bn Bn+1
B
n
Proof. We prove (a) by induction. First of all:
A1 B0 − A0 B1 = (a0 a1 + 1) − a0 a1 = (−1)0 = 1
Using Proposition 2 (b), we have:
An+2 Bn+1 −An+1 Bn+2 = (an+2 An+1 +An )Bn+1 −An+1 )(an+2 Bn+1 +Bn )
= An Bn+1 − An+1 Bn = (−1)(An+1 Bn − An Bn+1 )
which proves it. Then (b) follows directly from (a), since any common
factor of An and Bn would be a factor of (−1)n . Finally, for (c), we
notice that (a) also gives us:
An+1 An
(−1)n
−
=
Bn+1 Bn
Bn Bn+1
which means that the differences of consecutive terms in the sequence:
A0 A1 A2 A3
,
,
,
, ...
B0 B1 B2 B3
are alternating in sign and decreasing to zero. This implies that the
sequence has a limit, and that the limit is between any two consecutive
terms, which gives (c).
5
Example. The sequence 1, 2, 2, 2, . . . gives:
A0 = 1, A1 = 3, A2 = 7, A3 = 17, A4 = 41
B0 = 1, B1 = 2, B2 = 5, B3 = 12, B4 = 29
which give rational numbers:
A0
A1
A2
A3
A4
= 1,
= 1.5,
= 1.4,
≈ 1.417,
≈ 1.414
B0
B1
B2
B3
B4
√
that alternate above and below 2, and seem to converge to it.
Getting to the point (finally) which is to convert α into ai ’s.
Case 1.
r0
is a rational number > 1 in lowest terms
r1
Apply the Euclidean algorithm to the (relatively prime) pair (r0 , r1 ):
r2
r0
= a0 +
r0 = a0 r1 + r2 ;
r1
r1
r1
r3
r1 = a1 r2 + r3 ;
= a1 +
r2
r2
..
.
rn−1
1
rn−1 = an−1 · rn + 1;
= an−1 +
rn
rn
rn = an · 1 + 0; rn = an
But the right column gives us:
1
1
1
α = a0 + r1 = a0 +
1 = · · · = a0 +
1
a1 + r2
a1 + .
r2
r3
.. 1
a
+ 1
α=
n−1
an
which exactly tells us that
r0
An
=
r1
Bn
for the (finite!) sequence a0 , a1 , . . . , an of natural numbers.
α=
Bonus! From Proposition 3(a), we get: r0 Bn−1 − r1 An−1 = (−1)n−1
which tells us precisely how to solve the equation:
r0 x + r1 y = 1
with integers (x, y).
6
Example. α = 61/48.
61 = 1 · 48 + 13
48 = 3 · 13 + 9
13 = 1 · 9 + 4
9=2·4+1
4=4·1+0
The algorithm terminates with an output of: 1, 3, 1, 2, 4. Rebuilding:
A0
1 A1
4 A2
5 A3
14 A4
61
= ,
= ,
= ,
= ,
=
B0
1 B1
3 B2
4 B3
11 B4
48
gives the bonus equation 61 · 11 − 48 · 14 = −1.
Case 2.
α > 1 is irrational.
In this case there is no Euclidean algorithm, but we may define:
• [α] is the round down of α to the nearest integer, and
• {α} = α − [α] is the fractional part of α.
Then we get an infinite sequence of natural numbers a0 , a1 , a2 , . . . :
1
1
, letting a0 = [α] and α1 =
α1
{α}
1
1
α1 = a1 + , letting a1 = [α1 ] and α2 =
α2
{α1 }
1
1
etc.
α2 = a2 + , letting a2 = [α2 ] and α3 =
α3
{α2 }
Claim. The sequence of rational numbers {An /Bn } coming from the
sequence {an } converges to the number α that we started with.
α = a0 +
Proof of Claim. From the definitions above, we have:
1
1
1
α = a0 +
= a0 +
= ···
1 = a0 +
α1
a1 + α2
a1 + a +1 1
2
α3
and our polynomial results tell us that:
fn+1 (a0 , . . . , an , αn+1 )
α=
fn (a1 , . . . , an , αn+1 )
which, by Corollary 2, tells us that:
αn+1 fn (a0 , . . . , an ) + fn−1 (a0 , . . . , an−1 )
αn+1 An + An−1
=
α=
αn+1 fn−1 (a1 , . . . , an ) + fn−2 (a1 , . . . , an−1 )
αn+1 Bn + Bn−1
An
But it is easy to check that this number is between B
and
n
since this is true for all n, it follows that α is the limit!
An−1
,
Bn−1
and
7
3. Periodic Continued Fractions. A purely periodic continued
fraction is associated to a sequence of natural numbers of the form:
a0 , a1 , . . . , an , a0 , a1 , . . . , an , a0 , a1 , . . . , an , . . .
If we let:
An
n→∞ Bn
α = lim
then we get:
α = a0 +
1
a1 + . 1
. .+
1
1
an + α
from which we may conclude, as in the proof of the claim above, that:
αAn + An−1
α=
αBn + Bn−1
so α is a root of the quadratic equation:
Bn x2 + (Bn−1 − An )x − An−1 = 0
and one can solve for α with the quadratic formula.
Examples.
(i) Expansions of the form:
a, a, a, a, a, . . .
give α = a + 1/α so α is a root of the equation x2 − ax − 1 = 0 and
since α > 1, we conclude that:
√
a + a2 + 4
α=
2
√
(a) When a = 1 we get the golden mean, α = (1 + 5)/2.
√
(b) When a = 2k is even, we get α = k + k 2 + 1 so:
√
k, 2k, 2k, 2k, . . . is the expansion for k 2 + 1
(ii) Expansions of the form:
2k, k, 2k, k, . . .
give α which is a root of: 0 = B1 x2 + (B0 − A1 )x − A0 = k(x2 − 2kx − 2)
and therefore:
√
√
2k + 4k 2 + 8
= k + k2 + 2
α=
2
Thus it follows that:
√
k, k, 2k, k, 2k, . . . is the expansion of k 2 + 2
8
(iii) Expansions of the form:
2k, 1, 2k, 1, 2k, 1 . . .
give α which is a root of x2 − 2kx − 2k = 0, so:
√
√
2k + 4k 2 + 8k
α=
= k + k 2 + 2k
2
p
√
and square roots k 2 + 2k = (k + 1)2 − 1 have expansions:
k, 1, 2k, 1, 2k, . . .
(iv) Expansions of the form:
2k, 2, 2k, 2, 2k, . . .
give α which is a root of 2(x2 − 2kx − k) = 0 so:
√
√
2k + 4k 2 + 4k
α=
= k + k2 + k
2
√
and square roots of the form k 2 + k have expansions:
k, 2, 2k, 2, 2k, . . .
Question. Which α > 1 have purely periodic continued fractions?
We know each such α is an irrational root of a quadratic equation.
Definition. Suppose ax2 + bx + c = 0 is a quadratic equation, and
b2 − 4ac is not a perfect square
Then we will say that the roots are a conjugate pair (α, α).
Example. (a) If b2 − 4ac < 0, then α, α are complex numbers and
they are conjugates in the ordinary sense.
√
√
(b) The conjugate of the golden mean α = (1 + 5)/2 is (1 − 5)/2.
√
√
(c) The conjugate of k (when k is not a perfect square) is − k.
Theorem. The α > 1 with purely periodic continued fractions:
(i) Are irrational numbers, which
(ii) Are roots of a quadratic ax2 + bx + c = 0 with a, b, c ∈ Z and
(iii) Have a conjugate root α that satisfies −1 < α < 0.
Example. Any α of the form:
√
α = k + k 2 + m with 0 < m ≤ 2k
is irrational, a root of the quadratic
equation: x2 − 2kx − m = 0 and
√
has conjugate root α = k − k 2 + m < 0 satisfying −1 < α < 0.
9
4. Pell’s Equation. We seek a solution to an equation of the form:
x2 − dy 2 = 1
where d > 0 is a natural number that is not itself a perfect square.
√
√
Strategy. Such a solution satisfies (x − y d)(x + y d) = 1 hence:
√
x √
1
1
1
√
√ < 2
x−y d=
and 0 < − d =
y
y
x+y d
y(x + y d)
√
Such good approximations of an irrational ( d) by a rational (x/y)
are precisely what continued fraction√
expansions produce. For example,
the continued fraction expansion of 7 is
2, 1, 1, 1, 4, 1, 1, 1, 4, . . .
and the associated sequence of rational numbers:
2 3 5 8
, ,
,
,...
1 1 2 3
satisfy, respectively:
22 − 7 · 12 = −3
32 − 7 · 12 =
2
52 − 7 · 22 = −3
82 − 7 · 32 =
1
and (8, 3) is a solution to Pell’s equation.
√
A more involved example is 13, whose expansion is:
3, 1, 1, 1, 1, 6, 1, 1, 1, 1, 6, . . .
producing the sequence:
3 4 7 11 18
, , , , ,
1 1 2 3 5
which satisfy:
32 − 13 · 12
42 − 13 · 12
72 − 13 · 22
112 − 13 · 32
182 − 13 · 52
= −4
=
3
= −3
=
4
= −1
and although (18, 5) only solves x2 − 13y 2 = −1, we know how to
convert that to a solution to Pell’s equation by squaring:
√
√
√
(18 − 5 13)2 = (324 + 25 · 13) − 180 13 = 649 − 180 13
giving the solution (649, 180).
10
Proposition 4. Let:
a0 − k, a1 , . . . , an , a0 , a1 , . . . , an , . . .
√
be the continued fraction expansion of k 2 + m (m ≤ 2k).
Then either:
(a) n is even, and:
A2n − (k 2 + m) · Bn2 = −1
or else
(b) n is odd, and:
A2n − (k 2 + m) · Bn2 = 1
In the latter case, Pells’ equation is solved, and in the former:
√
√
(An − Bn k 2 + m)2 = (A2n + (k 2 + m)Bn2 ) − 2An Bn k 2 + m
solves it with the pair (A2n + (k 2 + m)Bn2 , 2An Bn ).
√
Proof. α = k + k 2 + m has periodic expansion:
√
a0 , , a1 , . . . , an , a0 , . . . , an , . . .
k 2 + m. Then:
αAn + An−1
(β + k)An + An−1
β=
=
αBn + Bn−1
(β + k)Bn + Bn−1
from which it follows that β is a root of the polynomial:
Let β =
Bn x2 − (kBn + Bn−1 − An )x − (kAn + An−1 ) = 0
√
But β = k 2 + m, so β is a root of the polynomial:
x2 − (k 2 + m) = 0
and it follows that:
(i) kBn + Bn−1 − An = 0 and
(ii) kAn + An−1 = (k 2 + m)Bn .
Multiplying (i) through by An gives us:
kAn Bn + An Bn−1 − A2n = 0
and Proposition 3(a) gives us An Bn−1 = An−1 Bn + (−1)n−1 hence:
kAn Bn +An−1 Bn +(−1)n−1 −A2n = (kAn +An−1 )Bn −A2n +(−1)n−1 = 0
and then (ii) gives:
(k 2 + m)Bn2 − A2n = (−1)n
which is exactly what we needed to prove.
11
Final Remarks. Our examples from §3 give us the following expansions:
√
k 2 + m (k, m)
expansion
√
2
(1, 1)
1, 2
√
3
(1, 2)
1, 1, 2
√
5
(2, 1)
2, 4
√
6
(2, 2)
2, 2, 4
√
7
(2, 3)
not from the examples
√
8
(2, 4)
2, 1, 4
10
(3, 1)
3, 6
11
(3, 2)
3, 3, 6
12
(3, 3)
3, 2, 6
13
(3, 4)
not from the examples
14
(3, 5)
not from the examples
15
(3, 6)
3, 1, 6
√
√
√
√
√
√
and while these expansions are predictable, the others are mysterious:
√
(1) 7 has expansion 2, 1, 1, 1, 4
(2)
√
13 has expansion 3, 1, 1, 1, 1, 6
(3)
√
14 has expansion 3, 1, 2, 1, 6
and some really long periods appear for small numbers. For example:
√
46 has expansion 6, 1, 3, 1, 1, 2, 6, 2, 1, 1, 3, 1, 12
leading to an enormous smallest solution to Pell’s equation of (24335, 3588).