Fermat s Little Theorem

Similar documents
Applications of Fermat s Little Theorem and Congruences

Factoring Algorithms

Math 319 Problem Set #3 Solution 21 February 2002

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

GREATEST COMMON DIVISOR

I. GROUPS: BASIC DEFINITIONS AND EXAMPLES

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

Computing exponents modulo a number: Repeated squaring

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

= = 3 4, Now assume that P (k) is true for some fixed k 2. This means that

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

Number Theory Hungarian Style. Cameron Byerley s interpretation of Csaba Szabó s lectures

Every Positive Integer is the Sum of Four Squares! (and other exciting problems)

mod 10 = mod 10 = 49 mod 10 = 9.

Doug Ravenel. October 15, 2008

Homework until Test #2

SUM OF TWO SQUARES JAHNAVI BHASKAR

Lectures on Number Theory. Lars-Åke Lindahl

1. MATHEMATICAL INDUCTION

Integer roots of quadratic and cubic polynomials with integer coefficients

8 Primes and Modular Arithmetic

Notes on Factoring. MA 206 Kurt Bryan

The Mean Value Theorem

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

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

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

Discrete Mathematics, Chapter 4: Number Theory and Cryptography

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

Handout #1: Mathematical Reasoning

Primality - Factorization


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

MATH10040 Chapter 2: Prime and relatively prime numbers

SOLUTIONS FOR PROBLEM SET 2

Chapter 3. if 2 a i then location: = i. Page 40

Revised Version of Chapter 23. We learned long ago how to solve linear congruences. ax c (mod m)

ALGEBRAIC APPROACH TO COMPOSITE INTEGER FACTORIZATION

a 11 x 1 + a 12 x a 1n x n = b 1 a 21 x 1 + a 22 x a 2n x n = b 2.

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

Stupid Divisibility Tricks

Just the Factors, Ma am

MATH 289 PROBLEM SET 4: NUMBER THEORY

WRITING PROOFS. Christopher Heil Georgia Institute of Technology

An Introductory Course in Elementary Number Theory. Wissam Raji

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

Overview of Number Theory Basics. Divisibility

Handout NUMBER THEORY

Factoring & Primality

Elementary Number Theory

Factorization Algorithms for Polynomials over Finite Fields

CS 103X: Discrete Structures Homework Assignment 3 Solutions

PYTHAGOREAN TRIPLES KEITH CONRAD

The Chinese Remainder Theorem

FACTORING CERTAIN INFINITE ABELIAN GROUPS BY DISTORTED CYCLIC SUBSETS

Boolean Algebra Part 1

Module MA3411: Abstract Algebra Galois Theory Appendix Michaelmas Term 2013

Maths delivers! A guide for teachers Years 11 and 12. RSA Encryption

Today s Topics. Primes & Greatest Common Divisors

26 Ideals and Quotient Rings

Quotient Rings and Field Extensions

Pythagorean vectors and their companions. Lattice Cubes

Integer Factorization using the Quadratic Sieve

Continued Fractions and the Euclidean Algorithm

V Quantitative Reasoning: Computers, Number Theory and Cryptography

Some facts about polynomials modulo m (Full proof of the Fingerprinting Theorem)

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

Introduction to Finite Fields (cont.)

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

INCIDENCE-BETWEENNESS GEOMETRY

Settling a Question about Pythagorean Triples

THE CONGRUENT NUMBER PROBLEM

Lecture 13: Factoring Integers

GENERATING SETS KEITH CONRAD

The cyclotomic polynomials

PROBLEM SET 6: POLYNOMIALS

All trees contain a large induced subgraph having all degrees 1 (mod k)

4.2 Euclid s Classification of Pythagorean Triples

Online EFFECTIVE AS OF JANUARY 2013

2 When is a 2-Digit Number the Sum of the Squares of its Digits?


HOMEWORK 5 SOLUTIONS. n!f n (1) lim. ln x n! + xn x. 1 = G n 1 (x). (2) k + 1 n. (n 1)!

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

Winter Camp 2011 Polynomials Alexander Remorov. Polynomials. Alexander Remorov

Primes in Sequences. Lee 1. By: Jae Young Lee. Project for MA 341 (Number Theory) Boston University Summer Term I 2009 Instructor: Kalin Kostadinov

PROOFS BY DESCENT KEITH CONRAD

Lecture 13 - Basic Number Theory.

Labeling outerplanar graphs with maximum degree three

H/wk 13, Solutions to selected problems

POLYNOMIAL RINGS AND UNIQUE FACTORIZATION DOMAINS

4. FIRST STEPS IN THE THEORY 4.1. A

Cryptography and Network Security Chapter 8

RSA and Primality Testing

6.2 Permutations continued

calculating the result modulo 3, as follows: p(0) = = 1 0,

Congruent Number Problem

PUTNAM TRAINING POLYNOMIALS. Exercises 1. Find a polynomial with integral coefficients whose zeros include

Five fundamental operations. mathematics: addition, subtraction, multiplication, division, and modular forms

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

Invertible elements in associates and semigroups. 1

Inner products on R n, and more

Transcription:

Fermat s Little Theorem Theorem (Fermat s Little Theorem): Let p be a prime. Then p n p n (1) for any integer n 1. Proof: We distinguish two cases. Case A: Let p n, then, obviously, p n p n, and we are done. Case B: Let p n. (2) Consider the following numbers: By the Division Algorithm we have n, 2n, 3n,..., (p 1)n. n = pk 1 + r 1 p n r 1 2n = pk 2 + r 2 p 2n r 2 3n = pk 3 + r 3... p 3n r 3... (3) (p 1)n = pk p 1 + r p 1 p (p 1)n r p 1 where 0 r i p 1. Moreover, r i 0, since otherwise p in, and therefore by Euclid d Lemma p i or p n. But this is impossible, since p > i and p n by (2). So, Lemma 1: Let a, b, c, d, and p be integers such that Then p (ac bd). Proof: We have 1 r i p 1. (4) p (a b) and p (c d). (5) ac bd = ac bc + bc bd = c(a b) + b(c d). By (5) the right-hand side is divisible by p. Therefore the left-hand side is also divisible by p. By Lemma 1 we can multiply out all terms from the right-hand column of (3). We have p [n 2n 3n... (p 1)n r 1 r 2... r p 1 ] p [(p 1)!n p 1 r 1 r 2... r p 1 ]. (6) 1

Lemma 2: We have Proof: We first show that r 1 r 2... r p 1 = (p 1)!. (7) r 1, r 2,..., r p 1 are all distinct. (8) In fact, assume to the contrary that there are some r i and r j with r i = r j. Then by (3) we have in pk i = jn pk j, hence (i j)n = p(k i k j ). This means that p divides (i j)n. From this by Euclid s Lemma it follows that p (i j) or p n. But this is impossible, since p > i j by (4) and p n by (2). This contradiction proves (8). So, we have p 1 distinct numbers between 1 and p 1. This means that which gives (7). By (6) and (7) we obtain {r 1, r 2,..., r p 1 } = {1, 2,..., p 1}, p [(p 1)!n p 1 (p 1)!]. p (p 1)!(n p 1 1). p 1 2... (p 1)(n p 1 1). Since p divides the product, by Euclid s Lemma it follows that p divides at least one of its terms. Note that p 1, p 2,..., p (p 1). Therefore p (n p 1 1), hence p (n p n). Congruences Definition: Let m be a positive integer. Then integers a and b are congruent modulo m, denoted by a b mod m, if m (a b). Example: 3 1 mod 2, 6 4 mod 2, 14 0 mod 7, 25 16 mod 9, 43 27 mod 35. Properties: Let m be a positive integer and let a, b, c, d be integers. Then 1. a a mod m 2. If a b mod m, then b a mod m. 3. If a b mod m and b c mod m, then a c mod m. 4. (a) If a qm + r mod m, then a r mod m. (b) Every integer a is congruent mod m to exactly one of 0, 1,..., m 1. 5. If a b mod m and c d mod m, then a ± c b ± d mod m and ac bd mod m. 2

5. If a b mod m, then a ± c b ± c mod m and ac bc mod m. 5. If a b mod m, then a n b n mod m for any n Z +. 6. If (c, m) = 1 and ac bc mod m, then a b mod m. Proof 2 of Fermat s Little Theorem: We distinguish two cases. Case A: Let p n, then, obviously, p n p n, and we are done. Case B: Let p n. Consider the following numbers: n, 2n, 3n,..., (p 1)n. We have n r 1 mod p 2n r 2 mod p 3n r 3 mod p... (p 1)n r p 1 mod p, (9) where 0 r i p 1. Moreover, r i 0, since otherwise p in, and therefore by Euclid d Lemma p i or p n. But this is impossible, since p > i and p n. So, 1 r i p 1. From (9) by property 5 we have n 2n 3n... (p 1)n r 1 r 2... r p 1 mod p (p 1)!n p 1 r 1 r 2... r p 1 mod p. (10) By Lemma 2 we have r 1 r 2... r p 1 = (p 1)!. (11) By (10) and (11) we obtain (p 1)!n p 1 (p 1)! mod p. Since (p, (p 1)!) = 1, from this by by property 6 we get n p 1 1 mod p, hence n p n mod p by property 4. This means that n p n is divisible by p. 3

Theorem (Fermat s Little Theorem): Let p be a prime. Then for any integer n 1. p n p n (1)

Proof: We distinguish two cases. Case A: Let p n, then, obviously, p n p n, and we are done. Case B: Let p n. (2) Consider the following numbers: n, 2n, 3n,..., (p 1)n. By the Division Algorithm we have n = pk 1 + r 1 2n = pk 2 + r 2 3n = pk 3 + r 3... (p 1)n = pk p 1 + r p 1 p n r 1 p 2n r 2 (3)... p (p 1)n r p 1 where 0 r i p 1. Moreover, r i 0, since otherwise p in, and therefore by Euclid d Lemma p i or p n. But this is impossible, since p > i and p n by (2). So, 1 r i p 1. (4)

Lemma 1: Let p, a, b, c, and d be integers such that p (a b) and p (c d). (5) Then p (ac bd). Proof: We have ac bd = ac bc + bc bd = c(a b) + b(c d). The right-hand side is divisible by p by (5). Therefore the left-hand side is also divisible by p.

By Lemma 1 we can multiply out all terms from the right-hand column of (3). We have p [n 2n... (p 1)n r 1 r 2... r p 1 ] p [(p 1)!n p 1 r 1 r 2... r p 1 ]. (6)

Lemma 2: We have r 1 r 2... r p 1 = (p 1)!. (7) Proof: We first show that r 1, r 2,..., r p 1 are all distinct. (8) In fact, assume to the contrary that there are some r i and r j with r i = r j. Then by (3) we have in pk i = jn pk j, hence (i j)n = p(k i k j ). This means that p divides (i j)n. From this by Euclid s Lemma it follows that p (i j) or p n. But this is impossible, since p > i j by (4) and p n by (2). This contradiction proves (8). So, we have p 1 distinct numbers between 1 and p 1. This means that {r 1, r 2,..., r p 1 } = {1, 2,..., p 1}, which gives (7).

By (6) and (7) we obtain p [(p 1)!n p 1 (p 1)!]. p (p 1)!(n p 1 1). p 1 2... (p 1)(n p 1 1). Since p divides the product, by Euclid s Lemma it follows that p divides at least one of its terms. Note that p 1, p 2,..., p (p 1). Therefore p (n p 1 1), hence p (n p n).

CONGRUENCES Definition: Let m be a positive integer. Then integers a and b are congruent modulo m, denoted by if m (a b). a b mod m, Example: 3 1 mod 2, 6 4 mod 2, 14 0 mod 7, 25 16 mod 9, 43 27 mod 35.

Properties: Let m be a positive integer and let a, b, c, and d be integers. Then 1. a a mod m 2. If a b mod m, then b a mod m. 3. If a b mod m and b c mod m, then a c mod m. 4. (a) If a qm + r mod m, then a r mod m. (b) Every integer a is congruent mod m to exactly one of 0, 1,..., m 1.

5. If a b mod m and c d mod m, then and a ± c b ± d mod m ac bd mod m. 5. If a b mod m, then and a ± c b ± c mod m ac bc mod m. 5. If a b mod m, then a n b n mod m for any n Z +. 6. If (c, m) = 1 and ac bc mod m, then a b mod m.

Proof 2 of Fermat s Little Theorem: We distinguish two cases. Case A: Let p n, then, obviously, p n p n, and we are done. Case B: Let p n. Consider the following numbers: n, 2n, 3n,..., (p 1)n. We have n r 1 mod p 2n r 2 mod p... (p 1)n r p 1 mod p, (9) where 0 r i p 1. Moreover, r i 0, since otherwise p in, and therefore by Euclid d Lemma p i or p n. But this is impossible, since p > i and p n. So, 1 r i p 1.

From (9) by property 5 we have n 2n... (p 1)n r 1 r 2... r p 1 mod p (p 1)!n p 1 r 1 r 2... r p 1 mod p. (10) By Lemma 2 we have r 1 r 2 r 3... r p 1 = (p 1)!. (11) By (10) and (11) we obtain (p 1)!n p 1 (p 1)! mod p. Since (p, (p 1)!) = 1, from this by by property 6 we get n p 1 1 mod p, hence n p n mod p by property 4. This means that n p n is divisible by p.