euler's theorem - lecture 7 › ... · 12/7/2018  · fermat’s little theorem review...

42
Euler’s Theorem Lecture 7 Justin Stevens Justin Stevens Euler’s Theorem (Lecture 7) 1 / 42

Upload: others

Post on 30-May-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Euler's Theorem - Lecture 7 › ... · 12/7/2018  · Fermat’s Little Theorem Review Theorem. Ifp isprimeandaisanintegerwithp- a,then ap−1 ≡1 (modp). Alternatively,foreveryintegera,ap

Euler’s TheoremLecture 7

Justin Stevens

Justin Stevens Euler’s Theorem (Lecture 7) 1 / 42

Page 2: Euler's Theorem - Lecture 7 › ... · 12/7/2018  · Fermat’s Little Theorem Review Theorem. Ifp isprimeandaisanintegerwithp- a,then ap−1 ≡1 (modp). Alternatively,foreveryintegera,ap

Outline

1 PrimesFermat’s Little Theorem Challenge ProblemsPseudoprimesPrime Number TheoremWilson’s Theorem

2 Chinese Remainder Theorem

3 Euler’s Totient Theorem

Justin Stevens Euler’s Theorem (Lecture 7) 2 / 42

Page 3: Euler's Theorem - Lecture 7 › ... · 12/7/2018  · Fermat’s Little Theorem Review Theorem. Ifp isprimeandaisanintegerwithp- a,then ap−1 ≡1 (modp). Alternatively,foreveryintegera,ap

Fermat’s Little Theorem Review

Theorem. If p is prime and a is an integer with p - a, then

ap−1 ≡ 1 (mod p).

Alternatively, for every integer a, ap ≡ a (mod p).

Justin Stevens Euler’s Theorem (Lecture 7) 3 / 42

Page 4: Euler's Theorem - Lecture 7 › ... · 12/7/2018  · Fermat’s Little Theorem Review Theorem. Ifp isprimeandaisanintegerwithp- a,then ap−1 ≡1 (modp). Alternatively,foreveryintegera,ap

Challenge Problems

Example 1. (IMO 2005) Determine all positive integers relativelyprime to all the terms of the infinite sequence 2n +3n +6n−1, n ≥ 1

Example 2. (NIMO) Let p = 2017 be a prime. Find the remainderwhen ⌊1p

p

⌋+⌊2p

p

⌋+⌊3p

p

⌋+ · · ·+

⌊2015p

p

⌋is divided by p. Here b·c denotes the greatest integer function.

Justin Stevens Euler’s Theorem (Lecture 7) 4 / 42

Page 5: Euler's Theorem - Lecture 7 › ... · 12/7/2018  · Fermat’s Little Theorem Review Theorem. Ifp isprimeandaisanintegerwithp- a,then ap−1 ≡1 (modp). Alternatively,foreveryintegera,ap

IMO Problem

Example. (IMO 2005) Determine all positive integers relatively primeto all the terms of the infinite sequence 2n + 3n + 6n − 1, n ≥ 1

Solution. I claim the answer is 1, therefore, every prime p divides a term inthe sequence. For p = 2, n = 1 works and for p = 3, n = 2 works. ByFermat’s Little Theorem for n = p − 2,

6(2p−2 + 3p−2 + 6p−2 − 1

)≡ 3 · 2p−1 + 2 · 3p−1 + 6p−1 − 6

≡ 3 + 2 + 1− 6≡ 0 (mod p).

Therefore, for p 6= 2, 3, when n = p − 2, we have p | 2n + 3n + 6n − 1.

Justin Stevens Euler’s Theorem (Lecture 7) 5 / 42

Page 6: Euler's Theorem - Lecture 7 › ... · 12/7/2018  · Fermat’s Little Theorem Review Theorem. Ifp isprimeandaisanintegerwithp- a,then ap−1 ≡1 (modp). Alternatively,foreveryintegera,ap

NIMO Sum

Example. (NIMO) Let p = 2017 be a prime. Find the remainder when⌊1p

p

⌋+⌊2p

p

⌋+⌊3p

p

⌋+ · · ·+

⌊2015p

p

⌋is divided by p. Here b·c denotes the greatest integer function.

Solution. By FLT, np ≡ n (mod p), so bnp

p c = np−np and the sum is

p−2∑k=1

kp − kp = 1

p

p−2∑k=1

(kp − k) .

From the Binomial Theorem, jp + (p − j)p ≡ 0 (mod p2) for all j , sop−2∑k=1

(kp − k) ≡ 1p −p−2∑k=1

k ≡ 1− (p − 2)(p − 1)2 ≡ p(3− p)

2 (mod p2).

Substituting p = 2017, 3−p2 ≡

−20142 ≡ −1007 ≡ 1010 (mod p).

Justin Stevens Euler’s Theorem (Lecture 7) 6 / 42

Page 7: Euler's Theorem - Lecture 7 › ... · 12/7/2018  · Fermat’s Little Theorem Review Theorem. Ifp isprimeandaisanintegerwithp- a,then ap−1 ≡1 (modp). Alternatively,foreveryintegera,ap

Pseudoprimes

Over 25 centuries ago, Chinese mathematicians believed n is prime iff2n ≡ 2 (mod n). The counterexample n = 341 was discovered in 1819.

Fermat’s primality test says to pick a number a with 1 < a < p − 1. Ifan−1 6≡ 1 (mod n), then we can conclude that a is composite. However, ifthe congruence holds, then we assign a high probability to n being prime.

Composite n with an−1 ≡ 1 (mod n) are called pseudoprimes to base a.

Example. Prove that if n is a base-2 pseudoprime, then Mn = 2n−1is a larger one.

Justin Stevens Euler’s Theorem (Lecture 7) 7 / 42

Page 8: Euler's Theorem - Lecture 7 › ... · 12/7/2018  · Fermat’s Little Theorem Review Theorem. Ifp isprimeandaisanintegerwithp- a,then ap−1 ≡1 (modp). Alternatively,foreveryintegera,ap

Mersenne Pseudoprimes

Composite n with an−1 ≡ 1 (mod n) are called pseudoprimes to base a.

Example. If n is a base-2 pseudoprime, then Mn = 2n − 1 is a larger one.

Proof.Since n is a base-2 pseudoprime, 2n−1 ≡ 1 (mod n), so 2n ≡ 2 (mod n).Therefore, there exists an integer k with 2n − 2 = kn. Substituting, we have

2Mn−1 − 1 = 2kn − 1

= (2n − 1)(2n(k−1) + 2n(k−2) + · · ·+ 2n + 1

)≡ 0 (mod Mn).

Since n is composite, Mn is composite and the conclusion follows.

Justin Stevens Euler’s Theorem (Lecture 7) 8 / 42

Page 9: Euler's Theorem - Lecture 7 › ... · 12/7/2018  · Fermat’s Little Theorem Review Theorem. Ifp isprimeandaisanintegerwithp- a,then ap−1 ≡1 (modp). Alternatively,foreveryintegera,ap

Carmichael Numbers

A Carmichael number is an integer n that is a pseudoprime for everycoprime base a. In other words, an−1 ≡ 1 (mod n) for every gcd(a, n) = 1.

Example. Prove that 561 is a Carmichael number.

Proof. Factoring shows 561 = 3 · 11 · 17. Therefore, for every a coprime to3, 11, and 17, using Fermat’s Little Theorem,

a2 ≡ 1 (mod 3), a10 ≡ 1 (mod 11), a16 ≡ 1 (mod 17).

Using these congruences, we see that

a560 ≡(a2)280

≡ 1 (mod 3)

a560 ≡(a10)56≡ 1 (mod 11)

a560 ≡(a16)35≡ 1 (mod 17).

Therefore a560 ≡ 1 (mod 561) for all a relatively prime to 561.Justin Stevens Euler’s Theorem (Lecture 7) 9 / 42

Page 10: Euler's Theorem - Lecture 7 › ... · 12/7/2018  · Fermat’s Little Theorem Review Theorem. Ifp isprimeandaisanintegerwithp- a,then ap−1 ≡1 (modp). Alternatively,foreveryintegera,ap

Korselt’s Criterion

The previous example establishes the intuition for the below theorem.

Theorem. (Korselt’s Criterion) A number n is Carmichael if and only ifn = p1p2 · · · pr , where the pi are distinct primes and pi − 1 | n − 1 forevery 1 ≤ i ≤ r .

Justin Stevens Euler’s Theorem (Lecture 7) 10 / 42

Page 11: Euler's Theorem - Lecture 7 › ... · 12/7/2018  · Fermat’s Little Theorem Review Theorem. Ifp isprimeandaisanintegerwithp- a,then ap−1 ≡1 (modp). Alternatively,foreveryintegera,ap

Primality Tests

One way to test primality is trial division: if d - n for 2 ≤ d ≤ n − 1, then nis prime. This can be improved by observing that factors come in pairs:

48 = 1 · 48 = 2 · 24 = 3 · 16 = 4 · 16 = 6 · 8.

The divisors flip around and repeat, so we only check 2 ≤ d ≤ b√nc.

Theorem. (Eratosthenes) Write the numbers 1 to N in a grid. For allprimes p ≤

√N, cross out the multiples 2p, 3p, 4p, · · · from. The numbers

that remain are the primes less than N.

Example. Find all primes less than or equal to 100.

Justin Stevens Euler’s Theorem (Lecture 7) 11 / 42

Page 12: Euler's Theorem - Lecture 7 › ... · 12/7/2018  · Fermat’s Little Theorem Review Theorem. Ifp isprimeandaisanintegerwithp- a,then ap−1 ≡1 (modp). Alternatively,foreveryintegera,ap

Primes less than 100

Example 3. Find all primes less than or equal to 100.

Solution. We show the completed grid using the Sieve of Eratosthenes:

2 3 4 5 6 7 8 9 1011 12 13 14 15 16 17 18 19 2021 22 23 24 25 26 27 28 29 3031 32 33 34 35 36 37 38 39 4041 42 43 44 45 46 47 48 49 5051 52 53 54 55 56 57 58 59 6061 62 63 64 65 66 67 68 69 7071 72 73 74 75 76 77 78 79 8081 82 83 84 85 86 87 88 89 9091 92 93 94 95 96 97 98 99 100

Justin Stevens Euler’s Theorem (Lecture 7) 12 / 42

Page 13: Euler's Theorem - Lecture 7 › ... · 12/7/2018  · Fermat’s Little Theorem Review Theorem. Ifp isprimeandaisanintegerwithp- a,then ap−1 ≡1 (modp). Alternatively,foreveryintegera,ap

π Function

Definition. The number of primes less than or equal to a number n isdefined as π(n). For example, in our grid above, π(100) = 25.

Example 4. Find an exact formula for π(n) if p1, p2, · · · , pt are theprimes ≤

√n. Hint: Use Principle of Inclusion-Exclusion!

Justin Stevens Euler’s Theorem (Lecture 7) 13 / 42

Page 14: Euler's Theorem - Lecture 7 › ... · 12/7/2018  · Fermat’s Little Theorem Review Theorem. Ifp isprimeandaisanintegerwithp- a,then ap−1 ≡1 (modp). Alternatively,foreveryintegera,ap

Exact Formula

Example. Find a formula for π(n) if p1, p2, · · · , pt are the primes ≤√n.

Solution. We start with n and subtract off the numbers ≤ n divisible by atleast one pi . We then add back the primes p1, p2, · · · , pt and subtract 1.From Principle of Inclusion-Exclusion,

π(n) = n −∑

ib npic+

∑i<jb npipjc −

∑i<j<k

b npipjpk

c+ · · ·+ π(√

n)− 1.

For small n, this gives a very compact way to compute π(n). However, forlarger values of n, computing the sum above isn’t reasonable.

Theorem. (Prime Number Theorem) The number of primes less than orequal to n is asymptotic to n/ ln(n). In other words,

limn→∞

π(n)n/ ln(n) = 1.

Justin Stevens Euler’s Theorem (Lecture 7) 14 / 42

Page 15: Euler's Theorem - Lecture 7 › ... · 12/7/2018  · Fermat’s Little Theorem Review Theorem. Ifp isprimeandaisanintegerwithp- a,then ap−1 ≡1 (modp). Alternatively,foreveryintegera,ap

History behind Theorem

We show a table of π(n) for several powers of 10.

n π(n) n/ ln(n)1000 168 14510000 1229 1086

100000 9592 86861000000 78498 7238210000000 664579 620420

In 1798 Legendre published the first significant conjecture on the size ofπ(n) in his book “Essai sur la Théie des Nombres”.Tchebycheff made the first real progress towards proving the theorem in1850 by showing that there exists constants a ≤ 1 ≤ b with

a (n/ ln(n)) < π(n) < b (n/ ln(n)) .

In 1896, Hadamard and de la Vallée Poussin completely proved the primenumber theorem using Riemann’s complex zeta function.

Justin Stevens Euler’s Theorem (Lecture 7) 15 / 42

Page 16: Euler's Theorem - Lecture 7 › ... · 12/7/2018  · Fermat’s Little Theorem Review Theorem. Ifp isprimeandaisanintegerwithp- a,then ap−1 ≡1 (modp). Alternatively,foreveryintegera,ap

Other Estimates

While studying prime tables in 1791, Gauss came up with another estimate:

π(x) ≈∫ x

2

dtln(t) = Li(x).

In his proof, de la Vallée Poussin proved that Gauss’ Li function is always abetter estimate than n/ ln(n). He also showed that the best estimate of theform n/(ln(n)− a) is when a = 1. Consider the following table:

n π(n) Gauss’ Li n/(ln(n)− 1)1000 168 178 16910000 1229 1246 1218

100000 9592 9630 95121000000 78498 78628 78030

10000000 664579 664918 661459

Table 1: Gauss’ estimate of π(n)

Justin Stevens Euler’s Theorem (Lecture 7) 16 / 42

Page 17: Euler's Theorem - Lecture 7 › ... · 12/7/2018  · Fermat’s Little Theorem Review Theorem. Ifp isprimeandaisanintegerwithp- a,then ap−1 ≡1 (modp). Alternatively,foreveryintegera,ap

Consequences of the Prime Number Theorem

One consequence is that the nth prime is approximately pn ≈ n ln(n).

Bertrand’s Postulate states that there is always a prime between n and2n for n ≥ 2. He showed this for all integers up to 3 million by consider

2, 3, 5, 7, 13, 23, 43, 83, 163, 317, 631, 1259, 2503, 4001, · · ·

This is a sequence of primes, each less than twice the predecessor.

Tchebycheff proved the result in 1852 using methods similar to the primenumber theorem. In fact, the number of primes in the range is asymptoticto n/ ln n. “Proofs from the book" features an elementary method.

An unsolved problem is Legendre’s conjecture that states there is alwaysa prime between n2 and (n + 1)2. This conjecture would imply that for anyprime p, the gap between the next prime is in the order of √p.

Justin Stevens Euler’s Theorem (Lecture 7) 17 / 42

Page 18: Euler's Theorem - Lecture 7 › ... · 12/7/2018  · Fermat’s Little Theorem Review Theorem. Ifp isprimeandaisanintegerwithp- a,then ap−1 ≡1 (modp). Alternatively,foreveryintegera,ap

Wilson’s Theorem

Theorem. (Wilson) (p − 1)! ≡ −1 (mod p) for all odd primes p.

Solution. When p = 7, 6! = 720 ≡ −1 (mod 7). Alternatively,

6! = 1 · (2 · 4) (3 · 5) · 6 ≡ 1 · 1 · 1 · 6 ≡ −1 (mod 7).

We find groups of terms that multiply to 1 mod p. Observe that

x2 ≡ 1 mod p ⇐⇒ (x − 1) (x + 1) ≡ 0 mod p ⇐⇒ x ≡ ±1 mod p.

Since p is odd, this implies we can pair the inverses off into (p − 3)/2 pairs,say (x1, y1), (x2, y2), (x3, y3), · · · (x(p−3)/2, y(p−3)/2). Therefore,

(p − 1)! ≡ 1 · (x1y1) (x2y2) · · ·[x(p−3)/2y(p−3)/2

]· (p − 1) (mod p)

≡ 1 · 1 · 1 · · · 1 · (p − 1) (mod p)≡ −1 (mod p).

Justin Stevens Euler’s Theorem (Lecture 7) 18 / 42

Page 19: Euler's Theorem - Lecture 7 › ... · 12/7/2018  · Fermat’s Little Theorem Review Theorem. Ifp isprimeandaisanintegerwithp- a,then ap−1 ≡1 (modp). Alternatively,foreveryintegera,ap

Quadratic Residue

Theorem. For an odd prime p, x2 ≡ −1 (mod p) iff p ≡ 1 (mod 4).

Proof. If x2 ≡ −1 (mod p), then raising this to the power of (p − 1)/2:(x2) p−1

2 ≡ (−1)p−1

2 =⇒ xp−1 ≡ (−1)p−1

2 (mod p).

By Fermat’s Little Theorem the LHS is 1, therefore p ≡ 1 (mod 4).

By Wilson’s Theorem, (p − 1)! ≡ −1 (mod p). Furthermore,

(p − 1)! = [1 · (p − 1)] [2 · (p − 2)] · · · [(p − 1)/2 · (p + 1)/2]≡ (1 · −1) (2 · −2) · · · [(p − 1)/2 · (−(p − 1)/2))] (mod p)

≡ (−1)p−1

2

[(p − 12

)!]2

(mod p)

If p ≡ 1 (mod 4), then x =(

p−12

)! solves x2 ≡ −1 (mod p).

Justin Stevens Euler’s Theorem (Lecture 7) 19 / 42

Page 20: Euler's Theorem - Lecture 7 › ... · 12/7/2018  · Fermat’s Little Theorem Review Theorem. Ifp isprimeandaisanintegerwithp- a,then ap−1 ≡1 (modp). Alternatively,foreveryintegera,ap

Outline

1 Primes

2 Chinese Remainder TheoremGeneral Solution to Linear Congruences

3 Euler’s Totient Theorem

Justin Stevens Euler’s Theorem (Lecture 7) 20 / 42

Page 21: Euler's Theorem - Lecture 7 › ... · 12/7/2018  · Fermat’s Little Theorem Review Theorem. Ifp isprimeandaisanintegerwithp- a,then ap−1 ≡1 (modp). Alternatively,foreveryintegera,ap

Linear Congruences Review

The inverse of a mod m exists iff gcd(a,m) = 1.If the Diophantine equation ax + by = c has particular solution (x0, y0)and d = gcd(a, b), then the set of ordered integer solutions is

S ={(

x0 + bd · k, y0 −

ad · k

) ∣∣∣∣ k ∈ Z}.

If ca ≡ cb (mod m), then a ≡ b (mod m/d), where d = gcd(c,m).

Justin Stevens Euler’s Theorem (Lecture 7) 21 / 42

Page 22: Euler's Theorem - Lecture 7 › ... · 12/7/2018  · Fermat’s Little Theorem Review Theorem. Ifp isprimeandaisanintegerwithp- a,then ap−1 ≡1 (modp). Alternatively,foreveryintegera,ap

Example

Example. Find all solutions to the congruence 18x ≡ 30 (mod 42).

Solution. We can divide the congruence by gcd(18, 42) = 6:

3x ≡ 5 (mod 7).

Listing numbers that are 5 mod 7, 5, 12, 19, we see x ≡ 4 (mod 7):

x ≡ 4, 11, 18, 25, 32, 39 (mod 42).

Notice there are d = gcd(18, 42) = 6 solutions to the congruence.

Justin Stevens Euler’s Theorem (Lecture 7) 22 / 42

Page 23: Euler's Theorem - Lecture 7 › ... · 12/7/2018  · Fermat’s Little Theorem Review Theorem. Ifp isprimeandaisanintegerwithp- a,then ap−1 ≡1 (modp). Alternatively,foreveryintegera,ap

Solutions to General Congruence

Theorem. ax ≡ b (mod m) has d = gcd(a,m) mutually incongru-ent solutions if d | b.

Let a particular solution to the Diophantine equation ax + my = b have xvalue x0. Then consider the d solutions

x0, x0 + md , x0 + 2md , · · · , x0 + (d − 1) md .

We begin by showing the solutions are unique. Assume for the sake ofcontradiction that two are the same. Therefore, there exists integers t1 andt2 such that 0 ≤ t1, t2 ≤ d − 1 and

x0 + t1md ≡ x0 + t2

md (mod m).

Since gcd(md ,m) = m

d , we subtract x0 and divide by md :

t1 ≡ t2 (mod d),

which is a contradiction. Therefore, the solutions are mutually incongruent.Justin Stevens Euler’s Theorem (Lecture 7) 23 / 42

Page 24: Euler's Theorem - Lecture 7 › ... · 12/7/2018  · Fermat’s Little Theorem Review Theorem. Ifp isprimeandaisanintegerwithp- a,then ap−1 ≡1 (modp). Alternatively,foreveryintegera,ap

Every Solution

Theorem. ax ≡ b (mod m) has d = gcd(a,m) mutually incongru-ent solutions if d | b.

We now show that every number of the form x0 + t · md is congruent to one

of the d solutions above. Let t = dq + r , 0 ≤ r ≤ d − 1 by the divisionalgorithm. Therefore,

x0 + t md = x0 + (dq + r) md = x0 + qm + r md ≡ x0 + r · md (mod m).

Since 0 ≤ r ≤ d − 1, this is a listed solution.

Justin Stevens Euler’s Theorem (Lecture 7) 24 / 42

Page 25: Euler's Theorem - Lecture 7 › ... · 12/7/2018  · Fermat’s Little Theorem Review Theorem. Ifp isprimeandaisanintegerwithp- a,then ap−1 ≡1 (modp). Alternatively,foreveryintegera,ap

System of Linear Congruences

Since we solved a single linear congruence, we now consider the system:

a1x ≡ b1 mod m1, a2x ≡ b2 mod m2, · · · , arx ≡ br mod mr .

Assume that the moduli mk are pairwise relatively prime. The system willhave no solution unless each individual congruence has a solution, thereforedk | bk for each k, where dk = gcd(ak ,mk).

If this is the case, then dk can be cancelled in the kth congruence toproduce the system with the same solution:

a′1x ≡ b′1 mod n1, a′2x ≡ b′2 mod n2, · · · , a′rx ≡ b′r mod nr .

Observe that nk = mk/dk and the moduli nk are pairwise relatively prime.Furthermore, gcd(a′i , ni) = 1, so the congruences have solutions

x ≡ c1 mod n1, x ≡ c2 mod n2, · · · , xr ≡ cr mod nr .

Justin Stevens Euler’s Theorem (Lecture 7) 25 / 42

Page 26: Euler's Theorem - Lecture 7 › ... · 12/7/2018  · Fermat’s Little Theorem Review Theorem. Ifp isprimeandaisanintegerwithp- a,then ap−1 ≡1 (modp). Alternatively,foreveryintegera,ap

Chinese Remainder Theorem

Theorem. Let n1, n2, · · · , nr be pairwise relatively prime integers. Then

x ≡ c1 mod n1, x ≡ c2 mod n2, · · · , xr ≡ cr mod nr

has a unique solution modulo n1n2 · · · nr .

Proof. Let N = n1n2 · · · nr and Nk = N/nk = n1 · · · nk−1nk+1 · · · nr .

Since the moduli are pairwise relatively prime, gcd(Nk , nk) = 1 for every k.The congruence Nkxk ≡ 1 (mod nk) then has a unique solution. Consider

x = c1N1x1 + c2N2x2 + · · ·+ crNrxr .

Observe that Nk ≡ 0 (mod nj) for k 6= j , so x ≡ cjNjxj ≡ cj (mod nj).Therefore, x is a solution to our original system of congruences.

We now must prove that the solution is unique.

Justin Stevens Euler’s Theorem (Lecture 7) 26 / 42

Page 27: Euler's Theorem - Lecture 7 › ... · 12/7/2018  · Fermat’s Little Theorem Review Theorem. Ifp isprimeandaisanintegerwithp- a,then ap−1 ≡1 (modp). Alternatively,foreveryintegera,ap

Uniqueness of Solution

Theorem. Let n1, n2, · · · , nr be pairwise relatively prime integers. Then

x ≡ c1 mod n1, x ≡ c2 mod n2, · · · , xr ≡ cr mod nr

has a unique solution modulo n1n2 · · · nr .

Assume that x ′ is another integer that satisfies the system, so:

x ′ ≡ ck ≡ x (mod nk).

However, then nk | x ′ − x for every k. Since the nk are pairwise relativelyprime, this implies n1n2 · · · nr | x ′ − x . In other words, x ′ ≡ x (mod N),contradiction. We have thus proven the Chinese Remainder Theorem

Justin Stevens Euler’s Theorem (Lecture 7) 27 / 42

Page 28: Euler's Theorem - Lecture 7 › ... · 12/7/2018  · Fermat’s Little Theorem Review Theorem. Ifp isprimeandaisanintegerwithp- a,then ap−1 ≡1 (modp). Alternatively,foreveryintegera,ap

Sun-Tsu Puzzle

One example is due to the first-century Chinese mathematician Sun-Tsu:Example. Solve the system of linear congruences

x ≡ 2 (mod 3), x ≡ 3 (mod 5), x ≡ 2 (mod 7).

Solution. Using the notation from our proof, N = 3 · 5 · 7 = 105 and

N1 = N3 = 35, N2 = N

5 = 21, N3 = N7 = 15.

We furthermore see that the linear congruences

35x1 ≡ 1 (mod 3), 21x2 ≡ 1 (mod 5), 15x3 ≡ 1 (mod 7)

are solved by x1 = 2, x2 = 1, and x3 = 1. Therefore, a solution is

x = c1N1x1 + c2N2x2 + c3N3x3 = 2 · 35 · 2 + 3 · 21 · 1 + 2 · 15 · 1 = 233.

Taking this modulo 105, our unique solution is x ≡ 233 ≡ 23 (mod 105).Justin Stevens Euler’s Theorem (Lecture 7) 28 / 42

Page 29: Euler's Theorem - Lecture 7 › ... · 12/7/2018  · Fermat’s Little Theorem Review Theorem. Ifp isprimeandaisanintegerwithp- a,then ap−1 ≡1 (modp). Alternatively,foreveryintegera,ap

Least Common Multiple Puzzle

Example. Solve the system of linear congruences

x ≡ 6 (mod 7), x ≡ 10 (mod 11), x ≡ 12 (mod 13).

Solution. Observe that adding 1 to every congruence, we have

x + 1 ≡ 0 (mod 7), x + 1 ≡ 0 (mod 11), x + 1 ≡ 0 (mod 13).

Therefore, we see that 7 · 11 · 13 | x + 1, so x ≡ 1000 (mod 1001).

Justin Stevens Euler’s Theorem (Lecture 7) 29 / 42

Page 30: Euler's Theorem - Lecture 7 › ... · 12/7/2018  · Fermat’s Little Theorem Review Theorem. Ifp isprimeandaisanintegerwithp- a,then ap−1 ≡1 (modp). Alternatively,foreveryintegera,ap

Outline

1 Primes

2 Chinese Remainder Theorem

3 Euler’s Totient TheoremFormulaEuler’s Totient TheoremChallenge Problems

Justin Stevens Euler’s Theorem (Lecture 7) 30 / 42

Page 31: Euler's Theorem - Lecture 7 › ... · 12/7/2018  · Fermat’s Little Theorem Review Theorem. Ifp isprimeandaisanintegerwithp- a,then ap−1 ≡1 (modp). Alternatively,foreveryintegera,ap

Fermat’s Omissions

Fermat occasionally omitted proofs of theorems he stated. When heproposed Fermat’s Last Theorem, which claimed that there are no solutionsto the diophantine equation xn + yn = zn for n > 2, he famously wrote

“It is impossible to separate a cube into two cubes, or a fourthpower into two fourth powers, or in general, any power higherthan the second, into two like powers.I have discovered a trulymarvelous proof of this, which this margin is too narrow tocontain.” - Fermat in Arithmetica (1637)

Fermat’s Last Theorem was not finally proved until Andrew Wiles did so in1993 (and later revised his proof in 1994): link to the proof.

Fermat also failed to prove his little theorem, therefore, a Swissmathematician by the name of Leonhard Euler published a proof in 1736.

Euler continued to present other proofs of the theorem, and eventuallygeneralized the problem in 1763 in his paper titled “Euler’s theorem".

Justin Stevens Euler’s Theorem (Lecture 7) 31 / 42

Page 32: Euler's Theorem - Lecture 7 › ... · 12/7/2018  · Fermat’s Little Theorem Review Theorem. Ifp isprimeandaisanintegerwithp- a,then ap−1 ≡1 (modp). Alternatively,foreveryintegera,ap

Euler’s Totient Function

Definition. Define φ(m) to be the number of positive integers less than orequal to m that are relatively prime to m. For instance, φ(6) = 2.

Example. Compute φ(24).

Solution. Factorizing 24 = 23 · 31, we find the number of integers thatshare a divisor with 24 using the Principle of Inclusion-Exclusion,

|Mults of 2|+ |Mults of 3| − |Mults of 6| = 24/2 + 24/3− 24/6 = 16.

Therefore, using complimentary counting, φ(24) = 24− 16 = 8. Thenumbers relatively prime to 24 are 1, 5, 7, 11, 13, 17, 19, 23. Note that theycome in pairs that sum to 24.

In general, for n > 2, φ(n) is even since gcd(n − a, n) = gcd(a, n).

Justin Stevens Euler’s Theorem (Lecture 7) 32 / 42

Page 33: Euler's Theorem - Lecture 7 › ... · 12/7/2018  · Fermat’s Little Theorem Review Theorem. Ifp isprimeandaisanintegerwithp- a,then ap−1 ≡1 (modp). Alternatively,foreveryintegera,ap

Multiplicative Function Review

Definition. A function f is multiplicative if whenever gcd(a, b) = 1,

f (ab) = f (a)f (b).

Hence, if n = pk11 pk2

2 · · · pkrr is the prime factorzation of a number,

f (n) = f (pk11 )f (pk2

2 ) · · · f (pkrr ).

Therefore, we only evaluate multiplicative functions up to prime powers.

Also, since f (a · 1) = f (a) · f (1), we must have f (1) = 1 if f 6= 0.

Theorem. φ is a multiplicative function.

Justin Stevens Euler’s Theorem (Lecture 7) 33 / 42

Page 34: Euler's Theorem - Lecture 7 › ... · 12/7/2018  · Fermat’s Little Theorem Review Theorem. Ifp isprimeandaisanintegerwithp- a,then ap−1 ≡1 (modp). Alternatively,foreveryintegera,ap

Visualization for φ(24) = φ(3)φ(8).

Mod 80 1 2 3 4 5 6 7

0 24 9 18 3 12 21 6 151 16 1 10 19 4 13 22 7

Mod

3

2 8 17 2 11 20 5 14 23

Justin Stevens Euler’s Theorem (Lecture 7) 34 / 42

Page 35: Euler's Theorem - Lecture 7 › ... · 12/7/2018  · Fermat’s Little Theorem Review Theorem. Ifp isprimeandaisanintegerwithp- a,then ap−1 ≡1 (modp). Alternatively,foreveryintegera,ap

Proof φ is multiplicative

For coprime m and n, we define the sets Smn and S(m,n) by:

Smn = {a : 1 ≤ a ≤ mn and gcd(a,mn) = 1}S(m,n) = {(b, c) : 0 ≤ b ≤ m − 1 and gcd(b,m) = 1;

0 ≤ c ≤ n − 1 and gcd(c, n) = 1}.

We prove there is a bijection from Smn to S(m,n).

For an element (b, c) ∈ S(m,n), using the Chinese Remainder Theorem,there exists a unique solution to the linear congruences

x ≡ b (mod m), x ≡ c (mod n)

modulo mn, call it a. Furthermore, since b is relatively prime to m and c isrelatively prime to n, gcd(a,mn) = 1, therefore a ∈ Smn.

Justin Stevens Euler’s Theorem (Lecture 7) 35 / 42

Page 36: Euler's Theorem - Lecture 7 › ... · 12/7/2018  · Fermat’s Little Theorem Review Theorem. Ifp isprimeandaisanintegerwithp- a,then ap−1 ≡1 (modp). Alternatively,foreveryintegera,ap

Proof φ is multiplicative

Smn = {a : 1 ≤ a ≤ mn and gcd(a,mn) = 1}S(m,n) = {(b, c) : 0 ≤ b ≤ m − 1 and gcd(b,m) = 1;

0 ≤ c ≤ n − 1 and gcd(c, n) = 1}.

If a ∈ Smn, we divide a by m and n, respectively, to give remainders (b, c).

By the division algorithm, 0 ≤ b ≤ m − 1 and 0 ≤ c ≤ n − 1.

Furthermore, since a is relatively prime to mn, gcd(b,m) = 1 andgcd(c, n) = 1, so (b, c) ∈ S(m,n) and we have established our bijection.

By definition, |Smn| = φ(mn) and |S(m,n)| = φ(m)φ(n). Therefore,

φ(mn) = φ(m)φ(n).

Justin Stevens Euler’s Theorem (Lecture 7) 36 / 42

Page 37: Euler's Theorem - Lecture 7 › ... · 12/7/2018  · Fermat’s Little Theorem Review Theorem. Ifp isprimeandaisanintegerwithp- a,then ap−1 ≡1 (modp). Alternatively,foreveryintegera,ap

Formula for φ

For a number n, if we write it as n = pe11 pe2

2 · · · pekk , then by the

multiplicative property of φ, φ(n) = φ(pe11 )φ(pe2

2 ) · · ·φ(pekk ).

For a prime pi , the number of integers between 1 and peii inclusive that are

multiples of pi is peii /pi = pei−1

i . Therefore, using complimentary counting,

φ(peii ) = pei

i − pei−1i = pei

(1− 1

p

).

Substituting for each prime pi , we arrive at the formula

φ(n) =k∏

i=1

(pei

i − pei−1i

)=

k∏i=1

[pei

i

(1− 1

pi

)]= n

k∏i=1

(1− 1

pi

).

For example, φ(24) = 24(1− 1

2

) (1− 1

3

)= 8.

Justin Stevens Euler’s Theorem (Lecture 7) 37 / 42

Page 38: Euler's Theorem - Lecture 7 › ... · 12/7/2018  · Fermat’s Little Theorem Review Theorem. Ifp isprimeandaisanintegerwithp- a,then ap−1 ≡1 (modp). Alternatively,foreveryintegera,ap

Euler’s Totient Theorem

Theorem. For coprime positive integers a and m, aφ(m) ≡ 1 (mod m).

Proof. Let r1, r2, · · · , rφ(m) be a reduced residue system modulo m. I claim

{ar1, ar2, · · · , arφ(m)} ≡ {r1, r2, · · · , rφ(m)} (mod m).

Notice that every element of the left set is relatively prime to m sincegcd(a,m) = 1. Furthermore, if two distinct elements of the reduced residueset ri and rj are mapped to the same mod m element, then

ari ≡ arj (mod m) =⇒ ri ≡ rj (mod m).

Since the sets are equivalent, their product must be as well:

aφ(m)φ(m)∏j=1

rj ≡φ(m)∏j=1

rj (mod m).

Cancelling out the product since gcd(rm,m) = 1, aφ(m) ≡ 1 (mod m).Justin Stevens Euler’s Theorem (Lecture 7) 38 / 42

Page 39: Euler's Theorem - Lecture 7 › ... · 12/7/2018  · Fermat’s Little Theorem Review Theorem. Ifp isprimeandaisanintegerwithp- a,then ap−1 ≡1 (modp). Alternatively,foreveryintegera,ap

Challenge Problems

Example 5. (AIME 1983) Let an = 6n + 8n. Determine the remainderon dividing a83 by 49.

Example 6. (Canada) Find the last 3 digits of 200320022001 .

Justin Stevens Euler’s Theorem (Lecture 7) 39 / 42

Page 40: Euler's Theorem - Lecture 7 › ... · 12/7/2018  · Fermat’s Little Theorem Review Theorem. Ifp isprimeandaisanintegerwithp- a,then ap−1 ≡1 (modp). Alternatively,foreveryintegera,ap

AIME Problem

Example. (AIME 1983) Let an = 6n + 8n. Determine the remainder ondividing a83 by 49.

Solution. Since φ(49) = 42, 642 ≡ 1 (mod 49) and 842 ≡ 1 (mod 49):

683 + 883 ≡ 6−1 + 8−1 (mod 49)

We can compute 6−1 ≡ −8 (mod 49) and 8−1 ≡ −6 (mod 49), therefore

a83 ≡ −8− 6 ≡ −14 ≡ 35 (mod 49).

Alternatively, by distributing out the inverses,

6−1 + 8−1 ≡ 6−18−1 (8 + 6) ≡ 48−1 · 14 ≡ −14 ≡ 35 (mod 49).

Justin Stevens Euler’s Theorem (Lecture 7) 40 / 42

Page 41: Euler's Theorem - Lecture 7 › ... · 12/7/2018  · Fermat’s Little Theorem Review Theorem. Ifp isprimeandaisanintegerwithp- a,then ap−1 ≡1 (modp). Alternatively,foreveryintegera,ap

Canada Problem

Example. (Canada) Find the last 3 digits of 200320022001 .

Solution. We find the value mod 8 and find the value mod 125 then usethe Chinese Remainder Theorem. First note that φ(8) = 4, therefore,

200320022001 ≡ 1 (mod 8)

since 4 | 20022001. Next, we see that φ(125) = 100, therefore we desire

20022001 ≡ 22001 (mod 100).

We find this value mod 4 and mod 25. Since φ(25) = 20, we see{22001 ≡ 0 (mod 4)22001 ≡ 2 (mod 25)

=⇒ 22001 ≡ 52 (mod 100).

Justin Stevens Euler’s Theorem (Lecture 7) 41 / 42

Page 42: Euler's Theorem - Lecture 7 › ... · 12/7/2018  · Fermat’s Little Theorem Review Theorem. Ifp isprimeandaisanintegerwithp- a,then ap−1 ≡1 (modp). Alternatively,foreveryintegera,ap

Canada Problem

Example. (Canada) Find the last 3 digits of 200320022001 .

We therefore have

200320022001 ≡ 320022001 ≡ 352 (mod 125).

By Euler’s Totient Theorem, 3100 ≡ 1 (mod 125), so(350)2≡ 1 (mod 125) =⇒ 350 ≡ ±1 (mod 125).

However, 350 ≡ 925 ≡ −1 (mod 5), so 350 ≡ −1 (mod 125). Hence,352 ≡ −9 ≡ 116 (mod 125). Combining these congruences we see{200320022001 ≡ 1 (mod 8),200320022001 ≡ 116 (mod 125)

=⇒ 200320022001 ≡ 241 (mod 1000).

Justin Stevens Euler’s Theorem (Lecture 7) 42 / 42