Chapter 3 Basic Number Theory

Similar documents
3 The fundamentals: Algorithms, the integers, and matrices

Definition: div Let n, d 0. We define ndiv d as the least integer quotient obtained when n is divided by d. That is if

4 Number Theory and Cryptography

Math 109 HW 9 Solutions

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?

ELEMENTS OF NUMBER THEORY

Ch 4.2 Divisibility Properties

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?

3.2 Solving linear congruences. v3

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

The Chinese Remainder Theorem

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

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

Notes on Systems of Linear Congruences

Basic elements of number theory

Basic elements of number theory

NOTES ON SIMPLE NUMBER THEORY

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

Wilson s Theorem and Fermat s Little Theorem

4 Powers of an Element; Cyclic Groups

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

Math 261 Spring 2014 Final Exam May 5, 2014

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

Homework #2 solutions Due: June 15, 2012

For your quiz in recitation this week, refer to these exercise generators:

The Euclidean Algorithm and Multiplicative Inverses

Ma/CS 6a Class 2: Congruences

Part V. Chapter 19. Congruence of integers

Chapter 5. Number Theory. 5.1 Base b representations

Number theory lectures

Chapter 1 A Survey of Divisibility 14

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

Chapter 2. Divisibility. 2.1 Common Divisors

AN ALGEBRAIC PROOF OF RSA ENCRYPTION AND DECRYPTION

CHAPTER 3. Congruences. Congruence: definitions and properties

Slides by Christopher M. Bourke Instructor: Berthe Y. Choueiry. Spring 2006

Number Theory Proof Portfolio

4.4 Solving Congruences using Inverses

MATH 501 Discrete Mathematics. Lecture 6: Number theory. German University Cairo, Department of Media Engineering and Technology.

Lecture 2. The Euclidean Algorithm and Numbers in Other Bases

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

CSE 20 DISCRETE MATH. Winter

Elementary Properties of the Integers

CSE 20 DISCRETE MATH. Winter

PUTNAM TRAINING NUMBER THEORY. Exercises 1. Show that the sum of two consecutive primes is never twice a prime.

MTH 346: The Chinese Remainder Theorem

Discrete Mathematics and Probability Theory Fall 2013 Vazirani Note 3

NUMBER THEORY AND CODES. Álvaro Pelayo WUSTL

The Chinese Remainder Theorem

SOLUTIONS TO PROBLEM SET 1. Section = 2 3, 1. n n + 1. k(k + 1) k=1 k(k + 1) + 1 (n + 1)(n + 2) n + 2,

Integers and Division

Course 2BA1: Trinity 2006 Section 9: Introduction to Number Theory and Cryptography

Know the Well-ordering principle: Any set of positive integers which has at least one element contains a smallest element.

12x + 18y = 50. 2x + v = 12. (x, v) = (6 + k, 2k), k Z.

MATH 361: NUMBER THEORY FOURTH LECTURE

MATH 145 Algebra, Solutions to Assignment 4

MATH 2112/CSCI 2112, Discrete Structures I Winter 2007 Toby Kenney Homework Sheet 5 Hints & Model Solutions

Lecture 7: Number Theory Steven Skiena. skiena

1. multiplication is commutative and associative;

A Readable Introduction to Real Mathematics

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

LARGE PRIME NUMBERS (32, 42; 4) (32, 24; 2) (32, 20; 1) ( 105, 20; 0).

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

Course MA2C02, Hilary Term 2013 Section 9: Introduction to Number Theory and Cryptography

MATH 4400 SOLUTIONS TO SOME EXERCISES. 1. Chapter 1

CSE 20 DISCRETE MATH. Fall

Wednesday, February 21. Today we will begin Course Notes Chapter 5 (Number Theory).

Beautiful Mathematics

Introduction to Sets and Logic (MATH 1190)

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

NUMBER SYSTEMS. Number theory is the study of the integers. We denote the set of integers by Z:

Number theory (Chapter 4)

Introduction to Cryptography CS 355 Lecture 3

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

Lecture Notes. Advanced Discrete Structures COT S

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

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

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

EXAMPLES OF MORDELL S EQUATION

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.

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

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:

Number Theory. CSS322: Security and Cryptography. Sirindhorn International Institute of Technology Thammasat University CSS322. Number Theory.

The Impossibility of Certain Types of Carmichael Numbers

p = This is small enough that its primality is easily verified by trial division. A candidate prime above 1000 p of the form p U + 1 is

Chapter 8. Introduction to Number Theory

Ma/CS 6a Class 2: Congruences

MATH 215 Final. M4. For all a, b in Z, a b = b a.

Divisibility of Natural Numbers

Homework #2 Solutions Due: September 5, for all n N n 3 = n2 (n + 1) 2 4

7.2 Applications of Euler s and Fermat s Theorem.

Chapter 5: The Integers

CS March 17, 2009

CISC-102 Fall 2017 Week 6

Introduction to Number Theory

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

Chapter 9 Mathematics of Cryptography Part III: Primes and Related Congruence Equations

Applied Cryptography and Computer Security CSE 664 Spring 2017

Math 324, Fall 2011 Assignment 7 Solutions. 1 (ab) γ = a γ b γ mod n.

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

Transcription:

Chapter 3 Basic Number Theory

What is Number Theory? Well...

What is Number Theory? Well... Number Theory The study of the natural numbers (Z + ), especially the relationship between different sorts of numbers.

What is Number Theory? Well... Number Theory The study of the natural numbers (Z + ), especially the relationship between different sorts of numbers. Divisibility Suppose n, m Z, m 0, we say m divides n if n is a multiple of m. That is, k Z n = mk. If m divides n, we write m n. If not, m n.

Greatest Common Factors Basic Examples gcd(12,20)=

Greatest Common Factors Basic Examples gcd(12,20)= 4 gcd(18,30)=

Greatest Common Factors Basic Examples gcd(12,20)= 4 gcd(18,30)= 6 gcd(225,120)=

Greatest Common Factors Basic Examples gcd(12,20)= 4 gcd(18,30)= 6 gcd(225,120)= 15

Greatest Common Factors Basic Examples gcd(12,20)= 4 gcd(18,30)= 6 gcd(225,120)= 15 For the last one, we cant just look at it and know the answer - we need some technique, and prime factorization works here. 120 = 2 3 3 5, 225 = 3 2 5 2 This is not practical for large numbers.

The Euclidean Algorithm Example Find (132, 36)

The Euclidean Algorithm Example Find (132, 36) 132 = 3 36 + 24

The Euclidean Algorithm Example Find (132, 36) 132 = 3 36 + 24 36 = 1 24 + 12

The Euclidean Algorithm Example Find (132, 36) 132 = 3 36 + 24 36 = 1 24 + 12 24 = 2 12 + 0

The Euclidean Algorithm Example Find (132, 36) 132 = 3 36 + 24 36 = 1 24 + 12 24 = 2 12 + 0 So, (132, 36) = 12.

Another Example Example Find (1160718174, 316258250)

Another Example Example Find (1160718174, 316258250) The answer we seek is 1078.

Another Example Example Find (1160718174, 316258250) The answer we seek is 1078. Can you generalize this? (a, b) =

Another Example Example Find (1160718174, 316258250) The answer we seek is 1078. Can you generalize this? (a, b) = (b, r)

The Division Algorithm Before we analyze, where does this equation come from? The division algorithm, which states

The Division Algorithm Before we analyze, where does this equation come from? The division algorithm, which states The Division Algorithm a = bq + r, 0 r < b There are two parts to this proof, the existence of q and r, and uniqueness.

The Division Algorithm Before we analyze, where does this equation come from? The division algorithm, which states The Division Algorithm a = bq + r, 0 r < b There are two parts to this proof, the existence of q and r, and uniqueness. Proof Existence Consider the set S = {a nd n Z}. We claim S contains a non-negative integer. There are two cases to consider: 1 If a 0, choose n = 0 2 If a < 0, choose n = ad

The Division Algorithm Proof Proof In both cases, a nd is non-negative and thus S always contains at least one non-negative integer. This means we can apply the well-ordering principle.

The Division Algorithm Proof Proof In both cases, a nd is non-negative and thus S always contains at least one non-negative integer. This means we can apply the well-ordering principle. Every non-empty set of positive integers contains a smallest element.

The Division Algorithm Proof Proof In both cases, a nd is non-negative and thus S always contains at least one non-negative integer. This means we can apply the well-ordering principle. Every non-empty set of positive integers contains a smallest element. and we can deduce that S contains a least non-negative integer r. By definition, r = a nd for some n. Let q be this n. Then, by rearranging, a = qd + r.

The Division Algorithm Proof Proof It remains to show 0 r < d. The first inequality holds as r was chosen to be non-negative. To show r < d, suppose r d. Since d 0, r > 0 but d > 0 or d < 0.

The Division Algorithm Proof Proof It remains to show 0 r < d. The first inequality holds as r was chosen to be non-negative. To show r < d, suppose r d. Since d 0, r > 0 but d > 0 or d < 0. If d > 0 then r d implies a qd d, further implying a qd d 0 a (q + 1)d 0. Therefore, a (q + 1)d S, and since a (q + 1)d = r d with d > 0, we know a (q + 1)d < r, contradicting that r was the least non-negative element in S.

The Division Algorithm Proof Proof It remains to show 0 r < d. The first inequality holds as r was chosen to be non-negative. To show r < d, suppose r d. Since d 0, r > 0 but d > 0 or d < 0. If d > 0 then r d implies a qd d, further implying a qd d 0 a (q + 1)d 0. Therefore, a (q + 1)d S, and since a (q + 1)d = r d with d > 0, we know a (q + 1)d < r, contradicting that r was the least non-negative element in S. If d < 0, then r d implies that a qd d. This implies that a qd + d 0 a (q 1)d 0. Therefore, a (q 1)d S and, since a (q 1)d = r + d with d < 0, we know a (q 1)d < r. So, r < d, completing the existence proof.

The Division Algorithm Proof Proof. Uniqueness Suppose there exists q, q, r, r with 0 r, r < d a = dq + r and a = dq + r. Without loss of generality, assume q q. Subtracting the two equations yields d(q q) = r r.

The Division Algorithm Proof Proof. Uniqueness Suppose there exists q, q, r, r with 0 r, r < d a = dq + r and a = dq + r. Without loss of generality, assume q q. Subtracting the two equations yields d(q q) = r r. If d > 0 then r r and r < d d + r, so (r r ) < d. Similarly, if d < 0 then r r and r < d d + r, so (r r ) < d. Combining these yields r r < d.

The Division Algorithm Proof Proof. Uniqueness Suppose there exists q, q, r, r with 0 r, r < d a = dq + r and a = dq + r. Without loss of generality, assume q q. Subtracting the two equations yields d(q q) = r r. If d > 0 then r r and r < d d + r, so (r r ) < d. Similarly, if d < 0 then r r and r < d d + r, so (r r ) < d. Combining these yields r r < d. The original equation implies d divides r r. So, d r r or r r = 0. But, we established that r r < d, so r = r. Substituting into the original equation yields dq = dq and since d 0, q = q, proving uniqueness.

The Division Algorithm Back to the Euclidean Algorithm. The general method looks like: a = q 1 b + r 1 b = q 2 r 1 + r 2 r 1 = q 3 r 2 + r 3 r 2 = q 4 r 3 + r 4 r n 2 = q n r n 1 + r n r n 1 = q n+1 r n + 0.

The Division Algorithm Back to the Euclidean Algorithm. The general method looks like: a = q 1 b + r 1 b = q 2 r 1 + r 2 r 1 = q 3 r 2 + r 3 r 2 = q 4 r 3 + r 4 r n 2 = q n r n 1 + r n r n 1 = q n+1 r n + 0 Why is this last nonzero remainder r n a common divisor of a and b?.

The Division Algorithm Back to the Euclidean Algorithm. The general method looks like: a = q 1 b + r 1 b = q 2 r 1 + r 2 r 1 = q 3 r 2 + r 3 r 2 = q 4 r 3 + r 4 r n 2 = q n r n 1 + r n r n 1 = q n+1 r n + 0 Why is this last nonzero remainder r n a common divisor of a and b? Start from the bottom and work upwards..

Justification The last line r n 1 = q n+1 r n shows that r n r n 1.

Justification The last line r n 1 = q n+1 r n shows that r n r n 1. The line above that r n 2 = q n r n 1 + r n shows that r n divides r n 2 since it divides r n and r n 1.

Justification The last line r n 1 = q n+1 r n shows that r n r n 1. The line above that r n 2 = q n r n 1 + r n shows that r n divides r n 2 since it divides r n and r n 1. By continuing in this fashion, we see it also divides r n 3, r n 4,, all the way through to a and b.

Justification But, why is r n the greatest common divisor of a and b?

Justification But, why is r n the greatest common divisor of a and b? Suppose d is any common divisor of a and b. We will work our way back down the list. Consider a = q 1 b + r 1. Since d divides a and b, it must also divide r 1. The second equation b = q 2 r 1 + r 2 shows d must divide r 2.

Justification But, why is r n the greatest common divisor of a and b? Suppose d is any common divisor of a and b. We will work our way back down the list. Consider a = q 1 b + r 1. Since d divides a and b, it must also divide r 1. The second equation b = q 2 r 1 + r 2 shows d must divide r 2. Continuing down the line, at each stage we know d divides the previous two remainders, r i 1 and r i, and the current line r i 1 = q i+1 r i + r i+1 will tell us d also divides r i+1.

Justification But, why is r n the greatest common divisor of a and b? Suppose d is any common divisor of a and b. We will work our way back down the list. Consider a = q 1 b + r 1. Since d divides a and b, it must also divide r 1. The second equation b = q 2 r 1 + r 2 shows d must divide r 2. Continuing down the line, at each stage we know d divides the previous two remainders, r i 1 and r i, and the current line r i 1 = q i+1 r i + r i+1 will tell us d also divides r i+1. Eventually, we reach r n 2 = q n r n 1 + r n, at which point we conclude d r n. So, if we have any common divisor of a and b in d then d r n. Therefore r n must be the greatest common divisor of a and b.

The Division Algorithm Statement of the Euclidean Algorithm To compute (a, b), let r 1 = a and r 0 = b and compute successive quotients and remainders of r i 1 = q i+1 r i + r i+1 until some remainder r n+1 = 0. Then r n is the greatest common divisor. Note: Although the notation may look odd, we let a = r 1 so that we have a mechanism to refer to all values in the algorithm in the form r i.

Primes Theorem There are infinitely many primes.

Primes Theorem There are infinitely many primes. Proof. Suppose we start with a list of all primes p 1, p 2,, p n. Let A = p 1 p 2 p n + 1. A is larger than any number on our list. So, if A is prime then we are done.

Primes Theorem There are infinitely many primes. Proof. Suppose we start with a list of all primes p 1, p 2,, p n. Let A = p 1 p 2 p n + 1. A is larger than any number on our list. So, if A is prime then we are done. If A is composite, then there must be a q 1 q 1 A where q 1 p i for all i = 1, n. Because q 1 1 we have a contradiction, So, it must be so that q 1 is a prime not on our original list.

Primes Theorem There are infinitely many primes. Proof. Suppose we start with a list of all primes p 1, p 2,, p n. Let A = p 1 p 2 p n + 1. A is larger than any number on our list. So, if A is prime then we are done. If A is composite, then there must be a q 1 q 1 A where q 1 p i for all i = 1, n. Because q 1 1 we have a contradiction, So, it must be so that q 1 is a prime not on our original list. Let B = q 1 p 1 p n + 1 and repeat this process.

Helpful Tools for Number Theory Theorem If x 0, y 0 is a solution of ax + by = c, then so is x 0 + bt, y 0 at. Proof. We know ax 0 + by 0 = c. Consider the following: a(x 0 + bt) + b(y 0 at) = ax 0 + abt + by 0 abt = ax 0 + by 0 = c

Helpful Tools for Number Theory Theorem If (a, b) c then ax + by = c has no solution and if (a, b) c then ax + by = c has a solution. Proof. Suppose x 0, y 0 Z ax 0 + by 0 = c. Since (a, b) ax 0 and (a, b) by 0, (a, b) c. Conversely, suppose (a, b) c. then c = m(a, b) for some m. We know ar + bs = (a, b) for some r, s Z. Then, and x = rm, y = sm is a solution. a(rm) + b(sm) = m(a, b) = c

One More Theorem Theorem Suppose (a, b) = 1 and x 0, y 0 is a solution of ax + by = c. Then all solutions are given by x = x 0 + bt, y = y 0 at for t Z.

Congruences Definition Let a, b, n be integers with n 0, We say a b(mod n) if a b is a multiple of n.

Congruences Definition Let a, b, n be integers with n 0, We say a b(mod n) if a b is a multiple of n. The Linear Congruence Theorem Suppose g = (a, m). a) If g b then ax b(mod m) has no solutions. b) If g b then ax b(mod m) has exactly g incongruent solutions.

Proof of (a) Proof. (by contrapositive) If ax b(mod m) has a solution then (a, m) b. Suppose r is a solution. Then ar b(mod m) by definition, and from the definition, m (ar b), or ar b = km for some k. Since (a, m) a and (a, m) km, it follows that (a, m) b.

Proof of (b) Proof. Since g = (a, m) and g b then we can rewrite our congruence as a g x b ( mod m ) g g

Proof of (b) Proof. Since g = (a, m) and g b then we can rewrite our congruence as a g x b ( mod m ) g g ( ) But, a g, m g =1, so the right hand side has a unique solution modulo ( ) m g, say x x m 1 g.

Proof of (b) Proof. Since g = (a, m) and g b then we can rewrite our congruence as a g x b ( mod m ) g g ( ) But, a g, m g =1, so the right hand side has a unique solution modulo ( ) m g, say x x m 1 g. So, the integers x which satisfy ax b(mod m) are exactly those of the form x = x 1 + k m g for some k.

Proof of (b) Proof. Consider the set of integers { x 1, x 1 + m g, x 1 + 2 m g,, x 1 + (g 1) m } g

Proof of (b) Proof. Consider the set of integers { x 1, x 1 + m g, x 1 + 2 m g,, x 1 + (g 1) m } g None of these are congruent modulo m and none differ by as much as m. further, for any k Z, we have that x 1 + k m g is congruent modulo m to one of them.

Proof of (b) Proof. To see this, write k = gq + r where 0 r < d from the Division Algorithm. then, x 1 + k m g = x 1 + (gq + r) m g = x 1 + mq + r m g x 1 + r m (mod m) g So, these are the g solutions of ax b(mod m).

Congruence Rules 1 a a(mod m)

Congruence Rules 1 a a(mod m) 2 a 0(mod m) iff m a

Congruence Rules 1 a a(mod m) 2 a 0(mod m) iff m a 3 a b(mod m) iff b a(mod m)

Congruence Rules 1 a a(mod m) 2 a 0(mod m) iff m a 3 a b(mod m) iff b a(mod m) 4 If a b(mod m) and c d(mod m) then 1 a + c b + d(mod m)

Congruence Rules 1 a a(mod m) 2 a 0(mod m) iff m a 3 a b(mod m) iff b a(mod m) 4 If a b(mod m) and c d(mod m) then 1 a + c b + d(mod m) 2 ac bd(mod m)

Congruence Rules 1 a a(mod m) 2 a 0(mod m) iff m a 3 a b(mod m) iff b a(mod m) 4 If a b(mod m) and c d(mod m) then 1 a + c b + d(mod m) 2 ac bd(mod m) 5 (a, n) = 1 then ab ac(mod n) implies that b c(mod n)

Congruence Rules 1 a a(mod m) 2 a 0(mod m) iff m a 3 a b(mod m) iff b a(mod m) 4 If a b(mod m) and c d(mod m) then 1 a + c b + d(mod m) 2 ac bd(mod m) 5 (a, n) = 1 then ab ac(mod n) implies that b c(mod n) 6 If (a, n) = d 1 then a b(mod n) implies a d b d (mod n d )

Congruence Rules 1 a a(mod m) 2 a 0(mod m) iff m a 3 a b(mod m) iff b a(mod m) 4 If a b(mod m) and c d(mod m) then 1 a + c b + d(mod m) 2 ac bd(mod m) 5 (a, n) = 1 then ab ac(mod n) implies that b c(mod n) 6 If (a, n) = d 1 then a b(mod n) implies a d b d (mod n d ) 7 If (a, m) = 1 then ax b(mod m) has one solution.

Using These Properties Example Solve for x in 4x 3(mod 19).

Using These Properties Example Solve for x in 4x 3(mod 19). Since (5, 19) = 1, we can multiply both sides by 5. This gives 4x 3(mod 19) 20x 15(mod 19) and since 20 1(mod 19), we have that x 15(mod 19).

And Another One Example Solve for x in 6x 15(mod 514)

And Another One Example Solve for x in 6x 15(mod 514) Since 6x 15 is always odd, it can never be divisible by 514. So, there is no solution.

Fermat s Little Theorem Theorem Let p be a prime which does not divide the integer a, then a p 1 1(mod p). Proof. Start by listing the first p 1 positive multiples of a: a, 2a, 3a,, (p 1)a.

Fermat s Little Theorem Theorem Let p be a prime which does not divide the integer a, then a p 1 1(mod p). Proof. Start by listing the first p 1 positive multiples of a: a, 2a, 3a,, (p 1)a. Suppose that ra and sa are the same modulo p, then we have r s(mod p), so the p 1 multiples of a above are distinct and nonzero; that is, they must be congruent to 1, 2, 3,, p 1 in some order.

Fermat s Little Theorem Theorem Let p be a prime which does not divide the integer a, then a p 1 1(mod p). Proof. Start by listing the first p 1 positive multiples of a: a, 2a, 3a,, (p 1)a. Suppose that ra and sa are the same modulo p, then we have r s(mod p), so the p 1 multiples of a above are distinct and nonzero; that is, they must be congruent to 1, 2, 3,, p 1 in some order. Multiply all these congruences together and we find a 2a 3a (p 1)a 1 2 3 (p 1)(mod p) or better, a p 1 (p 1)! (p 1)!(mod p). Divide both sides by (p 1)! to complete the proof.