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



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

GREATEST COMMON DIVISOR

Today s Topics. Primes & Greatest Common Divisors

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

MATH 289 PROBLEM SET 4: NUMBER THEORY

CS 103X: Discrete Structures Homework Assignment 3 Solutions

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

DIVISIBILITY AND GREATEST COMMON DIVISORS

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

Section 4.2: The Division Algorithm and Greatest Common Divisors

8 Divisibility and prime numbers

6.2 Permutations continued

8 Primes and Modular Arithmetic

Homework until Test #2

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

MATH10040 Chapter 2: Prime and relatively prime numbers

The Euclidean Algorithm

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

Discrete Mathematics, Chapter 4: Number Theory and Cryptography

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

z 0 and y even had the form

15 Prime and Composite Numbers

COMMUTATIVE RINGS. Definition: A domain is a commutative ring R that satisfies the cancellation law for multiplication:

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

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.

Math 319 Problem Set #3 Solution 21 February 2002

Quotient Rings and Field Extensions

The Division Algorithm for Polynomials Handout Monday March 5, 2012

RSA and Primality Testing

SUM OF TWO SQUARES JAHNAVI BHASKAR

MATH 13150: Freshman Seminar Unit 10

The Chinese Remainder Theorem

WRITING PROOFS. Christopher Heil Georgia Institute of Technology

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

Elementary Number Theory

I. GROUPS: BASIC DEFINITIONS AND EXAMPLES

POLYNOMIAL RINGS AND UNIQUE FACTORIZATION DOMAINS

3. Mathematical Induction

TEXAS A&M UNIVERSITY. Prime Factorization. A History and Discussion. Jason R. Prince. April 4, 2011

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

Continued Fractions and the Euclidean Algorithm

PROBLEM SET 6: POLYNOMIALS

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

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

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

11 Ideals Revisiting Z

Handout #1: Mathematical Reasoning

WOLLONGONG COLLEGE AUSTRALIA. Diploma in Information Technology

V Quantitative Reasoning: Computers, Number Theory and Cryptography

Handout NUMBER THEORY

MATH 537 (Number Theory) FALL 2016 TENTATIVE SYLLABUS

5544 = = = Now we have to find a divisor of 693. We can try 3, and 693 = 3 231,and we keep dividing by 3 to get: 1

of Nebraska - Lincoln

Intermediate Math Circles March 7, 2012 Linear Diophantine Equations II

Lecture Notes on Discrete Mathematics

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,...

An Innocent Investigation

Winter Camp 2011 Polynomials Alexander Remorov. Polynomials. Alexander Remorov

ALGEBRAIC APPROACH TO COMPOSITE INTEGER FACTORIZATION

CHAPTER 3. Methods of Proofs. 1. Logical Arguments and Formal Proofs

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

Math Abstract Algebra I Questions for Section 23: Factoring Polynomials over a Field

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

SUBGROUPS OF CYCLIC GROUPS. 1. Introduction In a group G, we denote the (cyclic) group of powers of some g G by

Mathematical Induction

Computing exponents modulo a number: Repeated squaring

Breaking The Code. Ryan Lowe. Ryan Lowe is currently a Ball State senior with a double major in Computer Science and Mathematics and

The Fundamental Theorem of Arithmetic

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

Introduction to Programming (in C++) Loops. Jordi Cortadella, Ricard Gavaldà, Fernando Orejas Dept. of Computer Science, UPC

Example. Introduction to Programming (in C++) Loops. The while statement. Write the numbers 1 N. Assume the following specification:

Factoring Algorithms

1. MATHEMATICAL INDUCTION

Modern Algebra Lecture Notes: Rings and fields set 4 (Revision 2)

Settling a Question about Pythagorean Triples

Overview of Number Theory Basics. Divisibility

Theorem3.1.1 Thedivisionalgorithm;theorem2.2.1insection2.2 If m, n Z and n is a positive

Factoring Whole Numbers

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.

Public Key Cryptography: RSA and Lots of Number Theory

A Study on the Necessary Conditions for Odd Perfect Numbers

Math Circle Beginners Group October 18, 2015

s = s = s =

How To Know If A Domain Is Unique In An Octempo (Euclidean) Or Not (Ecl)

PYTHAGOREAN TRIPLES KEITH CONRAD

SOLUTIONS FOR PROBLEM SET 2

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

CISC - Curriculum & Instruction Steering Committee. California County Superintendents Educational Services Association

Solutions for Practice problems on proofs

Math Workshop October 2010 Fractions and Repeating Decimals

Lecture 3: Finding integer solutions to systems of linear equations

Lecture 13 - Basic Number Theory.

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

Lemma 5.2. Let S be a set. (1) Let f and g be two permutations of S. Then the composition of f and g is a permutation of S.

Test1. Due Friday, March 13, 2015.

The Mean Value Theorem

2.2 Derivative as a Function

Notes on Factoring. MA 206 Kurt Bryan

Session 6 Number Theory

Transcription:

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

Challenge Problem 2 (Mastermind) due Fri. 9/26 Find a fourth guess whose scoring will allow you to determine the secret code (repetitions are allowed in the code): O Y P R!!xx! Y B O W!!xo! B W Y Y!!o!

Divisors The set of divisors of a positive integer n are all those integers d whose absolute value is less than or equal to n and that have the property: d n So, for example, the divisors of 18 are: +/- 1, +/- 2, +/- 3, +/- 6, +/- 9, +/- 18 The divisors of 42 are: +/- 1, +/- 2, +/- 3, +/- 6, +/- 7, +/- 14, +/- 21, +/- 42

Primes and GCDs A prime number is a positive integer >= 2 whose only divisors are 1 and itself. For any two numbers m and n, gcd(m, n) is the greatest common divisor shared by m and n. gcd(14, 35) = 7 gcd(6, 0) = 6 gcd(8, 9) = 1 gcd(7, 5) = 1

Relatively Prime Numbers Two numbers are relatively prime if their gcd is 1: 8 and 9 are relatively prime. 12 and 15 are not relatively prime. Any two distinct primes (e.g., 5 and 11) are relatively prime. 1 and any number are relatively prime.

A couple of questions What numbers can be expressed in the form: 12 x + 27 y where x and y are integers?

A couple of questions What numbers can be expressed in the form: 13 x + 27 y where x and y are integers?

A hypothesis If two numbers m and n are relatively prime, then we can find integers x and y such that: m*x + n*y = 1 This implies in turn that any integer can be expressed in combinations of m and n.

Bezout s Theorem If two numbers m and n are relatively prime, then we can find integers x and y such that: m*x + n*y = 1 Proof by contradiction: Suppose that d is the smallest positive integer such that m*x + n*y = d, and suppose that d > 1. We ll find a positive integer smaller than d that can be expressed as a combination of m and n.

Okay, let s get started m * x + n * y = d where d > 1 Now, d can t divide both m and n, since then they wouldn t be relatively prime. So let s say d does not divide m. Then we can write: m = d*q + r where 0 < r < d So now we can write: r = m d*q = m (m*x + n*y)*q = m(1 q*x) - n * (q*y)

Okay, let s get started m * x + n * y = d where d > 1 So now we can write: r = m d*q = m (m*x + n*y)*q = m(1 q*x) - n * (q*y) But hold it! We just showed that r is a combination of m and n. And we know that r is less than d! So our original premise can t be right.

Bezout s Theorem, Again If two numbers m and n are relatively prime, then we can find x and y such that: m*x + n*y = 1 Try it for any two relatively prime numbers: 7 and 26 9 and 11

A Corollary to Bezout s Theorem If gcd(m, n) = d where d > 1, then we can find an integer combination of m and n that sums to d: m * x + n * y = d Why? Note that gcd(m/d, n/d) = 1, and then we can find a combination such that: (m/d) * x + (n/d) * y = 1

How to find the gcd? (Euclid again!) We want to find gcd(a, b) where a >= b. First, we note that if a = b, the answer is a. Also, if b = 0, the answer is a. Otherwise, we can find gcd(a, b) by noting that the greatest common divisor of a and b is also the greatest common divisor of b and the remainder r when a is divided by b.

Why does this work? Suppose d a and d b. (In prose, d goes into both a and b.) And suppose a = b*q + r. Then d b and d (a b*q).

gcd (99, 18) = gcd(18, 9) = gcd(9, 0) = 9 Two examples: gcd(70, 49) = gcd(49, 21) = gcd(21, 7) = gcd(7, 0) = 7

Scheme version of the algorithm! for finding the GCD (define (gcd a b)! (if!(= b 0)!!!!a!!!!(gcd b (remainder a b))))!!

Not only is this idea super-fast, but it s also useful: (18, 7) = (7, 4) = (4, 3) = (3, 1) = (1, 0) = 1 18 = (2 * 7) + 4 7 = (1* 4) + 3 4 = (1 * 3) + 1 Now, unwind those statements: 1 = 4 (1 * 3) = 4 - (1 * (7 (1 * 4))) = 4 (7 4) = (2 * 4) - 7 = ((2 * (18 (2 * 7))) 7 = (2 * 18) (5 * 7)

The Structure of Divisors Let s try to break down a number s divisors as far as we can: 84 = 2 * 42 = 2 * 2 * 21 = 2 * 2 * 3 * 7 We can t go any further than this, since we have only prime factors.

The Fundamental Theorem of Arithmetic Every number n has a unique factorization into primes.

A Lemma Suppose d (ab) and gcd(d,a) = 1 In prose: d goes into the product of a and b, but d and a are relatively prime. Then d b

Let s prove the lemma. Since d ab We can write: ab = dq And since gcd(d, a) = 1 We can find x and y such that: dx + ay = 1 So: dbx + aby = b dbx + dqy = b d(bx + qy) = b

Lemma 2 (a corollary to Lemma 1) We now know that if d (ab) and gcd(d,a) = 1, then d b. Suppose d is a prime number (let s call it p for prime). Then if p (ab), we know that either p a or p b. Proof: Suppose p doesn t go into a. Then by the definition of greatest common divisor (and the definition of a prime number ), gcd(p,a) = 1. Which means, from our previous lemma, that p b.

More generally, we have the following: p q 1 q 2 q 3 q n means that p must go into at least one factor in the product.

Now we re ready to prove the Fundamental Theorem of Arithmetic First we show that every number can be factored into primes. (We ll leave uniqueness for the next step.) Step 1. We know that 2 can be factored into primes (i.e., 2 itself). Step 2. Suppose that all numbers from 2 n can be factored into primes. Consider n+1. If it s prime, we re done. Step 3. Suppose it isn t prime. Then it must have some factor q. So qx = (n+1). But we know that both q and x are smaller than n+1, so they can be factored into primes. A note: this technique (step 2) is called strong induction.

The factorization is unique (proof by contradiction). Suppose the factorization weren t unique. Let m be the smallest number with two distinct prime factorizations, with factors ordered low to high: p 1 p 2 p 3..p j = m = q1q2q3 qk If p is equal to q, then we can divide both factorizations by that number, and we have a smaller value with two distinct factorizations (contrary to our assumption). So choose the smaller of p, q: let s say it s p. Then by our earlier lemma 2, p must go into one of the q factors, contrary to our assumption that they re all prime! Either way, we have a contradiction.