Section 4.4 Euler's Theorem
Objectives
- Define Euler's totient function \(\phi(n)\text{,}\) compute its values for small \(n\text{,}\) and prove general statements about \(\phi(n)\text{.}\)
- State and apply Euler's Theorem and Fermat's Little Theorem to solve congruences and prove other results.
- Apply Fermat's Little Theorem to primality testing.
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
Video: Euler's Phi Function
Example 4.4.2. \(\phi(1)\) and \(\phi(8)\).
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.
Checkpoint 4.4.3. \(\phi(n)\) for small \(n\).
The table below lists values of \(\phi(m)\) for small values of \(m\text{.}\) Complete the table for \(m = 11, 12, \ldots, 20\text{.}\)
\(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:
Proposition 4.4.5. \(\phi(p)\).
If \(p\) is prime, then \(\phi(p) = p-1\text{.}\)
Checkpoint 4.4.6. Converse of Proposition 4.4.5.
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.
Checkpoint 4.4.7. \(\phi(p^k)\).
If \(p\) is prime and \(k \in \mathbb{N}\text{,}\) prove that \(\phi(p^k) = p^k - p^{k-1}\text{.}\)
Checkpoint 4.4.8. \(\phi(pq)\).
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
Theorem 4.4.9. Euler's Theorem.
If \(a, n \in \mathbb{N}\) with \(\gcd(a,n) = 1\text{,}\) then
Theorem 4.4.10. Fermat's Little Theorem (FLT).
If \(a \in \mathbb{N}\) and \(p\) is prime such that \(p \nmid a\text{,}\) then
Proof.
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].
Example 4.4.11. Example of Theorem 4.4.9.
Take \(n = 8\) and \(a = 7\) so that \(\gcd(a,n) = 1\text{.}\) By Theorem 4.4.9 we have
Example 4.4.12. Compute the Remainder.
Compute \(3^{2020} \mmod 113\text{.}\)
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
Using the Theorem 1.3.2 on 2020 we get \(2019 = 18\cdot 112 + 4\text{.}\) Hence
So \(3^{2020} \mmod 113 = 81\text{.}\)
Checkpoint 4.4.13. Compute the Remainder.
Compute \(6^{6777} \mmod 667\text{.}\)
\(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
by \(a\) induces a permutation of the set modulo \(n\text{.}\) We give first an example with numbers.
Example 4.4.14. Why Theorem 4.4.9 holds, for \(a = 4\) and \(n = 9\).
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:
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
since \(\phi(9) = 6 = |S|\text{.}\)
Checkpoint 4.4.15. Repeat the Argument.
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
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
We invoke Theorem 1.3.2 now to write \(ab_i\) as
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{:}\)
Multiplying all the congruences together gives another congruence, where the right-hand-side is just
since each element of \(S\) appears exactly once. Hence,
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{.}\)