• Tidak ada hasil yang ditemukan

The Euclidean Algorithm and Continued Fractions

Dalam dokumen Elementary Methods in Number Theory (Halaman 32-40)

A First Course in Number Theory

1.3 The Euclidean Algorithm and Continued Fractions

Letaandbbe integers withb≥1. There is a simple and efficient method to compute the greatest common divisor of a and b and to express (a, b) explicitly in the form ax+by. Define r0 =a and r1 =b. By the division algorithm, there exist integersq0 andr2such that

r0=r1q0+r2

and

0≤r2< r1.

If an integer ddivides r0 andr1, thendalso dividesr1 and r2. Similarly, if an integer ddividesr1 andr2, thendalso dividesr0and r1. Therefore, the set of common divisors ofr0 andr1is the same as the set of common divisors ofr1andr2, and so

(a, b) = (r0, r1) = (r1, r2).

Ifr2= 0, thena=bq0and (a, b) =b=r1. Ifr2>0, then we divider2into r1 and obtain integersq1 andr3such that

r1=r2q1+r3, where

0≤r3< r2< r1

and

(a, b) = (r1, r2) = (r2, r3).

Moreover,q11 sincer2< r1. If r3 = 0, then (a, b) =r2. If r3>0, then there exist integersq2and r4 such that

r2=r3q2+r4, whereq21 and

0≤r4< r3< r2< r1 and

(a, b) = (r2, r3) = (r3, r4).

Ifr4= 0, then (a, b) =r3.

Iterating this process k times, we obtain an integer q0, a sequence of positive integersq1, q2, . . . , qk1, and a strictly decreasing sequence of non- negative integersr1, r2, . . . , rk+1such that

ri−1=riqi−1+ri+1 fori= 1,2, . . . , k, and

(a, b) = (r0, r1) = (r1, r2) =· · ·= (rk, rk+1).

Ifrk+1>0, then we can divide rk byrk+1 and obtain rk=rk+1qk+rk+2,

where 0≤rk+2< rk+1. Since a strictly decreasing sequence of nonnegative integers must be finite, it follows that there exists an integer n≥1 such that rn+1 = 0. Then we have an integer q0, a sequence of positive inte- gersq1, q2, . . . , qn−1, and a strictly decreasing sequence of positive integers r1, r2, . . . , rn with

(a, b) = (rn, rn+1) =rn.

Thenapplications of the division algorithm producenequations r0 = r1q0+r2

r1 = r2q1+r3

r2 = r3q2+r4 ...

rn−2 = rn−1qn−2+rn rn−1 = rnqn−1. Sincern< rn+1, it follows thatqn12.

This procedure is called the Euclidean algorithm. We call n the length of the Euclidean algorithm for a and b. This is the number of divisions

1.3 The Euclidean Algorithm and Continued Fractions 19 required to find the greatest common divisor. The sequenceq0, q1, . . . , qn1

is called the sequence of partial quotients. The sequence r2, r3, . . . , rn is called thesequence of remainders.

Let us use the Euclidean algorithm to find (574,252) and express it as a linear combination of 574 and 252. We have

574 = 252·2 + 70, 252 = 70·3 + 42,

70 = 42·1 + 28, 42 = 28·1 + 14, 28 = 14·2, and so

(574,252) = 14.

The sequence of partial quotients is (2,3,1,1,2) and the sequence of partial remainders is (70,42,28,14). The Euclidean algorithm for 574 and 252 has length 5. Note that 574 = 14·41 and 252 = 14·18, and that 41 and 18 are relatively prime. Working backwards through the Euclidean algorithm to express 14 as a linear combination of 574 and 252, we obtain

14 = 4228·1

= 42(7042·1)·1 = 42·270·1

= (25270·3)·270·1 = 252·270·7

= 252·2(574252·2)·7 = 252·16574·7.

Let a0, a1, . . . , aN be real numbers with ai > 0 for i = 1, . . . , N. We define thefinite simple continued fraction

a0, a1, . . . , aN=a0+ 1 a1+a 1

2+ 1

... 1

aN−1 + 1 aN

.

Another notation for a continued fraction is a0, a1, . . . , aN=a0+ 1

a1+ 1 a2+· · · 1

aN

.

The numbersa0, a1, . . . , aN are called thepartial quotientsof the continued fraction. For example,

2,1,1,2= 2 + 1 1 +1+11

2

= 13 5 .

We can write a finite simple continued fraction as a rational function in the variablesa0, a1, . . . , aN. For example,

a0=a0,

a0, a1=a0a1+ 1 a1

, and

a0, a1, a2= a0a1a2+a0+a2

a1a2+ 1 . IfN 1, then (Exercise 5)

a0, a1, . . . , aN=a0+ 1 a1, . . . , aN.

We can use the Euclidean algorithm to write a rational number as a finite simple continued fraction with integral partial quotients. For example, to represent 574/274, we have

574

252 = 2 + 70 252

= 2 + 1

3 +4270

= 2 + 1

3 +1+128 42

= 2 + 1

3 +1+11 1+ 1428

= 2 + 1

3 +1+11 1+ 12

= 2,3,1,1,2.

Notice that the partial quotients in the Euclidean algorithm are the partial quotients in the continued fraction.

Theorem 1.6 Let a and b be integers withb 1. If the Euclidean algo- rithm foraandbhas lengthnwith sequence of partial quotientsq0, q1, . . . , qn−1,

then a

b =q0, q1, . . . , qn−1.

Proof. Letr0=aandr1=b. The proof is by induction on n. Ifn= 1, then

r0=r1q0

and a

b = r0

r1 =q0=q0. Ifn= 2, then

r0 = r1q0+r2, r1 = r2q1,

1.3 The Euclidean Algorithm and Continued Fractions 21

and a

b =r0

r1 =q0+r2

r1 =q0+ 1

r1

r2

=q0+ 1

q1 =q0, q1.

Let n≥2, and assume that the theorem is true for integers aand b 1 whose Euclidean algorithm has length n. Let a and b 1 be integers whose Euclidean algorithm has lengthn+ 1 and whose sequence of partial quotients isq0, q1, . . . , qn. Let

r0 = r1q0+r2 r1 = r2q1+r3

...

rn−1 = rnqn−1+rn+1

rn = rn+1qn.

be then+ 1 equations in the Euclidean algorithm fora=r0 and b=r1. The Euclidean algorithm for the positive integers r1 and r2 has length n with sequence of partial quotientsq1, . . . , qn. It follows from the induction hypothesis that

r1 r2

=q1, . . . , qn and so

a b = r0

r1

=q0+ 1

r1

r2

=q0+ 1

q1, . . . , qn =q0, q1, . . . , qn. This completes the proof.2

It is also true that the representation of a rational number as a finite simple continued fraction is essentially unique (Exercise 8).

Exercises

1. Use the Euclidean algorithm to compute the greatest common divisor of 35 and 91, and to express (35,91) as a linear combination of 35 and 91. Compute the simple continued fraction for 91/35.

2. Use the Euclidean algorithm to write the greatest common divisor of 4534 and 1876 as a linear combination of 4534 and 1876. Compute the simple continued fraction for 4534/1876.

3. Use the Euclidean algorithm to compute the greatest common divisor of 1197 and 14280, and to express (1197,14280) as a linear combina- tion of 1197 and 14280.

4. Compute the simple continued fraction 2,1,2,1,1,4 to 4 decimal places, and compare this number toe.

5. Prove that

a0, a1, . . . , aN=a0+ 1 a1, . . . , aN. 6. LetN 1. Prove that

a0, a1, . . . , aN2, aN−1,1=a0, a1, . . . , aN−2, aN1+ 1.

7. Let x=a0, a1, . . . , aN be a finite simple continued fraction whose partial quotients ai are integers, with N 1 and aN 2. Let [x]

denote the integer part ofxand{x} the fractional part ofx. Prove that

[x] =a0

and

{x}= 1 a1, . . . , aN.

8. Let ab be a rational number that is not an integer. Prove that there exist unique integersa0, a1, . . . , aNsuch thatai1 fori= 1, . . . , N− 1,aN 2, and

a

b =a0, a1, . . . , aN1, aN. Hint:By Exercise 7, if

x=a0, a1, . . . , aN=b0, b1, . . . , bM withai, bjZandaN, bM 2, thena0= [x] =b0. 9. Prove that

a0, a1, . . . , aN, aN+1=a0, a1, . . . , aN + 1 aN+1. 10. Leta0, a1, . . . , aNbe a finite simple continued fraction. Define

p0=a0, p1=a1a0+ 1, and

pn =anpn1+pn2 forn= 2, . . . , N . Define

q0= 1, q1=a1,

1.3 The Euclidean Algorithm and Continued Fractions 23 and

qn=anqn−1+qn−2 forn= 2, . . . , N . Prove that

a0, a1, . . . , an=pn qn

forn = 0,1, . . . , N. The continued fraction a0, a1, . . . , an is called thenthconvergentof the continued fractiona0, a1, . . . , aN. 11. Compute the convergents pn/qn of the simple continued fraction

1,2,2,2,2,2,2. Compute p6/q6 to 5 decimal places, and compare this number to

2.

12. Let a0, a1, . . . , aNbe a finite simple continued fraction, and let pn

andqn be the numbers defined in Exercise 10. Prove that pnqn1−pn1qn= (1)n−1

and forn= 1, . . . , N. Prove that if ai Zfor i= 0,1, . . . , N, then (pn, qn) = 1 for n= 0,1, . . . , N.

13. Let a0, a1, . . . , aNbe a finite simple continued fraction, and let pn

andqn be the numbers defined in Exercise 10. Prove that pnqn2−pn2qn = (1)nan

forn= 2, . . . , N.

14. Let x = a0, a1, . . . , aN be a finite simple continued fraction, and let pn and qn be the numbers defined in Exercise 10. Prove that the even convergents are strictly increasing, the odd convergents are strictly decreasing, and every even convergent is less than every odd convergent, that is,

p0

q0

<p2

q2

< p4

q4

<· · · ≤x≤ · · ·p5

q5

<p3

q3

< p1

q1

.

15. We define a sequence of integers as follows:

f0 = 0, f1 = 1,

fn = fn−1+fn−2 forn≥2.

The integerfn is called thenthFibonacci number. Compute the Fi- bonacci numbersfn for n = 2,3, . . . ,12. Prove that (fn, fn+1) = 1 for all nonnegative integersn.

In Exercises 16–23,fn denotes thenth Fibonacci number.

16. Compute the convergents pn/qn of the simple continued fraction 1,1,1,1,1,1,1. Observe that

pn qn

=fn+1 fn

forn= 0,1, . . . ,6.

17. Prove that

f1+f2+· · ·+fn=fn+21 for all positive integersn.

18. Prove that

fn+1fn1−fn2= (1)n for all positive integersn.

19. Prove that

fn=fk+1fn−k+fkfn−k−1 for allk= 0,1, . . . , n. Equivalently,

fn = fn1+fn2= 2fn2+fn3

= 3fn−3+ 2fn−4= 5fn−4+ 3fn−5· · ·. 20. Prove thatfn dividesfn for all positive integers . 21. Prove that, forn≥1,

fn+1 fn

fn fn−1

=

1 1 1 0

n

.

22. Let

α= 1 + 5 2 and

β= 1−√ 5 2 . Prove that

fn= αn−βn

5 for alln≥0.

Prove that

fn αn

5 asn→ ∞ and

fn≥αn−2 forn≥2.

Dalam dokumen Elementary Methods in Number Theory (Halaman 32-40)