- Euler's theorem
- statement
- proof

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

**summary**: modular exponentiation works, except that

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

**version 1**: In other words, if [*a*]∈ℤ_{m} is a unit and [*b*]∈ℤ_{ϕ(m)} then [*a*]^{[b]} = [*a*^{b}] 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.

**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 *k**n* elements (i.e. *ϕ*(*m*)=*k**n*). 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].

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

(*Z*_{m})^{*} = {[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].

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:

- the arcs always form simple loops, and don't have any branches of any kind.

**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*

The arcs stay within (

*Z*_{m})^{*}. In other words, the product of units is a unit.If

*n*is the length of the loop containing [1] (and [*a*]), then for any [*b*], traversing*n*edges from [*b*] leads back to [*b*].Similarly, traversing fewer than

*n*edges does**not**lead back to [*b*].

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 (*Z*_{m})^{*} into *k* groups of *n* elements each, so (*Z*_{m})^{*} has *k**n* elements. In other words, *ϕ*(*m*)=*k**n*.

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