The following is an informal description of Euclid s algorithm for finding the greatest common divisor of a pair of numbers:

Similar documents
Ch 4.2 Divisibility Properties

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

5: The Integers (An introduction to Number Theory)

4 Powers of an Element; Cyclic Groups

Chapter 5: The Integers

NOTES ON INTEGERS. 1. Integers

Greatest Common Divisor MATH Greatest Common Divisor. Benjamin V.C. Collins, James A. Swenson MATH 2730

MATH10040 Chapter 1: Integers and divisibility

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

Intermediate Math Circles February 29, 2012 Linear Diophantine Equations I

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.

Number Theory Math 420 Silverman Exam #1 February 27, 2018

CS250: Discrete Math for Computer Science

NOTES ON SIMPLE NUMBER THEORY

This is a recursive algorithm. The procedure is guaranteed to terminate, since the second argument decreases each time.

a = qb + r where 0 r < b. Proof. We first prove this result under the additional assumption that b > 0 is a natural number. Let

The Euclidean Algorithm and Multiplicative Inverses

Chapter 1 A Survey of Divisibility 14

1 Overview and revision

All variables a, b, n, etc are integers unless otherwise stated. Each part of a problem is worth 5 points.

CISC-102 Winter 2016 Lecture 11 Greatest Common Divisor

MATH 433 Applied Algebra Lecture 4: Modular arithmetic (continued). Linear congruences.

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

Chapter 2. Divisibility. 2.1 Common Divisors

Elementary Properties of the Integers

Notes for Recitation 6

Math Circle Beginners Group February 28, 2016 Euclid and Prime Numbers Solutions

CS 5319 Advanced Discrete Structure. Lecture 9: Introduction to Number Theory II

Chapter 5. Number Theory. 5.1 Base b representations

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

MATH FINAL EXAM REVIEW HINTS

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

Homework 3, solutions

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

4. Number Theory (Part 2)

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

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:

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

Ma/CS 6a Class 2: Congruences

Rings and modular arithmetic

8 Primes and Modular Arithmetic

CHAPTER 3. Number Theory

Arithmetic Algorithms, Part 1

The Fundamental Theorem of Arithmetic

Senior Math Circles Cryptography and Number Theory Week 2

Lecture 7.5: Euclidean domains and algebraic integers

Writing Assignment 2 Student Sample Questions

Elementary Algebra Chinese Remainder Theorem Euclidean Algorithm

(e) Commutativity: a b = b a. (f) Distributivity of times over plus: a (b + c) = a b + a c and (b + c) a = b a + c a.

Discrete Mathematics GCD, LCM, RSA Algorithm

Math Circle Beginners Group February 28, 2016 Euclid and Prime Numbers

Math.3336: Discrete Mathematics. Primes and Greatest Common Divisors

Ma/CS 6a Class 1. Course Details

#26: Number Theory, Part I: Divisibility

CISC-102 Fall 2017 Week 6

INTEGERS. In this section we aim to show the following: Goal. Every natural number can be written uniquely as a product of primes.

2. THE EUCLIDEAN ALGORITHM More ring essentials

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

Proofs. Methods of Proof Divisibility Floor and Ceiling Contradiction & Contrapositive Euclidean Algorithm. Reading (Epp s textbook)

WORKSHEET MATH 215, FALL 15, WHYTE. We begin our course with the natural numbers:

2 Elementary number theory

Primes and Modular Arithmetic! CSCI 2824, Fall 2014!!

The Euclidean Algorithm

Elementary Number Theory

Integers modulo N. Geoff Smith c 1998

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?

CSE 311 Lecture 13: Primes and GCD. Emina Torlak and Kevin Zatloukal

Lecture 5: Arithmetic Modulo m, Primes and Greatest Common Divisors Lecturer: Lale Özkahya

Some Facts from Number Theory

Chapter 14: Divisibility and factorization

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

Lecture Notes. Advanced Discrete Structures COT S

Lecture 4: Number theory

Applied Cryptography and Computer Security CSE 664 Spring 2017

Introduction to Sets and Logic (MATH 1190)

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?

Part V. Chapter 19. Congruence of integers

Modular Arithmetic and Elementary Algebra

Math 511, Algebraic Systems, Fall 2017 July 20, 2017 Edition. Todd Cochrane

Number Theory Solutions Packet

CMPUT 403: Number Theory

Solutions Math 308 Homework 9 11/20/2018. Throughout, let a, b, and c be non-zero integers.

Mathematics for Computer Science Exercises for Week 10

Number theory. Myrto Arapinis School of Informatics University of Edinburgh. October 9, /29

Elementary Number Theory Review. Franz Luef

Algorithmic number theory. Questions/Complaints About Homework? The division algorithm. Division

An Algorithm for Prime Factorization

Prof. Ila Varma HW 8 Solutions MATH 109. A B, h(i) := g(i n) if i > n. h : Z + f((i + 1)/2) if i is odd, g(i/2) if i is even.

Beautiful Mathematics

cse547, math547 DISCRETE MATHEMATICS Professor Anita Wasilewska

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.

Exercises Exercises. 2. Determine whether each of these integers is prime. a) 21. b) 29. c) 71. d) 97. e) 111. f) 143. a) 19. b) 27. c) 93.

Remainders. We learned how to multiply and divide in elementary

Integers and Division

MAS114: Solutions to Exercises

Prime Factorization and GCF. In my own words

1. multiplication is commutative and associative;

0 Sets and Induction. Sets

Number theory (Chapter 4)

Number Theory and Graph Theory. Prime numbers and congruences.

Transcription:

Divisibility Euclid s algorithm The following is an informal description of Euclid s algorithm for finding the greatest common divisor of a pair of numbers: Divide the smaller number into the larger, and note the remainder. Divide the remainder into the previous divisor, and note the remainder. Keep doing this until you get a remainder of 0. The last remainder you got right before the zero remainder is your GCF. See if the instructions make sense - try an example, then we ll back up and go through all the theory. Example: Use Euclid s algorithm to find gcd(300, 70). Now, the theory. We need to build this up in stages, and so we ll start with an observation. Let a and b be the two numbers in the previous example: a = 300 and b = 70. Let s and t be a various integers, and consider the quantity sa + tb for each of the pairs s and t. Note that s and t are chosen almost at random, but all choices are such that sa + tb > 0. What can you observe?

Theorem: Let a and b be integers, not both equal to 0. Then gcd(a, b) isthe smallest positive integer that can be expressed as a sum ma + nb, where m and n are also integers. The set is bounded below, since sa + tb > 0. [Nicodemi, p. 16] The Well-Ordering Principle says the set must have a smallest member; call it d. Anything that divides both a and b will also divide d. And d divides both a and b. So d must equal gcd(a, b). Corollary: An integer x is of the form ma + nb, withm, n Z, if and only if x is a multiple of gcd(a, b). [Nicodemi, p. 17] This corollary tells us whether an equation ma + nb = x with a, b, andx given will have integer solutions for m and n. Example: Will the equation 25m +70n = 15 have integer solutions for m and n? Will the equation 25m +70n = 7 have integer solutions for m and n?

Relatively prime Let a and b be integers, not both zero. We say that a and b are relatively prime if gcd(a, b) =1. Example: Which pairs of numbers are relatively prime? 5and7 9and15 9and35 Proposition: Suppose that gcd(a, b) =d. Thengcd ³ a, b d d =1. For convenience in writing, let gcd(a, b) = d. By definition, d a and d b (it s a divisor of both). This means a d and b d are both integers. Also, by the previous theorem, d = ma + nb for some integers m and n. Divide everybody through by d: d d = ma d So 1 = m ³ a d + n µ bd. + nb d. You aren t going to find a postive integer smaller than 1, so 1 is the smallest positive integer that can be expressed as m ³ µ a + n bd. d And by that previous theorem, that makes 1 = gcd ³ a,. b d d

Euclid s lemma Suppose that gcd(a, b) = 1 and that a bc. Then a c. Euclid s lemma says that if you have two numbers a and b with no factors in common (other than 1), and you know that a divides some number that does have b has a factor...then that number a must be a factor of c, because it certainly can t be a factor of b. Suppose that gcd(a, b) = 1 and that a bc. By previous theorem, there exists integers m and n such that 1 = ma + nb. Multiply through by c: c = mac + nbc a mac (it appears there as a factor). The hypothesis is that a bc, so a nbc. Since a divides both mac and nbc, it divides their sum: a (mac + nbc) Which is equal to c: a c.

Euclid s algorithm Almost there - a couple more propositions, and we ll have an explanation of why Euclid s algorithm works. Proposition: If a>0 and a b, then gcd(a, b) = a. Proposition: Let a and b be integers and suppose that a = qb + r. Then gcd(a, b) = gcd(b, r). This is a classic use of the show two sets are equal by showing each is the subset of the other technique. The idea is to consider the set of common divisors of a and b, and the set of common divisors of b and r, and show that they are the same set (and therefore have the same largest element). Let S be the set of common divisors of a and b. LetT be the set of common divisors of b and r. Note a = qb + r, and therefore r = a qb. Show S T : Suppose x S. Then x a and x b. Therefore, x (a qb), and so x r (if x is a divisor of a and b, then it is also a divisor of r). Therefore x T, and S T. Show T S: Suppose x T. Then x b and x r. Therefore, x (bq + r), and so x a (if x is a divisor of b and r, thenx is a divisor of a). Therefore x S, and T S. So S = T, and the largest element of S must be the largest element of T. gcd(a, b) =gcd(b, r).

Example: Take the values a = 300 and b = 70. According to the previous proposition, what can you claim? The fact that this process can be repeated gives us Euclid s algorithm. Recall the original example: 300 = 4 70 + 20. gcd(300, 70) = gcd(70, 20). 70 = 3 20 + 10. gcd(70, 20)=gcd(20, 10). 20 = 2 10. And gcd(20, 10) = 10, since 10 20. gcd(300, 70) = gcd(70, 20) = gcd(20, 10) = 10