whitelabs' blog


Möbius function

Multiplicative function


Definition


We say that function \(f\) is multiplicative if it satisfies the following two conditions:

  • \(f(1)==1\)

  • \(f(ab)==f(a)f(b)\) for a pair of relatively prime numbers \(a,b∈\mathbb{N^+}\).

And functions satisfy the following two conditions are called completely multiplicative functions:

  • \(f(1)==1\)

  • \(f(ab)==f(a)f(b)\) for \(a,b∈\mathbb{N}\).

Examples


  • \(\varepsilon(n)=[n==1]\) : is a completely multiplicative function;

  • \(\varphi(n)=\Sigma_{i=1}^n[gcd(i,n)==1]\) : is a multiplicative function;

  • \(1(n)=1\) :is a completely multiplicative function;

  • \(id(n)=n\) :is a completely multiplicative function;


Dirichlet convolution


Definition


If 3 functions \(F\) , \(f\) and \(g\) satisfies:

\[F(n)=\Sigma_{d|n}f(d)g(n/d) \]

Then \(F\) is called the Dirichlet convolution of \(f\) and \(g\) ,denoted \(F=f*g\) .

Properties


Associative: \((f*g)*h=f*(g*h)\)

distributive over addition: \(f*(g+h)=f*g+f*h)\)

commutative: \(f*g=g*f\)

the identity element:

\[f∗ε=f \]

Proof :

\[(f∗ε)(n)=\underset{d|n}{\Sigma}f(d)\varepsilon(n/d)=f(n)\varepsilon(n/n)+\underset{d|n-1}{\Sigma}f(d)\varepsilon(n/d) \]

The value of the function \((f∗ε)(n)\) is \(1\) if and only if \(n==d\) . Obviously \(f∗ε=f\).


Möbius function


Definition


For any integer \(n∈\mathbb{N}\) , the Mobius function of it denoted \(μ(n)\) , is defined as:

\[μ(n)= \begin{cases} 1& \quad n=1\\ -1^k& \quad n=p_1*p_2*...*p_k\\ 0& \quad otherwise \end{cases}\]


Properties


Property 1:

\[\underset{d|n}{\Sigma}μ(d)=0 \qquad (n>1) \]

Proof:

  • Do the factorization of \(n\) : \(n=p_1*p_2*...p_t\) ;

  • Each \(d\) is a product of these factors , and the set of \(ds\) made up of the products of k factors \((k∈[1,t])\) .

  • And the answer is the sum of the \(ds\);

  • When use \(1\) factor , the value of \(μ(d)s\) are \((-1)^1\) , the number of \(ds\) is \(C_n^1\) , and the sum of \(μ(d)s\) is \(C_n^1*(-1)^1\);

  • When use \(2\) factors , the value of \(μ(d)s\) are \((-1)^2\) , the number of \(ds\) is \(C_n^2\) , and the sum of \(μ(d)s\) is \(C_n^2*(-1)^2\);

  • ...

  • When use \(n\) factors , the value of \(μ(d)s\) are \((-1)^n\) , the number of \(ds\) is \(C_n^n\) , and the sum of \(μ(d)s\) is \(C_n^n*(-1)^n\);

  • Therefore :

\[\underset{d|n}{\Sigma}μ(d)=\Sigma_{k=1}^t C_n^k (-1)^k \]

  • According to Binomial Theorem :

\[\Sigma_{k=1}^t C_n^k (-1)^k=\Sigma_{k=0}^t C_n^k (-1)^k(1^{t-k}) \]

\[=((−1)+1)^n \]

\[=0 \]


Property 2:

\[μ∗I=ε \]

Proof:

\[(μ∗I)(n)=\underset{d|n}{\Sigma}μ(d)*1 \]

  • When \(n=1\) , the value is \(1\);

  • When \(n=0\) , the value is \(0\);

  • When \(n>1\) , \(\underset{d|n}{\Sigma}μ(d)=0\) .

  • Obviously , \(μ∗I=ε\) .

Property 3:

The relationship with Euler's Totient Function :

\[μ*id=\varphi \]

Proof:

  • Let \(f(n)=\underset{d|n}{∑}ϕ(d)\)

  • Obviously , \(f\) is a Multiplicative function .

  • Do the factorization of \(n\) : \(n=p_1^{c_1}*p_2^{c_2}*...p_t^{c_t}\) ;

  • \(f\) is a Multiplicative function , which implies that :

\[f(n)=f(p_1^{c_1}*p_2^{c_2}*...p_t^{c_t})=f(p_1^{c_1})*f(p_2^{c_2})*...f(p_t^{c_t}) \]

\[f(p_x^{c_x})=\underset{d|n}{∑}\varphi(p_x^{c_x})=\varphi(p_x^0)+\varphi(p_x^1)+\varphi(p_x^2)+...+\varphi(p_x^{c_x}) \]

\[=1+(p_x-1)+(p_x^2-p_x)+...+(p_x^{c_x}-p^{c_x-1})=p^{c_x} \]

  • Therefore ,

\[f(n)=f(p_1^{c_1})*f(p_2^{c_2})*...f(p_t^{c_t})=p_1^{c_1}*p_2^{c_2}*p_t^{c_t} \]

\[=n \]

  • That is ,

\[\underset{d|n}{\Sigma}\varphi(d)=n\quad,\quad\varphi*I=id \]

  • $\varphi=\varepsilon*\varphi $ , \(\varepsilon=\mu*I\) , so we get :

\[\varphi*\mu*I=\varphi \]

  • \(\varphi*I=id\) , so we get :

\[\mu*id=\varphi \]


Code


inline void Mobius(int n){
    M[1]=1;
    for(int i=2;i<=n;i++){
        if(!marked[i]) prime[++SUM]=i,M[i]=-1;
        for(int j=1;j<=SUM&&prime[j]*i<=n;j++){
            marked[i*prime[j]]=1;
            if(!(i%prime[j])) break;
            else M[i*prime[j]]=-M[i];
        }
    }
}



Möbius inversion formula


Definition


The Mobius inversion formula expresses the values of \(f\) in terms of its summatory function of \(f\) .

For 2 arithmetic function \(f\) and \(f\) , if they satisfied :

\[F(n)=\underset{d|n}{\Sigma}f(d) \]

We have :

\[F(n)=\underset{d|n}{\Sigma}\mu(d)F(n/d) \]

Another form of Mobius inversion is :

For 2 arithmetic function \(f\) and \(f\) , if they satisfied :

\[F(n)=\underset{n|d}{\Sigma}f(d) \]

We have :

\[F(n)=\underset{n|d}{\Sigma}\mu(d/n)F(d) \]


Proof


For the first form:
  • \(F(n)=\underset{d|n}{\Sigma}f(d)\) , that is : \(F=f*I\)

  • Notice that \(I*\mu=\varepsilon\) , we get :

\[F=f*I\quad=>\quad F*\mu=f*I*\mu\quad=>\quad F*\mu=f*\varepsilon \]

\[=>\quad F=\mu*f \]

  • That is , \(F(n)=\underset{d|n}{\Sigma}\mu(d)F(n/d)\) .

For the second form:

Let's prove it backwards from the results:

  • Let \(k=d/n\) . Change all the \(n|d\) into \(k*n\) , we have:

\[\underset{n|d}{\Sigma}\mu(d/n)F(d) \]

\[=\Sigma_{k=1}^∞\mu(k)F(nk) \]

  • Substitute \(f\) into it , we get:

\[\Sigma_{k=1}^∞\mu(k)\underset{(nk)|t}{\Sigma}f(t) \]

  • \(t\) is a multilpe of \(nk\) , and \(k,t\) goes from \(1\) to \(∞\) .

  • Thus , there are and only multiples of \(n\) that are be taken ;

  • Change the order of \(k\) and \(t\) :

\[\Sigma_{t=1}^∞f(t)\underset{(nk)|t}{\Sigma}\mu(k) \]

  • There are still multiples and only multiples of \(n\) that are taken ,

  • because when \(n\) isn't a factor of \(t\) , the value of \(\underset{(nk)|t}{\Sigma}\mu(k)\) will be \(0\) and \(f(t)\underset{(nk)|t}{\Sigma}\mu(k)\) will be 0.

  • Therefore :

\[\Sigma_{k=1}^∞\mu(k)\underset{(nk)|t}{\Sigma}f(t)=\Sigma_{t=1}^∞f(t)\underset{(nk)|t}{\Sigma}\mu(k) \]

  • And it can be written as :

\[\Sigma_{t=1}^∞f(t)\underset{k|(t/n)}{\Sigma}\mu(k) \]

\[=\Sigma_{t=1}^∞f(t)\underset{k|(t/n)}{\Sigma}\mu(k)I((t/n)/k) \]

  • Using dirichlet convolution , we get :

\[=\Sigma_{t=1}^∞f(t)(\mu*I)(t/n) \]

\[=\Sigma_{t=1}^∞f(t)\varepsilon(t/n) \]

  • The value is 1 if and only if \(t/n==1\) , that is \(t==n\) . Obviously ,

\[\Sigma_{t=1}^∞f(t)\varepsilon(t/n)=f(n) \]

  • That is , \(\underset{n|d}{\Sigma}\mu(d/n)F(d)=f(n)\) .

posted on 2021-09-06 23:27  whitelabs  阅读(125)  评论(0)    收藏  举报

导航