taocp

This site has no text of the book. Keep your own copy of TAOCP next to it. See what is checked.

Exercise · Volume 1 · 1.2.4-28

Exercise 1.2.4-28

proved in Lean solution written

RatingM25
MarkersM (mathematical), recommended
KindK1, prove: show that a stated fact is true from the written solution
SectionSection 1.2.4 of Volume 1. Companion chapter: Integer functions and elementary number theory

The task

Prove Euler's theorem aφ(m)≡1(modm)a^{\varphi(m)} \equiv 1 \pmod m for a⊥ma \perp m, with the method used for Fermat's theorem.

The exact wording is in your copy of the book.

Hints

Open one hint at a time. Try the exercise again after each.

Hint 1

Let SS be the set of numbers in {0,…,m−1}\{0, \ldots, m-1\} that are relatively prime to mm. Show that multiplication by aa modulo mm maps SS to SS.

Hint 2

The map is one-to-one by Law B, so it is a permutation of SS. Multiply all elements of SS.

Solution

Show the solution

If m=1m = 1, every congruence modulo 11 holds. Let m≥2m \ge 2 and S={k:0≤k<m, k⊥m}S = \{k : 0 \le k < m,\ k \perp m\}, so ∣S∣=φ(m)|S| = \varphi(m). Let a⊥ma \perp m.

The map goes from SS to SS. For k∈Sk \in S put k′=ak mod mk' = ak \bmod m, so ak=k′+mtak = k' + mt for an integer tt. A common divisor of k′k' and mm divides akak, and a common divisor of akak and mm divides k′k'. So gcd⁡(k′,m)=gcd⁡(ak,m)\gcd(k', m) = \gcd(ak, m). If a prime qq divided gcd⁡(ak,m)\gcd(ak, m), then q∣aq \mid a or q∣kq \mid k by Euclid's lemma, and in either case qq would be a common divisor of mm with aa or with kk, which is impossible. So gcd⁡(ak,m)=1\gcd(ak, m) = 1, k′⊥mk' \perp m, and k′∈Sk' \in S.

The map is one-to-one. If ak≡ak′(modm)ak \equiv ak' \pmod m for k,k′∈Sk, k' \in S, Law B gives k≡k′(modm)k \equiv k' \pmod m, and since both lie in [0,m)[0, m), k=k′k = k'. A one-to-one map of a finite set into itself is onto, so the numbers ak mod mak \bmod m, k∈Sk \in S, are the elements of SS in another order.

The product. Let Q=∏k∈SkQ = \prod_{k \in S} k. By Law A, ∏k∈S(ak)≡∏k∈S(ak mod m)=Q(modm)\prod_{k \in S} (ak) \equiv \prod_{k \in S} (ak \bmod m) = Q \pmod m. The left side is aφ(m)Qa^{\varphi(m)} Q. So aφ(m)Q≡1⋅Q(modm)a^{\varphi(m)} Q \equiv 1 \cdot Q \pmod m. The number QQ is relatively prime to mm by the argument above (a prime that divides QQ divides some factor kk). Law B cancels QQ and gives aφ(m)≡1(modm)a^{\varphi(m)} \equiv 1 \pmod m. □\square

For the note: n⋅nφ(m)−1≡1(modm)n \cdot n^{\varphi(m) - 1} \equiv 1 \pmod m, since φ(m)≥1\varphi(m) \ge 1. So n′=nφ(m)−1 mod mn' = n^{\varphi(m) - 1} \bmod m is an inverse of nn.

Check

m=10m = 10: S={1,3,7,9}S = \{1, 3, 7, 9\}, φ(10)=4\varphi(10) = 4. For a=3a = 3 the products 3,9,21,273, 9, 21, 27 leave the remainders 3,9,1,73, 9, 1, 7, which is SS again. 34=81≡1(mod10)3^4 = 81 \equiv 1 \pmod{10}. A run over 1≤m<601 \le m < 60 and 0≤a<2000 \le a < 200 with a⊥ma \perp m confirms aφ(m) mod m=1a^{\varphi(m)} \bmod m = 1 (for m=1m = 1 the remainder is 00).

Remarks

For a prime pp, φ(p)=p−1\varphi(p) = p - 1, and the theorem becomes Fermat's theorem in the form of Exercise 1.2.4-25. The inverse through the power is slower than the extended algorithm of Exercise 1.2.4-19 when φ(m)\varphi(m) is not known.

This solution is checked, and a person has not reviewed it yet. The source.

In Lean

proved The statement and its proof are in Lean. The kernel accepts the proof, and it uses the standard axioms only.

The status is computed from the Lean build. The node of the map.

Something is wrong? Report it.