From Convolution to Inversion: What Mobius Inversion Does
Based on original number theory notes, covering Dirichlet convolution, Möbius function, inversion techniques, and common identities.
Contents#
Dirichlet ConvolutionMöbius FunctionMöbius InversionCommon Convolution Relations and Problem-Solving Entry Points
First, the Conclusion: What This Article Aims to Solve#
At this point, a certain structure often appears in number theory problems:
- What you really want to find is some function ;
- But the problem initially gives you , which is often the result of “accumulating over all its divisors”;
- That is, a formula similar to
The most natural question then is:
- Given the “accumulated quantity,” how do we deduce the original function?
This is precisely what Möbius inversion does. It’s not a technique that appears out of thin air; it involves first writing the “summation over divisors” as a convolution, and then using to eliminate the .
- Identify the structure first: Look at the summation in the problem. Is it expanding over “divisors/multiples”? For example, forms like
{“\sum_{d|n}”}or{“\sum_{d|\gcd(i,j)}”}. - Write the expression as a convolution: If it can be written as
f = g * 1,f = g * id, etc., you are already very close to inversion. - Find the inverse function: The most commonly used is
{“\mu * 1 = \epsilon”}. By convolving both sides with{“\mu”}, the original function can be extracted.
Dirichlet Convolution#
In the form of a Dirichlet generating function:
Multiplication operation:
This has the same flavor as “multiplication corresponds to convolution” in ordinary generating functions, except that ordinary convolution sums over “indices adding up,” while here it sums over “factorization of the index.”
Define Dirichlet convolution:
It satisfies commutativity, associativity, and distributivity.
Three commonly used functions:
- Unit function:
- Constant function:
- Identity function:
We have: , but .
Common convolution relations:
Why It Resembles Ordinary Convolution#
If we denote ordinary convolution as:
Then Dirichlet convolution simply replaces “summation splitting” with “divisor splitting”:
So the most important thing to remember in this entire line of thought is not the names, but:
- As long as the problem’s structure involves “a number being contributed to by all its divisors,” you should think of Dirichlet convolution;
- Once it can be written as a convolution, many equations suddenly become much more structured.
It’s best to memorize these three convolution relations so you recognize them on sight
-
- This is the core of Möbius inversion.
-
- Because .
-
- This can be directly derived from the first two relations and often appears when dealing with sums involving
lcm/gcd.
- This can be directly derived from the first two relations and often appears when dealing with sums involving
When actually solving a problem, before rushing to apply inversion, first ask yourself: can this be rewritten as one of these standard convolution relations?
The Möbius Function#
Derived from Euler’s totient function.
Definition of the Möbius function. Let be a composite number, and be the smallest prime factor of .
We have:
If is prime, then .
That is:
These three cases can be understood directly as:
- : the defined value is ;
- As soon as a square factor appears, ;
- If it’s square-free, only the parity of the number of distinct prime factors matters.
Why μ Becomes the Protagonist of Inversion#
Because it exactly satisfies:
In convolution language, this is:
And acts as the “identity element” in convolution.
So whenever you see an expression that can be written as
you can immediately convolve both sides with :
This step is essentially the essence of Möbius inversion.
Möbius Inversion#
Prerequisites
Define Dirichlet convolution:
It satisfies commutativity, associativity, and distributivity.
Three commonly used functions:
- Unit function:
- Constant function:
- Identity function:
We have: , .
Common convolution relations:
Inversion Formula#
When and are both multiplicative functions, is called the Möbius transform of , and is called the inverse Möbius transform of .
Where Does This Formula Actually Come From?#
If
Then convolving both sides on the left with :
Writing this back in summation form, we get:
So now I prefer to understand inversion as:
- First, write the “accumulation over divisors” as a convolution;
- Then, use to eliminate the that was convolved in.
Common Entry Points When Solving Problems#
- Rewrite into the “standard divisor sum”: Try to organize the expression in the problem into the form
{“f(n)=\sum_{d|n} g(d)”}orf=g*1. - Decide whether to invert directly or continue simplifying: Many problems don’t end with simply applying the inversion formula; they often require combining it with techniques like division blocking, linear sieves, and prefix sums.
- See which function is needed in the final answer: If the result ends up involving
μ,φ, or prefix sums of multiplicative functions, you’ll usually need to proceed further with sieving methods and division blocking.
A Feeling for the Most Common Routine#
For example, given
If you want to find , it’s a direct inversion:
However, if the problem is phrased as a sum over multiples, like
it can often be transformed through substitution into a form of “counting over divisors/multiples,” and then you can consider whether to apply inversion.
So when actually solving a problem, don’t just stare at the formula’s literal form. First, see if the core structure involves “divisor contributions being mixed together.”
Practice Problems#
- P1829 Crash’s Digital Table / JZPTAB ↗
- Find
- P2522 [HAOI 2011] Problem b ↗
- Find
- LCMSUM ↗
- Find
- LibreOJ 2185 ↗
- Find
The common point of these problems is:
- They all eventually involve enumeration over divisors;
- Inversion itself is often not the endpoint, but an intermediate step to “untangle the relationships”;
- After untangling, they usually require combining with linear sieves, prefix sums of multiplicative functions, or division blocking.
How to Remember This Article in the End#
I now condense this line of thought into one sentence:
- Ordinary convolution handles “summation over indices”;
- Dirichlet convolution handles “splitting by divisors”;
- Möbius inversion is the process of “reconstructing the original quantity that was mixed together by summing over its divisors.”