Skip to main content

Section 4.4 Euler's Theorem

First, let's restate the definition of Euler's totient function (introduced in Exploration 3.2.1).

Definition 4.4.1. Euler's Totient Function.

Euler's totient function (or Euler's phi-function) is the function \(\phi: \mathbb{N} \rightarrow \mathbb{N}\) defined by

\begin{equation*} \phi(n) = \bigl|\{k \in \mathbb{N} : 1 \leq k \leq n, \gcd(k,n) = 1\}\bigr|\text{.} \end{equation*}

Video: Euler's Phi Function

We have \(\phi(1) = 1\) since \(1\) is the only integer in \(\{1\}\) relatively prime with 1.

Also \(\phi(8) = 4\text{,}\) since there are four numbers in the set \(\{1,2,\ldots,8\}\) relatively prime with 8: they are 1, 3, 5, and 7.

The table below lists values of \(\phi(m)\) for small values of \(m\text{.}\) Complete the table for \(m = 11, 12, \ldots, 20\text{.}\)

Table 4.4.4. Values of \(\phi(n)\)
\(n\) integers \(1 \leq k \leq n\) \(\phi(n)\)
such that \(\gcd(k,n)=1\)
1 1 1
2 1 1
3 1, 2 2
4 1, 3 2
5 1, 2, 3, 4 4
6 1, 5 2
7 1, 2, 3, 4, 5, 6 6
8 1, 3, 5, 7 4
9 1, 2, 4, 5, 7, 8 6
10 1, 3, 7, 9 4
11
12
13
14
15
16
17
18
19
20

If \(p\) is prime, then by definition all integers from \(1\) to \(p-1\) are relatively prime with \(p\text{.}\) This implies the following result:

Is the converse of the above statement true? That is, if \(n \gt 2\) is an integer such that \(\phi(n) = n-1\text{,}\) does it necessarily follow that \(n\) is prime?

Justify your answer.

If \(p\) is prime and \(k \in \mathbb{N}\text{,}\) prove that \(\phi(p^k) = p^k - p^{k-1}\text{.}\)

If \(p\) and \(q\) are prime, prove that \(\phi(pq) = (p-1)(q-1)\text{.}\)

Now we can state Euler's Theorem then prove Fermat's Little Theorem, which is a special case.

Video: Two Theorems in Number Theory

If \(p\) is prime with \(p \nmid a\text{,}\) we have \(\gcd(a,p) = 1\text{.}\) So we can use Theorem 4.4.9 on \(a\) and \(m = p\text{.}\) Since \(\phi(p) = p-1\) by Proposition 4.4.5, the result follows.

Although Theorem 4.4.10 is a special case of Theorem 4.4.9, it was Theorem 4.4.10 that was actually proven first—in 1736, also by Euler [1]. Only in 1763 did Euler publish the generalization that is Euler's Theorem [2].

Take \(n = 8\) and \(a = 7\) so that \(\gcd(a,n) = 1\text{.}\) By Theorem 4.4.9 we have

\begin{equation*} 7^{\phi(8)} \equiv 1 \Mod{8} \Rightarrow 7^4 \equiv 1 \Mod{8}\text{.} \end{equation*}

Compute \(3^{2020} \mmod 113\text{.}\)

Solution

Since \(\gcd(3,113) = 1\text{,}\) we can apply Theorem 4.4.9. In fact, 113 is prime, so Theorem 4.4.10 applies here, so we know that

\begin{equation*} 3^{112} \equiv 1 \Mod{13}\text{.} \end{equation*}

Using the Theorem 1.3.2 on 2020 we get \(2019 = 18\cdot 112 + 4\text{.}\) Hence

\begin{equation*} 3^{2020} \equiv (3^{112})^{18} \cdot 3^4 \Mod{113} \equiv 81 \Mod{113}\text{.} \end{equation*}

So \(3^{2020} \mmod 113 = 81\text{.}\)

Compute \(6^{6777} \mmod 667\text{.}\)

Hint

\(667 = 23 \times 29.\)

The idea behind the proof of Theorem 4.4.9 is that for \(a,n \in \mathbb{N}\) relatively prime, multiplying each element of the set

\begin{equation*} S = \{y \in \{1,2,\ldots,n\} : \gcd(y,n) = 1\} \end{equation*}

by \(a\) induces a permutation of the set modulo \(n\text{.}\) We give first an example with numbers.

Let \(a = 4\) and \(n = 9\text{.}\) Then \(\phi(9) = 6\text{,}\) since the integers \(S = \{1,2,4,5,7,8\}\) are relatively prime with \(9\text{.}\)

Multiplying each number in \(S\) by 4 and reducing modulo 9, we have

\(S = \) \(\{\)1 2 4 5 7 8\(\}\)
\(\downarrow\) \(\downarrow\) \(\downarrow\) \(\downarrow\) \(\downarrow\) \(\downarrow\) (multiply by \(a = 4\))
4 8 16 20 28 32
\(\downarrow\) \(\downarrow\) \(\downarrow\) \(\downarrow\) \(\downarrow\) \(\downarrow\) (reduce modulo 9)
\(\{\)4 8 7 2 1 5\(\}\) \(\rightarrow\) same as \(S\text{!}\)

What this means is that \(S\) and \(\{4y : y \in S\}\) contain the same numbers modulo 9; so when we take the product of all elements in these sets, the results must be congruent modulo 9 as well:

\begin{equation*} (4\cdot 1)(4\cdot 2)(4\cdot 4)(4 \cdot 5)(4\cdot 7)(4\cdot 8) \equiv (1)(2)(4)(5)(7)(8)\Mod{9}\text{.} \end{equation*}

Since each element of \(S\) is relatively prime with 9, we can apply Proposition 4.2.15 to cancel each term, and we are left with

\begin{equation*} (4)(4)(4)(4)(4)(4) \equiv 1 \Mod{9} \Rightarrow 4^{\phi(9)} \equiv 1 \Mod{9} \end{equation*}

since \(\phi(9) = 6 = |S|\text{.}\)

Replicate the idea in Example 4.4.14 to show that \(7^{\phi(15)} \equiv 1 \Mod{15}\text{.}\)

Finally, we present the proof of Theorem 4.4.9.

Proof of Euler's Theorem

Let \(a,n \in \mathbb{N}\) such that \(\gcd(a,n) = 1\text{.}\)

First define the set

\begin{equation*} S = \{y : 1 \leq y \leq n, \gcd(y,n) = 1\} \end{equation*}

to be the set of natural numbers smaller than \(n\) and relatively prime with \(n\text{.}\) We know that there are exactly \(\phi(n)\) elements in the set \(S\text{,}\) so we can label them as \(S = \{b_1,b_2,\ldots,b_{\phi(n)}\}\text{,}\) where \(\gcd(b_i,n) = 1\) for \(i = 1,2,\ldots,\phi(n)\text{.}\)

Since we have \(\gcd(b_i,n) = 1\) and \(\gcd(a,n) = 1\text{,}\) we must also have

\begin{equation*} \gcd(ab_i, n) = 1 \text{ for any } i = 1,2,\ldots,\phi(n)\text{.} \end{equation*}

We invoke Theorem 1.3.2 now to write \(ab_i\) as

\begin{equation*} ab_i = qn + r \text{ for some } 0 \leq r \lt n, \end{equation*}

which implies that \(ab_i \equiv r \Mod{n}\text{.}\)

Combining with the fact that \(\gcd(ab_i,n) = 1\text{,}\) this implies that \(\gcd(r,n) = 1\text{,}\) so \(r\) is a natural number smaller than \(n\) and relatively prime with \(n\text{.}\)

In other words, \(r\) is in the set \(S\text{,}\) and we can write \(r = b_j\) for some \(1 \leq j \leq \phi(n)\text{.}\) This means for each \(1 \leq i \leq \phi(n)\text{,}\) we have \(ab_i \equiv b_j \Mod{n}\) for some \(1 \leq j \leq \phi(n)\text{.}\)

Furthermore, none of the \(b_j\)'s are repeated, because no two \(ab_i\) terms are equivalent modulo \(n\text{.}\) (Otherwise, \(ab_{i_1} \equiv ab_{i_2} \Mod{n} \Rightarrow b_{i_1} \equiv b_{i_2} \Mod{n}\) by Proposition 4.2.15, which is a contradiction as the \(b_i\)'s are all distinct and smaller than \(n\text{.}\))

Hence, each integer \(ab_i\) is congruent modulo \(n\) to distinct elements in \(S\text{:}\)

\begin{align*} ab_1 \amp \equiv b_{j_1} \Mod{n}\\ ab_2 \amp \equiv b_{j_2} \Mod{n}\\ \vdots \amp\\ ab_{\phi(n)} \amp \equiv b_{j_{\phi(n)}} \Mod{n} \end{align*}

Multiplying all the congruences together gives another congruence, where the right-hand-side is just

\begin{equation*} \displaystyle\prod_{k=1}^{\phi(n)} b_{j_k} = \displaystyle\prod_{i=1}^{\phi(n)} b_i \end{equation*}

since each element of \(S\) appears exactly once. Hence,

\begin{equation*} \prod_{i=1}^{\phi(n)} ab_i \equiv \prod_{i=1}^{\phi(n)} b_i \Mod{n} \Rightarrow a^{\phi(n)} \equiv 1 \Mod{n} \end{equation*}

by an application of Proposition 4.2.15.

Video: Primality Testing

Exploration 4.4.1. Primality Testing.

Theorem 4.4.10 asserts that if \(p\) is prime and \(\gcd(a,p)=1\text{,}\) then \(a^{p-1} \equiv 1 \Mod{p}\text{.}\)

(a)

Note that the converse of this statement is not true in general: Even if \(\gcd(a,n) = 1\) and \(a^{n-1} \equiv 1 \Mod{n}\text{,}\) we would not be able to conclude that \(n\) is prime.

Can you give examples of pairs \(a, n\) such that \(\gcd(a,n) = 1\) and \(a^{n-1} \equiv 1 \Mod{n}\) are both true, but \(n\) is not prime.

(b)

Complete the contrapositive of Theorem 4.4.10:

If \(a,n \in \mathbb{N}\text{,}\) \(\gcd(a,n) = 1\text{,}\) and \(a^{n-1} \not\equiv 1 \Mod{n}\text{,}\) then .

(c)

Show that 91 is not prime by using part (b) with \(a = 2\text{.}\)