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

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

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

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

Wilson s Theorem and Fermat s Little Theorem

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

Number Theory Proof Portfolio

Lecture 4: Number theory

Number Theory and Group Theoryfor Public-Key Cryptography

Notes on Systems of Linear Congruences

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

An integer p is prime if p > 1 and p has exactly two positive divisors, 1 and p.

8 Primes and Modular Arithmetic

Elementary Number Theory Review. Franz Luef

3 The fundamentals: Algorithms, the integers, and matrices

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

CHAPTER 6. Prime Numbers. Definition and Fundamental Results

Outline. Number Theory and Modular Arithmetic. p-1. Definition: Modular equivalence a b [mod n] (a mod n) = (b mod n) n (a-b)

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

2.3 In modular arithmetic, all arithmetic operations are performed modulo some integer.

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

1. multiplication is commutative and associative;

4 Powers of an Element; Cyclic Groups

4 Number Theory and Cryptography

Number Theory Solutions Packet

MATH 361: NUMBER THEORY FOURTH LECTURE

Fermat's Little Theorem

Introduction to Sets and Logic (MATH 1190)

7. Prime Numbers Part VI of PJE

MATH 145 Algebra, Solutions to Assignment 4

CS483 Design and Analysis of Algorithms

ECE 646 Lecture 5. Mathematical Background: Modular Arithmetic

A Readable Introduction to Real Mathematics

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

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

[Part 2] Asymmetric-Key Encipherment. Chapter 9. Mathematics of Cryptography. Objectives. Contents. Objectives

Integers and Division

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

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

Part IA Numbers and Sets

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?

Discrete Logarithms. Let s begin by recalling the definitions and a theorem. Let m be a given modulus. Then the finite set

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

CIS 6930/4930 Computer and Network Security. Topic 5.1 Basic Number Theory -- Foundation of Public Key Cryptography

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

Lecture Notes. Advanced Discrete Structures COT S

A SURVEY OF PRIMALITY TESTS

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

Number Theory Homework.

Introduction to Cryptography CS 355 Lecture 3

7.2 Applications of Euler s and Fermat s Theorem.

Applied Cryptography and Computer Security CSE 664 Spring 2017

CPSC 467b: Cryptography and Computer Security

Applied Cryptography and Computer Security CSE 664 Spring 2018

Algebra. Modular arithmetic can be handled mathematically by introducing a congruence relation on the integers described in the above example.

download instant at

Introduction to Public-Key Cryptosystems:

Math 109 HW 9 Solutions

Topics in Cryptography. Lecture 5: Basic Number Theory

MATH 2200 Final Review

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?

Definition 6.1 (p.277) A positive integer n is prime when n > 1 and the only positive divisors are 1 and n. Alternatively

Number Theory. Modular Arithmetic

Ma/CS 6a Class 3: The RSA Algorithm

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

1 Structure of Finite Fields

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

Congruences and Residue Class Rings

Numbers. Çetin Kaya Koç Winter / 18

MONOALPHABETIC CIPHERS AND THEIR MATHEMATICS. CIS 400/628 Spring 2005 Introduction to Cryptography

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

CSC 474 Information Systems Security

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

Some Facts from Number Theory

Lecture notes: Algorithms for integers, polynomials (Thorsten Theobald)

Elementary Number Theory. Franz Luef

Numbers, Groups and Cryptography. Gordan Savin

NOTES ON SIMPLE NUMBER THEORY

Part V. Chapter 19. Congruence of integers

Number Theory Notes Spring 2011

CPSC 467: Cryptography and Computer Security

ECE 646 Lecture 5. Motivation: Mathematical Background: Modular Arithmetic. Public-key ciphers. RSA keys. RSA as a trap-door one-way function

Number Theory & Modern Cryptography

Homework #2 solutions Due: June 15, 2012

Discrete Mathematics with Applications MATH236

Senior Math Circles Cryptography and Number Theory Week 2

The number of ways to choose r elements (without replacement) from an n-element set is. = r r!(n r)!.

This exam contains 5 pages (including this cover page) and 4 questions. The total number of points is 100. Grade Table

Number Theory A focused introduction

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

Clock Arithmetic. 1. If it is 9 o clock and you get out of school in 4 hours, when do you get out of school?

4 PRIMITIVE ROOTS Order and Primitive Roots The Index Existence of primitive roots for prime modulus...

Chuck Garner, Ph.D. May 25, 2009 / Georgia ARML Practice

1 Overview and revision

EULER S THEOREM KEITH CONRAD

Chapter 5. Number Theory. 5.1 Base b representations

Introduction to Cryptography. Lecture 6

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

9 Modular Exponentiation and Square-Roots

Ma/CS 6a Class 2: Congruences

Elementary Properties of the Integers

Transcription:

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

Divisibility Outline Greatest Common Divisor Fundamental Theorem of Arithmetic Modular Arithmetic Euler Phi Function RSA Cryptosystem Reference: Course Notes of MIT 6.042J (Fall 05) by Prof. Meyer and Prof. Rubinfeld

Fundamental Theorem of Arithmetic

Fundamental Theorem of Arithmetic Theorem 3: Any positive integer n > 1 can be written in a unique way as a product of primes : n = p 1 p 2 p j (p 1 p 2 p j ) The above theorem is called the fundamental theorem of arithmetic Before we prove it, let us prove a useful lemma

Fundamental Theorem of Arithmetic Lemma 3: Let p be a prime. (1) If p ab, then p a or p b (2) If p a 1 a 2 a n, then p divides some a i Proof of (1): gcd(a, p) must be either 1 or p (why?) If gcd(a, p) = p, then the claim holds. Else gcd(a, p) = 1, so p b by Lemma 2 (part (4)). Proof of (2): By induction

Proof of the Fundamental Theorem First, we prove (by strong induction) that all n can be written as a product of primes. Base case: n = 2 is a prime. Inductive case: Assume all k < n can be written as product of primes. If n is a prime, then the statement is true. Else, n = a b for some a, b < n. Then by the induction assumption, a and b can both be written as product of primes, which implies that n = a b can be as well.

Proof of the Fundamental Theorem Next, we prove (by contradiction) that all n can be written as a product of primes in a unique way. Suppose the statement is not true Let n be the smallest integer that can be written as product of primes in more than one way Let n = p 1 p 2 p j = q 1 q 2 q k be two of the (possibly many) ways to write n as a product of primes

Proof of the Fundamental Theorem Proof (cont) : Then p 1 n so that p 1 divides some q i Since q i is a prime, we must have p 1 = q i Now we delete p 1 from the first product, and q i from the second product, we find that n / p 1 is a positive integer smaller than n and can be written as product of primes in more than one way Contradiction occurs, proof completes

Modular Arithmetic

Modular Arithemetic Gauss introduced the notion of congruence in his book Disquisitiones Arithmeticae We say a is congruent to b modulo n if n (a b) It is denoted by : a b (mod n) For instance, 29 15 (mod 7) because 7 (29 15)

Lemma 4: Facts About Congruence Congruence modulo n is an equivalent relation. That is : 1. a a (mod n) 2. a b (mod n) implies b a (mod n) 3. a b (mod n) and b c (mod n) implies a c (mod n)

Facts About Congruence Lemma 5: (Congruence and Remainder) 1. a (a rem n) (mod n) 2. a b (mod n) implies (a rem n) = (b rem n) Proof of (2) : Let q 1 and q 2 be integers such that (a rem n) = a q 1 n and (b rem n) = b q 2 n Thus (a rem n) (b rem n) = (a b) + n (q 2 q 1 ) is a multiple of n

Facts About Congruence Lemma 6: For all n 1, the following statements hold. 1. a b (mod n) implies a + c b + c (mod n) 2. a b (mod n) implies ac bc (mod n) 3. a b (mod n) and c d (mod n) implies a + c b + d (mod n) 4. a b (mod n) and c d (mod n) implies ac bd (mod n)

Cancellation Law The previous statements show that under the same modulo, we can validly perform addition, subtraction, and multiplication of congruences However, division may not be okay. For instance, 14 4 (mod 10) but 76 2 (mod 10) The theorem on the next page provides conditions where division is okay

Cancellation Law Theorem 4: If bc bd (mod n) and gcd(b, n) = 1, then c d (mod n) Proof : Since n bc bd, and gcd(b, n) = 1, we have n c d by Lemma 2 part (4)

Multiplicative Inverse In fact, the previous theorem can be proved in an alternative way : Since gcd(b, n) = 1, there exists b such that b b + qn = 1 for some q. Thus b b = 1 (mod n). The theorem follows by multiplying b on both sides of the congruence The value b is called the multiplicative inverse of b modulo n, and is usually denoted by b 1

Cancellation Law Corollary 1: Suppose p is a prime and k is not a multiple of p. Then the sequence : (0 k) rem p, (1 k) rem p,, ((p 1) k) rem p is a permutation of the sequence : 0, 1, 2,, p 1 This remains true if the first term of each sequence is omitted

Cancellation Law Proof : The first sequence contains p numbers, ranging from 0 to p 1. Also, the numbers in the first sequence are distinct; otherwise, there exists distinct i and j ( i, j < p ) such that (i k) rem p = ( j k ) rem p i k j k (mod p) i j (mod p) which is impossible. Thus, the first sequence contains all numbers from 0 to p 1. The claim is still true if first terms are omitted, as both are 0

Theorem 5: Fermat s Little Theorem Let p be a prime. Then for any integer a, Proof: If p a, then a p a (mod p) p a p a. Else, we have (p 1)! (a rem p) (2a rem p) ((p 1)a rem p) a p 1 (p 1)! (mod p) The claim follows by multiplying the multiplicative inverse of (p 1)! to both sides

Wilson s Theorem Theorem 6: The congruence (m 1)! 1 (mod m) is true if and only if m is a prime

Euler Phi Function

Euler Phi Function If gcd(a, b) = 1, we say a is coprime to b (or we say a and b are relatively prime) Euler first studied the following function : (n) = # of positive integers at most n which are coprime to n (n) is called the Euler phi function For instance, (1) = 1, (9) = 6, (10) = 4

Fermat s Little Theorem (Revisited) Corollary 2: Suppose k is a positive integer coprime to n. Let k 1, k 2,, k (n) denote all integers coprime to n, with 0 k i < n. Then the sequence : (k 1 k) rem n, (k 2 k) rem n,, (k (n) k) rem n is a permutation of the sequence : k 1, k 2,, k (n)

Euler s Theorem Theorem 7: If gcd(k, n) = 1, then Proof : k (n) 1 (mod n) k 1 k 2 k (n) (k 1 k rem n) (k 2 k rem n) (k (n) k rem n) k (n) k 1 k 2 k (n) (mod n)

Theorem 8: Euler Phi Function The function can be expressed as : (n) = n 1 1 p n p Main Idea of Proof: Induction on number of prime factors of n

Proof : Euler Phi Function Base Case: n has one prime factor In that case, n = q k for some prime q and k Then out of all numbers from 1 to q k, exactly q k 1 of them are multiples of q (n) = (q k ) = q k q k 1 = n (1 1/q)

Proof : Euler Phi Function Inductive Case: n has j prime factors Let n = q k n for some prime q and k, with gcd(q, n ) = 1 Thus, n has exactly j 1 factors Now, consider arranging the integers [1, n] into q k groups, each group with n integers Then we have (see next page) :

Euler Phi Function q k n coprime to n

Proof (cont) : Euler Phi Function Number of integers coprime to n = q k (n ) Among these integers, exactly 1/ q of them are multiples of q (why?) Number of integers coprime to q k n = q k (n ) (1 1/q) = n p n (1 1/p)

Euler Phi Function Corollary 3: The function obeys the following properties : 1. Suppose the prime factorization of n is : n = p e 1 1 p2 e 2 pj e j (all p i s are distinct) Then (n) = (p e 1 1) (p2 e 2) (pj e j) 2. Suppose a and b are relatively prime. Then (ab) = (a) (b)