Möbius inversion formula Created 2026-09-24 Updated 2026-10-14
Möbius inversion recovers an arithmetic function from its divisor sum. For arithmetic functions , the following statements are equivalent, with each equality required for every positive integer :Here ranges over positive integer divisors of and is the Möbius function. No multiplicativity assumption is needed, and both sums are finite. The right side can also be written by exchanging complementary integer divisors. [ref]
https://darijgrinberg.gitlab.io/floor.pdf. Darij Grinberg, MIT 18.781 lecture notes, Theorem 2.5.1 and Proposition 2.5.2
The divisor sum bundles together with values at smaller integer divisors. Möbius inversion subtracts aggregates indexed by one distinct prime factor, adds those indexed by two, and continues with the alternating signs of inclusion-exclusion. A divisor containing a squared prime factor receives weight zero. The Möbius divisor-sum identity ensures that every unwanted contribution cancels exactly.
In Dirichlet convolution notation, and , where is the constant-one arithmetic function and is the Identity for Dirichlet convolution. Associativity and commutativity give the short proof:Convolving with proves the reverse implication. At , the formula reduces to because .
For a worked example, take , Euler's totient function. The totient divisor-sum identity says that , the identity arithmetic function:This identity comes from classifying the integers by their greatest common divisor with : the group with has members, since and are coprime integers. Summing the group sizes gives , as detailed under totient divisor-sum identity.
Now undo this aggregation with the Möbius function:The nonzero terms use ; vanish because they contain the square of the prime number . The four surviving integers coprime to are .
A divisor sum aggregates Euler's totient function values to 12, while Möbius inversion recovers the four integers coprime to 12
. Details. This example also reveals why Möbius inversion is useful: it turns an easy count of all objects into a count satisfying a coprimality restriction. Expanding over subsets of distinct prime factors givesThe product is inclusion-exclusion over multiples of the prime factors. For , it gives . More generally, whenever a counting problem produces a divisor sum, Möbius inversion lets that aggregate be reversed without solving a new system of equations.
