3.3: Multiplicative Order and Applications
( \newcommand{\kernel}{\mathrm{null}\,}\)
In this section we prove two very useful results called Euler’s Theorem and Fermat’s Little Theorem (a special case of Euler’s). We do not follow the proof strategy of Euler and Fermat, however, instead using an approach inspired by abstract algebra and Lagrange’s Theorem in that subject.
First we need the
Definition: Multiplicative Order
Suppose
Let us verify something which should probably always be checked for a new definition:
Proposition
Given relatively prime numbers
- Proof
-
The problem in the definition of
might be that there might not be any value of at all for which .But notice that this is a congruence, so we are really only concerned with the elements
up to their congruence class.So look at
and imagine putting the natural numbers into different boxes based on what is the corresponding congruence class . Since there are infinitely many elements in and only elements in – boxes – by the Pigeonhole Principle (Theorem 1.1.1) there must be two (actually, infinitely many pairs of) distinct values such that and end up in the same box, meaning . Assume without loss of generality that , so .We are given that
, so by Corollary 2.2.1, exists in mod . Thus (replacing with in the middle of this congruence since we know that , which means ) and therefore the set of for which is non-empty. The order is the smallest such value, which exists by the Well-Ordering Principle.
Here now is a theorem from abstract algebra (Lagrange’s Theorem) translated into the current context:
Theorem
Given relatively prime numbers
- Proof
-
Start by looking at the congruence classes
. They go up to and then start to repeat, so the set is a set of elements of (in group theory, this set is called the cyclic subgroup of generated by ). Notice that because , . Also, since if is the inverse of mod , is the inverse of for , we see that .To finish, we shall show that
is made up of some number, say , of pieces, which we shall call cosets, each of which is bijective with . These pieces will thus all have elements, so , from which our desired result follows.A coset of
is a set of the form where . We have observed that , so , , meaning that every congruence class is in some coset, i.e.,In fact, each coset
is bijective with . The bijection is the map defined by for with . This map is a bijection because it has an inverse , coming from the inverse mod of .Now suppose
and are two cosets. I claim that either or . For this, suppose , so . That means that such that , , and . In other words, Without loss of generality, assume . Then if we multiply both sides of the above congruence by , we have . But this means that every element is can be expressed as , and every element is can be expressed as . Thus .
That was a lot of work, but now we get the famous theorems of Fermat’s Little and of Euler very easily.
Theorem
Say
- Proof
-
The previous theorem, Theorem 3.3.1, told us that
, so such that . By the definition of order, this means
Corollary
If
- Proof
-
We have seen that for primes
, , so there is very little to do here.
Sometimes one sees Fermat’s Little Theorem in the following, different form:
Theorem
If
- Proof
-
If
, then by Fermat’s Little, . Multiplying both sides of this congruence by yields the desired result.If instead
, it must be that since that gcd is a divisor of , which is prime. The gcd is also a divisor of , so in fact . But then and all its powers are congruent mod to , so .
Exercise
- What are the remainder when
is divided by and the remainder when is divided by ? - We know
is prime (it’s just a wonderful number, isn’t it?). But just to be sure, use Wilson’s Theorem to prove it. - Can we build a test for primality out of Fermat’s Little Theorem? If so, would it be better (more efficient) than one based on Wilson’s Theorem? How would it work? Write a clear, formal statement of your proposed primality test.
- If you know a programming language, write some code to try out your primality test. If not (or, in any case, after the programming), do a little research to see if this question has already been investigated and, if so, what was the conclusion. Give either a formal statement of the test and formal result describing its efficacy or a counter-example to your test that you found in the literature.
- Suppose
is an odd prime. Prove that if the quadratic congruence has a solution, then . [Hint: Apply Fermat’s Little Theorem to a solution of the congruence, then multiply and divide by in the power.]


