In our last lesson, we established the critical role of coprime integers in modular arithmetic by exploring the Extended Euclidean Algorithm and its use in finding modular inverses. We saw that an inverse of a modulo m exists if and only if gcd(a, m) = 1. Today, we will build directly on this foundation to explore two of the most celebrated theorems in elementary number theory: Euler's theorem and Fermat's Little Theorem.
These theorems provide a powerful framework for simplifying expressions involving exponents in modular arithmetic. This is not just a theoretical exercise; it is the mathematical engine that drives public-key cryptosystems like RSA. By the end of this lesson, you will be able to state both theorems and, in line with your preference for a rigorous approach, formally prove their correctness.
Euler's Totient Function and Reduced Residue Systems
Before we can state Euler's theorem, we must first define a crucial component: Euler's totient function, denoted (phi of n).
Definition: Euler's Totient Function
For a positive integer , is defined as the number of positive integers less than or equal to that are relatively prime (coprime) to .
For example:
- , because there are four numbers in that are coprime to 10: .
- If is a prime number, , because all numbers from 1 to are coprime to .
The set of integers is a foundational concept. A more formal term for a set of integers with these properties is a reduced residue system.
Definition: Reduced Residue System
A set of integers is a reduced residue system modulo if:
- for all .
- for all .
Essentially, it's a complete set of representatives for the congruence classes of numbers coprime to . The simplest such system is the set of integers from 1 to that are coprime to . The following video provides a clear introduction to these concepts.
Euler's Theorem Number Theory 12
This video introduces Euler's totient function and the formal definition of a reduced residue system, which will be central to our proof.
Watch the first part of the video, from the beginning until the definitions, to familiarize yourself with these terms and see a few examples.
Stating the Theorems
With the totient function defined, we can now state our main results.
Theorem 2.4 (Euler's Theorem):
Let and be integers such that . Then:
A direct and historically significant special case of this theorem occurs when the modulus is a prime number.
Corollary 2.5 (Fermat's Little Theorem):
Let be a prime number and be an integer such that does not divide (which is equivalent to ). Then:
This follows directly from Euler's theorem because, as we noted, .
The Proof of Euler's Theorem
The proof is elegant and relies on the properties of the reduced residue system we just defined. The core idea is to show that if we take a reduced residue system and multiply each of its elements by an integer a (where gcd(a, m) = 1), the resulting set is also a reduced residue system modulo m.
Let's break this down.
- Let be a reduced residue system modulo .
- Construct a new set .
- The key step is to prove that , when its elements are taken modulo , is just a permutation of .
The video you just started provides a formal and detailed proof of this crucial lemma. The rigor of this proof should align well with your preference for formal arguments.
Euler's Theorem Number Theory 12
The presenter now proves the lemma: if R is a reduced residue system modulo n and \gcd(a, n) = 1, then aR = \{ar_1, \dots\} is also a reduced residue system modulo n.
Please watch from the lemma proof. Pay close attention to the two parts of the proof: first, showing that the new elements are still coprime to n, and second, showing they are all incongruent modulo n.
With this lemma established, the final step of the proof is straightforward. Since the sets and are identical modulo (they are just permutations of each other), the product of their elements must be congruent modulo .
Let .
Then, considering the product of the elements in :
We can factor out the a terms:
Since every element in the reduced residue system is coprime to , their product is also coprime to . As we learned in the previous lesson, this means has a multiplicative inverse modulo . We can therefore multiply both sides of the congruence by , effectively canceling .
This leaves us with:
This completes the proof of Euler's theorem. The final part of the video walks through this last step.
Euler's Theorem Number Theory 12
The presenter concludes the proof of Euler's theorem using the lemma.
Watch from the final proof.
An Alternative Proof of Fermat's Little Theorem
While Fermat's Little Theorem falls out nicely as a corollary, there is a beautiful combinatorial proof that offers a different kind of insight. It's often called the "bracelet proof" or "necklace proof".
Imagine we want to make bracelets of length (where is a prime number) using beads of different colors.
-
First, consider creating fixed, oriented strings of length . There are choices for each of the positions, so there are possible strings.
-
Out of these strings, exactly of them consist of beads of all the same color (e.g., "AAAA...", "BBBB...", etc.). These strings, when made into a bracelet, only have one arrangement under rotation.

-
This leaves strings that use at least two colors. What happens when we turn these strings into bracelets? Since is prime, a string with multiple colors cannot have a rotational symmetry period shorter than . For example, if , a string like "AABAAAB" cannot be identical to a rotation by 1, 2, 3, 4, 5, or 6 positions. If it were, its length would have to be a divisor of 7, which is impossible.
-
Therefore, each of these non-monochromatic strings belongs to a group of exactly distinct strings that can be rotated into one another (e.g., "AABBC", "ABBC A", "BBC AA", "BC AAB", "C AABB"). These strings all form the same bracelet.
-
This means the non-monochromatic strings can be perfectly partitioned into groups of size . Consequently, must divide .
or
-
If we assume is not a multiple of (so ), we can cancel from both sides, yielding Fermat's Little Theorem:
Application: Simplifying Modular Exponentiation
Euler's theorem is an indispensable tool for reducing large powers in modular arithmetic. Let's see it in action.
[PDF] ALGEBRA 1 FOR COMPUTER SCIENTISTS kompatscher@karlin ...
This resource provides a concise statement of the theorems and a clear computational example.
Please read the example exercise at the beginning and then the more efficient solution using Euler's theorem at the end of the section.
As you can see from the reading, the task of computing becomes trivial.
- We are working modulo 10, and .
- We calculate .
- By Euler's theorem, we know .
- We express the exponent 123 in terms of 4: .
- Therefore, .
- The final step is easy to compute: .
This technique of reducing the exponent modulo is a cornerstone of the RSA algorithm, which we will study in depth later in the course.
Conclusion
In this lesson, we have formally stated and proven two fundamental theorems of number theory. We saw how the concept of a reduced residue system provides the structure needed for a rigorous proof of Euler's theorem, and how Fermat's Little Theorem emerges as a simple yet powerful special case. We also explored an alternative, elegant combinatorial proof for Fermat's theorem that provides a different kind of intuition.
Key Takeaways:
- Euler's totient function, , counts the number of positive integers up to that are coprime to .
- Euler's Theorem: If , then .
- Fermat's Little Theorem: If is prime and , then .
- The proof of Euler's theorem hinges on the fact that multiplying a reduced residue system by a coprime integer
asimply permutes the system modulom. - These theorems are essential for efficiently computing modular exponentiation.
A key piece of information we've used today is the value of . While we know for a prime , how do we compute it for a composite number like ? In our next lesson, we will derive a general formula for calculating for any integer , provided we know its prime factorization. This will be another critical step toward understanding the security of modern cryptosystems.