Section 4.2: The Division Algorithm and Greatest Common Divisors



Similar documents
8 Divisibility and prime numbers

Kevin James. MTHSC 412 Section 2.4 Prime Factors and Greatest Comm

CS 103X: Discrete Structures Homework Assignment 3 Solutions

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

8 Primes and Modular Arithmetic

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

Today s Topics. Primes & Greatest Common Divisors

The Euclidean Algorithm

Intermediate Math Circles March 7, 2012 Linear Diophantine Equations II

GREATEST COMMON DIVISOR

MATH 289 PROBLEM SET 4: NUMBER THEORY

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

I. GROUPS: BASIC DEFINITIONS AND EXAMPLES

Factoring Algorithms

GCDs and Relatively Prime Numbers! CSCI 2824, Fall 2014!

Homework until Test #2

Discrete Mathematics, Chapter 4: Number Theory and Cryptography

Fibonacci Numbers and Greatest Common Divisors. The Finonacci numbers are the numbers in the sequence 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144,...

Quotient Rings and Field Extensions

Continued Fractions and the Euclidean Algorithm

MATH 22. THE FUNDAMENTAL THEOREM of ARITHMETIC. Lecture R: 10/30/2003

Settling a Question about Pythagorean Triples

Handout NUMBER THEORY

Chapter 4. Polynomial and Rational Functions. 4.1 Polynomial Functions and Their Graphs

Page 331, 38.4 Suppose a is a positive integer and p is a prime. Prove that p a if and only if the prime factorization of a contains p.

MATH10040 Chapter 2: Prime and relatively prime numbers

a 11 x 1 + a 12 x a 1n x n = b 1 a 21 x 1 + a 22 x a 2n x n = b 2.

RSA and Primality Testing

MATH 537 (Number Theory) FALL 2016 TENTATIVE SYLLABUS

DIVISIBILITY AND GREATEST COMMON DIVISORS

6.2 Permutations continued

The Division Algorithm for Polynomials Handout Monday March 5, 2012

Elementary Number Theory

26 Integers: Multiplication, Division, and Order

MATH10212 Linear Algebra. Systems of Linear Equations. Definition. An n-dimensional vector is a row or a column of n numbers (or letters): a 1.

15 Prime and Composite Numbers

Math 319 Problem Set #3 Solution 21 February 2002

Math 115 Spring 2011 Written Homework 5 Solutions

11 Ideals Revisiting Z

SUM OF TWO SQUARES JAHNAVI BHASKAR

Gröbner Bases and their Applications

z 0 and y even had the form

NUMBER SYSTEMS. William Stallings

JUST THE MATHS UNIT NUMBER 1.8. ALGEBRA 8 (Polynomials) A.J.Hobson

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

Real Roots of Univariate Polynomials with Real Coefficients

The Fundamental Theorem of Arithmetic

Binary Number System. 16. Binary Numbers. Base 10 digits: Base 2 digits: 0 1

Winter Camp 2011 Polynomials Alexander Remorov. Polynomials. Alexander Remorov

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

3.2 The Factor Theorem and The Remainder Theorem

Pre-Calculus II Factoring and Operations on Polynomials

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

Number Theory Hungarian Style. Cameron Byerley s interpretation of Csaba Szabó s lectures

a 1 x + a 0 =0. (3) ax 2 + bx + c =0. (4)

The Prime Numbers. Definition. A prime number is a positive integer with exactly two positive divisors.

Number Theory: A Mathemythical Approach. Student Resources. Printed Version

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

Polynomial and Synthetic Division. Long Division of Polynomials. Example 1. 6x 2 7x 2 x 2) 19x 2 16x 4 6x3 12x 2 7x 2 16x 7x 2 14x. 2x 4.

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

We can express this in decimal notation (in contrast to the underline notation we have been using) as follows: b + 90c = c + 10b

Lecture Notes on Polynomials

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

ABSTRACT ALGEBRA: A STUDY GUIDE FOR BEGINNERS

SYSTEMS OF PYTHAGOREAN TRIPLES. Acknowledgements. I would like to thank Professor Laura Schueller for advising and guiding me

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

Recall the process used for adding decimal numbers. 1. Place the numbers to be added in vertical format, aligning the decimal points.

Math Workshop October 2010 Fractions and Repeating Decimals

PYTHAGOREAN TRIPLES KEITH CONRAD

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

Section 1.1 Real Numbers

Grade 6 Math Circles March 10/11, 2015 Prime Time Solutions

On the generation of elliptic curves with 16 rational torsion points by Pythagorean triples

PROPERTIES OF ELLIPTIC CURVES AND THEIR USE IN FACTORING LARGE NUMBERS

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

Factoring & Primality

Zeros of a Polynomial Function

CONTENTS 1. Peter Kahn. Spring 2007

DEGREES OF ORDERS ON TORSION-FREE ABELIAN GROUPS

Mathematics for Computer Science/Software Engineering. Notes for the course MSM1F3 Dr. R. A. Wilson

Continued Fractions. Darren C. Collins

Contents. 6 Continued Fractions and Diophantine Equations. 6.1 Linear Diophantine Equations

Practice with Proofs

Basic Algorithms In Computer Algebra

Factoring Polynomials

An Introductory Course in Elementary Number Theory. Wissam Raji

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

Lecture 13 - Basic Number Theory.

Playing with Numbers

SOLVING POLYNOMIAL EQUATIONS

Discrete Structures. Lecture Notes

Integer Factorization using the Quadratic Sieve

Lecture 3: Finding integer solutions to systems of linear equations

1. Let P be the space of all polynomials (of one real variable and with real coefficients) with the norm

Division of whole numbers is defined in terms of multiplication using the idea of a missing factor.

Core Maths C1. Revision Notes

SOLUTIONS FOR PROBLEM SET 2

Test1. Due Friday, March 13, 2015.

minimal polyonomial Example

of Nebraska - Lincoln

Transcription:

Section 4.2: The Division Algorithm and Greatest Common Divisors The Division Algorithm The Division Algorithm is merely long division restated as an equation. For example, the division 29 r. 20 32 948 can be rewritten in equation form as 948 = 32(29) + 20. More generally, if m (the dividend) and d (the divisor) are positive integers then division of m by d yields quotient q and remainder r as follows: ( ) Furthermore, we know that 0 r < d. We can express ( ) in equation form as: d q m rem r m = dq + r where 0 r < d. Theorem 1 (The Division Algorithm for Integers): Let m be any integer and let d be a positive integer. Then there exist unique integers q and r such that 0 r < d and m = dq + r. Comment: Note that in the Division Algorithm, m, the dividend, is an arbitrary integer. From long division, we are familiar only with the case where m d. The other cases are easily handled as follows. Case 1: Assume 0 m < d. Then set q = 0 and r = m; that is, m = d(0) + m. Case 2: Assume the dividend is m, where m is positive. Since m is positive, we can use long division to find integers q and r such that m = dq + r. Then m = d( q) r = d( q 1) + (d r). Since 0 r < d, it follows that 0 d r < d. Exercise 1: In each of (a) (d) you are given values for m and d. In each case find (using the notation of the Division Algorithm) the quotient q and the remainder r. (a) m = 6, d = 10 (b) m = 6, d = 10 (c) m = 15153, d = 83 (d) m = 15153, d = 83 87

Greatest Common Divisors Definition 1: Let a and b be integers. A positive integer d is called the greatest common divisor of a and b, written d = gcd(a, b), provided: (a) d divides a and d divides b; and (b) if c is an integer such that c divides a and c divides b, then c divides d. Comment: In words, the definition states that d = gcd(a, b) provided d is a common divisor of a and b and d is divisible by all other common divisors of a and b. Example 1: The common divisors of 18 and 30 are ±1, ±2, ±3, and ±6. Clearly, 6 = gcd(18, 30) and note that all other common divisors of 18 and 30 divide 6. Uniqueness of the GCD Lemma 1: Let d 1 and d 2 be positive integers such that d 1 divides d 2 and d 2 divides d 1. Then d 1 = d 2. Proof: Let d 1 and d 2 be positive integers such that d 1 divides d 2 and d 2 divides d 1. Then there exist positive integers q 1 and q 2 such that d 1 = q 1 d 2 and d 2 = q 2 d 1. Thus, d 1 = q 1 d 2 = q 1 (q 2 d 1 ) = (q 1 q 2 )d 1. Since d 1 = (q 1 q 2 )d 1, it follows that 1 = q 1 q 2. Recall that q 1 and q 2 are both positive, so it follows that q 1 = q 2 = 1. (The only other possibility, q 1 = q 2 = 1, is eliminated.) Thus, d 1 = q 1 d 2 = d 2. Theorem 2: Let a and b be integers. If gcd(a, b) exists, it is unique. Proof: Let a and b be integers and assume that gcd(a, b) exists. Suppose that d 1 = gcd(a, b) and suppose also that d 2 = gcd(a, b). Let s first view d 1 as gcd(a, b). Since d 2 is, by (a) of Definition 1, a common divisor of a and b, it follows from (b) of Definition 1 that d 2 divides d 1. Similarly, viewing d 2 as gcd(a, b), we see that d 1 divides d 2. It now follows from Lemma 1 that d 1 = d 2, so gcd(a, b) is unique when it exists. 88

Existence of the GCD Special Cases: Let a and b be integers. gcd(0, 0) does not exist. If a 0 then gcd(a, 0) = a. If a divides b then gcd(a, b) = a. If a 0 and b 0 then gcd(a, b) = gcd( a, b ). Thus, in the algorithm given as the proof of Theorem 3 below, we may always assume that a and b are positive integers. The next Lemma gives an essential reduction step for calculating gcd(a, b). Lemma 2: Let a, b, q, and r be integers such that a = qb + r. (cf. The Division Algorithm) Then gcd(a, b) = gcd(b, r). Proof: The proof of Lemma 2 is Exercise 4.2.3. Theorem 3: If a and b are integers, not both zero, then gcd(a, b) exists. Proof: The special cases were considered above. We give here an algorithm for finding gcd(a, b) when a b > 0. Apply the Division Algorithm, with b as the divisor, to obtain a = q 1 b + r 1 where 0 r 1 < b. If r 1 0, apply the Division Algorithm to b and r 1, with r 1 as the divisor, to obtain b = q 2 r 1 + r 2 where 0 r 2 < r 1. If r 2 0, apply the Division Algorithm to r 1 and r 2, with r 2 as the divisor, to obtain r 1 = q 3 r 2 + r 3 where 0 r 2 < r 1. Since the remainders r 1, r 2, r 3, etc. form a sequence of positive integers with r 1 > r 2 > r 3 0. It follows that there is an integer k such that r k 0 but r k+1 = 0. Following is the algorithm for calculating gcd(a, b): 89

Algorithm 1: Finding the GCD: Then r k = gcd(a, b). a = q 1 b + r 1 where 0 r 1 < b b = q 2 r 1 + r 2 where 0 r 2 < r 1 r 1 = q 3 r 2 + r 3 where 0 r 2 < r 1. r k 3 = q k 1 r k 2 + r k 1 where 0 r k 1 < r k 2 r k 2 = q k r k 1 + r k where 0 r k < r k 1 r k 1 = q k+1 r k To see that r k = gcd(a, b), repeatedly apply Lemma 2 to get gcd(a, b) = gcd(b, r 1 ) = gcd(r 1, r 2 ) = = gcd(r k 1, r k ). But, by the last equation in Algorithm 1, r k divides r k 1. Thus, r k = gcd(r k 1, r k ) = gcd(a, b). Example 2: Find gcd(216, 80). Solution: Repeated use of long division gives: 2 80 216 or, in equation form: r. 56 56 1 80 r. 24 24 2 56 r. 8 8 3 24 r. 0 216 = (2)80 + 56 80 = (1)56 + 24 56 = (2)24 + 8 24 = (3)8. Therefore, 8 = gcd(216, 80). Exercise 2: In each of (a) (d), find gcd(a, b). (a) a = 44, b = 0 (b) a = 22, b = 660 (c) a = 715, b = 208 (d) a = 715, b = 208 Further Theorems Theorem 4: Let a and b be integers and suppose d = gcd(a, b). Then there exist integers m and n such that d = ma + nb. Comment: Note that 6 = gcd(18, 30) and we may write 6 = (2)18 + ( 1)30 = ( 3)18 + (2)30 = (7)18 + ( 4)30, so, in the notation of Theorem 4, m and n are not unique. 90

The following algorithm for finding one choice for m and n is a continuation of Algorithm 1 for find gcd(a, b). Algorithm 2: Writing gcd(a, b) = ma + nb Beginning with the second to last equation of Algorithm 1 and working up, we solve each equation for the remainder. This gives: Recall that r k = gcd(a, b). r k = r k 2 q k r k 1 r k 1 = r k 3 q k 1 r k 2. r 3 = r 1 q 3 r 2 r 2 = b q 2 r 1 r 1 = a q 1 b In the equation for r k, substitute for r k 1, using the second equation. This gives r k = r k 2 q k r k 1 = r k 2 q k (r k 3 q k 1 r k 2 ) = (1 + q k 1 )r k 2 + ( q k )r k 3. In the resulting equation, we next substitute for r k 2 and simplify. Then substitute for r k 3 and simplify. Continuing, we eventually substitute for r 1 and simplify. This will yield r k = ma + nb. Example 3: We have seen in Example 2 that 8 = gcd(216, 80). Find integers m and n such that 8 = 216m + 80n. Solution: In the solution to Example 3 we obtained several equations representing the repeated applications of the Division Algorithm. In reverse order, we solve each those equations for the remainder. This gives: 8 = 56 (2)24 24 = 80 (1)56 56 = 216 (2)80. Now in 8 = 56 (2)24 substitute 24 = 80 (1)56 to obtain 8 = 56 2 ( 80 (1)56 ) = ( 2)80 + (3)56. Next, substitute 56 = 216 (2)80 to obtain: 8 = ( 2)80 + (3)56 = ( 2)80 + 3 ( 216 (2)80 ) = (3)216 (8)80. Thus, 8 = (3)216 (8)80. 91

Exercise 3: Find d = gcd(4977, 405) and find integers m and n such that d = 4977m + 405n. Theorem 5: Let a, and b be integers, where a and b are not both zero. Then gcd(a, b) exists so let d = gcd(a, b). For an integer c there exist integers m and n such that c = ma + nb if and only if c is a multiple of d. Proof: Note that this is an equivalence, so two proofs are required. First, let c be an integer and assume that there exist integers m and n such that c = ma + nb. Let d = gcd(a, b). Then d divides both a and b, so there exist integers a 1 and b 1 such that a = a 1 d and b = b 1 d. Thus, c = ma + nb = ma 1 d + nb 1 d = (ma 1 + nb 1 )d. Consequently, c = qd, where q = ma 1 + nb 1, and so d divides c. In the opposite direction, set d = gcd(a, b), let c be an integer, and assume that d divides c. Then there exists an integer k such that c = kd. By Theorem 4, there exist integers m 1 and n 1 such that d = m 1 a + n 1 b. Therefore, c = kd = k(m 1 a + n 1 b) = km 1 a + kn 1 b. Thus, c = ma + nb, where m = km 1 and n = kn 1. Exercise 4: Suppose 11 = ma + nb, where a, b, m, and n are integers. List all possible choices for d = gcd(a, b). 92

Section 4.2. EXERCISES 4.2.1. In each of (a) (e) you are given integers m and n, where n is positive. In each case, find integers q and r such that m = qn + r and 0 r < n. (a) m = 2, n = 5 (b) m = 2, n = 5 (c) m = 30, n = 6 (d) m = 4129, n = 232 (e) m = 4129, n = 232. 4.2.2. In each of (a) (c) below you are given integers a and b. In each case use the Division Algorithm to find gcd(a, b) and to find integers m and n such that gcd(a, b) = ma + nb (a) a = 899, b = 29 (b) a = 224, b = 98 (c) a = 963, b = 177 4.2.3. Let a, b, q, and r be integers such that a = bq + r. Prove that gcd(a, b) =gcd(b, r). 4.2.4. Let a, b, c, and d be integers such that a divides bc and d = gcd(a, b). Prove that a divides cd. 4.2.5. Let a and b be integers and let d = gcd(a, b). If k is a positive integer, prove that kd = gcd(ka, kb). 93