The Möbius function is a tool from number theory that answers a surprisingly simple question: given a positive integer, how many distinct prime factors does it have, and are any of those factors repeated? It assigns each integer a value of −1, 0, or 1 based on the answer.
Think of it as a "prime factor signature" that cares only about two things: whether the number is square-free (no prime squared divides it), and if so, whether the number of distinct primes is odd or even.
The Intuition First
Take any positive integer n. Factor it completely into primes:
n=p1a1p2a2⋯pkak
Now ask two yes/no questions:
Is any exponent ai≥2? That is, does any prime appear more than once in the factorization? If yes, the number is not square-free.
If the number is square-free, is the count k of distinct primes odd or even?
The Möbius function μ(n) encodes the answers:
If any prime repeats (ai≥2 for some i), then μ(n)=0.
If all primes appear exactly once (ai=1 for all i), then μ(n)=(−1)k, where k is the number of distinct primes.
So μ(n)=1 when n is square-free with an even number of prime factors, and μ(n)=−1 when n is square-free with an odd number of prime factors.
The Special Case: n=1
The number 1 has no prime factors at all. It is square-free by convention, and the number of distinct primes is k=0. Since (−1)0=1, we define:
μ(1)=1
This is not arbitrary — it makes the Möbius function work beautifully in sums and inversions, as you will see later.
The Precise Definition
μ(n)=⎩⎨⎧10(−1)kif n=1,if n is not square-free (some prime squared divides n),if n is square-free with exactly k distinct prime factors.
Worked Examples
n
Prime factorization
Square-free?
k
μ(n)
1
(none)
Yes
0
1
2
2
Yes
1
−1
3
3
Yes
1
−1
4
22
No
—
0
6
2⋅3
Yes
2
1
12
22⋅3
No
—
0
30
2⋅3⋅5
Yes
3
−1
210
2⋅3⋅5⋅7
Yes
4
1
Notice the pattern: μ(n) alternates sign with the parity of the number of distinct primes, but only when no prime repeats.
Why It Matters (A Glimpse)
The Möbius function is the key to Möbius inversion, a technique that lets you "undo" sums over divisors. If you have a function f(n) and define g(n)=∑d∣nf(d), then you can recover f from g using μ:
f(n)=∑d∣nμ(d)g(dn)
This is one of the most powerful identities in elementary number theory, used everywhere from prime number theory to combinatorics.
Watch out
A common mistake: do not confuse μ(n)=0 with "the number is prime." Many primes give μ(p)=−1, not 0. The value 0 means a prime squared divides n — so 4,8,9,12,16,18,20,… all have μ=0, but primes themselves never do.
Quick Check
What is μ(72)? Factor 72=23⋅32. Since 22 divides 72 (and so does 32), the number is not square-free. Therefore μ(72)=0.
What about μ(42)? Factor 42=2⋅3⋅7. All exponents are 1, so it is square-free with k=3 distinct primes. Hence μ(42)=(−1)3=−1.
Each of Euler's totient φ, the divisor-count τ, the divisor-sum σ, and the Möbius function μ is computed from a number's prime factorisation, so all four numbers must be factorised before evaluating them.
✓Final answer
φ(90)+τ(42)+σ(72)+μ(70)=24+8+195+(−1)=226
Using the prime factorisations, φ(90)=24, τ(42)=8, σ(72)=195 and μ(70)=−1, giving a total of 226.
For n=p1a1p2a2⋯pkak:
φ(n)=n∏(1−pi1),τ(n)=∏(ai+1),σ(n)=∏pi−1piai+1−1,μ(n)=(−1)k if square-free, else 0
where φ = Euler totient, τ = number of divisors, σ = sum of divisors, μ = Möbius function.
φ(90):90=2×32×5, so φ(90)=90(1−21)(1−31)(1−51)=90×21×32×54=24.
τ(42):42=2×3×7, so τ(42)=(1+1)(1+1)(1+1)=8.
σ(72):72=23×32, so σ(72)=2−124−1×3−133−1=115×226=15×13=195.
μ(70):70=2×5×7 is square-free with k=3 primes, so μ(70)=(−1)3=−1.