Lecture 25: Euler's theorem

Statement of Euler's theorem

Here are several different ways of stating Euler's theorem. The first is how I remember it.

summary: modular exponentiation works, except that

  1. the base needs to be a unit, and
  2. the exponent needs to be mod ϕ(m) instead of mod m.

version 1: In other words, if [a]∈ℤm and [b]∈ℤϕ(m) then [a][b] = [ab] is well defined.

version 2: if [a]∈(ℤm)* and b ≡ b (mod ϕ(m)) then [a]b = [a]b.

version 3: if [a] is a unit of m, then [a]b + kϕ(m) = [a]b (mod m)

version 4: if [a] is a unit of m, then [a]ϕ(m) = [1] (mod m)

It is a good exercise to check that these are all saying the same thing. Version 1 is closest to the summary, and is the easiest to use in practice. Version 4 is easiest to prove. Versions 2 and 3 help to show how version 1 and 4 are equivalent.

Proof of Euler's theorem

Summary: We wish to show that [a]ϕ(m) = [1]. We will draw a picture of what happens when you multiply all the units by [a]. We'll find that the picture always forms k loops of the same size (n), so that there are kn elements (i.e. ϕ(m)=kn). To find [a]x, you start at [1] and multiply by [a] x times, which traverses x arcs. If x = ϕ(m) then this goes around a loop exactly k times, ending on [1].

Working through an example (with fantastic ascii art)

Let's consider m = 9. Then (using the fact that [a] is a unit if a and m are coprime):

(Zm)* = {[1],[2],[4],[5],[7],[8]}, ϕ(9)=6.

We draw an arc from x to y if [a]x = y. For example, if a = 2, then we have

 [1] --> [2] --> [4] --> [8] --> [7] --> [5]
  |                                       |                multiplication by [2]
  |                                       |              ------------------------>
  \-------------------<<<-----------------/

(note that [8][2]=[16]=[7] and [7][2]=[14]=[5] mod 9). We get a nice loops that goes through all of the units. To compute [2]6, we start at [1] and multiply by [2] 6 times, i.e. we start at [1] and follow 6 edges. This brings us back to [1], so [2]6 = [1].

We get a different picture if a = 4:

[1] --> [4] --> [7]    [2] --> [8] --> [5]
 |               |      |               |                  multiplication by [4]
 \-----<<<-------/      \------<<<------/                ------------------------>

Here we have two loops, both of size 3. To compute [4]6, we start at [1] and follow 6 edges. This goes around the first loop twice, ending up at [1]. Thus [4]6 = [1].

We get a third picture if a = 1:

  [1]    [2]    [4]    [5]    [7]    [8]
 /   \  /   \  /   \  /   \  /   \  /   \                  multiplication by [1]
 \-<-/  \-<-/  \-<-/  \-<-/  \-<-/  \-<-/                ------------------------>

Here we have 6 loops, each of size 1. We compute [1]6 by starting at [1] and following 6 edges. This loops 6 times around the loop of size 1, ending at [1], so [1]6 = [1].

Generalizing

In general, the picture will always break up into k loops, all of the same length. There are several things you may need to check to convince yourself of this. They all have very simple (one or two line) proofs, which I encourage you to check. I have done the first for you:

Proof: There can't be two (different) edges out of x, say to y and z, because otherwise we have [y]=[a]x = [z].

There also can't be two edges (say from y and z) into x, because otherwise we have [a]y = x = [a]z. Multiplying both sides by [a]−1 (which exists because [a] is a unit) gives y = [a]−1[a]y = [a]−1[a]z = z

Thus all of the loops are the same size (call it n), and every element is in exactly one of the loops. So the loops split up (Zm)* into k groups of n elements each, so (Zm)* has kn elements. In other words, ϕ(m)=kn.

Now, to compute [a]ϕ(m), we start at [1] and multiply by [a] ϕ(m) times. In other words, we traverse kn arcs. This means we go around the loop containing [1] exactly k times, so we end up back at [1]. Thus [a]ϕ(m) = [1].