Wilson s Theorem and Fermat s Little Theorem

Similar documents
Number Theory Homework.

4.4 Solving Congruences using Inverses

Part V. Chapter 19. Congruence of integers

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

Notes on Systems of Linear Congruences

Math 109 HW 9 Solutions

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

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

Chapter 3 Basic Number Theory

M381 Number Theory 2004 Page 1

Discrete Mathematics with Applications MATH236

A Readable Introduction to Real Mathematics

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

Euler s, Fermat s and Wilson s Theorems

Math 261 Spring 2014 Final Exam May 5, 2014

7.2 Applications of Euler s and Fermat s Theorem.

NOTES ON SIMPLE NUMBER THEORY

3.2 Solving linear congruences. v3

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

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

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

CSE 20 DISCRETE MATH. Winter

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

Chapter 5. Modular arithmetic. 5.1 The modular ring

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

9 Modular Exponentiation and Square-Roots

Carmen s Core Concepts (Math 135)

Fermat's Little 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,

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

Notes on Primitive Roots Dan Klain

3 The fundamentals: Algorithms, the integers, and matrices

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?

Congruence of Integers

cse 311: foundations of computing Fall 2015 Lecture 11: Modular arithmetic and applications

Ma/CS 6a Class 2: Congruences

Sums of Squares. Bianca Homberg and Minna Liu

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

. In particular if a b then N(

Modular Arithmetic Instructor: Marizza Bailey Name:

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

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?

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

Solutions to Assignment 1

Classification of Finite Fields

Proof 1: Using only ch. 6 results. Since gcd(a, b) = 1, we have

4 Number Theory and Cryptography

ALGEBRA I (LECTURE NOTES 2017/2018) LECTURE 9 - CYCLIC GROUPS AND EULER S FUNCTION

7. Prime Numbers Part VI of PJE

The Impossibility of Certain Types of Carmichael Numbers

Ma/CS 6a Class 2: Congruences

1. Prove that the number cannot be represented as a 2 +3b 2 for any integers a and b. (Hint: Consider the remainder mod 3).

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

PMA225 Practice Exam questions and solutions Victor P. Snaith

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

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

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

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

MA441: Algebraic Structures I. Lecture 18

Lecture Notes. Advanced Discrete Structures COT S

Partial Sums of Powers of Prime Factors

Math 110 HW 3 solutions

MTH 346: The Chinese Remainder Theorem

8 Primes and Modular Arithmetic

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

SOLUTIONS FOR IMO 2005 PROBLEMS

ax b mod m. has a solution if and only if d b. In this case, there is one solution, call it x 0, to the equation and there are d solutions x m d

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

Chapter 8. Introduction to Number Theory

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

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?

Number Theory Proof Portfolio

CSE 20 DISCRETE MATH. Fall

Homework #2 solutions Due: June 15, 2012

Theory of RSA. Hiroshi Toyoizumi 1. December 8,

Elementary Algebra Chinese Remainder Theorem Euclidean Algorithm

Math 4400 First Midterm Examination September 21, 2012 ANSWER KEY. Please indicate your reasoning and show all work on this exam paper.

Math 4400/6400 Homework #8 solutions. 1. Let P be an odd integer (not necessarily prime). Show that modulo 2,

Chapter 1. Number of special form. 1.1 Introduction(Marin Mersenne) 1.2 The perfect number. See the book.

4 Powers of an Element; Cyclic Groups

Lagrange s polynomial

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

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

Elementary Number Theory Review. Franz Luef

Relations. Binary Relation. Let A and B be sets. A (binary) relation from A to B is a subset of A B. Notation. Let R A B be a relation from A to B.

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

Elementary Number Theory. Franz Luef

Number Theory and Group Theoryfor Public-Key Cryptography

ICS141: Discrete Mathematics for Computer Science I

Summary Slides for MATH 342 June 25, 2018

3 Solutions of congruences

ELEMENTS OF NUMBER THEORY

Selected Chapters from Number Theory and Algebra

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

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

MATH 4400 SOLUTIONS TO SOME EXERCISES. 1. Chapter 1

Applied Cryptography and Computer Security CSE 664 Spring 2018

Solution Sheet (i) q = 5, r = 15 (ii) q = 58, r = 15 (iii) q = 3, r = 7 (iv) q = 6, r = (i) gcd (97, 157) = 1 = ,

Number Theory. Modular Arithmetic

Beautiful Mathematics

Transcription:

Wilson s Theorem and Fermat s Little Theorem Wilson stheorem THEOREM 1 (Wilson s Theorem): (p 1)! 1 (mod p) if and only if p is prime. EXAMPLE: We have (2 1)!+1 = 2 (3 1)!+1 = 3 (4 1)!+1 = 7 (5 1)!+1 = 5 2 (6 1)!+1 = 11 2 (7 1)!+1 = 7 103 (8 1)!+1 = 71 2 (9 1)!+1 = 61 661 (10 1)!+1 = 19 71 269 (11 1)!+1 = 11 329891 (12 1)!+1 = 39916801 (13 1)!+1 = 13 2 2834329 (14 1)!+1 = 83 75024347 (15 1)!+1 = 23 3790360487 (16 1)!+1 = 59 479 46271341 (17 1)!+1 = 17 61 137 139 1059511 REMARK: The first proof of Wilson s Theorem was given by the French mathematician Joseph Lagrange in 1770. The mathematician after whom the theorem is named, John Wilson, conjectured, but did not prove it. Proof: Suppose p is prime. When p = 2 and p = 3, the Theorem is true (see the Example above). Now let p be a prime greater than 3. By Theorem 1 from Section 4.2, for each integer a with 1 a p 1 there is a unique (since (a,p) = 1) inverse ā, 1 ā p 1, with aā 1 (mod p) By Theorem 2 from Section 4.2, the only positive integers less than p that are their own inverses are 1 and p 1. Therefore, we can group the integers from 2 to p 2 into (p 3)/2 pairs of integers, with the product of each pair congruent to 1 modulo p. Hence, we have 2 3...(p 3)(p 2) 1 (mod p) We multiply both sides of this congruence by 1 and p 1 to obtain (p 1)! = 1 2 3...(p 3)(p 2)(p 1) 1 (p 1) 1 (mod p) This completes the first part of the proof. 1

Now assume that p is a composite integer and that (p 1)! 1 (mod p) Since p is composite, we have p = ab, where 1 < a < p and 1 < b < p. Because a < p, we know that a (p 1)!, since a is one of the p 1 numbers multiplied together to form (p 1)!. Because (p 1)! 1 (mod p), it follows that p ((p 1)!+1). This means, by Theorem 1 from Section 1.5, that a also divides (p 1)!+1. By Theorem 2 from Section 1.5, since a (p 1)! and a ((p 1)!+1) we conclude that a [((p 1)!+1) (p 1)!] = 1 This is a contradiction, since a > 1. Fermat s Little Theorem THEOREM 2 (Fermat s Little Theorem): If p is prime and a is an integer with p a (1) then p a p 1 1 or, equivalently, a p 1 1 (mod p) (2) REMARK 1: If p a, then a p 1 1 (mod p). Indeed, p a implies a 0 (mod p), which gives a p 1 0 (mod p) by Theorem 5 from Section 4.1. REMARK 2: The converse of Fermat s little theorem is not generally true. Indeed, if a = 5 and p = 4, then (2) becomes 5 4 1 1 (mod 4) It is much harder to find a similar example for a = 2. Indeed, the smallest composite integer p > 1 such that 2 p 1 1 (mod p) is p = 341 = 11 31. Proof of the Theorem: Consider the following numbers: By the Division Algorithm we have a, 2a, 3a,...,(p 1)a a = pk 1 +r 1 a r 1 (mod p) 2a = pk 2 +r 2 2a r 2 (mod p) 3a = pk 3 +r 3... = 3a r 3 (mod p)... (3) (p 1)a = pk p 1 +r p 1 (p 1)a r p 1 (mod p) 2

where 0 r i p 1. Moreover, r i 0, since otherwise p ia, and therefore by Theorem 2 from Section 3.5, p i or p a. But this is impossible, since p > i and p a by (1). So, From (3) by part (iii) of Theorem 4 (Section 4.1) it follows that LEMMA: We have Proof: We first show that 1 r i p 1 (4) (p 1)!a p 1 r 1 r 2...r p 1 (mod p) (5) r 1 r 2...r p 1 = (p 1)! (6) r 1,r 2,...,r p 1 are all distinct. (7) In fact, assume to the contrary that r i = r j for some i j. Then by (3) we have hence ia pk i = ja pk j (i j)a = p(k i k j ) Thismeansthatpdivides(i j)a.fromthisbytheorem2(section3.5)itfollowsthatp (i j) or p a. But this is impossible, since p > i j by (4) and p a by (1). This contradiction proves (7). So, we have p 1 distinct numbers between 1 and p 1. This means that which gives (6). By (5) and (6) we obtain so {r 1,r 2,...,r p 1 } = {1,2,...,p 1} (p 1)!a p 1 (p 1)! (mod p) (p 1)!a p 1 (p 1)! 0 (mod p) (p 1)!(a p 1 1) 0 (mod p) p 1 2...(p 1)(a p 1 1) Since p divides the product, by Theorem 2 from Section 3.5, it follows that p divides at least one of its terms. Note that p 1, p 2,...,p (p 1) Therefore p a p 1 1 or, equivalently, a p 1 1 (mod p) 3

COROLLARY: If p is prime and a is a positive integer, then a p a (mod p) Proof: If p a, by Fermat s little theorem, we know that a p 1 1 (mod p) Multiplying both sides of this congruence by a, we find that If p a, then p a p as well, so that a p a (mod p) a p a 0 (mod p) This finishes the proof, since a p a (mod p) if p a and if p a. EXAMPLE: Prove that 17 a 80 1 for any positive integer a with (a,17) = 1. Solution: By Fermat s Little theorem we have a 16 1 (mod 17) therefore by Theorem 5 from Section 4.1, we get and the result follows. a 16 5 1 5 1 (mod 17) EXAMPLE: Prove that 23 a 154 1 for any for any positive integer a with (a,23) = 1. Solution: By Fermat s Little theorem we have a 22 1 (mod 23) therefore by Theorem 5 from Section 4.1, we get and the result follows. EXAMPLE: Prove that 300 11 10 1. Solution: We have a 22 7 1 7 1 (mod 23) 11 10 1 = (11 5 +1)(11 5 1) = (11 5 +1)(11 1)(11 4 +11 3 +11 2 +11+1) (8) Since 11 1 mod 10, by Theorem 5 from Section 4.1, we get 11 n 1 mod 10. Therefore by Theorem 4 from Section 4.1, we obtain 11 4 +11 3 +11 2 +11+1 5 (mod 10) hence 11 4 +11 3 +11 2 +11+1 is divisible by 5. We also note that 11 5 +1 is divisible by 2 and 11 1 is divisible by 10. Therefore the right-hand side of (8) is divisible by 2 10 5 = 100. On the other hand, by Fermat s Little Theorem, 11 10 1 is divisible by 3. Since (3,100) = 1, the whole expression is divisible by 300. 4

EXAMPLE: What is the remainder after dividing 3 50 by 7? Solution: By Fermat s Little theorem we have 3 6 1 (mod 7) therefore by Theorem 5 from Section 4.1, we get 3 6 8 1 48 1 (mod 7) therefore 3 50 9 2 (mod 7) EXAMPLE: Prove that for any integer n 0. Solution 1: STEP 1: For n = 0 (9) is true, since 3 0 3 0. 3 n 3 n (9) STEP 2: Suppose (9) is true for some n = k 0, that is 3 k 3 k. STEP 3: Prove that (9) is true for n = k +1, that is 3 (k +1) 3 (k +1). We have (k +1) 3 (k +1) = k 3 +3k 2 +3k +1 k 1 = k 3 k }{{} Solution 2: 3 n 3 n by the Corollary above with p = 3. St. 2 div. by 3 +3k } 2 {{ +3k }. div. by 3 THEOREM 3: If p is prime and a is an integer such that p a, then a p 2 is an inverse of a modulo p. Proof: If p a, then by Fermat s little theorem we have Hence, a p 2 is an inverse of a modulo p. a a p 2 = a p 1 1 (mod p) COROLLARY: If a and b are positive integers and p is prime with p a, then the solutions of the linear congruence ax b (mod p) are the integers x such that x a p 2 b (mod p) Proof: Suppose that ax b (mod p). Since p a, we know from the Theorem above that a p 2 is an inverse of a modulo p. Multiplying both sides of the original congruence by a p 2, we have a p 2 ax a p 2 b (mod p) Hence, x a p 2 b (mod p) 5

EXAMPLE: Find all solutions of the following congruence 2x 5 (mod 7) Solution 1: We first note that (2,7) = 1. Therefore we can apply the Corollary from Section 4.2. Since s = 4 is a particular solution of 2s 1 (mod 7), we get x bs 5 4 6 (mod 7) Solution 2: Since p = 7 is a prime number and 7 2, we can apply the Corollary above. We have x a p 2 b = 2 7 2 5 = 160 6 (mod 7) 6