Continued fractions, Fermat, Euler, Lagrange

Similar documents
Continued Fractions and the Euclidean Algorithm

8 Primes and Modular Arithmetic

U.C. Berkeley CS276: Cryptography Handout 0.1 Luca Trevisan January, Notes on Algebra

CONTINUED FRACTIONS AND PELL S EQUATION. Contents 1. Continued Fractions 1 2. Solution to Pell s Equation 9 References 12

CS 103X: Discrete Structures Homework Assignment 3 Solutions

QUADRATIC EQUATIONS EXPECTED BACKGROUND KNOWLEDGE

5.1 Radical Notation and Rational Exponents

Partial Fractions. Combining fractions over a common denominator is a familiar operation from algebra:

Math 319 Problem Set #3 Solution 21 February 2002

0.8 Rational Expressions and Equations

Chapter 11 Number Theory

Zero: If P is a polynomial and if c is a number such that P (c) = 0 then c is a zero of P.

Solving Rational Equations

Math Workshop October 2010 Fractions and Repeating Decimals

PYTHAGOREAN TRIPLES KEITH CONRAD

CONTINUED FRACTIONS AND FACTORING. Niels Lauritzen

k, then n = p2α 1 1 pα k

Lecture 13 - Basic Number Theory.

Session 7 Fractions and Decimals

3.1. RATIONAL EXPRESSIONS

Section 0.3 Power and exponential functions

Introduction. Appendix D Mathematical Induction D1

Every Positive Integer is the Sum of Four Squares! (and other exciting problems)

MATH 289 PROBLEM SET 4: NUMBER THEORY

This unit will lay the groundwork for later units where the students will extend this knowledge to quadratic and exponential functions.

Indices and Surds. The Laws on Indices. 1. Multiplication: Mgr. ubomíra Tomková

CHAPTER 5. Number Theory. 1. Integers and Division. Discussion

Homework until Test #2

Copy in your notebook: Add an example of each term with the symbols used in algebra 2 if there are any.

Lecture 3: Finding integer solutions to systems of linear equations

8 Divisibility and prime numbers

Primes in Sequences. Lee 1. By: Jae Young Lee. Project for MA 341 (Number Theory) Boston University Summer Term I 2009 Instructor: Kalin Kostadinov

Number Theory. Proof. Suppose otherwise. Then there would be a finite number n of primes, which we may

1 if 1 x 0 1 if 0 x 1

Continued Fractions. Darren C. Collins

Algebra 1 Course Title

mod 10 = mod 10 = 49 mod 10 = 9.

Math Circle Beginners Group October 18, 2015

MATH10040 Chapter 2: Prime and relatively prime numbers

Zeros of a Polynomial Function

5. Factoring by the QF method

Math Review. for the Quantitative Reasoning Measure of the GRE revised General Test

Student Outcomes. Lesson Notes. Classwork. Discussion (10 minutes)

PYTHAGOREAN TRIPLES M. SUNIL R. KOSWATTA HARPER COLLEGE, ILLINOIS

Revised Version of Chapter 23. We learned long ago how to solve linear congruences. ax c (mod m)

Math 181 Handout 16. Rich Schwartz. March 9, 2010

The Chinese Remainder Theorem

Solutions of Linear Equations in One Variable

SUM OF TWO SQUARES JAHNAVI BHASKAR

Vocabulary Words and Definitions for Algebra

Quotient Rings and Field Extensions

Unit 1 Number Sense. In this unit, students will study repeating decimals, percents, fractions, decimals, and proportions.

Answer Key for California State Standards: Algebra I

Elementary Number Theory and Methods of Proof. CSE 215, Foundations of Computer Science Stony Brook University

Discrete Mathematics and Probability Theory Fall 2009 Satish Rao, David Tse Note 2

SECTION 10-2 Mathematical Induction

MATHEMATICAL INDUCTION. Mathematical Induction. This is a powerful method to prove properties of positive integers.

Counting Primes whose Sum of Digits is Prime

WRITING PROOFS. Christopher Heil Georgia Institute of Technology

March 29, S4.4 Theorems about Zeros of Polynomial Functions

Vieta s Formulas and the Identity Theorem

The last three chapters introduced three major proof techniques: direct,

Goldbach's Strong Conjecture This states that all even integers are formed by the addition of at least one pair of prime numbers.

Some practice problems for midterm 2

A Binary Recursive Gcd Algorithm

Polynomial and Rational Functions

Handout #1: Mathematical Reasoning

2.3 Solving Equations Containing Fractions and Decimals

H/wk 13, Solutions to selected problems

MATH Fundamental Mathematics IV

it is easy to see that α = a

Chapter 3. Cartesian Products and Relations. 3.1 Cartesian Products

Second Order Linear Nonhomogeneous Differential Equations; Method of Undetermined Coefficients. y + p(t) y + q(t) y = g(t), g(t) 0.

4.2 Euclid s Classification of Pythagorean Triples

DIVISIBILITY AND GREATEST COMMON DIVISORS

HOMEWORK 5 SOLUTIONS. n!f n (1) lim. ln x n! + xn x. 1 = G n 1 (x). (2) k + 1 n. (n 1)!

Rational Exponents. Squaring both sides of the equation yields. and to be consistent, we must have

Algebraic and Transcendental Numbers

Our Primitive Roots. Chris Lyons

1. The Fly In The Ointment

Equations, Inequalities & Partial Fractions

Stanford Math Circle: Sunday, May 9, 2010 Square-Triangular Numbers, Pell s Equation, and Continued Fractions

1 Homework 1. [p 0 q i+j p i 1 q j+1 ] + [p i q j ] + [p i+1 q j p i+j q 0 ]

Chapter 4, Arithmetic in F [x] Polynomial arithmetic and the division algorithm.

Special Situations in the Simplex Algorithm

10.1 Systems of Linear Equations: Substitution and Elimination

3.3 Real Zeros of Polynomials

Math 0980 Chapter Objectives. Chapter 1: Introduction to Algebra: The Integers.

Section 1.1 Linear Equations: Slope and Equations of Lines

9. POLYNOMIALS. Example 1: The expression a(x) = x 3 4x 2 + 7x 11 is a polynomial in x. The coefficients of a(x) are the numbers 1, 4, 7, 11.

COMP 250 Fall 2012 lecture 2 binary representations Sept. 11, 2012

In mathematics, there are four attainment targets: using and applying mathematics; number and algebra; shape, space and measures, and handling data.

Chapter 17. Orthogonal Matrices and Symmetries of Space

Core Maths C1. Revision Notes

Just the Factors, Ma am

Math 3000 Section 003 Intro to Abstract Math Homework 2

CORRELATED TO THE SOUTH CAROLINA COLLEGE AND CAREER-READY FOUNDATIONS IN ALGEBRA

Some Polynomial Theorems. John Kennedy Mathematics Department Santa Monica College 1900 Pico Blvd. Santa Monica, CA

Some facts about polynomials modulo m (Full proof of the Fingerprinting Theorem)

Algebra II End of Course Exam Answer Key Segment I. Scientific Calculator Only

Transcription:

Continued fractions, Fermat, Euler, Lagrange Introduction. Continued fractions are a natural way of expressing irrational numers. Unlike decimal fractions, which depend on the choice of ase ten, continued fractions are free of artificial choices. Thus patterns in the continued fraction expansions have a universal and deeper meaning. Beginning with exploratory calculations of continued fractions of roots of integers, we derive a celerated theorem of Fermat that characterizes the prime numers that can e written as sum of two squares. Generally, roots of quadratic polynomials play a particular role in the theory of continued fractions, as they are the ones that produce eventually periodic continued fractions. This is a pair of theorems y Euler and y Lagrange that we also explore. Continued fractions. A continued fraction is an infinitely nested fraction () x m + m 2 + m 3 + m 4 +... where (2) m, m 2, m 3, m 4,... is a sequence of natural numers. By natural numer in this chapter we mean an integer greater than zero. The infinite nesting is somewhat intimidating. Even worse, the natural starting point for calculating a nested fraction is the deepest level of nesting, where at the displayed continued fraction we find nothing ut dots. The difficulty persists, even if we have a very clear understanding of a particular sequence (2). For example, consider the sequence (3) 2,, 2,,, 4,,, 6,,, 8,,, 0,,, 2,..., which except for the first miscellaneous terms is the sequence of even integers interlaced with doule ones. To solve the impasse of having no place to start the calculation, one may calculate the stopped fractions m, m + m 2, m + m 2 + m 3,.... Prolem. Calculate the stopped fractions for the sequence (3), oth as standard fractions and as approximate decimal fractions, up to level ten of nesting.

2 If you have solved this prolem, you have seen that the stopped fractions quickly come close to each other and appear to produce more and more definite decimal places of a certain presumaly infinite decimal fraction. One can indeed show for general continued fractions that one otains in this way an irrational numer. In this particular example, one can show that one otains Euler s numer e. In this chapter we will e more concerned with the inverse prolem, that is calculating the sequence (2) from a given real numer x. Curiously, this process is much more straight forward than the forward calculation of the continued fraction. Assume we start with a positive numer x. We shall assume that x is an irrational numer, that is it is not the fraction of two natural numers. We shall also assume is is at least one, since in the continued fraction () the term m is already at least one, while the remaining nested fraction is nonneagitve since it is uilt from positive numers using only addition and division, operations which do not leave the realm of nonnegative numers. The key oservation is that if we write (4) x m + x and compare with the continued fraction (), then the numer x that we shall call residue is again a continued fraction x m 2 + m 3 + m 4 + m 5 +..., with a layer stripped sequence where the first term of the original sequence has een removed. Hence x is at least one again, and thus /x is at most one. Note that x m cannot e an integer since x is not a fraction of integers and therefore not an integer neither. Hence whatever /x is, it is a well defined reciprocal since it is nonzero, and it is strictly less than one. Then the only possile choice for m is the integer part of x, the largest integer not exceeding x. This determines m and also x as the reciprocal of the fractional part of x. To see that we are equally safe from division y zero if we study the continued fraction of x, we oserve that x is again not a fraction of natural numers. If was, say it was p/q, then x itself was a fraction: x m + q p m p + q q, ut we assumed it was not.

Now we can simply proceed to peel off the sequence (2) y taking away integer parts and iterating with the reciprocal of the fractional parts. An example will e discussed shortly. Roots of integers. The numer 2 is an example of a real numer that cannot e written as a fraction. To see that, we take any fraction, call it p/q, and we convince ourselves that its square is not 2. For this it suffices to convince ourselves that (5) p 2 2q 2, as one sees y dividing y q 2. We can assume the fraction p/q is reduced, or else we reduce it efore continuing the discussion. If p is odd, then we conclude (5) since the left hand side is odd and the right hand side is even. If p is even, then q is odd since the fraction p/q is reduced. Then we conclude (5) again since the left hand side is divisile y four, while the right hand side is not divisile y four. Prolem 2. Show that a natural numer which is not a square of a natural numer is not the square of a fraction of natural numers neither. This prolem gives us the maye most asic source of real numers which are not fractions. Ofcourse we are eager to test our continued fraction expansion on these numers. We start with x 2. Its integer part m is, since 2 < 2 < 2 2. Note we did not yet algeraically use that x 2 2, we just used inequalities and the fact that squaring positive real numers preserves the relative size. Thus m has to e the largest natural numer whose square does not exceed 2. Hence the first fractional part is 2 and we otain for its reciprocal: x 2 2 + ( 2 )( 2 + ) 2 + 2 2 +. The key identity in the last display was the third one using the inomial formula (a + )(a ) a 2 2. after suitale expansion of the fraction. Application of the ionomial formula causes the denominator of the fraction to ecome an integer again. This turning of the tale helps to unravel the nesting of fractions in the continued fraction. In the present calculation, the integer in the denominator accidentally turns out to e one and thus 3

4 disappears entirely, a luxury that may not always happen in future similar calculations. We already know that 2 lies etween one and two, hence x lies etween two and three, and we conclude m 2 2. Now a great simplification occurs, in that we realize that the fractional part of x 2 is again 2, a fractional part we have just encountered. It is thus easy to anticipate the following calculations, they lead all to the same integer parts two. Thus (2) ecomes, 2, 2, 2, 2, 2,.... If we compare with the difficulty of calculating the decimal expansion of 2, the relative ease of calculating the continued fraction 2 + 2 + 2+ 2+.... is quite remarkale. Prolem 3. Calculate the continued fractions of square roots of small integers that are not integers themselves: 3, 5, 6,..., n,..., until you see certain patterns emerge. For each such square root, record the sequence (2) of integer parts as well as the sequence x, x 2, x 3, x 4... of residues, each written in the form with integers a and. Watch out for repetitions in the residues. To get you started we show another example, say for 9. calculations give for the sequence (2) of integer parts The 4, 2,, 3,, 2, 8, 2,, 3,, 2, 8,..., while the first few terms of the sequence of residues are 9 + 4 9 + 2 9 + 3 9 + 3 9 + 2 9 + 4,,,,,, 3 5 2 5 3 at which point the next residue happens to e the same as the first residue shown and the sequence of residues repeats periodically.

Seeing the pattern emerge. We assume you and your team have done many calculations for Prolem 2. What are the patterns that emerge? The following questions help understand the patterns. Prolem 4. Why can we express all residues in the form (6) with an integer dividing the integer n a 2? Solution: Initially we have a 0 and, and it is clear that divides n a 2 in this case. Assume we have arrived at an expression, either as initial term or as a calculated residue, such that divides n a 2. Sutracting the integer part m and using the inomial formula gives for the fractional part m n (a m)2 ( n (a m)). Since divides n a 2, it also divides n (a m) 2 (n 2 a 2 ) + 2am 2, since it divides each summand on the right-hand-side. Hence we can write the next residue, that is the reciprocal of the penultimate display, as n (a m) n + a n (a m) 2 where we have extracted the new integers (7) a m a (8) n (a m)2 and clearly divides n (a ) 2. Note that not only each remainder can e written in the form (6), ut this representation is unique ecause if n + ã, then trying to solve for n we otain ( ) n a ã. Using that n is not a fraction we can conclude that and a ã. 5

6 Prolem 5. Why do we always have 0 a n and 0 <? Solution: The original x has a 0 and which satisfy the inequalities. Assume we have arrived at an expression where 0 a < n and 0 <. The integer part m of that expression is the largest integer such that m > 0, hence with the formula (7) for a we have n > m a a. Also, since m is maximal, 2m < 0 and since a < n 2a 2m < 0 and hence a > 0 y (7). That > 0 then follows from n (a ) 2. Prolem 6. Why are we guaranteed that eventually we otain a residue that we have calculated efore? Solution: There are only finitely many choices of a, namely the integers etween 0 and n, and there are finitely many choices of, namely the natural numers less than n. Hence there eventually needs to e a residue that has occurred efore. Prolem 7. Why do we always have n a +, except for the initial points a and 0? Solution: With the notation as in (7) and (8) and with a < n and m, we conclude < m + n a. Since n 2 (a ) 2 ( n a )( ), we conclude > n a. This shows the desired inequality n < a + for each calculated residue.

To assure that the property a+ < n is also satisfied for the initial x, we could slightly modify the task to calculate the continued fraction of n + [ n] where [ n] denotes the largest integer smaller than n. Note that this doules the first integer m ut gives the same first residue x and thus the same sequence of residues. In the examples calculated this modification always lets the periodic pattern of the sequence (2) start with the first term. Prolem 8. Given a and as in (7) and (8), how does one calculate the previous residue a and (or the initial real numer of the modified prolem)? Solution: We calculate using (8) in the form (n 2 (a ) 2 )/. Note that y Prolems 5 and 7 we have a m a n, a + (m + ) a > n, and hence m is determined as the largest integer such that m a < n. With that m, we may calculate a from (7). Prolem 9. Can you descrie and prove the palindromic symmetry of the period of the residues? Solution: The modified prolem is the continued fraction of n + [ n] x. We claim that the first residue that that is not new, call it x N, is equal to x. Otherwise it was equal to some x M with 0 < M < N. But then, y Prolem 8, we would e ale to calculate x N and x M (or the initial x if M ) and oserve they are equal, so x N would not e the first residue repeated. To discuss the palindromic symmetry, we look at the residues from x to x N. Now we claim that if for K N/2 the residue x K has the form (6) then x N+ K has the form (n a 2 )/. 7

8 This claim descries the palindromic symmetry. The claim is immediately verified for K with a [ n] and n a. If the claim is true for certain x K, then x K+ has the form with notation as in (7) and (8), and with Prolem 8 the residue x N K has the form n + a (n (a ) 2 )/. This verifies the claim for x K+ and proves the palindromic symmetry. Prolem 0. Which neat equation for a and can you prove aout the residue in the symmetry point of this symmetry in the case when the length of the period is odd? Solution: If the period is odd (for example in the case of 2), then among the residues x K there is a fixed point under the reflection symmetry and the fixed point has to satisfy n + a (n a 2 )/ y the calculations in the solution to Prolem 9. Simplifying, we conclude n a 2 + 2. Prolem. Now assume n is an odd prime numer. Can you determine the last residue efore the symmetry point if the period of the residues is even? Solution: An example for an even period is the case of 9. If the last residue efore the symmetry point is written as in (6), then the next residue satisfies y the calculations in the solution to Prolem 9 the equation (n a 2 )/. We conclude a a and y (7) we see that divides 2a. Assume first that is odd. Then divides a. Since divides n a 2 y Prolem 4, it then also divides n. Since n is prime and < n, we see. By Prolem (7), we need a to e the largest integer less than n. This pair of a and is attained at the last point of the period, so it cannot

e the last residue efore the symmetry point. Hence cannot e odd, and thus has to e even. If is even, we conclude similarly to aove that /2 divides a and thus divides n and thus /2. By Prolem 7 we conclude that a is [ n] or [ n]. But since is even and divides n 2 a, a has to e odd und is uniquely determined. Prolem 2. Now assume n is a prime numer of the form 4k + for some integer k. Can you prove that n can e written as the sum of two squares? Solution: Using Prolem (0) we need to show the period is odd. Assume to get a contradiction that the period is even. By Prolem the last residue efore the symmetry point satisfies 2. Let a and e as in (7) and (8) e the parameters of the next residue, the first one after the symmetry point. Since every square has remainder 0 or modulo four, the difference n (a ) 2 has remainder 0 or modula four. Since n (a ) 2 has to e divisile y 2, it is divisile y four and thus is even as well y (8). We claim that then all residues after the symmetry point written in the form (6) have even denominator. Namely, assume that any consecutive residues in the form (6) have even denominators and assume that the second residue is. Since the previous residue has even denominator, y (8) we have that (n a 2 )/ is even. But then repeating the calculations for Prolem (4) (n (m a) 2 )/ turns out also even, and thus the next residue also has even denominator. On the other hand, we know that the last residue in the period has denominator y the considerations in Prolem 9, a contradiction. We have shown the hard part of the following Theorem, the rest of it is left as an easy prolem: Prolem 3. [Theorem of Fermat] A prime numer is the sum of two squares if and only if dividing it y 4 gives a remainder of one or two. The theorem was stated y Pierre de Fermat, ut since he had the hait of not writing down proofs, the first known proof is y Leonhard Euler. 9

0 Continued fractions of roots of general quadratic polynomials. We generalize the considerations to roots of more general quadratic polynomials. Let x e a numer that solves a quadratic equation rx 2 + sx + t 0 with integers r, s, t. Note that r, s 0 and t a natural numer that is not a square is the case discussed so far. Prolem 4. Show that x is not a fraction of integers, if the discriminant s 2 4rt is not a square integer. Solution: We can write x s ± s 2 4rt 2r with a certain choice of sign in place of ±. If x was a fraction of integers, then so was s 2 4rt, which would imply y Prolem 2 that s 2 4rt was a square of a natural numer. We may thus expand such roots of quadratic polynomials into continued fractions. Prolem 5. Let x e a numer greater than one that solves a quadratic equation rx 2 + sx + t 0 for some integers r, s, t and assume x is irrational. Show that all residues x K also satisfy such quadratic equations, say We may normalize so that r K x 2 K + s K x K + t K 0. (9) t K+ r K, and all discriminants s 2 K 4r Kt K have the same value. Solution: First we notice that the equation r(x m ) 2 + 2rm (x m ) + rm 2 + s(x m ) + sm + t 0 is true since it reduces to the assumed quadratic equation for x. Hence x m satisfies the quadratic equation t (x m ) 2 + s (x m ) + r 0 with t r and s s + 2rm and r rm 2 + sm + t. Then the reciprocal x /(x m ) satisfies the equation r x 2 + s x + t 0.

The discriminant s 2 4r t is easily calculated to e the same as the original one, s 2 4rt. Iterating this argument solves the prolem. Note that since x K is not a fraction, we have r K 0 for all K. Prolem 6. Let x e an irrational numer that solves a quadratic equation rx 2 + sx + t 0 for some integers r, s, t and let r K, s K, t K e as in Prolem 5. Show that there are infinitely many indices K so that r K and r K+ have different signs. Solution: Assume to otain a contradiction that there are finitely many sign changes. Then there is an N such that all r K have the same sign for K N. By the normalization (9), the coefficients t K for K > N also have this same sign. We claim that there is a s K with large L such that s N+L also has the same sign. But we have s K+ s K + 2m K+ r K for all K and and since m K+ is always positive and at least, we see that since the r K all have the same sign past N, eventually s K+ will have the same sign as well. This however gives a contradiction, as x N+L is positive and cannot solve a quadratic equation with all coefficients of the same sign. For the next prolem we ask to prove the following theorem of Joseph-Louis Lagrange. Prolem 7. [Theorem of Lagrange] Let x e an irrational numer that solves a quadratic equation rx 2 + sx + t 0 Show that x has an eventually periodic continued fraction expansion. Solution: We need to show that at some point we oserve a residue that has occured efore. Each time there is a sign change etween r K and r K+, we have that the discriminant s 2 K+ 4r K+ t K+ is a sum of two positive terms. Hence each of r K+, s K+, t K+ is ounded y the discriminant, here we use that r K and r k+ are nonzero integers. There are only finitely many choices for such coefficients, and since there are infinitely many sign changes, eventually one has to encounter repetition in the coefficients. Hence the residues will eventually have a repetition. The converse of this theorem is slightly simpler. We first look at a specific continued fraction:

2 Prolem 8. Which numer has the continued fraction expansion with sequence (2) consisting just of,,,...? For the solution, oserve x x in (4) and calculate. Each time a sequence (2) has a large entry m K, the stopped fraction just prior to this entry is a relatively good approximation to the desired numer since the error at the deepest level is the small numer /m K. For example, the continued fraction expansion of π starts has a sequence (2) eginning with 3, 7, 5,, 292,,,.... The relatively large 5 causes the stopped fraction 3 to e a good 7 approximation to π given the size of the denominator, and the large 292 causes the stopped fraction 3 6 to e an execllent approximation with 3 six correct digits after the decimal point. Unfortunately the sequence (2) for π is not easy to understand. The solution numer to Prolem 8 is for the discussed reason sometimes called the worst approximale irrational of all. It is also known as the golden ratio and has a colorful history. The converse to Lagrange s theorem was oserved y Euler, its proof is a modification of the solution to the last prolem. Prolem 9. [Theorem of Euler] Let x e a numer that has an eventually periodic continued fraction expansion. Show that it solves a quadratic equation rx 2 + sx + t 0 for some integers r, s, t. We end this discussion with a note that one can also try to peel off a sequence (2) from a fraction x p/q of natural numers with p > q. Prolem 20. Show that the continued fraction algorithm for a rational x stops with some remainder r k 0. In case of a rational x the continued fraction algorithm is called Euclid s algorithm. If one refrains from reducing the fraction p/q and all susequent residues, then one can read off the greatest common denominator of p and q from the last residue.