Euler's Totient Function
Euler's totient function counts the positive integers up to that are coprime to . Key result: it is multiplicative, with , giving the product formula . Where it applies: number theory, the structure of , RSA cryptography, and Euler's theorem. Who/when: introduced by Leonhard Euler (1763), with the notation standardized by Gauss (1801).Euler's totient function assigns to each positive integer the number of integers in that share no common factor with other than . It is one of the most fundamental arithmetic functions because it precisely measures the size of the multiplicative group of integers modulo , the group of units. This single quantity controls the orders of elements in modular arithmetic, underlies Euler's generalization of Fermat's Little Theorem, and is the secret-key ingredient of the RSA cryptosystem. A surprising fact: although measures "how many numbers are coprime to ," its values are extraordinarily erratic—yet they satisfy the beautiful, exact summation identity .
The Core Insight
Counting integers coprime to becomes easy when you break into its prime-power building blocks. The Chinese Remainder Theorem guarantees that being coprime to is equivalent to being simultaneously coprime to each independently. This independence makes multiplicative, so the whole function is determined by its values on prime powers, which can be counted directly by subtracting off the multiples of each prime.
Formal Statement
Euler's Totient Function
For a positive integer , the totient is the number of integers with such that :
Here denotes the greatest common divisor of and . The integers counted are called totatives of . Equivalently, is the order (cardinality) of the multiplicative group of residue classes that are invertible modulo .
Multiplicative Function
An arithmetic function is multiplicative if whenever , and completely multiplicative if this holds for all . The totient is multiplicative but not completely multiplicative (see the warning below).
Product Formula for the Totient
Let be the prime factorization of , with distinct primes and exponents . Then
The product runs over the distinct prime divisors of only (the exponents do not appear in the second form).
Prime-Power Value
For a prime and integer ,
In particular for any prime .
Divisor Sum Identity (Gauss)
For every positive integer ,
Euler's Theorem
If , then
This generalizes Fermat's Little Theorem , recovered by setting prime so .
Why It Holds / Derivation
Multiplicativity of the Totient
We prove whenever .
Step 1 — Set up the bijection. By the Chinese Remainder Theorem (CRT), since , there is a ring isomorphismGauss's Divisor Sum Identity
We prove .
Step 1 — Classify by gcd. Each integer in has a well-defined value , which is a divisor of . Partition the set into classes . Step 2 — Count one class. Write . Then iff , with . The number of such is exactly . Step 3 — Sum over classes. The classes partition , soLeonhard Euler | 1707–1783
The Swiss polymath Leonhard Euler introduced the totient function in his 1763 paper Theoremata arithmetica nova methodo demonstrata, where he proved the congruence now bearing his name as a generalization of Fermat's Little Theorem. Euler used the function to extend results about residues to composite moduli, a critical step toward the structure theory of modular arithmetic. He did not use the symbol ; he wrote the function descriptively. The notation , and the German name Totient, came later— from Carl Friedrich Gauss in the Disquisitiones Arithmeticae (1801), and "totient" coined by J. J. Sylvester. Euler's contributions to number theory, analysis, mechanics, and graph theory make him one of the most prolific mathematicians in history.
Building Intuition
Think of as answering: "Of the residue classes mod , how many can be inverted by multiplication?" An element has a multiplicative inverse mod precisely when —because the equation is solvable exactly under that condition (Bézout's identity). So literally counts the "usable" multipliers.
The product formula has a probabilistic reading. Pick a random integer near ; the "chance" it avoids the prime as a factor is . Because divisibility by distinct primes behaves independently, you multiply these chances together, and scaling by converts a probability into a count. This independence is exactly what the Chinese Remainder Theorem makes rigorous.
Totatives of n = 12: integers coprime to 12 are highlighted; the count gives φ(12) = 4
Worked Examples
Computing φ(360) from the Factorization
Given: . Compute . Step 1 — Factor. . The distinct primes are . Step 2 — Apply the product formula (equation ):Using Euler's Theorem to Reduce a Huge Power
Given: Find the last two digits of , i.e. compute . Step 1 — Set up. Last two digits means working mod . Since , Euler's theorem (equation ) applies. Step 2 — Compute the modulus exponent. , soCommon Misconceptions
The totient is multiplicative, NOT completely multiplicative. The identity requires . When the arguments share a factor it fails. Likewise, beware these traps:- in general; the correct value is .
- In the product formula , the product is over distinct primes; do not repeat a prime for higher exponents.
- is even for all . There is no with (it is not in the image), so not every even number is a totient value—values like are "nontotients."
Failure of Complete Multiplicativity
Take , which are not coprime. Then
Connections
The totient sits at the crossroads of several core structures. It is the order of the unit group studied in Modular Arithmetic, so its value governs element orders and the existence of Primitive Roots (which exist mod exactly when is cyclic). Equation is a special case of Dirichlet Convolution: writing , Möbius inversion recovers , linking to the Möbius Function. Euler's theorem (equation ) is a corollary of Lagrange's Theorem (Group Theory) applied to the unit group, and generalizes Fermat's Little Theorem. The summatory behavior of connects to Analytic Number Theory through the asymptotic density of coprime pairs and the Riemann Zeta Function via the Dirichlet series .
Real-World Applications
- RSA cryptography. Key generation uses for secret primes ; the encryption/decryption exponents satisfy , where . Security rests on the hardness of recovering without factoring .
- Diffie–Hellman and ElGamal. Choosing generators of relies on knowing and its factorization to verify primitive roots.
- Random number generators. The period of a linear congruential generator with multiplier coprime to the modulus is bounded by the totient/order structure of the unit group.
- Cyclotomic polynomials. The -th cyclotomic polynomial has degree exactly , used in error-correcting BCH codes and primality tests (AKS).
- Hashing and check-digit schemes. Modular inverses (existing iff coprime, counted by ) underpin invertible mixing steps in checksum algorithms.
- Music and rhythm theory. Counting distinct necklaces/rhythmic patterns of period uses terms via Burnside/Pólya counting.
- Continued fractions and Farey sequences. The number of fractions in the Farey sequence is , applied in numerical approximation.
Historical Development
- 1640 — Pierre de Fermat states his "Little Theorem" , the prime-modulus precursor to Euler's generalization.
- 1736 — Euler publishes the first known proof of Fermat's Little Theorem.
- 1763 — Euler introduces the totient idea and proves in Theoremata arithmetica nova methodo demonstrata.
- 1801 — Gauss, in Disquisitiones Arithmeticae, systematizes modular arithmetic, introduces the symbol , and proves the divisor-sum identity .
- 1832 — Gauss's framework clarifies the structure of and the existence of primitive roots, all phrased through .
- 1879 — J. J. Sylvester coins the term "totient."
- 1932 — Robert Carmichael studies the related (Carmichael function), the exact exponent of the unit group, refining Euler's bound.
- 1962 — Wacław Sierpiński and others investigate the distribution of nontotients and Carmichael's totient-uniqueness conjecture.
- 1977 — Rivest, Shamir, and Adleman base the RSA cryptosystem on , making the totient a cornerstone of modern security.
Subtleties & Limits
Several deep questions about remain unresolved:
- Carmichael's Totient Conjecture (1907). For every , is there always another integer with ? In other words, no totient value is attained exactly once. It has been verified for up to enormous bounds () but no proof exists.
- Lehmer's Totient Problem (1932). Does ever hold for composite ? For primes it always holds since ; whether a composite counterexample exists is unknown. Any such must have at least 15 prime factors.
- Distribution of values. The average order satisfies , but the fine fluctuations and the precise structure of the image (totients vs. nontotients) involve subtle analytic estimates (Ford's theorem, 1998, on the multiplicity of totient values).
- Iterated totients. The behavior of repeatedly applying (the "totient chain" reaching ) and its length is studied but not fully understood.