Euler’s Theorem
Learning objectives
- Define Euler’s totient
- Compute for prime powers and via multiplicativity
- State and apply Euler’s theorem: when
- Derive Fermat’s little theorem as the prime-modulus special case
Euler’s theorem is the engine inside RSA. It says: if you live in and you are coprime to , then raising yourself to the power lands you exactly back on . That single identity — first proved by Euler in 1763 — is what makes RSA decryption work: the recipient’s private exponent is chosen so that , and Euler’s theorem then guarantees . Beyond RSA, Euler’s theorem powers pseudo-random number generators, primality tests, and the entire theory of finite cyclic groups.
Euler’s totient
The Euler totient counts the integers with and . These are exactly the units of — the elements that have multiplicative inverses. Examples: , (namely ), (namely ).
Computing from the prime factorisation. is multiplicative: if , then . Combined with for prime , this gives a formula for every : factor and compute . Example: .
The group
The set of units of is closed under multiplication: if are both coprime to , so is . It contains , and every unit has an inverse (that is the definition). So is a finite abelian group of order , often written . The mapping below illustrates how multiplication-by-a fixed unit permutes :
(The mapping-arrows widget visualises a function between two sets. Mentally label the left column with the units of and the right column with the same set; an arrow from to shows multiplication-by- as a permutation. Because is a unit, every element on the right is hit exactly once.)
Euler’s theorem
If , then .
Sketch of proof. Let be the units of . Multiplication by permutes them (because is a unit). So as sets. Take the product of both sides: . The product is itself a unit, so we may cancel it: .
Fermat’s little theorem — the special case
When is prime, . Euler’s theorem becomes: if , then . Equivalently, for all integers (just multiply by if ). This is Fermat’s little theorem, the prototype primality-test: pick a random , compute , and if you get anything other than , is definitely composite.
Pause and think: Why does Euler’s theorem require ? Consider what goes wrong with : compute directly. The result is not . The proof breaks because multiplication-by- does not permute the units of .
Try it
- Predict before computing. Then enumerate the integers with and confirm.
- Use Euler’s theorem to compute without ever forming . (Hint: .)
- Compute via Fermat’s little theorem.
- Show that when are distinct primes. (This is the formula RSA uses.)
A trap to watch for
The two formulas and look similar but behave very differently. For a prime , almost every residue is coprime — only is not. For a prime power , the coprime residues miss every multiple of , so the density of units drops to . A common mistake is to assume by analogy — that would only be correct if were itself prime, which it isn’t for . Always factor first, then apply the totient formula prime-by-prime.
What you now know
You can compute from the prime factorisation, apply Euler’s theorem to collapse huge powers into single residues, and recognise Fermat’s little theorem as the special case. In the final section, public-key cryptography, you will see how RSA stitches Euler’s theorem and the hardness of factoring into a working encryption scheme.
References
- Velleman, D. J. (2019). How to Prove It: A Structured Approach (3rd ed.). Cambridge University Press, §7.4.
- Hardy, G. H., Wright, E. M. (2008). An Introduction to the Theory of Numbers (6th ed.). Oxford University Press, ch. 5–6.
- Niven, I., Zuckerman, H. S., Montgomery, H. L. (1991). An Introduction to the Theory of Numbers (5th ed.). Wiley, ch. 2.
- Rosen, K. H. (2010). Elementary Number Theory (6th ed.). Pearson, ch. 6.
- Koblitz, N. (1994). A Course in Number Theory and Cryptography (2nd ed.). Springer, ch. 1.