← LibraryArithmetic Functions and Möbius InversionEngineering · MathematicsLesson 11/32← PrevNext →
ArticlePublished 6 Aug 2026Updated 5 Aug 20267 min readBy Kevin Jogin
KEVOS® Knowledge Library · Engineering → Mathematics

Engineering/Mathematics/Foundations of number theory

Arithmetic Functions and Möbius Inversion

Divisor sums appear everywhere a quantity is counted by degree, order or period. Dirichlet convolution turns them into an algebra, and Möbius inversion turns any such sum inside out — which is how the number of irreducible polynomials of a given degree is counted exactly.

  • Core theory
  • Number theory
  • Counting tool
  • ≈14 min read
  • Used in finite field theory
μ(n)Möbius function0 if n is not squarefree, otherwise (−1)k for k distinct prime factors.
Dirichlet convolution(f ∗ g)(n) = ∑d∣n f(d)g(n/d) — commutative, associative, with identity, and it preserves multiplicativity.
qk/kIrreduciblesThe count of monic irreducible polynomials of degree k over Fq, to leading order — derived by inversion.
1/ζ(s)Dirichlet seriesThe generating series of μ; the analytic form of the inversion identity.

01

Executive summary

An arithmetic function is any map from positive integers to a ring, usually . The useful ones are multiplicative: f(mn) = f(m)f(n) whenever gcd(m,n) = 1. Such a function is completely determined by its values on prime powers, which reduces every question about it to a local one.

The organising operation is Dirichlet convolution. Under it the arithmetic functions with f(1) ≠ 0 form an abelian group, the multiplicative functions form a subgroup, and the Möbius function is the inverse of the constant function 1. Möbius inversion is nothing more than multiplying by that inverse.

Operationf ∗ g

Divisor-indexed convolution; the natural product on arithmetic functions.

Identityε(n) = [n = 1]

The unit of the convolution algebra.

Inverse of 1μ

∑ over divisors of μ gives ε — the defining property of the Möbius function.

ConsequenceInversion

F = f ∗ 1 ⟺ f = F ∗ μ. Any divisor-sum relation can be run backwards.

Contents

02

Definitions

Definition D1

Multiplicative and completely multiplicative

f is multiplicative if f(1) = 1 and f(mn) = f(m)f(n) for coprime m,n; it is completely multiplicative if the condition holds for all m,n. Multiplicative functions are determined by their prime-power values via f(n) = ∏pe ∥ n f(pe).

The standard catalogue
FunctionDefinitionValue at peType
ε1 if n = 1, else 00completely multiplicative
1constant 11completely multiplicative
Idnpecompletely multiplicative
τ = σ0number of divisorse + 1multiplicative
σ = σ1sum of divisors(pe+1−1)/(p−1)multiplicative
φcount of units mod npe − pe−1multiplicative
μMöbius function−1 if e = 1, else 0multiplicative
Λvon Mangoldtlog pneither

Λ is not multiplicative but is the natural weight for prime counting: ∑_{d∣n} Λ(d) = log n.

Definition D2

Dirichlet convolution

(f ∗ g)(n) = ∑d ∣ n f(d) g(n/d) = ∑de = n f(d)g(e)

The operation is commutative and associative, has identity ε, and f has a convolution inverse exactly when f(1) ≠ 0. Crucially, the convolution of two multiplicative functions is multiplicative — which is how multiplicativity of φ, σ and τ is proved uniformly.

Contents

03

The Möbius function and inversion

Theorem T1

The defining identity

d ∣ n μ(d) = ε(n) = 1 if n = 1, 0 otherwiseequivalently μ ∗ 1 = ε, so μ is the Dirichlet inverse of the constant function 1

Proof: for n > 1 with k distinct prime factors, only squarefree divisors contribute, giving j C(k,j)(−1)j = (1−1)k = 0 by the binomial theorem.

Theorem T2

Möbius inversion

F(n) = ∑d ∣ n f(d)  ⟺  f(n) = ∑d ∣ n μ(d) F(n/d)In convolution notation: F = f ∗ 1 ⟺ f = F ∗ μ. The proof is associativity plus μ ∗ 1 = ε.

A multiplicative version of the same statement, useful when the underlying relation is a product rather than a sum:

F(n) = ∏d ∣ n f(d)  ⟺  f(n) = ∏d ∣ n F(n/d)μ(d)

Immediate example

From d ∣ n φ(d) = n — proved by partitioning {1,…,n} according to gcd with n — inversion gives φ(n) = ∑d ∣ n μ(d)·n/d = n ∏p ∣ n(1 − 1/p), recovering the closed form without any counting argument.

Contents

04

Applications

Counting irreducible polynomials over a finite field

Every monic irreducible of degree d over Fq divides Xqk − X exactly when d ∣ k, and that polynomial is squarefree. Comparing degrees gives qk = ∑d ∣ k d·Iq(d), and inversion yields the exact count:

Iq(k) = (1/k) ∑d ∣ k μ(d) qk/d = qk/k + O(qk/2/k)So a random monic polynomial of degree k over F_q is irreducible with probability close to 1/k — the basis for randomised construction of finite fields.

Other standard uses

01

Necklace and Lyndon word counts

The number of aperiodic cyclic strings of length n over a k-letter alphabet is (1/n)∑d∣n μ(d)kn/d — the same formula, because both count objects of exact period.

02

Cyclotomic polynomials

Φn(X) = ∏d∣n(Xd−1)μ(n/d), obtained by multiplicative inversion of Xn−1 = ∏d∣nΦd(X).

03

Squarefree counting

n ≤ x |μ(n)| = 6x/π2 + O(√x): about 61% of integers are squarefree.

04

Inclusion–exclusion sieving

μ is the sign bookkeeping of inclusion–exclusion over prime divisors; every elementary sieve is a truncated Möbius sum.

05

Coprimality density

The probability that two random integers are coprime is 1/ζ(2) = 6/π2, from ∑ μ(n)/n2.

06

Order statistics in groups

In a cyclic group of order m, the count of elements of exact order d is φ(d) — an inversion of the divisor-sum count of elements of order dividing d.

Contents

05

Dirichlet series: the analytic shadow

Attaching the formal series Df(s) = ∑n ≥ 1 f(n)n−s converts convolution into multiplication: Df∗g = Df·Dg. Multiplicativity becomes an Euler product.

Standard correspondences
FunctionDirichlet seriesReading
1ζ(s)The Riemann zeta function; Euler product p(1−p−s)−1
μ1/ζ(s)Möbius inversion in analytic form
φζ(s−1)/ζ(s)From φ = Id ∗ μ
τζ(s)2From τ = 1 ∗ 1
σζ(s)ζ(s−1)From σ = 1 ∗ Id
Λ−ζ′(s)/ζ(s)The link between zeros of ζ and prime counting

The last line is the entry point to analytic prime number theory: error terms in the prime number theorem correspond directly to the zero-free region of ζ.

Why an engineer should care

The identity ∑ μ(n)n−s = 1/ζ(s) is the reason sieve estimates and smooth-number densities are computable at all. Those densities set the parameters — the size of the factor base and the sieving interval — for subexponential factoring and discrete-log algorithms.

Contents

06

Computing arithmetic functions

Cost of evaluation
TaskMethodCost
μ, φ, τ, σ for all n ≤ Nlinear sieve over smallest prime factorO(N) time, O(N) space
μ(n) or φ(n) at a single large nrequires factoring nas hard as factoring
n ≤ x μ(n) (Mertens function)Deléglise–Rivat and successorssublinear, but far from trivial
Iq(k)direct Möbius sum over divisors of kO(τ(k)) arithmetic operations
Convolution f ∗ g up to Ndivisor-pair enumerationO(N log N)

Single-point evaluation is not cheap

There is an asymmetry worth internalising: computing φ or μ for every integer below a bound is linear time, but computing either at one cryptographically sized argument requires the factorization of that argument. Confusing the two leads to badly wrong performance assumptions.

Contents

07

Quick reference and FAQ

Convolution identities
IdentityMeaning
1 ∗ μ = εDefinition of the Möbius function
φ ∗ 1 = Idd∣n φ(d) = n
φ = Id ∗ μClosed form for the totient
1 ∗ 1 = τDivisor count
Id ∗ 1 = σDivisor sum
Λ ∗ 1 = logvon Mangoldt weighting
μ ∗ log = −ΛInverted form, used in analytic estimates
Why is μ(n) = 0 for non-squarefree n?
Because μ is the inverse of the constant function 1 under convolution, and solving d∣pe μ(d) = 0 recursively forces μ(p) = −1 and μ(pe) = 0 for e ≥ 2. The combinatorial reading is that inclusion–exclusion over distinct primes has no term for repeated primes.
Is Möbius inversion the same as inclusion–exclusion?
It is inclusion–exclusion on the divisor lattice. The general form is Möbius inversion on a locally finite partially ordered set; the classical version is the special case of the divisibility order, and the subset lattice gives ordinary inclusion–exclusion.
Where does this appear in the rest of the library?
Most directly in the count of irreducible polynomials, which justifies randomised construction of finite fields, and in the smooth-number estimates used to size the factor base in subexponential factoring.
Does the theory work over an arbitrary ring?
Yes. Arithmetic functions with values in any commutative ring form a convolution algebra, and inversion holds verbatim. This is used when the target ring is a polynomial or power series ring rather than .
Contents

09

References and further reading

  • V. Shoup, A Computational Introduction to Number Theory and Algebra, Cambridge University Press, 2005 — §2.6 and §20.3.
  • T. M. Apostol, Introduction to Analytic Number Theory, Springer, 1976 — Chapters 2 and 11, the standard reference for Dirichlet convolution.
  • R. Lidl and H. Niederreiter, Finite Fields, 2nd ed., Cambridge, 1997 — §3.2 for the irreducible-polynomial count.
  • R. P. Stanley, Enumerative Combinatorics, Vol. 1, 2nd ed., Cambridge, 2011 — §3.7 on Möbius functions of posets.

KEVOS® Knowledge LibraryEngineering → MathematicsTaxonomy ID: ENG-MATHPage ID: arithmetic-functions-and-mobius-inversionReview cycle: annual


Continue learning

Euler's Phi Function and Fermat's Little TheoremArticle · MathematicsNEXT LESSON →The Distribution of PrimesArticle · MathematicsCongruences and Modular ArithmeticArticle · MathematicsAbelian Groups and Cyclic StructureArticle · Mathematics