* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Continued Fractions in Approximation and Number Theory
Law of large numbers wikipedia , lookup
History of trigonometry wikipedia , lookup
Mathematics of radio engineering wikipedia , lookup
Non-standard calculus wikipedia , lookup
Chinese remainder theorem wikipedia , lookup
Georg Cantor's first set theory article wikipedia , lookup
Mathematical proof wikipedia , lookup
Vincent's theorem wikipedia , lookup
Pythagorean theorem wikipedia , lookup
Karhunen–Loève theorem wikipedia , lookup
Nyquist–Shannon sampling theorem wikipedia , lookup
Quadratic reciprocity wikipedia , lookup
Central limit theorem wikipedia , lookup
List of important publications in mathematics wikipedia , lookup
Elementary mathematics wikipedia , lookup
Brouwer fixed-point theorem wikipedia , lookup
Four color theorem wikipedia , lookup
Continued fraction wikipedia , lookup
Wiles's proof of Fermat's Last Theorem wikipedia , lookup
Î 1 i 1 1 Continued Fractions in Approximation and Number Theory CONTINUED FRACTIONS IN RATIONAL APPROXIMATIONS AND NUMBER THEORY by DAVID C. EDWARDS Thesis for Kaster of Science Department of Mathematics McGill University @ David C. üiwards lm January 1971 TABLE OF CONTENTS INTRODUCTION. i PART I. 1 Some Basic Results 1. Definitions, Notations, and the Basic Formulas 2 2. Convergence of Continued Fractions with Unit 6 Numerators 3. Simple Continued Fractions 10 4. The Fibonacci Numbers 14 5. Miscellaneous Results 16 PART II. 6. 7. Applications to Rational Approximations Best Approximations to Real Numbers 19 1- Introduction and Motivation 19 2. The Main Theorems 21 3. A Restatement 30 Hurwitz's Theorem and Related Results PART III. 18 Applications to Number Theory 32 37 8. The Number of Steps in the Euc1idean A1gorithm 38 9. Periodic Simple Continued Fractions 40 ,fD 49 10. The Expans ion of 11. The PeU Equation 12. The SolvabUity of 54 x 2 - Dy 2 = -1 60 CONCLUSION. 65 BIBLIOGRAPHY. 67 INTRODUCTION This thesis surveys the elementary theory of continued fractions and discusses in detail some important applications of continued fractions to the theory of rational approximations to real numbers and elementary number theory. Chapters 1 to 5 introduce continued fractions and their basic properties, and provide the results on which the following chapters are based. Chapters 6 and 7 develop the elementary theory of rational approximations, culminating with Hurwitz's Theorem, and using continued fractions as the fundamental tool. The approach is essentially that of Khintchine [4], Sections l and II, but the theorems are stated and proved in greater detail, an attempt is made to clearly motivate the definitions, and some closely related results from [6], Chapter 7, are included. Chapters 8 to 12 investigate closely the applications of continued fractions to the Euclidean Algorithm and to the Pell Equation 2 2 x -Dy = N. This involves a thorough examination of periodic continued fractions, in particular the simple-continued-fraction expansion of a positive nonsquare integer). Perron [8], Ol~s .rD (D being The material is drawn primarily from [7], and Niven and Zuckerman [6]. As far as l have been able to discover, the bound on the period given in Theorems 9.4 and 10.1 is an original result, although admittedly a minor one. Theorems 12.2 to 12.4 (from Perron [8]) are significant and fairly deep results, rarely found in discussions of continued fractions or the Pell Equation. i ii Most recent texts on number theory treat the theory of continued fractions fleetingly, or with a single application in mind ; in contrast, an attempt has been made in this survey to demonstrate the richness and wide applicability of the theory. -1- PART l SOME BASIC RESULTS -2- Chapter 1. Let DEFINITIONS, NOTATIONS, AND THE BASIC FORMULAS. F be a field. (al' b , a , b 3 , a ,···) 2 2 3 F such that, for each A continued fraction in F is a sequence of an odd or infinite number of elements of n?2, each denominator in the following composite fraction is not zero : (1) b _ n 1 +---~a The fraction (1) is called the and denoted by c c n = a1 + bn an nth convergent of the continued fraction, It is usually written in the more convenient form n + n-l b - a b 2 2 + a b 3 3 + +a (2) n n Additionally, the first convergent is If the sequence is finite, say cl = al . (al' b 2 , a 2 ,··· ,bm' am) where m > 1 , then the continued fraction is called a finite continued fraction, and its value is defined to be the 1ast convergent, c m . If the sequence is infinite, then we have an infinite sequence of convergents c ,c ,c .•. , 1 2 3 and (assuming a metric on convergent or divergent in F) the continued fraction is said to be F according as ~cn exists or not in In the former case, the limit is taken as the value of the continued F. -3- fraction. Normally When F is the real field. b2 , b3 ,··· are all 1 , the continued fraction is said to have unit numerators, and we use the notation (al' l, a 2 , l, a 3 , ••• ) = (3) [al' a 2 , a 3 ,···] For a finite or convergent continued fraction, we often use the same notation for the continued fraction and its value. c n = [al' a ,···,a ] 2 n Thus we write for the convergents of a continued fraction with unit numerators. A continued fraction [al' a , ••• ] , with unit numerators and 2 infinitely many terms, is said to be periodic with period exist m>O and t>l n>m, such that for al1 a +t n t = an if there We write (4) The least period any period for any t 0 is called the fundamental period. t = k t +r, where t , for i f not, let 0 0 divides is the 1east period. then ; 0 therefore 0 t 0 0 < r< t n>m , we have a n = a n+t = a n+k t +r = a n+r a period, contradicting that t is r The continued fraction is said to be purely periodic if it is possible to take m = 0, i.e. = (5) Given a continued fraction, it is desirab1e to have a systematic method for expressing each convergent such a method is to consider c n c n as a simple fraction as a function of a n Now p Iq n if we simplify (1) starting at the lower right and working upwards, we find n -4- That C a • is a quotient of 1inear functions of n where p = k nn a n and s a r e independent of n = kn r = a + land n = r nn a n + s , and k , l ,r n n n n k, l , r , s n n n n (i.e. n q ln fact, suppose n depend on1y on (an + b n+ 1 /a n + 1 + ln n (an + b n+ 1 /a n+ 1 ) + sn (k a + l ) a + + k b + n 1 n n 1 n n n (r a + s ) a + + r b + n 1 n n n n n 1 = p a + k b n n+1 n n+1 q a + r b n n+1 n n+1 Thus we can take and c n+1 p - p n+2 - Noting that n+1 is a1so a quotient of 1inear functions of the same argument to where and q Pn+1 -- Pn a n+1 + k n b n+ 1 c n+ 1 ' we therefore have c n+ 2 = q n a n+1 +r n b n+1 a + . App1ying n 1 = Pn+2/ Qn+2' a n+1 n+2 + Pnbn+2 and cl = (1.a 1 + 0) / (0.a 1 + 1) and using induction, we c1early have the fo11owing theorem : Theorem 1.1 The convergents (al' b 2 , a 2 , b 3 , a 3 ,···) are cl' c ' .•. of the continued fraction 2 c n = pn /q n , where p n and q n are defined as fo11ows : Pl = al ' q1 P2 = a la2 =1 + b2 , q2 = a2 p -ap +bp n - n n-l n n-2 (n ? 3) (6) Q =aq +bq n n-1 n n-2 (n ? 3) (7) n ' -5- Theorem 1. 2. Fo11owing the notation of the previous theorem, n Pnq n-1 - pn- 1q n = (_l)n e -e n n-1 = e -e n n-2 = (-1) n 1i i=2 b.1 (n ? 2) (8) (n ? 2) (9) (n ? 3) (10) n bi i=2 qnqn-1 n-1 a (-1) n-1 1i b n i=2 i qnq n-2 1i Proof: true for n = 2. Assume (8) for n-1. Mu1tip1ying (6) by q and (9) fo11ows fram (8) by dividing by q q 1. n n- n-1 (8) is proved. Using (9), e -e 2 n n- n-1 (e n-e n- 1) + (e n- 1 - e n- 2) = a (-1) n n-1 n-1 TC b . 2 i 1= ~ (-1) n-1 1i i=2 qn-1 b. ( ------- sinee by (7), 1 b - -b q + q n n+2 n n + 1 qn qn-2 = a nq n-1 . ) = 1/ = -6- CONVERGENCE OF CONTINUED FRACTIONS WITH UNIT NUMERATORS. Chapter 2. From now on, a11 continued fractions will be assumed to have unit numerators. For the present chapter at 1east, this restriction is not serious, because it is c1ear that any continued fraction with nonzero numerators can he converted to an equiva1ent (i.e. same convergents) continued fraction with unit numerators. A1so, for definiteness, we sha11 work in the rea1 field. Introducing q = 0 = p-1 and q-1 = 1 = Po ' it may he checked that formulas (6) and that is va1id for n = 0 and 1 , assuming (8) and o (7) of Chapter 1 are a1so va1id for hi = 1 n=l and 2, for a11 i. For the continued fraction (1) (where a ,a ,a , ... are any real numbers) , the formulas of Chapter 1 1 2 3 therefore become : cn = [a 1 ,a 2 ,··· ,an] Pnq n-1- Pn-1q n = (-1) c -c n c -c n Remark: If n-l = n-2 = (_l)n = Pn/qn n (n ? 1) (2) (n ? 1) (3) (n ? 1) (4) (n ? 0) (5) (n ? 2) (6) (n ? 3) (7) a , a , ••• are positive, then (1) is a valid continued 2 3 fraction (since all denominators are positive), although not necessarily -7- convergent, and induction on (3) shows that Theorem 2.1 Let ql' q2' .•• are positive. a , a , •.• be positive real numbers. 2 3 Then the odd- numbered convergents of (1) form a strictly increasing sequence, the even-numbered convergents form a strictly decreasing sequence, and every odd-numbered convergent is less than every even-numbered one ; (1) is convergent if and only if (r) limqq 1=00 n n- n -+ 00 Proof: and (7). The first three assertions follow immediately from formula (6) It is then clear that (1) is convergent if and only if c 2n - c 2n- l -+ 0 (equivalently, equivalent to (8). Corollary: If c2n+l-c2n -+ 0 ), which, by (6), is Il x = [a ,a , •.. 1, where l 2 a , a , ... > 0, then 2 3 x lies strictly between any two consecutive convergents (except the last two if the continued fraction is finite). The following important theorem provides a convenient necessary and sufficient condition for convergence. Theorem 2.2 Let a , a , ••• be positive real numbers. 3 2 if and only if the series Then (1) converges 00 ~ n=l a n (9) is divergent. Proof: The proof uses the well known result that if 0 < t < 1 , then the n 00 ~ (l-t) is convergent (i.e. has a positive limit) if and only if n=l n -8- co L t is convergent. n=l n hence (a) qn- 1 < qn N such that Suppose (9) converges. a a n < 1 if n n?N, > N. For By (3), ~O, n therefore there exists (3) gives qn < a nq n + qn2- , i.e. q n < q n- 2/(1-a) n , in case (a), and qn < a nq n- 1 + q n- 1 < qn- l/(l-a) n in case (b). Therefore q n < ( r = n-1 or n-2) • Repeated application of this resu1t gives r, ••• ,s,t such that n>r> ... >A?R t = N-1 or N-2, and q n qt < (10) (l-an )(l-ar ) .•. (l-as ) co ~ (l-a ) = L > 0 ; the denominator of (10) exceeds L , therefore i i=N 1etting M be the larger of qN-l and qN-2' we have qn < M/L (n?N) , Now hence qn+lqn < ~/L2 , so that (1) diverges, by Theorem 2.1. Conversely, suppose (9) diverges. (n even) and qn>qn-2 > •.• > ql (n odd). gives q > q n - n- 2 + ca qn + qn-l (0)2). n- Let Now (3) gives qn > qn- 2> •.. >q2 c = max (ql,q2). Then (3) Therefore ? qn-2 + qn-3 +c ( a n + a n- 1) ? qn-4 + qn-S + c ( a n +an-l +an-2 +an-3 ) - --- > ?t n L + q1 + c i=3 n q1 +q 0 +c > c Sn , L i=2 where Sn a.1 (n even) ai (n odd) n = L a.1 2=3 ' -9- 1 qu' qn-1 exceeds '2 c Sn' The other is at 1east c , hence qnqn-1 > C 2 S By assumption, S -+ co , n n 2 therefore (1) converges, by Theorem 2.1. Il Therefore at 1east one of Theorem 2.3. Let a , a , •.• be positive rea1 numbers and let n>1 . The 3 2 continued fraction is convergent if and on1y if (1) is convergent. to values x If (1) and (11) converge and m respective1y, then n (12) Proof: (By theorem 2.1, H > a > 0 for n n The resu1t is trivial for n = 1. For n n > 2, hence (12) is a = 2, (13) = or 1 c -a r Now if (11) converges to ~ (14) 1 , then ~ +0 as noted, and taking 1imits in (13) shows that (1) converges to a +1/m = [a ,m ] ; if (1) converges 2 1 2 1 to x , then (x-al +0 by Theorem 2.1) taking 1imits in (14) shows that (11) converges, and again (12) ho1ds. if [a , a , ••• ] 2 3 For n?3, (1) converges if and on1y does, and, assuming the theorem for n-1, the latter converges if and on1y if (11) converges; a1so, using the theorem for 2 and n-1, -10- Chapter 3. SIMPLE CONTlNUED FRACTIONS. A simple continued fraction is one of the form [a ,a ,a , ... ], l 2 3 is any integer and a ,a , ..• are positive integers. In the where 2 3 following chapters we shall be concerned primarily with this special type of continued fraction. For a stmple continued fraction, the numbers p ,q n are n integers, and furthermore it is clear fram (3) of Chapter 2 that lim q q 1 = 00 , therefore n- 00 n nby Theorem 2.1 any simple continued fraction is convergent; this also In particular, 00 follows fram Theorem 2.2, since a Z n=l Theorem 3.1 Proof: By The integers are relatively prime for any and q (5) of Chapter 2, any common divisor of (_l)n , therefore Theorem 3.2 Pn' qn =00. n Let (p , q ) n x n =1 n. divides n Il . be any real number. Then (finite or infinite) simple continued fraction is the value of the x [al' a ,···], where 2 ai are defined inductively as follows ( [x] denotes the integral part of x) al = [x] 1 The induction terminates with a n if a i +l if m n = [mi +l ] (1) . is found to be an integer; n+l, we have a >1 n If no m. 1 i8 an integer, the continued fraction is infinite. Proof: It is clear that the process can be continued as long as remaina nonintegral, and yields integers al' a , .•• with 2 m. 1 a ,a , ..• positive. 2 3 -11- Furthermore, if Mi_l-a _ < 1. i l = ai (i ? m.(iFl) ai = mi > 1, since is an integer then It remains to show that x = [a ,a , ••. ] • 1 2 + 1/mi + l , therefore it is c1ear by induction that x 0) • If the process (1) terminates with m n = an Now mi = [a1,a2, .•. ,ai,mi+l] , this proves If it does not terminate, formula (6) of Chapter 2 gives 1 x-c Theorem 3.3 rational. x = [al' The value of any finite simple continued fraction Converse1y, x = [al' a 2 ,··· ,an] , where al'··· ,an r = al s = a 2r l + r s + rI r 2 s, r rand (0 < rI < (0 < r 2 < rI) s s) (2) n-3 The first assertion is obvious. equations of (2) by is (r,s integers, s > 0) , then the if x ="rls are the quotients in the Euclidean algorithm for 1 ,···, L r resu1ting 1eft hand side, by ml' tœ same as in Theorem 3.2. Theorem 3.4 where the 1 qiq i+l Il a 2 ,·.·]· procedure in Theorem 3.2 gives Proof: 1 = Hence 1 x-co 1 < l/qi'" 0 , 1. prime refers to [al,···,a , m + ] • i 1 i therefore i 1 n- 2' r ~, n- For the second, divide the 1 respectively, and denote the •.. , mn Clear1y mi and a.1. Il The representation of any irrational number as a simple are -12- Any rational number is the value of continued fraction is unique. exactly two simple continued fractions, and these are of the form Proof: Let x be irrational and suppose x = [al' a , .•. ]. This 2 continued fraction must be infinite, for otherwise x would be rational. ·To prove uniqueness, it is sufficient to prive that integers as given by the procedure of Theorem 3.2. because 1etting and mi+1 > 1. mi = [ai' a i + 1 ,···] we have Now let (finite or infinite). x Let n But this is clear, ml = x , mi = a i +1/m i +1 ' be rational and suppose x = [b , b , ... ] 2 1 Let x = [al' a 2 , ••• , anI (an> 1 if n FI), e.g. the expansion given by Theorems 3.2 and 3.3. induction on are the same that [b ,b 2 , ••• ] is [a ,a ,.··,a ] l l 2 n We sha1l prove by or [a ,a 2 ,··· ,a _ ,l]. n 1 1 m (possib1y infinite) be the number of terms in [b ,b , •.. ] 1 2 For n = 1, x = al is an integer, and we consider 3 cases : ( i) m= 1 b l = x = al as required. + 1/b , therefore b = 1 , and 2 2 1 [b , b ] = [a - 1 , 1 ] as required 1 2 1 (iii) m > 2 : b < x < b + 1/b ' contradicting that x 1 1 2 (ii) m = 2 x = b Therefore this case does not occur. and we have and m? s , b1 < x ~ b l For n>1, fo110ws by app1ying the resu1t for Proof: is not an integer + 1/ b 2 ~ b 1 + 1 , therefore b =[x] = al' 1 1/(x-b ) = [b , b , .•• ] = [a , ••• ,a ] ; 3 2 n l 2 Corol1ary: x is an integer. n-l. now the required resu1t Il The value of any infinite simple continued fraction is irrationa1. The value cannot be rational, since the on1y expansions of a -13- rational number are the two finite ones mentioned in the theorem. Il -14- Chapter 4. THE FIBONACCI NUMBERS. In this chapter we consider some elementary properties of the Fibonacci numbers and the closely related [1,1,1, ••• ]. s~le continued fraction This continued fraction plays a special role in later chapters. Let t [1,1,1, ••• ] • denote the value of Clearly t=l+l/[l,l, ..• ] = l+l/t , Le. t Solving 2 _ t - 1 =0 • (1) (1) for the positive root, we find t J"s = 1+ 2 s 1 = -l-J"s = - o. 618 ••. = - -t 2 -.- = 1.618 ... (2) the other root is Formulas (2) and (3) pn- p~1 + p~ 2 ' q n ql = q2 = 1. of Chapter 2, applied to = q~ 1 + q~ 2· Furthermore Now the Fibonacci numbers F F 1 n = F 2 (3) [1, 1, l, ... ] , give Po = P1 = 1 and FI' F 2 , F3' .. · are defined by = 1 = F n-l (4) + F n-2 Therefore we have (5) and the convergents of [1, 1, l, •.. ] are ratios of consecutive Fibonacci -15- It is important to know how quick1y the Fibonacci numbers grow with increasing n • and the same for Therefore for any s. From (1) we note that t n = t n-1 + t n-2 n n H = at + bs n b which resu1t in a and b, satisfies H =H +H ; solving for a and n n-1 n-2 = F , H = F ) , we get a = -b = Ho = 0, Hl = 1 (Le. H0 01 1 l/.fs . Therefore H = F and we have proved the very interesting formula n n (ca11ed Binet's Formula) F n = - 1 ( 1 - J"s)n ) 2 ( ( .fs (6) It follows that Hm n ~oo = - 1 (7) .fs so that F , F , ••• approxtmates a geometric progression. In fact, it l 2 is the nearest integer to tn,.fs. is clear from (6) that F n The fo11owing theorem shows that the denominators of the convergents of any simple continued fraction increase at 1east as fast as the Fibonacci numbers. Theorem 4.1. Proof: q 1 For any simple continued fraction, q > n - F n • = 1 = F1 q n- 1 > - F n- I ' we have q n = a nqn- 1 + q n- 2 > - q n- 1 + qn- 2 > - Fn- 1 + Fn- 2 = F. n Il -16- Chapter 5. MISCELlANEOUS RESULTS. Here we mention some miscellaneous theorems which will be used in later chapters, but which either are not of general interest or are weIl known elementary results. Theorem 5.1. expansions of x > 1 and consider the stmple continued fraction Let x and l/x. is the reciprocal of the Proof: If For (n-l) st convergent of x = [al' a 2 ,···] , then primed quantities refer to Theorem 7.15. Theorem 5.2. x l/x = [ 0, l/x x. al' a 2 ,···]· Letting l/x , and using (2) and (3) of Chapter 2, , one can verify by induction that the result follows. n ? , the nth convergent of Pn = qn-l' qn Details may be found in =P n- l ' from which [6], Il Let a , a , .•. be positive real numbers and assume that 2 3 = [al' a 2 ,···] F O. Denote [an' an+l""] by mn • Then for n? 1, 1 (1) = [ a , a l " ' " al' - 1: ] n Proof: n- x (Note: in the course of the proof, it must be shown that (1) is indeed a valid continued fraction, i.e. has no zero denominators.) For n = 1 , [al' - its value is 1 i] is a valid continued fraction (since x ; 0) and al - x , which, by Theorem 2.3, is assume that the result for mn -11M 2 , For n? 2 , n-l , i.e. = -1 (an_l,···,al,-l/x ] (2) -17- Now [an' .•• ,al' -l/x] assomption therefore is a valid continued fraction since by [a _ , ••• ,a , -l/x] is. n 1 l -l/Mn+l = an [an' ••• ,al' -l/x]. - mn By Theorem 2.3, mn = an + l/[an _ l ,··· ,al,-l/x] = [an ,mn+1]' = // We sha1l have occasion to use some results from elementary number theory. If p is an odd prime and cal1ed a quadratic residue of x 2 1. s: a p ~ 0 (mod p) , then if there exists x a is such that (mod p). -1 is a quadrat ic res idue of 2 is a quadratic residue of 2. a p if and only if p if and only if p if and only i f p lE 1 (mod 4). p le 1 or 7 (mod 8). p == 1 or 3 (mod 8). -2 is a quadratic residue of If N is a sum of two relatively prime squares, then N is a product of primes of the form 4k +1 or twice such a product. A proof of 1. may be found in Result 2. is proved in [9], Chapter 5, Section 2. [2], Chapter 20. (The converse of 2. is also true). -18- PART II APPLICATIONS TO RATIONAL APPROXIMATIONS -19- Chapter 6. 1. BEST APPROXIMATIONS TO REAL NUMBERS. Introduction and Motivation. This first section is meant to motivate and c1arify the definitions of best approximation of the first and second kind. Given a rea1 number x , it is natural to look for a rational number which is a good approximation to is "not too large". x More precisely, and a positive integer ~ satisfying : (1) 1 1 ~ 8 ~ N , we have b ~ x (Problem A) given a real number N, to find a11 pairs of integers a, b N , and (2) for any integers 'x-a/bl < Ix-rlsl . exists, and if one pair easily be found, since and yet whose denominator a, b cId Definition. Rational number r, s Clear1y at least one such pair is known, the others c, d must equa1 a/b (b > 0) a/b approximation of the first kind to x with (if any) can or 2x - a/b. is 8aid to be a best if 1 ~ d ~ b, cId + a/b imply 1 x - cId 1 > J x - a/b 1 • The relation of this definition to Problem A is indicated by the fo1lowing e1ementary propositions. Proposition. Any best approximation solution of Problem A for some Proof: For rIs Suppose = cId 1 < s < d. - - cId of the first kind i8 a N ,namely N = d. Ix-c/dl < Ix-rlsl . We must show that this is tmmediate, while for rIs + cId it follows from the definition of best approximation of the first kind. Proposition: Except for the case N= 1 and 1 Il x = n +2 (n an integer), -20- any solution a, b of Problem A with minimum b of the first kind to Proof: Then (by Suppose min~lity Rence t/b a x. 1 < d < b = Ix-a/bl Ix-c/dl and cid (since of b) ,and c x + a/b ,but Ix-c/dl 5 Ix-a/bl. =b a, b satisfies Problem A) , d is the average of differ by l , for if t a/b and c/b is strictly between = cid. C, a and wou1d be a better approximation to x • Without loss of generality, assume (r is a best approximation + 0, and then for otherwise x =a a/b = S/l, c =a hence + 1. b =1 a = qb+r, O<r<b Write by minima lit y of + 1/2, contrary to assumption.) lt is easily b, checked that q exceeds a/b but not approximation as (b-l) + r b-1 (a+l)/b, therefore is at least as good an a/b, contradicting the minima lit y of Il b. lt may be noted that the situation is simplified if x is irrational : then clear1y any solution of Prob1em A is a best approx~tion of the first kind. Proposition: Exclude the case approx~tion a/b N =1 , x of the first kind with =n + 1 2. Then any best 1 < b < N and such that b is maxÛDWD, is a solution of Problem A • Proof: If a, b is not a solution of Problem A, let solution with minimum d. preceding proposition, cId We have c, d lx - c/df < lx - a/bl. be a Now by the is a best approximation of the first kind, -21- therefore by maxima1ity of of a/b b , we have being a best approximation, d < b. But then by definition Ix-c/dl>1 x - a/bl ,contradicting Il the first inequa1ity. Thus (disregar.ding the trivial case of Prob1em A for genera1 N = 1, x = n +21 ), solution N is equiva1ent to knowing a11 the best approximations of the first kind to x. For some purposes it is desirab1e to consider the difference Ibx-al rather than lx - a/bl. This 1eads to a second king of best approximation, as fo11ows : Definition. Rational number a/b approximation of the second kind imp1y (b>O) to x is said to be a best if 1 < d < b, cId F a/b Idx-cl > Ibx-al. Theorem 6.1. Any best approximation of the second kind is a1so one of the first kind. Proof: Mu1tip1ying Idx-cl > Ibx-al by 1/d > lIb gives Ix-c/dl>lx-a/bl, Il as required. Examp1es are readi1y found to show that the converse of Theorem 6.1 is fa1se. e.g. let x = 5/12 - e , where 0 < e < 1/60 ; then 1/3 is a best approximation of the first kind but not of the second, since it may be verified that 2. 12x - 11 < 13x - 11 • The Main Theorems. We shal1 see that the convergents of the simple continued fraction expansion of x provide a very convenient means of finding al1 the best approximations of the first and second kind to x. We continue to use -22- the notation of Chapter 2 (formulas (1) to (7»: x = [a 1 ,a2 , ..• ] is a finite or infinite simple continued fraction, with convergents c n = [a 1 ,a 2 , .•• ,a n ] = pn Iq. n We begin by examining the difference between the continued fraction and its convergents. Theorem 6.2. If x has at 1east 1 x - cn 1 Proof: c n n + 2 terms, then By the coro11ary to Theorem 2.1, and therefore of Chapter 2). there are on1y x lies strict1y between = (formula (6) Il (1) n + 1 terms, for then n + 1 terms, then Theorem 6.3. (1) Ix-c n 1 < Ic n-c n+1 1 It shou1d be noted that 1east 1 < Let m = n is rep1aced by an inequa1ity if x = c n +1 • Thus, if x has at lx - c 1 < 1/q q +1 • n - n n Then [a n , a n+ 1 ,· •.] (_1)n+1 x - cn = (2) qn-1 qn2fmn+1 + qn Proof: x = = Il (al'· .. ,an ,mn+ Pnmn+1 + Pn-1 qnmn+1 + q n- 1 ) -23- Using this expression for x , we find that Pn-1q n - PnQn-1 = x - + 2 Qn mn+1 and (2) fo11ows by use of formula Theorem 6.4. If x has at 1east QnQn-1 (5) of Chapter 2. Il n + 1 terms and its 1ast term (if there is one) is not l , then 1x Proof: Comparing 1 - cl> n (2). and (3) (3), it is sufficient to prove that this becomes mn+1 < an+1 + l , which is c1ear1y true. Theorem 6.5. Let (if any) not 1. x have at 1east n + 2 Il terms, with the 1ast term ~hen: (4) Therefore by Theorem 6.4, Ix-cnl > 1/qnqn+2 Iqn x - pl> n 1 But, as noted after Theorem 6.2, (5) Ix-cn+11 < 1/qn+1qn+2' 1 fo11ows fram i.e. (6) qn+2 (4) Le. (5) and (6). Il -24- Corollary: c + n l any convergent c n of Except for the convergents is closer to x [ al' 1, 1 ] , than the preceding convergent ,Le. (7) 1 x - c ni> 1 x - c n+1 1 • Proof: (i) (ii) formula (7) If there are only n + 1 terms then If there are only n + 2 terms, then x = c + ' n 2 of Chapter 2, = 1 x - cn also, 1 x - c n +l 1 therefore (7) = 1, a 2 = 1, a n 3 =1 = 1; terms, this means that (iii) and a = 1 a n+2 qn+l > qn • is equivalent to (equality only if n and using 2 = 1), hence (7) i8 false only for sinee the present case is assuming only x = If there are n+2 [al' 1, 1 ] , i.e. the exception noted. n + 3 terms or more, we can absorb any final unit into the second to last term, therefore we always have by Theorem 6.5. Assuming Multiplying by b median value) of a/b and and d l/~? l/qn+l gives (7). (4), Il positive, the mediant (also called the cId is defined to be is, as one can trivially ver if y, strictly between (a+c) 1 (b+d) , and a/b and cId if -25- the latter are distinct. Consider the fractions Pn + ip~+l ( 0 qn + iqn+l We observe that the first of these is < i < a n+2 ) • cn' the last is (8) c n+2 ' and each after the first is the mediant of the preceding one and The fractions (8), other than the first and last, are Pn+l/qn+l' called intermediate fractions (or secondary convergents) of the continued fraction. The reason for introducing intermediate fractions is the following result : every best approximation of the first kind to x is either a convergent or an intermediate fraction of the simple continued fraction expansion of x. Since the proof is somewhat long, but not difficult, and the result will not be needed in what follows, we shall omit the proof ; it may be found in [4], § 6, Theorem 15. As will be shawn, every convergent is a best approximation of the first kind ; however, this is not true of every intermediate fraction. For best approximationrof the second kind, a much sharper result (presented in the next two theorems) is true, and this constitutes the main reason for considering best approximations of the second kind. Theorem 6.6. If there exists n > 1 Proof: Let L< a/b ~ is a best approximation of the second kind, then such that a/b = cn • be the number of terms in the given continued fraction. For the purposes of this proof, " c, d gives a coni.radiction " will mean that 1 ~ d ~ b, that a/b cId + a/b ,and 1 dx-c 1 ~ 1 bx-a l , is a best approximation of the second kind. thus contradicting We shall have -26- occasion to use the fact that for any integers e/f F g/h implies le/f - g/hl ? l/fh; e, f, g, h (f,h positive), this follows since leh-fgl is not zero, hence at least 1. If al' 1 L = 1, then = al = cl x gives a contradiction. = cl' a/b = Ibx-al for otherwise L > 2. Therefore assume Ix-aIl < Ix-a/bl < b Ix-a/bl we have ,and If a/b < cl' " so tbat al' 1 gives a contradiction. a/b > c If 2 ' then > Ix-.! b Le. b al> x ; therefore contradiction. Thus, assuming cl < a/b < c and = cL. (i) (ii) For some L n? l ,a/b is finite, and We note that if al' 1 aga in gives a is not equal to any convergent, ; also, a/b F x , for otherwise x is rational 2 Therefore we are clearly in one of two cases we have a/b a/b 1 > ajb ajb is strictly between is strictly between is strictly between c r and c n c n+ . 2 and c _ L 1 and cL=x . c r +1 ' then _1_< bq therefore r qr+l < b • In case (ii), therefore, qL < b; also, !qLx-PLf =0 , hence -27- PL' qL gives a contradiction. (i), we show that In case Now is a1so strict1y between a/b Furthermore, a/b g ives a contradiction. Pn+1' qn+1 c and n c n+ 1 ' hence qn+1 < b. is c1ear1y at 1east as close to c + n 2 as it is to x , so that 1x - ~ i.e. But Iqn+1 x - Pn+1 1 = > b 1 b qn+2 1 1 bx - al> qn+1 J x - c n+ 1 1 < 1/qn+2 Iqn+1 x - Pn+11 ~ Ibx_al. Therefore (from Theorem 6.2). Il Assume that the continued fraction used for Theorem 6.7 have a > 1 as a 1ast terme Let n = l, there are at 1east 2 terms, and 2. n = l, and the fraction is Pn/qn does not n? l, and exc1ude the fo110wing cases : 1. Then the convergent x a 2 =1 • [al' 2]. is a best approxLmation of the second kind (and hence a1so of the first kind). Remarks: then c (i) Iq nx - Pn 1 ~ qn-1 ~ qn' ' each being (H) In case therefore n>2 , and the 1ast term is - a n+1 =1 ; is not a best approx Lmat ion of the second kind ; Pn/qn c n-1 1: n Suppose Cl = a1/1 and (since x = c n+1) , 1qn- l x- pn- 11 = 1/qn+1· l, or 2, above, we have is not a best approxLmation of the first or second -28- kind (al + 1) /.1 ) • (by comparison with Proof of Theorem 6.7: continued fraction. then pn /qn - x Let m< Let ~ be the number of terms in the First of aIl, we can assume = 1, integer and v by 1 vx is equiva1ent to 2, .• . ,q 1. - u vx-t Letting ~ u ~ F attain a min~ of aIl e1ements of "Cu , v) o 0 where Define a function . n (u, v) t u vx + t ; v may be any F with domain X F , F(u,v) < t be any value of is bounded, therefore on1y a finite (and nonzero) number of e1ements hence n =m , and the resu1t is immediate. X be the set of aIl pairs F(u,v) = n < m, for if (u, v) satisfy at one of these e1ements. F(u, v) < t M be the set Let X at which this minUmwo is attained, and let be an e1ement of with 1east M v 0 Then we have 1. II. For aIl If F(u,v) > F(u , v ) . in X, (u, v) - 0 F(u,v) < F(u ,v), then (u, v) - 0 0 is in M , and 0 v>v - 0 We a1so c1aim the fo11owing III. If is in M , then u (u, v ) o Once III is proved, it will fol1ow that x, for if then II gives and III gives d = v o To prove III, suppose vx-ul=lvx-u o 0 0 u IV o 0 1 < d < v of the second kind to - and F(c,d) < F(u ,v ) , i8 in M, but (u, v ) o - 0 0 u ~ u . o Then land x = Ivox-u0 1 ~ 0 is a best approxLmation = uo c u+u a180, = uo 0 , hence 1 v0x 2 v - u 0 o o 1= (u + u ) 1 2 - u /1 1 > l o 0 - 2 ; -29- is rational, so x 2v m is finite and are relatively prime, for suppose 0 then Iqx - pl =o< 2v 0 0 q < v k>2 ; - = qm ; qm > 1 shows that therefore = l, (hence also n is in and o = kq , and X u+u 0 - Pm ' I~l x - Pm-ll = qm-l l cm-cm_ll Now therefore II gives a contradiction ~l vo > ,2v Therefore, < v o • Now 2vo ~l if we can show that > 2, m- m > 2. l , = kp u+u (p, q) 1/2 < 1 v ox - u 0 - Now u + u 0 Ivox-u 0 1 contradicts I. = l/~ = 1/2vo < assumed a so that 0 = cm x = am ~l + qm-2 unless a = m) since we dismissed n m ; =2 and we m=2 and this case was excluded, therefore III is proved. Theorem 6.6 now shows that there exists u /v 00 = c. s If and II gives Thus, u o u = kp and v q > v , so that k 0 - = ps 0 ,v 0 = qs =1 n which is false by definition of q s recalling + q <q s+l - n-l =1 1qx-pl < 1v x - u 1 ,then and such that - u ,v o 0 0 0 are relatively prime. • We complete the proof by showing that Since we excluded the case hence = kq 0 s > 1 + q n ; and X. a = l, 2 Suppose using 1, n < s leads to s < n ; then s q n = n. <q s s + 1 < n , Theorems 6.2 and 6.4, and n <m 1 > 1 qnx-p n 1 > 1 q s x-p s 1 1 >---- > 1 qs~s+l Therefore q n+l < q n + q n- l ' which is false since Il -30- 3. A Restatement. The results proved in this section are closely re1ated to Theorems 6.6 and As demonstrated by Niven and Zuckerman convenient to use. their 6.7, but are in a form which is sometimes more [6] in Theorem 7.13, tbey may a1so be proved direct1y without using our Theorems 6.6 and 6.7. Theorem 6.8. at 1east Proof: Let n > 1 and assume that the fraction used for n + 1 terms. We can assume b > 0, Ib~-al < Iqnx-Pnl imp1y Then a and b re1ative1y prime, for if b = kd , (c, d) = 1 , we could app1y the theorem to therefore If If c, d n = 1 and [al' S] , we have If m=n+2 a into m for qn+1 + qn > qn+l· n = l, a Fina11y, if 2 a b m = and the theorem still gives m = n + 1, we can assume = 1 bas been treated) ; an+l a ? q n+1 = (a n +1+1) qn + qn-l = fo11owing the statement of Theorem 6.7, therefore absorbing m-1 m and , absorbing a n+2 into a n+ 1 ' we get (where , primes refer to the nev fraction) , qn+1=1. A1so, we can assume that the continued fraction does not - the case d~n+1' lb -al >1 = Iq x - Pli , cont.radicting the x - 2 1 m>n + 3 we can absorb qn+1 • = kc , b? 2 = qn+1 have 1 as a 1ast term, for suppose the number of terms is ? b~n+1. to get and a 2 = l, the resu1t is trivial, since then n = 1 and the fraction is assumption. b has b? qn+l. otherwise b = 1 If a x ioto an' as indicated n > 1 (since in Remark (i) Iqn_Ix-Pn_l' = 'qnx - Pn' ; we have q n = (a n+1) qn-l + q~2 = qn + qn-l = qn+l • , b? q n' but 1. -31- Thus, Theorem 6.7 gives that A1so, a/b F p Iq n n the second kind. since = 1) (a, b) which is fa1se. , therefore (otherwise b < q - n b > qn' This shows is a best approximation of Pn/qn lbx -al Iq nx-p n 1 lb -al > Iq nx-p n 1 x implies Suppose = b < qn+1' , Then a/b is not a convergent, hence by Theorem 6.6 it is not a best approximation of the second kind. Thus there exist 1dx-c 1 ~ 1bx-al . c, d (c, d) = 1, and a Fc and 1< 1a- c 1 ~ 1dx- cl + 1bx-al ~ but except in the case ~ ~/qn+1 ~ We c1aim that = 1, a 2 = 1, Ibx-al < Iq x-p 1 n n- and d > q ,then Now if and 1 '2 ' n n cId such that 21 bx-al l<d<b, a/b F cId, d =b , hence 1bx-al >.! - 2 d F b, for 1 ~ f < d, is contradicted. Therefore n unti1 we eventua11y obtain rIs, rIs F Pn/qn) 1east n Let terms. n ,(r,s) = 1, , contradicting that Therefore Pn/qn b? qn+1' and 1 sx-r Il b > 0, Exclude the case n = 1, a 2 = 1. Then has at b > qn . n + 1 terms, since the resu1t is empty for b < q ,mu1tip1ying the given inequality by this gives - n fbx-af < Iqnx-Pn' ,therefore contradiction, since ~+1 < is a best x Proof: Assume at 1east If - n > 1 and assume that the fraction used for Ix-a/bl < Ix-p n Iq n 1 tmp1y terms. - e/f , This process may be continued 1 < s < q approximation of the second kind. Coro11ary: d < b . is not a best approximation of the second kind (e,f) = 1, Ifx-el ~Idx-cl . Iqnx-Pnl (hence ; which has been treated) Iq x - pnl n Idx-cl < Iq x-p l , so that by the same argument, we get n gives b? qn+1 ' by the theorem. > qn' Il This 1s a n -32- Chapter 7. HURWITZ' S THEOREM AND REIATED RESULTS. 2 q +1 :< q ,Theorem 6.2 shows that n - n Since and therefore for any irrationa1 number many rationa1s a/b b 2 n < l/q n , there exist infinite1y 2 Ix-a/bl < 1/b . such that the possibi1ity of rep1acing x 1x - c 1 Let us now consider by some other function of More specifica11y, for how large a value of k can b 2 b. be rep1aced by kb 2 Investigation of this prob1em 1eads to the striking resu1t, first proved by Hurwitz in 1891 ( [3] , using Farey sequences rather than continued fractions), that k J5, can be as large as however, we sha11 examine the easier case Theorem 7.1. Exc1ude the case where n Given any two consecutive convergents c k =1 n but no 1arger. First, = 2. and the fraction is [a ,1,1] . 1 and at 1east one of the fo110wing two inequa1ities i8 true 1 x - cn 1 < (1) 1 (2) 2 2q n+1 Proof: x - lx - c n 1 Now lies between c 1= and l/q q - lx - c l . n n+l n x - c n +l ' < 2 2 l/ab - 1/2a < 1/2b Le. a j: b. n But c n+1' therefore Assuming Ix-c n+1 (1) false, 1 = Ic n+1 -c 1 n we obtain 1 (3) is equivalent to 2ab-b qn+l ~r q n ' proving (2), un1ess 2 2 < a , i.e. (a-b) n = land 2 > 0, ? -33- and clearly one of case the fraction 1s true unless (1), (2) must be [al' l, 1] Since this case was Given any irrational number rational numbers a/b Proof: If x, there are inf1nitely many such that 1 x - a/b 1 < Theorem 7.2. 1 +"2 ' 1n wh1ch Il excluded, the theorem is proved. Corollary: x = al (4) We can assume holds, then b > o. (4) 1 2 2b 1s a convergent. a/b Given (4), we prove that best approximation of the second k1nd to x; 1s a a/b the des1red result then follows by Theorem 6.6. Suppose 1 < d <b cId f a/b; and we must prove (5) 1dx- cl> 1bx- al· By (4), it 1s enough to show dx-c ....! < I~ - .! 1 < db - d b - c x - -d a + 1 x - -b < c x-d +....!.... 2 2b < c x-d +ibd Therefore Le. 1 x-~I d 1 1dx - cl> l/2b. Theorem 7.3. If 1 > db - 2db > l/2b . 1 1 .. =- 2db Il k > ,,; , then there 1s an irrat10nal number x -34- (for example x = (1 + ../5) /2) such that a 1x - b <_l_ 2 kb (6) is true for only a finite number of rational numbers Proof: Let numbers a/b. = (1 +../5) / 2 and let Fl,F2,F3' .•• be the Fibonacci x 1,1,2, ••• As was shawn in Chapter 4, x = [l, l, l, ••• ] and By Theorem 6.3, 1 x - c But n x + Fn- l/F n ~ x + 11x for all 1 = 1 = Therefore ../5 (7) • k >J5 implies that n sufficiently large, lx - cl> l/kq2. But k > &, hence n n 2 by Theorem 7.2, if lx - albl < l/kb then alb is a convergent. /1 Therefore the theorem is proved. In preparation for proving the next theorem, we introduce some notation m n = [an' an+l'···] qn-2 n = qn-l w = u +m n n n u We observe that mn 1 un+ l Therefore 1 un+ l (n ? 1) (8) ? a) (9) (n > a) (10) (n = a n + l/mn+l' and qn = + qn-l 1 mn+l = an qn-l + qn-2 = a n +un qn-l = wn ( n>_ ) (11) -35- and a 1 = n - u (n n ?' (12) 2) The formula proved in Theorem 6.3 becomes 1 1 x - cn 1 = Lemma: Let un+1 > ( n > S. J5 - From w ~.rs n (13) w + ~.rs n 1 and 1 ) 1 2 . Proof: Using (11) , we have Therefore = 1 Mu1tip1ying by u + n 1 and comp1eting the square, ( u + n 1 1 u + n 1 2 J5 1 < 4 -Z ) ~J51 < "2 2 J5 ?'"2 - 1 2 un+1 un+1 But it follows that 1 = .fs-1 2 is rational, therefore the 1emma is proved. Theorem 7.4. Let n > 1 n + 2 terms. Then the inequa1ity and assume that 1 x - c.1 1 < = { al' x n + 3 a , .•• 1 has at 1east 2 1 is true for at 1east one of the three values Proof: We can assume at 1east Il (14) i =n , i =n terms, for otherwise + l, i (14) =n + 2 is true -36- for i =n + 2. Then by (13), lemma, u > ( i Assume J5 w ~ i J5 - (14) = n+2, (i 2 J"s-l which is false. Corollary: i. = n+l, n+2, n+3) , therefore by the (i 1)/2 false for aIl three values of - n+3). But then J"s-l = 1 -2- (12) gives , Il Given any irrational number many'rational numbers a/b such that x, there are infinitely -37- PART III APPLICATIONS TO NUMBER THEORY -38- Chapter 8. THE NUMBER OF STEPS IN THE EUCLIDEAN ALGORITHM In this chapter we prove an elementary yet significant result concerning the Euclidean algorithme The ease of the proof is a good illustration of the power of the theory of continued fractions. Let r, s algorithm for s > O. be any integers, with rand Consider the Euclidean s l. r = a 2. s = a r + r 2 l 2 3. rI 1 s + rI = a 3r 2 < rI < s ) ( 0 ( 0 < r 2 < rI ) < ( 0 + r3 r 3 < r 2 ) n-l. n Here, n > 1 notation is called the number of steps, and we shaii use the E (r,s) = n • As shawn in Theorem 3.3, continued fraction expansion of [al' a , ••• ,a ] 2 n rIs, and (if is the simple > n 1) a >2 • n - Therefore we can write r s Using to Fi = an - 1 ' l ] for the Fibonacci numbers and letting (1), we have (Theorem 4.1) qn+l? Fn+1 - s therefore n + 1 < m, i.e. E (r,s) < m - 2. ? Fn+l . Now suppose s < F therefore m Pi But (1) and qi refer rIs = Pn+l/qn+l s < F , Fn+ 1 < m This proves the foilowing Then -39- theorem : Theorem 8.1. r Let FI = 1, F2 = l, ••• is any integer and 0 < s < F m Euclidean algorithm for rand a = F (m--ll's) , hence E(Fm, Fm--1) Example 2. Let m--l r = 18, s , then the number of steps in the s and Example 1. Taking be the Fibonacci numbers. If is at most r m--2. = Fm , we have = m-2. = Il. Il is between the Fibonacci numbers = 8 and F7 = 13, hence the theorem predicts E( 18,11 ) < 7-2 = 5. In fact, E (18,11) = 5 : - F6 18 = 1.11 +7 11 = 1.7+4 7 = 1.4 + 3 4 = 1.3 + 1 3 = 3.1 -40- PERIODIC SIMPLE CONTINUED FRACTIONS Chapter 9. Periodic simple continued fractions have many interesting and useful properties, due primarily to the fact that a continued fraction is periodic if and only if it represents a quadratic irrational. This striking result was first proved by Lagrange in 1770. the simple-continued-fraction expansion of .JD where In particular, D is a positive nonsquare integer) provides the key to the solution of Pellls equation x 2 2 - Dy =~ l, to be discussed in later chapters. By a quadratic irrational we mean a number of the form where A and B are rational numbers nonsquare integer. and B =F = E). JO The conjugate of x =x y hence also x -1 = A + IWD y = E + = x -1 ) ~ 0) and JO = E + F B A+ BJD, JO, =E and consequently ls def ined to be FJO, then A / (B-F) , =F =x then x + y x =A - IWD. + y and ; in other words, the operation of taking the conjugate is an automorphism of the field field of elements D is a positive JO = (E-A) hence is irrational One easily verifies that, if xy A+B We note that if (for if B ~ F, we would have contradicting that A (B A+Ptfn , where A and Q(,fn) (i.e. the B are rational). Clearly a root of a quadratic equation with integer coefficients and positive nonsquare discrÜDinant is a quadratic irrational. Furthermore, it is not difficult to see that any given quadratic 2 irrational is a root of precisely one quadratic equation ex +bx+c where a,b,c are integers, a > 0, and (a,b,c) statement , x = A + B ·JD is a root of 2 = 1. 2 =0 To prove the last 2 x -2Ax + (A -B D) = 0, which -41- can clearly be put into the required form ; to show uniqueness, suppose ax 2 + bx + c = 0 = dx (d,e,f) ) ; eltminating (since x x 2 is irrationa1) 2 + ex + f (a, d > 0, (a,b,c) = 1 = ,we get bd = ae (bd-ae) x = - (cd-af), hence and cd = af ; assuming first that e F 0 and f F 0 , we have .! d -- È e -- ~f ; denoting each fraction by k that hence and letting k rd+se+tf = 1, we get is an integer; a = d, b = e, c but (a,b,c) = f; the case k = 1, e = ra+sb+tc, showing therefore in fact =0 or f =0 k = 1, is treated stmilarly. One half of Lagrange's result is relatively easy, and we state it in the following theorem : Theorem 9.1 The value of any periodic simple continued fraction is a quadratic irrational. Proof: Let x = [al' a 2 , ..• ] ,where, for aIl (here, m > 0 and r? 1). n > m, an+r= an Let Y = [am+l' am+2, .•. I. Then x = [al'··· ,am' yI = [al' ••• ,am+r' y1 , therefore x = PmY + Pm-l = ~y+~l Renee y Therefore Pm+r Y + Pm+r-l qm+r Y + ~-l satisfies a quadratic equation with integer coefficients y, and consequently x, is a quadratic irrational. Il -42- As a first step towards proving the converse, we sha11 determine which rea1 numbers have pure1y periodic expansions. These turn out to be the reduced quadratic irrationa1, defined as fo11ows Definition: x A reduced guadratic irrationa1 is a quadratic irrationa1 such that x > 1 -1 < and x < o. Theorem 9.2 Any pure1y periodic simple continued fraction (1) is a reduced quadratic irrationa1, and y Proof: x> al? l , =[ xy = -l, where (2) a r ,ar- l' ••. , al ] . and by Theorem 9.1 x is a quadratic irrational. App1ying Theorem 5.2, we have 1 =[ x 1 (3) a r ,ar- 1'· •. ,al' - -x ] . (2) and (3) show that when the proof of Theorem 9.1 is app1ied to and 1 x (using m equation. But y = 0) these numbers satisfy the same quadratic and - 1/x are distinct (they are of opposite sign) , therefore each is the conjugate of the other, proving that Fina11y, x LeIllD8 1. = -l/Y and y > l, therefore -1 < x < Any quadratic irrationa1 x o. xy = -1. Il may be expressed in the form (4) x = where y P, Q, D are integers, For any such representation, D > 0 ,and x D is not a square. is reduced if and on1y if -43- Given positive nonsquare P <.JD (5) Q-P <.JD (6) P-fQ > .JD (7) D, there are precisely quadratic irrational of the form (4), where h h(h+l) reduced = [ .JD J(integral part of .JD) • ~d Jk Proof: .! + Assume (4). b 2 cao he written as (ad + /b 2c k) 1 (bd). (i) let x be reduced, i.e. p+.JD >1 (8) Q P-.JD< 0 (9) Q P -.JD (10) > -1 • Q Q < 0 ; then (8) shows Suppose contradicting (9). (8)-(10). (ii) Subtracting Let (5) and Therefore P < 0; but then P - ~D < 0 , Q > 0, and (5)-(7) follow easily from (5)-(7) be satisfied. (7) gives Geometrically, (5) - (7) Q > 0, so that (8) - (10) follow. mean that (P,Q) is a lattice point strictly inside the triangle who se vertices are (.JD, 0), (0 "rn), (../D, 2.JD). Clearly tbe number of such lattice points is h(h + 1). Il Lemma 2. If x 2(1+2+ ... +h) is a reduced quadratic irrational, then so is -l/x Proof: -1 <x < 0, tberefore -l/x > 1 ; x > l, hence -l/x, which i8 the conjugate of -l/x, lies between -1 and O. 1/ = -44- Lemma 3. Let x be a quadratic irrationa1 satisfying 2 ax + bx + c where a (Fa) , b, c are integers , and let 2 2 b -4ac = k D and integers such that =0 (11) k D be any and k divides 2a, b, and 2c. Then given any sequence of integers and (i ? (12) 1) are of the form (i where Pi Proof: x = and Qi ~~2~) 1 2a 1s of the form (13). prove that each Xi (ai b~ where '1= 0) =s + we fi n d f k = a, 1/y , an~ 2d, e, 2f x y = 1/(x-s) (s any integer) does. substituting this into (11) and simplifying, 0 =, where d a1so, one can check that contradicting that Thus, it is sufficient to 2 dy2 + ey + f divides a,b,c, it is c1ear that satisfies an equation ai Xi + b i Xi + Ci = 0 2 - 4a i c i = k D and k divides 2a i , bi' Ci . For this, it is enough to prove that Now x (13) 1) are integers. Given (11) and the assumption about (-b ? = as 2 + bs + c, 2 e _ 4df = b2 - 4ac e = k 2D fina11y, d ; 0, for otherwise is irrational. = 2as + b ,and e 2 ; clear1y = k 2D , Il Theorem 9.3. The simple-continued-fraction expansion of any reduced quadratic irrat10nal is purely periodic. irrationa1 i9 a(Fa) , b, c 2 [al' a , ••• ] and satisfies ax + bx + c = 0 where 2 2 2 are integers vith b - 4ac = k D and k dividing x = Furthermore, if the quadratic -45- 2a, b, and 2e, then eaeh mn = [an , a n+l, •.• J (n irrational of the form +JO) / Q. (P n (P ,Q n fundamental period does not exeeed h(h+l) , Proof: Then m In lemma 3, take is of the form n an+l ? (P n si = ai' +JO) / Q. n Xi Assume n ? l) is a redueed quadratie integers), and the where h= [JOJ • = mi and therefore eaeh mn is redueed. Now mn+l > 1 ; also ., 1 (14) m - a n n but 0 < - mn < l, Le. a now that x x> l, sinee = ml a n < a n-mn < a n+1 , henee by (14) l/(an+1) < > 1 n - x n = 1 this follows fram the faet (for is redueed), therefore is redueed, therefore every m n m +l n i8 redueed. is redueed. But By lemma l, there are only h(h +l} redueed quadratie irrational of the form (4) , henee there exist r > 1 t < h (h+l) • - suppose b, n and t > 1 - Choose the smallest possible r. By leuma 2, Then and r = 1, for n br = a r- 1 + lIbr- l' bn m =m r+t r so that, denoting -l/m by r > 1. we have sueh that is redueed, henee Similarly br + t = a r +t - l bn > l , therefore [b r ] + l/b r +t _ 1 , = a r- l' br - br+t ,this shows that a r- 1 = a r+t- l' and eonsequently m _ l = m +t - , eontradicting the minimality of r. r r 1 Sinee Thus ml = h(h+l). ml~' proving that x is purely periodic with period t < 1/ The following result completes the proof of Lagrange's theorem, -46- The stmp1e-continued-fraction expansion of any Theorem 9.4. quadratic irrationa1 is periodic. irrationa1 is a, b, c = [al' x and 2c, then each mn 2 b -4ac = [an' (Pn' Qn integers), and a11 = k 2D and dividing k n In view of for which + J'ô)/Q n n from some point onward are reduced. m h(h+1) , where h As in the proof of Theorem 9.3, the fact that fo11ows from 1emma 3. 2a, b, [p an+1'···] is of the form The fundamenta1 period does not exceed Proof: ax 2+bx+ c = 0 where and satisfies a 2 ,··.] are integers with In fact, if the quadratic m mn = J'ô] . (Pn+ J'ô)/Q n Theorems 9.3 and 9.2, it remains on1y to find an n does not exceed h(h +1) is c1ear from 1emma 1.). n =[ is reduced. (The fact that the period Since x = [a 1 , .•. ,an ,mn+1 ], we have x = mn+1 Pn + Pn-1 (n ? (15) 0) mn+1 qn + qn-1 Taking conjugates and s01ving for mn+1 ' =- =- (16) x - c Now as n n increases, each convergent is a1tanate1y sma11er and 1arger than the previous one, therefore ( x - c n- 1) / ( x - cn ) is a1ternate1y sma11er and 1arger than 1 ; since this fraction converges to (x-x)/(x-x) there exists n such that o < x - c n-1 < 1 • x - cn qn-1 ~ qn ' hence (16) and (17) give -1 < mn+l < 0 . (17) = 1, -47- A1so mn+1 > a n+1 Theorem 9.5. ? Let let the integers 1, therefore x = [8 1 , 8 2 mn+1 , .•• ] Il is reduced. be a quadratic irrationa1, and a, b, c, k, D, Pn' Qn be as in Theorem 9.4. Then : P n+1 (n ? 1) (18) (n ? 1) (19) [Pn+1 + .rD] (n ? 0) (20) = a nQn D - Pn+1 Qn + 1 = a n+1 = - Pn 2 Qn Q n+1 (n Proof: (20) fo11ows from the fact that To prove (18) and (19) a n+1 = (P +!D)-a Q n (21) and (22) x by 1) (23) [mn+1]. we note that -Q (a = = ? n n n -P t) n'tl (a Q -P ) n n 2 n n + ~.1D) - D are easi1y obtained by solving (15) for (Pl + .rD) 1 Q, stmp1ifying, and using mn+1' rep1acing PnQn-1 - Pn-1 Qn (23) and (24) may be found from (15) by rep1acing n = (_l)n. by n-1 ,x by -48- (P n + JD) With regard to the value of x JiN) D = N. = (A take + For example let not of the form =2 D, it should be noted that if al = l, x and (P + Ji)/Q = (1 + Ji) 1 2 (which, incidentally, m = l/(x-a ) = 2 + 2 Ji which is 2 l _ As indicated in the statement of the D should be chosen by examining the quadratic equation satisfied by x. k Il 1 B (A, B integers) , it is not alwaya possible to is reduced) ; then theorems, 1 Qn , and crossmultiplying. lt is always possible to t ake is useful, notably for x k = l, but sometimes = JN . Formulas (18) to (20) above provide a very convenient algorithm for expanding a quadratic irrational into a simple continued fraction find D, get Pl and then use some pair and QI from x = (Pl + ~D) 1 QI ' obtain al = lx] , (18) - (20) to compute P2 ' Q2' a 2 , P3 ' Q3' a 3 , .•. until P ,Q n n repeats a previous pair. Formula (22) is the basis for the solution of the pell equation, as will be seen in later chapters. -49- Chapter 10. THE EXPANSION OF In the case where x JO. is the square root of an integer, the simple-continued-fraction expansion has a particularly interesting form, which we now examine. Theorem 10.1 Let [al' a 2 ,···] , mn the form D be a positive nonsquare integer, and let = [an' a n+ l ,.·.] , h = [JO] . x = JO = The expansion is of (1) where 0 5 r ~ h(h +1) - l , 1 5 b i 5 h , and (b l , b2 ,.·· ,br) is is of the form Each m symmetric, i.e. b i = br +l - i • n (n ? (2) 1) where Pn' Qn are integers satisfying, for 1 5 Qn ~ After 2h. QI n > 2 , 1 5 Pn ~ h , = l, Qr+2 is the first Qi to equal 1. We have the following formulas Pn+ 1 = a nQ (n ? 1) (3) Qn+l = (n ? 1) (4) (n ? 1) (5) n - Pn 2 D - Pn+l Qn An+l (-1) (-1) Pn-l Dqn-l =[Pn+l + hJ Qn+l n n Pn+l = Dq n Qn+l = Pn2 = qn-l = Pn-l (n q n-l - Pn Pn-l - D qn2 Pn + qn-2 Qn Pn + Pn-2 Qn ? 0) (6) (n ? 0) (7) (n ? 1) (8) (n ? 1) (9) -50- Proof: x satisfies we have (2). Pl (18) - (24) that if x =0 2 =0 - D = 1, QI and , therefore taking so that k =2 in Theorem 9.4, (3) - (9) fo11ow from of Theorem 9.5 (with regard to (5), it is easi1y seen v is any rea1 number and m, n are integers with m> 0 , then (n : v] hence the JO = (n: [v]] ; of formula (20), Chapter 9, can be rep1aced by h ) . By 1emma 1 (Chaper 9), h + therefore by Theorem 9.3, JD is reduced ; a1so [h + h + JD = [2h, b , .•• ,b ] 1 r JO] = 2h , (r ~ 0). [2h, b , ••. ,b , 2 ] , hence JO = [h,b , .•• ,b ,2 l , 1 r h r h 1 r + 1 to be the fundamenta1 period, Theorem 9.4 This can be rewritten as proving (1). Taking r ~ h(h +1) -1. states that To prove symmetry, we have -h + ~D [O,b 1 ,··· ,br' 2h] , or , taking reciproca1s, -1 / (h- = [br' •.. ,b 1 ,2hl but by Theorem 9.2, -l/(h-JD) unique, we conc1ude that = is symmetric. ~, (b , ••• ,b ) r 1 Since (by Theorem 9.2) of Chapter 9 gives (for n P ~ .Ji» = [b 1 ,··· ,b r ,2 h l ; since expansions are (b , •.• ,b ) , Le. (b , ... ,b ) 1 r r 1 m , ... are reduced, 1emma 1 3 2) JO < n = (10) (11) (12) P < h ; a1so Therefore n- 0 'n - subtracting (10) and (12) gives gives and P Q n n > 0 ; =1 P < h, hence adding gives n- Qn-< 2h ; Qn > 0 ; subtracting (11) and (12) thus 1 < P < h and n - ; then (10) and (12) give 1 < Q < 2h. n- JO - 1 < P < n Suppose JO, n >2 therefore -51- P n =h ; thus =h m n + JO ; but hence, considering the expansion for which mr+2 = m;+2 = n is at 1east r + 2. therefore by (5) , (l~i~). m~ = h + r + 1 is the fundamenta1 period, h + JO = JO (primes refer to h + [2h, b , ••• ,b ] r 1 Fina11y, this shows that ~ aj (Pj+h) 1 Qj ~ (h+h) 1 2 = h, (2~j~+1), i.e. b i ~ h Il 1. J5 = [ 2,4 2. J8 = [ Examp1es 3. = D 13, P n a Ji13 4. n = =3 1 2 3 4 5 6 o 3 1 2 1 3 1 4 3 3 4 1 3 1 1 1 1 6 = 31, n a h [3, l, l, l, l, 6] D P ] 2, l, 4 ] n n n h r =4 =5 1 2 3 4 5 6 7 8 9 o 5 1 4 5 5 4 1 5 1 6 5 3 2 3 5 6 1 5 1 1 3 5 3 1 1 10 Ji31 = [5, l, l, 3, 5, 3, l, 1, 10] Theorem 10.2 fo11owing : Qj? 2 JD) , r = 7 Using the same notation as in Theorem 10.1, we have the -52- (ii) If (Ui) If (iv) (v) Qn = Qn-l and n<r + 2, then r = 2n - 4 P = P and n<r + 2, then r = 2n - 5 n n-l If Qn = 2 and n < r + 2, then P + P ,hence r = 2n - 3. n l = n If bi=h' then i = (r+l) 1 2. (Le. only a central term of the symmetric part can equal Proof: Let YI ~ Y2 P + mean YI y; JD _ R + JD Q h.) = -1 one can check that <=> P = R, QS = D _ p 2 . (13) S In particular, using (4) , we have that (for i, j ? 2) <=> Now let 2 < i < r + 2; (14) using Theorem 9.2 and the symmetry of ~ [ bi_l'··· ,br' 2 h , b l ,···,b i _ 2 ] (b l ,··· ,br>' mi = = = m +4-i' therefore (14) clearly shows that r (QI' Q2,···,Qr+2) are symmetric. shows that therefore m = m . n r+4-n' shows that n-l = r+4-n, Q = 2 n since and ml ~ ~ n ~ r + 1 m n-l and r + 2, and but, as just shawn m-n ~mn- 1 ' hence impossible (it would make Assume m -m ; n n m-m +4 n r -n is the fundamental period, this n = r + 4 - n , i.e. r = 2n-4. Pn = P n- l ' then conclude Suppose (P 2 , ••. ,P +2 ) r Stmilarly, if = mr+4-n equal to a la ter ; now ~+2 n = 2 is mi) , therefore we i.e. r = 2n-5 . n < r + 2. Formula (3) gives (15) and -53- The symmetry of gives (P2 ,··· ,Pr +2) , (Ql"" ,Qr+2) , and (a2, ••• ,ar +l ) Pn+l = Pr +3- n , Qn = Qr+3-n ' and an = a r +3- n · - = Pn+l +.ID Qn Therefore: Pn +.ID Qn = Pn+l - Pn Q _n But < Qn = 2 0 < mi - ai < l, hence • (15) shows that Pn+l - Pn is even, therefore Pn = Pn+l , and r = 2n-3 follows by (iii). Finally, Theorem 10.1 shows that Q + 1 (z<n<r+l) , n - - while Q > 2 implies (by (5) ) a < Ih/Q < h ; therefore if n nn we must have b i = h, Il Qi+l =2 , hence r = 2(i+l) - 3 , i.e. i = (r+l) / 2. Formulas (3) - (5) provide a practial method for expanding JO P Q and a are bounded, n' n and no irrational numbers appear in the formulas, this method 1s as a simple continued fraction. Because n' especially convenient for rapid automat1c calculation. (1) - (1ii) Furthermore, of Theorem 10.2 show that only about half of the period needlto be calculated. When r is odd, (1) is said to have a central term (namely b., where i = (r+l) /2) • terme 1 When r 1s even, (1) 1s said to have no central -54- Chapter 11. THE PELL EQUATION. The Diophantine equation given integers and equation x and x 2 Dy2 = N, where D and N are are unknowns, is known as Pe11 1 s y (John Pe11, 1611-1685), although Pell was not the first to consider it. It appears in the famous cattle problem of Archimedes (see [1] p.249),and the Hindus, as long ago as 800 A.D., apparently cou1d solve various cases of the equation, but it remained for Lagrange (1736-1813) to give a complete and elegant analysis of it, about one hundred years after Fermat (1601-1665) proposed the problem to the English mathematicians of his day. The pell equation is important for several reasons. By means of various substitutions, the solution of the general quadratic Diophantine equation ax 2 + bxy + cy 2 + dx + ey + f the solution of Peilis equation. =0 can be made to depend upon Knowledge of the structure of the set of units in the field extension of the rationalS by...ID positive nonsquare integer ; x =a + b ~D (D being a is said to be a unit if x and l/x satisfy.:a monic quadratic equation with integer coefficients) depends upon a thorough knowledge + 4. N= + 1 and Other applications include the minÜDization of indefinite quadratic forms (see LeVeque We sball take primarily on the case (When [51 , Chapter 8). D to be a positive nonaquare integer, and concentrate N fraction expansion of ~D exist. of Peilis equation for =+ 1. It will be seen tbat the stmple-continued- conveniently furnishes aIl solutions, if any D is negative or a square the solutions are finite in number and usually not difficult to find directly, especially when N -55- is sma11.) x 2 2 - Dy It shou1d be noted that if =N = k 2E D , the solutions of fo11ow immediate1y fram the solutions of thus it is sufficient to consider on1y square-free x D; 2 2 -Ey =N ; however, it will be just as easy to treat the genera1 case. Theorem 11.1. of x for some 2 - Dy2 =N with P ,q n =1 (x, y) , satisfies x N > O. y and factoring , N "2 y < N 1 < y 2y2 Therefore by Theorem 7.2, there exists = pn , y = q. n -N For the case y2 - Ex c1ever argument. = 1NI < JD as auove gives that y/x which is = qn have N = 2 Dividing by JD , and we x/y? x - M > 0, and y refer to the simp1e-continued-fraction n = hence x = Pn' JD. First assume Therefore N (i.e. x > 0, y > 0) solution Then any positive n?1 , where expansion of Proof: D be a positive nonsquare integer, and let 1 N 1< JO. satisfy x, y Let 0) ; since convergent of ~D. Theorem 11.2. Let 2 = M, n > 1 x/y = pn /q n , N < 0 , we use the fo11owing where E = l/D gives M< Ji: is a convergent of JD > l, such that and M = -N/D ; now therefore the same argument l/Jn (and not the first, Theorem 5.1 gives that x/y 1s a /1 D be a positive nonsquare integer, assume the notation of Theorem 10.1 and consider the Pe11 equations: -56- x x 2 2 - (1) 2 .- Dy (2) =-1 (1) has infinitely many solutions; if JD of r is odd (i.e. the expansion has a central term), aIl positive solutions of (1) are (Pn' qn) , n if r = k (r+l ) , k = 1,2,3,... ; is even (i.e. no central term), aIl positive solutioœof (1) are: (Pn' qn) , n (2) is solvable if and only if positive solutions of r 1 < JO, (r+l) , k = 2, is even ; if r 4, 6, •.. is even, aIl (2) are (Pn' qn) , Proof: =k n =k (r+l) , k = 1,3,5, •.• and any solution of (1) or (2) is relatively prime, hence by Theorem Il.1, any positive solution of (1) or (2) is for some n > 1. (Pn' qn) Formula (7) of Theorem 10.1 gives (n ~ 1) Therefore and Qn+l (P n ' qn) = 1. is a solution of (1) if and only if But by Theorem 10.1, Pn+l (3) n is even = 1 (where n ? 1) is equivalent to n = k (r+l), where k? 1. The assertions about (1) clearly fo1low. For (2), we first note that no solution can have x =0 or y = O. if and on1y if (k ? 1). Now n is a solution of (2) (3) shows that (p n , q n ) is odd and Qn+1 = l, i.e. Therefore there are no solutions if n r odd and n = k(r+1) is odd, while for even, the positive solutions are as stated in the theorem. r Il The remainder of this =hapter shows how aIl positive solutions of -57- (l)and (2) may be found once the least positive solution is known. First, let us clarify the notion of "least" positive solution by (xl' YI) and (x2 , Y2) are different positive 2 x2 - Dy = N (where D > 0), then either xl < x and 2 observing that if solutions of , YI < Y2 or therefore assume hence and x 2 < xl YI < Y2 · = x 2 ' then also YI = Y2 ' 2 2 = x 2 - xl > 0, and Y2 < YI : if xl 2 2 DY2 - Dy l xl < x 2 ; then Secondly, given xl and YI, an equation x n + Yn JD= (xl + YI JD)n X uniquely determines the integers n and (4) Y ,since JD is n irrational and we can equate terms after expanding the power; in fact, denoting Xl + YI JD by u X - Y JD = n n n (un - v ) / (2JD). we have Yn = Le1ŒD&: denote Let JD and its conjugate Xl - YI JD n un = un = v , therefore D be a positive nonsquare integer, and for convenience lei = 1fi = 1 Let by". m < s + t Then there exists a positive solution a + b IK < x by 1 l (Xl + YI,,)m m 2 et < (Xl + YI ., ) ~l . (5) 2 2 m (a,b) of x -Dy = e f , such III • 1/ (Xl + YI We have l < e + Y 2 x 1 - DYI = e, , m? 1, and suppose (xl + YI • ) Proof: = x~ For example, x 2 (Xl' YI' s, t positive), that by v, G( ) = e (Xl - YI 1( ) , so that dividing (5) gives (s + tGl) (Xl - YI" ) m < Xl + YI oC· (6) -58- a + b CI(. Then a + b 0( < Xl + Yl4iW' , 2m 2 2 2 2 m (a + b«) (a - b-c) = e (s - Dt ) (Xl - Dy l ) = e f. Let the middle member of 2 2 = (6) be and a Now 1/ (a + beC) = 1a-b4Ifl , therefore But 2a = (a + bit) + (a - b-C) - Db Theorem Il.3. Let and b > O. // (xl,y ) is the least l (1), then aIl positive solutions are (x n ' Yn) positive solution of by a >0 D be a positive nonsquare integer, ~ = JO, and consider the Pell equations determined - ~I <1 < a+b« • 2b-c= (a + bec') - (a - b __ ), and 2a > 0, 2bot >0, fram which hence 1a (6) gives (1) (4), where and (2). If n = 1, 2, 3, ••• positive solution of (2), then aIl positive solutions are determined by (4), where n (x , y ) n n = 1,3,5, •.• , and furthermore (x 2 ,y2) is the least positive solution of (1). Proof: If x n ' Y n = (X - y IJ() if (xl' YI) n n n = 1,2,3, .•. Also, if (Xl' YI) n is a positive solution of (2), = 1,3,5, ••• , and furthermore (xn'Yn ) = 2,4,6, •.• are positive solutions of (1). n (i) let n (xn ' Yn) for n then so are for are defined by (4), then x2n - Din = (xn + Yn ,,) n n 2 2 n (Xl + YI lit) (Xl - Yl «) = (Xl - Dy l ) . Therefore i8 a positive solution of (1), so are (x , Y ) for Suppose (Xl' YI) is the least positive solution of (1), and (s, t) be any positive solution. s + t De ? Xl + YI II( , Now Xl + YI " > 1 and therefore there exists (x ' Y ) , for otherwise (5) holds for some n n provides a positive solution (a, b) n > 1 such that (s ,t) = m > l, and the lemma of (1) less than (Xl' YI) . -59- . (xl' Yl ) is the least positive solution of (sl' t l ) is a positive solution of (1) less than Suppose (ii) (l) , and that (x2 ' Y2 )· If > xl + Yl « • define (s,t) sl + tIC = (sl,t ) ; l sl + t « < xl + Y -< , and there is an r such that l l r-l r (sl + tlOC) < xl + Yl -< < (sl + tlOC) ,in which case define if not, we have = (sl + t l -<) r • In either case, (s, t) is a positive solution of (1) satisfying (5) for m = l, therefore the lemma gives s + t « a positive solution (a,b) of (2) less than (x 2 ' Y2) contradiction proves that (xl' Y ). This l is the least positive solution of (1). (iii) Suppose (xl' Y ) is the least positive solution of (2) , l and (s, t) is a positive solution of (2) not among (xl' Y ) , l (x ' y ),... Then s + t" exceeds xl + Y ~ and is not a power of 3 3 l xl + Y10( , therefore (5) positive solution less than holds for (a, b) of (2) less than (xl' Yl ) , or else of (1) (x ' Y ) (since xl + Y e( < x + Y 0( 2 2 l 2 2 even or odd. ), according as M is The former is tmpossible by assumption, the latter by (ii). It may be noted that is and The lelllDa gives a m>l. SOUle (a, b) is a solution of 2 x2 - Dy = N (xl' Y ) is a solution of l x is also a solution of + y n x 2 n JD =. (x1 - Dy 2 + y i JD) x 2 - Dy2 = 1 then (xn ' Yn ) given by (a + b JO) n = N. However, there is no assurance that all solutions can be obtained in this way from one known solution. /1 -60- Cbapter 12. THE SOLVABILITY OF x Since the Pell equation x 2 2 2 - Dy = -1. - Dy2 = -1 is solvable if and only if the sfmple-continued-fraction expansion of (Theorem Il.2), those JD bas no central term there naturally arises the problem of characterizing D for which JD bas no central term. As yet, there is no complete solution of this problem, but some important partial results are known, and this chapter is devoted to presenting these results. The proofs given here are based on the material in Perron [a] , Cbapter 3, Theorems 20-22. Theorem 12.1. Let the expansion of JiD assume the notat im of Theorem 10. 1. = where n have no central term, and Then 2 2 D = Qn+l + Pn+l (r + 2)/2, and (P n+ l , Pn+ l ) = 1. (1) Therefore (see Chapter 5) D is a product (possibly zero factors, i.e. the product is 1) of primes of the form 4k+l Proof: gives Since Q n r = Q.n+l To show that or twice such a product. is even, symmetryof (QI' Q2"" ,Qr+2) (Theorem 10.2) ,fram which (1) follows by formula (4) of Chapter 10. Pn+l and Qn+l are relatively prime, we note fram (7) of Cbapter 10 that 2 Qn+l = pn - D qn2 2 (_l)n-l Q = 2 Pn-l - D qn-l n (-1) Therefore if a prime D by (1) , and p p n divides divides Pn Qn = Qn+l and Pn-l and Pn+l' then by (2) and (3) ; (2) (3) p divides but -61- = l, (Pn ' Pn- l ) sinee Pnqn-l - Pn- l qn = (_l)n formula (5) of Il Chapter 2). The converse of the above theorem is false. 205 = 5.41 and 34 = 2.17 For example are sums of two relatively prime squares, but Ji05 = [l~, 3, 6, l, 4, l, 6, 3, 28 ] ~34 = [5, l, 4, l, 10 ] and have central terms. Rowever, we have the following results, leading up to the main theorem, Theorem 12.4. Theorem 12.2. D > 3 be nonsquare. Let x x x 2 2 2 - Dy 2 2 (4) =-1 - Dy2 = - Dy Of the three equations 2 (5) = -2 (6) at most one has a solution. Proof: (mod 3) ; Any square is convergent to henee for D = 3, 0 or 1 (mod 4) and to (4) and (5) 0 or 1 are not solvable (eonsider the terms module 4 and 3 respect ive ly), while (6) is solvable: 2 12 - 3.1 = -2. Therefore assume no solution has x =0 or y D? 5 ,henee = 0, 2 < .JD • Clearly and also any solution has (x,y) = 1. Therefore, using the notation of Theorems 10.1 and 10.2, Theorem 11.1 gives that any solution for seme n > 1. x,y Renee, if of Theorem 10.1 shows that is of the form (5) or (6) ~+l = 2, Ixl = pn , 1yi = qn is solvable, then formula (7) and Theorem 10.2 (iv) shows that -62- n + 1 where k > O. Therefore sinee (-1) Qn+1 n =2 = r + 3 + k (r+1) (7) r is odd, and (4) is not solvable. A1so, 2 that (5) is not solvable if solvable if (r +3) / 2 is solvable. n for (5) and (-1) Qn+1 (r +3) /2 is odd. = -2 for (6), (7) shows is even, whi1e (6) is not Therefore at most one of (4) - (6) Il Theorem 12.3. Let nonsquare D be a power (first or higher) of an odd prime, or twiee sueh a power. Then one and on1y one of (4) - (6) is solvable. Proof: Let Sinee the ease • where 2p, D = P• or is an odd prime and D>5 (4) - (6) (so that 2 < JO) n = a nQn ?1 . and show at 1east ia solvable. Suppose (4) i8 not solvable. is odd, and by Theorem 10.2 and (3) of Theorem 10.1, 2P ~ D = 3 wa8 treated in the proof of Theorem 12.2, it is suffieient to assume one of p ,where n = (r+3)/2. Then r Pn = Pn+1 and Thus (8) and (9) of Theorem 10.1 give : (8) 2pn- 1 = (qn- 1 an + 2qn- 2) Qn (9) Therefore Qn / 2Pn_l' 2Dqn_1' k / 2Pn_1 ' qn-1; ia fa1se sinee (i) Suppose k / Qn' qn-l ; k >1i8 odd, then k 1 Pn-l' qn- l' whieh if = 1; (Pn-1' qn-1) 1f k > 1 is even, then (11) 2 1 Qn' ~-1 ' henee by (8) 4 12Pn_1 ' therefore 1s fa1se. Therefore (0, q 'Il then n- (formula (7) of Theorem 10.1) therefore 1) 21pn- l' qn- l' wh1eh = 1 ,henee Qn 12pn- l' 2D. Now (-1) n-1 ~ 2 2 = Pn-1 - D qn-1 ' -63- 2 (_l)n-l 4= Q" ( :n-l) 2 (10) n It follows that (Q ,2D/Q) = 1, 2, or 4; n n ., (since 2 <p < r + 1), and 2D = 2p that (A) Q n Qn Qn Q +1 n therefore one finds 4p = 2D, D, D/2, 4, or 2. cannot be 2D or D if Q > D, hence P > D/2 . n n (B) ., or - - also cannot be even, and P n = 2D or D, then But (Theorem 10.1) 2P n P < h < n - = a nQn -> JO < D/2. Q = D/2, then Qn is odd, hence a n n (a 12) Q > Q = D/2, leading to a contradiction n n - n D/2 : = Q n if as in (A). (C) Qn if Q n cannot be 4 : = 4, then 2Pn_l ' hence 2/Pn_l' so that (10) 2D/Q qn-l n is odd, 4 = Qn divides is odd, and each term of except the last is divisible by 4, which is impossible. The on 1y rema i n i ng poss ib il i ty i s Q =. 2 Then (-1) n-l 2 = P2 2 n n-l Dqn-l (formula (7) of Theorem 10.1), so that (5) or (6) is solvable. Theorem 12.4. Let nonsquare D he a power (first or higher) of a prime of the form 4n+l , or twice a power (first or higher) of a prime of the form 8n+s. Then x 2 - Dl =-1 is solvable. Proof: In view of Theorem 12.3, it is sufficient to prove that (5) and (6) are not solvable • ., (i) Let D=P Therefore i.e. (et:? l, p = 4n+l) . x 2 Then D = 1 (mod 4). 2' - Dy = 0-0,0-1, 1-0, or 1-1 0,1, or 3 (mod 4). (6) are not solvable. Il But + 2 =2 (mod (mod 4), 4), therefore (5) and -64- (ii) x 2 Let ii:!" (~) and = 8n + Then x 2 (~)= 1 or (-~) = (-!) given in Chapter 5, 2 - Dy = ~2 tmplies But,recalling the 1. this is impossibe for Il 5. Corollary: = 8n+5). (G(? l , p 2 (mod p) ,therefore values of p c D = 2p If P is a prime of the form 4n+l, then x 2 solvable, therefore by Theorem 12.1 the representation of sum of two squares can be found by expanding ~p 2 - py = -1 is p as the as a simple continued fraction. For example, let have r = 4, p = 13. From Example 3 after Theorem 10.1, we (r + 2)/2 = 3, therefore _ Q2 + p2 P - 4 4 This construction for expressing a prime = p = 4n + 1 as the sum of two squares is attributed to Legendre (1808) (see [7], Appendix l ). The converse of Theorem 12.4 is false. and 2 2 x -2.41 y For example, x 2-5.l7y2 =-1 = -1 are solvable, since Jas = [ and J82 = have no central terms. 9, 4, l, l, 4, 18 ] [9, 18 ] -65- CONCLUSION It is hoped that the preceding chapters have demonstrated the utility and elegance of the theory of continued fractions as a tool in approximation theory and the theory of numbers. For although new methods have recently been developed in the field of Diophantine approximations, continued fractions remain the basic stepping stone, while in elementary number the ory they provide one of the very few direct methods. There are, of course, many topics in this area which the present survey has not discussed. For example, continued fractions can be used to assist in factoring numbers (see [1] p.266), and no mention has been made of the beautiful subject of the geometry of numbers, which is closely related to continued fractions. are many directions for further study. There Hurwitz's Theorem (Chapter 7) is the first of a whole series of related theorems and problems. One could explore continued fractions themselves in greater detail by referring to such books as Perron [8]. Alternatively, there is the extension to analytic continued fractions. Finally, there are two challenging problems introduced by the material presented in this survey, problems which may provide subjects for further research. We have shawn that the length of period of the sfmple-continued-fraction expansion of a quadratic irrational does not exceed h (h+l) quite crude. (see Theorem 9.4). However, this bound appears to be For example, it means that the period of JD is less -66- daa ..... D, wbi.le for D = 91.9 - t D (fiK' = 991), D ~ 1000 the 1argest period is 60 and .ost periods are much less than 60. Yery Uttle see.a bI he ....... about this topie. ~ï.. zZ _ • ia Clapter 12, characterization of those ~Z = -1 - of ....:. deep Seeondly, as is solvable (i.e. those is 0IId) is far fraa cOliplete. ~, D D for whieh for wbieh the period Tbeorem 12.4 is a fairly bal: .-e iDl:lusboe resu1ts may be found. -67- BlBLlOGRAPHY 1- Be 11er, A. H. Recreations in the Theory of Numbers, 2nd ed. Dover, 1966, N.Y. 2. Hardy, G.H. and Wright, E.M. Chapter 22. An Introduction to the Theory of Numbers, 4th ed. Oxford, 1960. Chapters 10, H. 3. "Ueber die angeniherte Darste Hung der Hurwitz Irrationalzahlen durch rationale Brûche," Mathematische Annalen, 4. 39(1891),279-284. Continued Fractions Khintchine, A. Ya. 3rd ed. Noordhoff, 1963, Groningen. Sections l, II. 5. LeVeque, W.J. Topics in Humber Theory, Vol. 1. Addison-Wesley, 1956, Reading, Mass. Chapter 8. 6. Niven, 1. and Zuckerman, B.S. An Introduction to the Theory of Numbers, 2nd ed. Wiley, 1966, N.Y. Chapter 7. 7. Olds, C. D. 8. Perron, o. Continued Fractions. RandOm House, 1963, N.Y. Die Lehre von den Kettenbrüchen, Chelsea, 1929, N. Y. 2nd ed. Chapters 1-3. 9. Vinogradov, I.M. Elements of Number Theory. 10. Vorob'ev, N. N. Fibonacci Numbers. Dover, 1954, N.Y. Blaisdell.