Euler's Totient Function and Euler's Theorem

Euler's totient function counts the positive integers up to that are coprime to . Euler's theorem states that if , then . These tools underpin modular arithmetic, cyclic group structure, and the RSA cryptosystem. Introduced by Leonhard Euler in 1763.

The Euler totient function assigns to each the cardinality of the set , equivalently the number of units in the ring . It is the foundation of Euler's theorem, a sweeping generalization of Fermat's little theorem that governs the multiplicative order of integers modulo . The function is multiplicative (though not completely so), enabling its computation from a number's prime factorization alone. A surprising fact: the average value of tends to , the same constant that gives the probability that two random integers are coprime. These ideas convert abstract group theory into the concrete arithmetic that secures modern digital communication.

The Core Insight

The integers coprime to form a group under multiplication modulo — the unit group — and that group has exactly elements. By Lagrange's theorem, every element raised to the size of the group returns to the identity. That single structural fact, applied to a finite abelian group of units, is Euler's theorem.

Formal Statement

Euler's Totient Function

For a positive integer , the totient is the number of integers in the range satisfying :

1
⟳Directly count the residues modulo that have a multiplicative inverse; by convention since .

Symbols: is the modulus; ranges over representatives of residue classes; is the greatest common divisor. Equivalently, , the order of the group of units.

Product Formula

If is the prime factorization of , then

2
⟳Compute for prime powers, then multiply across distinct primes using multiplicativity (Theorem below).

Symbols: the product runs over distinct prime divisors of ; each factor removes the fraction of integers divisible by .

Multiplicativity

If , then

3

⟳The Chinese Remainder Theorem gives a ring isomorphism , which restricts to a bijection of unit groups, so unit counts multiply.

Note: is multiplicative but not completely multiplicative; e.g. .

Euler's Theorem

If and are integers with and , then

4
⟳ represents a unit in , a finite group of order ; apply Lagrange's theorem, whose corollary forces for all .

When is prime, and [4] becomes Fermat's little theorem: for .

Divisor-Sum Identity (Gauss)

For every positive integer ,

5

⟳Partition the fractions by their reduced denominator ; exactly of them reduce to a fraction with denominator .

Why It Holds

Euler's Theorem via Group Theory

Step 1. Let , the set of residue classes coprime to . Closure holds: if then . Associativity and the identity are inherited from . Inverses exist because means is solvable by Bézout. Hence is a finite abelian group with . Step 2. Fix and consider its cyclic subgroup . Let , the smallest positive integer with . Then . Step 3. By Lagrange's theorem, the order of any subgroup divides the order of the group: . Write . Step 4. Therefore
This is exactly [4].

Euler's Theorem via Permuted Residues (elementary)

Step 1. Let be a reduced residue system — one representative from each class coprime to . Step 2. Since , the map permutes this set: each is still coprime to , and forces (cancel the unit ). So is a permutation of modulo . Step 3. Multiply all elements of each set:
Step 4. Each is invertible, so is a unit and may be cancelled, yielding .

Leonhard Euler | 1707–1783

The Swiss polymath Euler introduced the totient (he wrote it as for a number ) while extending Fermat's little theorem to composite moduli, publishing the result in Theoremata arithmetica nova methodo demonstrata (1763). Across an unmatched output of nearly 900 works, Euler founded analytic number theory, introduced the zeta function and its product over primes, and codified the notation (, , , ) that students still use. The symbol for the totient was later popularized by Gauss in Disquisitiones Arithmeticae (1801), where the function received its systematic treatment.

Building Intuition

Think of as a sieve count. Start with all integers from to ; the factor in [2] discards exactly the fraction that are divisible by . Because divisibility by distinct primes is "independent" (a probabilistic shadow of the Chinese Remainder Theorem), you simply multiply the surviving fractions. For Euler's theorem, picture the units modulo as beads on a finite necklace. Multiplying everything by a unit just rotates the necklace — it relabels the beads without losing any. Since the necklace has beads, repeating the rotation times (i.e. raising to the power) lands you exactly back where you started.

Sieving the totient: integers 1–12 with those coprime to 12 highlighted

n = 12 = 2²·3, φ(12) = 12(1−½)(1−⅓) = 4 1 2 3 4 5 6 7 8 9 10 11 12 coprime to 12: {1, 5, 7, 11} → 4 elements grey = shares a factor 2 or 3 with 12 (sieved out)

Worked Examples

Computing φ(360)

Given: . Step 1 — Factor: . Step 2 — Apply product form [2]:
Step 3 — Multiply: . Check via fractions: ✓

Using Euler's Theorem to find the last two digits of $7^{803}$

Given: compute (the last two digits in base 10). Step 1 — Totient of modulus: , so . Step 2 — Check coprimality: , so Euler's theorem [4] gives . Step 3 — Reduce the exponent mod 40: , so . Step 4 — Evaluate: .

Common Misconceptions

Euler's theorem requires coprimality. The congruence holds only when . If shares a factor with , is not a unit and the conclusion generally fails — for such cases use the Carmichael function or handle prime-power factors separately. Also: reducing exponents works modulo , not modulo . To simplify , reduce modulo (when ), never modulo itself.

Take and . Here , and . Euler's theorem would predict , but , not . The hypothesis fails, so the conclusion fails. Indeed for all — the powers of never reach .

is not completely multiplicative. One might guess always, but [3] requires . With (not coprime): , whereas .

Connections

Euler's theorem is the composite-modulus parent of Fermat's Little Theorem (the prime case) and a direct corollary of Lagrange's Theorem applied to the Group of Units Modulo n. The product formula [2] flows from the Chinese Remainder Theorem and exhibits as a Multiplicative Function in Analytic Number Theory, where it appears in the Dirichlet Series identity . The divisor-sum identity [5] is a clean application of Möbius Inversion, giving . Structurally, measures the order of the abelian group studied in Cyclic Groups and Primitive Roots.

Real-World Applications

  1. RSA cryptography. Key generation chooses and a public exponent ; the private exponent satisfies , and decryption relies directly on Euler's theorem. Security rests on being hard to compute without factoring .
  2. Diffie–Hellman key exchange. Operates in a cyclic group whose order is for prime modulus ; exponent arithmetic is taken modulo this totient.
  3. Random number generators. Linear congruential and multiplicative generators achieve full period using primitive roots, whose existence depends on the structure counted by .
  4. Cyclic redundancy and modular hashing. Period analysis of modular power sequences uses orders dividing .
  5. Digital signatures (RSA, Rabin). Verification re-exponentiation again invokes .
  6. Computing modular inverses fast. When , , an alternative to the extended Euclidean algorithm.
  7. Music and gear design / cycle counting. The number of distinct necklaces and rotational symmetries is counted with Burnside's lemma, in which totients of cycle lengths appear.

Historical Development

  • 1640 — Pierre de Fermat states (without proof) his little theorem in correspondence with Frénicle de Bessy.
  • 1736 — Euler publishes the first proof of Fermat's little theorem.
  • 1763 — Euler generalizes it to composite moduli, introducing the totient in Theoremata arithmetica nova methodo demonstrata, proving .
  • 1801 — Gauss systematizes the function in Disquisitiones Arithmeticae, popularizing the notation and proving the divisor-sum identity [5].
  • 1832 — Gauss and contemporaries clarify the structure of and existence of primitive roots.
  • 1879 — J. J. Sylvester coins the term totient.
  • 1900s — Robert Carmichael introduces the function , the exact (least universal) exponent, refining Euler's bound.
  • 1933 — Edmund Landau and others establish asymptotics: .
  • 1977 — Rivest, Shamir, and Adleman publish RSA, turning and Euler's theorem into the backbone of public-key cryptography.

Subtleties & Limits

Lehmer's totient problem (1932) asks whether there exists a composite with . Every prime satisfies ; D. H. Lehmer conjectured no composite does, but the question remains open. Any counterexample must be odd, squarefree, and have at least 15 prime factors exceeding . Relatedly, Carmichael's totient conjecture posits that no value of is attained exactly once — for every there is some with ; verified to enormous bounds but unproven. These show that despite its elementary definition, still hides deep mysteries.

See Also

Fermat's Little Theorem · Lagrange's Theorem · Group of Units Modulo n · Chinese Remainder Theorem · Carmichael Function · Primitive Roots · Möbius Function and Inversion · RSA Cryptosystem · Multiplicative Function

Before this

Where this leads