The Euclidean Algorithm and Diophantine Equations

Similar documents
An Introduction to Mathematical Thinking: Algebra and Number Systems. William J. Gilbert and Scott A. Vanstone, Prentice Hall, 2005

Intermediate Math Circles March 7, 2012 Problem Set: Linear Diophantine Equations II Solutions

Chapter 2. Divisibility. 2.1 Common Divisors

Chapter 1. Greatest common divisor. 1.1 The division theorem. In the beginning, there are the natural numbers 0, 1, 2, 3, 4,...,

Intermediate Math Circles February 29, 2012 Linear Diophantine Equations I

Number Theory. Introduction

Intermediate Math Circles February 26, 2014 Diophantine Equations I

Number Theory Basics Z = {..., 2, 1, 0, 1, 2,...} For, b Z, we say that divides b if z = b for some. Notation: b Fact: for all, b, c Z:

Deepening Mathematics Instruction for Secondary Teachers: Algebraic Structures

Ch 4.2 Divisibility Properties

Lecture 2. The Euclidean Algorithm and Numbers in Other Bases

Homework #2 solutions Due: June 15, 2012

WORKSHEET ON NUMBERS, MATH 215 FALL. We start our study of numbers with the integers: N = {1, 2, 3,...}

Math 131 notes. Jason Riedy. 6 October, Linear Diophantine equations : Likely delayed 6

LINEAR CONGRUENCES AND LINEAR DIOPHANTINE EQUATIONS

Chapter 1 A Survey of Divisibility 14

3. pour from one decanter to the other until either the receiving decanter is full or the poured decanter is empty.

My Favorite Problems, 2 Harold B. Reiter University of North Carolina Charlotte

4 Powers of an Element; Cyclic Groups

ALGEBRA. 1. Some elementary number theory 1.1. Primes and divisibility. We denote the collection of integers

Direct Proof MAT231. Fall Transition to Higher Mathematics. MAT231 (Transition to Higher Math) Direct Proof Fall / 24

My Favorite Problems HAROLD B. REITER. Mu Alpha Theta Annual Convention Denver, Colorado. Visit my website:

Definition For a set F, a polynomial over F with variable x is of the form

Remainders. We learned how to multiply and divide in elementary

3. pour from one decanter to the other until either the receiving decanter is full or the poured decanter is empty.

Math Circles - Lesson 2 Linear Diophantine Equations cont.

Chapter 3 Basic Number Theory

and LCM (a, b, c) LCM ( a, b) LCM ( b, c) LCM ( a, c)

The Euclidean Algorithm and Multiplicative Inverses

Elementary Properties of the Integers

50 Must Solve Algebra Questions

Signature: (In Ink) UNIVERSITY OF MANITOBA TEST 1 SOLUTIONS COURSE: MATH 2170 DATE & TIME: February 11, 2019, 16:30 17:15

2 Elementary number theory

D i v i s i b i l i t y

COMP239: Mathematics for Computer Science II. Prof. Chadi Assi EV7.635

Chapter 3: The Euclidean Algorithm and Diophantine. Math 138 Burger California State University, Fresno

KNOWLEDGE OF NUMBER SENSE, CONCEPTS, AND OPERATIONS

50 Must Solve Algebra Questions

4.4 Solving Congruences using Inverses

3. pour from one decanter to the other until either the receiving decanter is full or the poured decanter is empty.

Numbers, Groups and Cryptography. Gordan Savin

Chapter 1: Fundamentals of Algebra Lecture notes Math 1010

Lecture 7 Number Theory Euiseong Seo

Algorithms CMSC Basic algorithms in Number Theory: Euclid s algorithm and multiplicative inverse

Linear Diophantine Equations

Section 19 Integral domains

THESIS. Presented in Partial Fulfillment of the Requirements for the Degree Master of Science in the Graduate School of The Ohio State University

Grade AM108R 7 + Mastering the Standards ALGEBRA. By Murney R. Bell

Discrete Structures Lecture Solving Congruences. mathematician of the eighteenth century). Also, the equation gggggg(aa, bb) =

Math 110 FOUNDATIONS OF THE REAL NUMBER SYSTEM FOR ELEMENTARY AND MIDDLE SCHOOL TEACHERS

The Fundamental Theorem of Arithmetic

A field F is a set of numbers that includes the two numbers 0 and 1 and satisfies the properties:

REVIEW Chapter 1 The Real Number System

3 The fundamentals: Algorithms, the integers, and matrices

18 Divisibility. and 0 r < d. Lemma Let n,d Z with d 0. If n = qd+r = q d+r with 0 r,r < d, then q = q and r = r.

Lecture 7: Number Theory Steven Skiena. skiena

Mat Week 8. Week 8. gcd() Mat Bases. Integers & Computers. Linear Combos. Week 8. Induction Proofs. Fall 2013

Ch 1. The Language of Algebra

The set of integers will be denoted by Z = {, -3, -2, -1, 0, 1, 2, 3, 4, }

Student Responsibilities Week 8. Mat Section 3.6 Integers and Algorithms. Algorithm to Find gcd()

Solutions to Assignment 1

2x 1 7. A linear congruence in modular arithmetic is an equation of the form. Why is the solution a set of integers rather than a unique integer?

WRITING EQUATIONS through 6.1.3

Elementary Algebra Chinese Remainder Theorem Euclidean Algorithm

5: The Integers (An introduction to Number Theory)

CPSC 467: Cryptography and Computer Security

8 Primes and Modular Arithmetic

Introduction to Sets and Logic (MATH 1190)

NOTES ON OCT 9, 2012

CISC-102 Winter 2016 Lecture 11 Greatest Common Divisor

Solution Sheet (i) q = 5, r = 15 (ii) q = 58, r = 15 (iii) q = 3, r = 7 (iv) q = 6, r = (i) gcd (97, 157) = 1 = ,

KNOWLEDGE OF NUMBER SENSE, CONCEPTS, AND OPERATIONS

a the relation arb is defined if and only if = 2 k, k

MTH 310, Section 001 Abstract Algebra I and Number Theory. Sample Midterm 1

EUCLID S ALGORITHM AND THE FUNDAMENTAL THEOREM OF ARITHMETIC after N. Vasiliev and V. Gutenmacher (Kvant, 1972)

= $ m. Telephone Company B charges $11.50 per month plus five cents per minute. Writing that mathematically, we have c B. = $

UNIT 2: REASONING WITH LINEAR EQUATIONS AND INEQUALITIES. Solving Equations and Inequalities in One Variable

Numeric Reasoning. Robert Lakeland & Carl Nugent. Contents

ELEMENTS OF NUMBER THEORY

Grade 11/12 Math Circles Rational Points on an Elliptic Curves Dr. Carmen Bruni November 11, Lest We Forget

4 Number Theory and Cryptography

Undergraduate Notes in Mathematics. Arkansas Tech University Department of Mathematics. College Algebra for STEM

Chapter 2 (Part 3): The Fundamentals: Algorithms, the Integers & Matrices. Integers & Algorithms (2.5)

1. (a) q = 4, r = 1. (b) q = 0, r = 0. (c) q = 5, r = (a) q = 9, r = 3. (b) q = 15, r = 17. (c) q = 117, r = 11.

Lecture 7: Polynomial rings

ALGEBRA. COPYRIGHT 1996 Mark Twain Media, Inc. ISBN Printing No EB

2 Arithmetic. 2.1 Greatest common divisors. This chapter is about properties of the integers Z = {..., 2, 1, 0, 1, 2,...}.

SEVENTH EDITION and EXPANDED SEVENTH EDITION

NOTES ON SIMPLE NUMBER THEORY

Modular Arithmetic Instructor: Marizza Bailey Name:

Rings and modular arithmetic

2x 1 7. A linear congruence in modular arithmetic is an equation of the form. Why is the solution a set of integers rather than a unique integer?

Solutions to Section 1.3 Homework Problems S. F. Ellermeyer

Divisibility. Def: a divides b (denoted a b) if there exists an integer x such that b = ax. If a divides b we say that a is a divisor of b.

Divisibility. Chapter Divisors and Residues

Modular Arithmetic and Elementary Algebra

Number Theory and the abc Conjecture

LP03 Chapter 5. A prime number is a natural number greater that 1 that has only itself and 1 as factors. 2, 3, 5, 7, 11, 13, 17, 19, 23, 29,

CPSC 467b: Cryptography and Computer Security

Lecture Notes. Advanced Discrete Structures COT S

Transcription:

The Euclidean Algorithm and Diophantine Equations Donald Rideout, Memorial University of Newfoundland 1 Let Z = {0, ±1, ±2, } denote the set of integers. For a, b Z, a 0, we say b is divisible by an integer a, or a divides b, or a is a divisor of b, and we write a b, if b = ac, for some c Z. Otherwise, we write a / b. For example, 6 48 since 48 = 6 8 and 6 48 since 48 = ( 6)( 8). As an exercise, given integers a, b, c, a 0, and a b, a c, prove that a (bx + cy) for any integers x and y. Let a, b Z, not both zero. We say g Z is a greatest common divisor (gcd) of a and b, and we write g = (a, b), if (i) g is a common divisor of a and b, that is, g a and g b. (ii) g is the greatest of the common divisors of a and b. How do we find the gcd? Method 1. (Elementary School) Let a = p α 1 1 p α 2 2 p α r r, b = p β 1 1 p β 2 2 p β r r, where α i 0 and β i 0. Then g = p min{α 1,β 1 } 1 p min{α 2,β 2 } 2 p min{α r,β r } r. For example, if a = 40 = 2 3 5 and b = 225 = 3 2 5 2, then a = 2 3 3 0 5 1 and b = 2 0 3 2 5 2 so g = 2 0 3 0 5 1 = 5. There are real problems with this method since we are using the Fundamental Theorem of Arithmetic which says that every integer n 2 can be factored uniquely into primes. This theorem is proved using an alternate method for finding gcd s and hence we have a problem with circular reasoning. The above method is quite inefficient since we need to know the factorization of the number into primes, and for large numbers this is impractical. The second method uses the Division Algorithm which states that if a 0 and b is any integer, then there is an integer r such that b = qa + r where 0 r < a. This is just the Long Division algorithm. Method 2. This method finds the gcd by subtracting multiples of the larger number from the smaller, where we assume, without any loss of generality, that the numbers a and b are non-negative. Theorem 1 If b = qa + r, then (a, b) = (a, b qa) = (a, r). SUMMARY: Given any two integers, not both zero, subtracting a multiple of one number from the other changes the pair but not the gcd. Before we prove this theorem, we give an example using the above result. Find g = (679, 210). Using the theorem we have (679, 210) = (679 3(210), 210) = (49, 210) = (49, 210 4(49)) = (49, 14) = (49 3(14), 14) = (7, 14) = (7, 14 2(7)) = (7, 0) = 7. 1 Talk given at CMC Seminar, Waterloo, June 1997 1

Observe that we never needed to factor the numbers into primes! The Division Algorithm guarantees that the numbers get smaller until zero is reached. Proof. Let g = (a, b) and g = (a, b qa). Then g a and g b qa, and hence a = g c and b qa = g d. Therefore b = qa + g d = qg c + g d = g (qc + d), and hence g b. That is, g is a common divisor of a and b, and by the definition of g, g g. A similar argument shows that g g and hence g = g. The Division Algorithm can be used to show that there exist integers x 0 and y 0 such that g = (a, b) = ax 0 + by 0. Using the Division Algorithm, the sequence of computations showing that 7 = (679, 210) can be written as follows: 679 = 210(3) + 49 210 = 49(4) + 14 49 = 14(3) + 7 14 = 7(2) + 0 where the sequence of remainders decrease to zero. This is an example of the more general Euclidean Algorithm. Theorem 2 Given positive integers a and b, we have by the Division Algorithm the following equations a = bq 1 + r 1, 0 < r 1 < b, b = r 1 q 2 + r 2, 0 < r 2 < r 1, r 1 = r 2 q 3 + r 3, 0 < r 3 < r 2,... r j 2 = r j 1 q j + r j, 0 < r j < r j 1, r j 1 = r j q j+1 + 0. (1) The gcd of a and b is r j, the last nonzero remainder in the division process. Values of x 0 and y 0 in (a, b) = ax 0 + by 0 can be obtained by eliminating the remainders r j 1,..., r 2, r 1 from the set of equations. We will not prove this theorem, but we will show how to use the theorem for the above example. From (1) we have: 7 = 49 14(3) = 49 (210 49(4))(3) = 49(13) 210(3) = (679 210(3))(13) 210(3) = 679(13) + 210( 42). To find x 0 and y 0 such that (a, b) = ax 0 + by 0 it would be convenient to be able to work forward through the Equations (1). Let a and b be positive integers. Write 2

down the first two rows in the following table, and then add rows by the following rule. Obtain the ith row from the previous two rows by subtracting q i times the (i 1)st row from the (i 2)nd row where q i = [r i 2 /r i 1 ], the greatest integer in r i 2 /r i 1. We will illustrate the method by choosing the above numbers a = 679 and b = 210. Hence 1 0 a 0 1 b c 1 d 1 r 1 c 2 d 2 r 2... c j d j r j c j+1 d j+1 0 c n d n r n 1 0 679 0 1 210 1 3 49 4 13 14 13 42 7 30 97 0 c i = c i 2 q i c i 1 d i = d i 2 q i d i 1 r i = r i 2 q i r i 1 q n+1 3 4 3 2 where c 1 = 1, d 1 = 0, r 1 = a, c 0 = 0, d 0 = 1 and r 0 = b. The algorithm will terminate when r j+1 = 0. Then (a, b) = r j and each row (c i, d i, r i ) will satisfy the equation ac i + bd i = r i and, in particular, ac j + bd j = r j = (a, b). How can this be proved? First, check the result for i = 1 and i = 0, and suppose that Then r n 2 = ac n 2 + bd n 2 r n 1 = ac n 1 + bd n 1 ac n + bd n = a(c n 2 q n c n 1 ) + b(d n 2 q n d n 1 ) = (ac n 2 + bd n 2 ) q n (ac n 1 + bd n 1 ) = r n 2 q n r n 1 = r n. Note that we can find x 0 and y 0 simply by knowing the quotients q i for 1 i j in Equations (1). The computations can be carried out very quickly. The numbers in the second last column are the required numbers. That is, 7 = 679c 3 + 210d 3 = 679(13) + 210( 42). The following short QuickBasic TM program computes the gcd and computes the numbers x 0, y 0 so that g = ax 0 + by 0. PRINT ENTER A AND B WITH B 0 INPUT A, B C1 = 1: C2 = 0: D1 = 0: D2 = 1: AA = A: BB = B DO WHILE B 0 Q = INT(A / B): T = B: B = A 3

- Q * B: A = T T = C2: C2 = C1 - C2 * Q: C1 = T T = D2: D2 = D1 - D2 * Q: D1 = T LOOP PRINT THE GCD = ; A PRINT AA; * ; C1; + ; BB; * ; D1; = ; A END The Waterloo Maple software has several gcd programs. The best one for integers is igcd or igcdex. For example, igcd(679, 210); gives the output 7, and igcdex(679, 210, s, t );s;t; gives the output 7, 13, and 42. It is quite natural next to study the equation ax + by = n and investigate the problem of finding all the integral solutions for any given a, b, n Z. Such an equation is called a Diophantine equation in honour of the Greek mathematician Diophantus (4th century A.D.?) who first investigated the problem of finding integral solutions to equations, particularly the cases with more unknowns than equations. The next theorem is an important lemma needed to prove the next theorem (and also to prove the Fundamental Theorem of Arithmetic). Lemma 1 If c ab and (b, c) = 1, then c a. Proof. Since (b, c) = 1, there exists integers x and y such that bx+cy = 1. Multiplying by a we have abx + acy = a. Clearly c divides the left side of this last equation and hence c divides a. Theorem 3 If (a, b) = 1 and n is any integer, then ax+by = n has a solution x = x 0 and y = y 0. Furthermore, all solutions are given by the equations for all integral values of t. x = x 0 + bt y = y 0 at Proof. Since (a, b) = 1, there exist integers x 1 and y 1 such that ax 1 + by 1 = 1. Then x 0 = nx 1 and y 0 = ny 1 is clearly a solution of ax + by = n since a(nx 1 ) + b(ny 1 ) = n 1. Let x and y be another solution, then we have and so that and ax + by = n ax 0 + by 0 = n a(x x 0 ) + b(y y 0 ) = 0 a(x x 0 ) = b(y y 0 ). Since (a, b) = 1, provided b 0 (note one of a or b is not zero, why?), it follows that b x x 0 and therefore that x x 0 = bt for some t Z, or x = x 0 +bt. Substituting bt for x x 0, we obtain abt = b(y y 0 ). 4

After cancelling b we have y = y 0 at. We are finished if we check that x = x 0 + bt, y = y 0 at satisfy ax + by = n for all integral values of the parameter t. In general, if (a, b) = g then ax + by = n has a solution if and only if g n. If g n then clearly the equations ax + by = n a g x + b g y = n g have precisely the same solutions, and hence the theorem covers the general situation since g can be divided out. Example. Solve the Diophantine equation 8x + 5y = 100. Solution 1. Since 8x = 5(20 y) then 5 8x, and hence 5 x since (5, 8) = 1. Let x = 5t for t Z. Then 8(5t) + 5y = 100 implies 8t + y = 20. Hence, all solutions of 8x + 5y = 100 are given by where t is any integer. x = 5t y = 20 8t Solution 2. By inspection, 8(2) + 5( 3) = 1 and, hence, a particular solution is x 0 = 2(100) = 200 and y 0 = 3(100) = 300. All solutions are of the form where t is any integer. x = 200 + 5t y = 300 8t Example. Solve the Diophantine equation 69x + 111y = 9000. Solution. Since (69, 111) = 3(23, 37) = 3, we solve the equivalent equation 23x+37y = 3000. Since 23( 8)+37(5) = 1 then a particular solution is x 0 = 8(3000) = 24, 000 and y 0 = 5(3000) = 15, 000. All solutions are of the form where t is any integer. x = 24000 + 37t y = 15000 23t 5

Problems. 1. Find, if possible, the complete solution to the following Diophantine equations. (i) 28x + 35y = 60 (ii) 21x + 15y = 9 (iii) 343x + 259y = 658 (iv) 14x + 9y = 1000 (v) 12x + 57y = 423 (vi) 11x 12y = 13. Now find all the positive solutions, if any, of each of the above equations. 2. A customer has a large quantity of dimes and quarters. In how many different ways can he pay exactly for an item that is (i) worth $3.49 or (ii) worth $2.65? 3. When a man cashed a cheque, the clerk mistook the number of cents for the number of dollars, and vice versa. After spending 68 cents, the man discovered that he still had precisely twice as much money as the amount for which the cheque was originally written. What is the smallest amount for which the cheque could have been written? 4. A certain course has 120 students of whom 86 faithfully attended classes while 34 did not. The instructor would like to assign the same final integral mark to each student in the first group (i.e., those who attended class es) and a second lower integral mark to each of the students in the other group. In addition, the instructor would like the class average to be exactly 70. What mark should the instructor assign? 5. The Smiths run a restaurant which charges a flat fee of $11.00 per adult and $7.00 per child. At the end of an evening the total in the cash register is $657.00. What is the smallest number of people who could have dined that day? largest number? 6. An oil company has a contract to deliver 100, 000 litres of gasoline. Their tankers can carry 2, 400 litres, and they can attach one trailer carrying 2, 200 litres to each tanker. All the tankers and trailers must be completely full on this contract, otherwise, the gas would slosh around too much when going over some rough roads. Find the least number of tankers required to fulfill the contract. Each trailer, if used, must be pulled by a full tanker. 7. A man purchased at a post office some one-cent stamps, three-quarters as many two s as one s, three-quarters as many five s as two s, and five eight-cent stamps. He paid for them with a single bill, and there was no change. How many stamps of each kind did he buy? (Assume there are 1(loonie?), 2, 5, 10, 20, 50, 100, 1000, and 10000 dollar bills.) 6

Solutions. 1. (i) no solution (ii) x = 6 + 5t, y = 9 7t, t Z; no positive solutions. (iii) x = 282 + 37t, y = 376 49t, t Z; no positive solutions. (iv) x = 2000 + 9t, y = 3000 14t, t Z. There are eight positive solutions: x 2 11 20 29 38 47 56 65 y 108 94 80 66 52 38 24 10 (v) x = 705 + 19t, y = 141 4t, t Z. There are two positive solutions: (x, y) = (2, 7) and (21, 3). 2. (i) no solution (ii) If x = the number of dimes and y = the number of quarters, then the five possible ways are given in the table: 3. $10.21 x 4 9 14 19 24 y 9 7 5 3 1 (x = 106 + 5t, y = 53 2t, t Z is the general solution of 10x + 25y = 265.) 4. 87% and 27% 5. smallest number = 63; largest number = 91. 6. The least number of tankers is 27. 7. 18, 816 ones, 14, 112 twos, 10, 584 fives, and 5 eights. (Ross Honsberger in his book Mathematical Morsels entitles this problem A Mathematical Joke.) 7