# Liouville function and perfect square

Let $n \in \mathbb{Z}$ with $n > 0$. Let $F(n) = \sum_{d \mid n} \lambda(d)$. Prove that $$F(n) = \begin{cases}1, \quad \text{if }n \text{ is a perfect square}\\ 0, \quad \text{otherwise} \end{cases}$$

By the Fundamental Theorem of Arithmetic, all $d$’s admit a prime factorization $d=p_1^{a_1}p_2^{a_2}\cdots p_k^{a_k}$ for primes $p_i$ and nonnegative integers $a_i$. So $\lambda(d)=\lambda(p_1^{a_1}p_2^{a_2}\cdots p_k^{a_k})$. Now the idea is that all the divisors will cancel in pairs of $1$ and $-1$ when $n$ is a perfect square, except the divisor $1$, and so the sum will total $1$. How do I prove this rigorously? If I just choose a generic divisor and write it’s prime factorization I don’t find anything I can generalize. Can you help?

#### Solutions Collecting From Web of "Liouville function and perfect square"

You can prove it using “multiplicative” property and it’s simple but I just solved it without it and I believe that it’s much more beautiful.

Consider $$n=p_{1}^{a_1} p_2^{a_2} … p_k^{a_k}$$

So $\Omega(n)=\sum a_i$ and $\lambda(n)=(-1)^{\Omega(n)}$

Now $$\sum_{d|n}\lambda(d)=\sum_{d|n}(-1)^{\Omega(d)}$$

So it’s suffices to calculate $D$; the difference of the number of divisor with even $\Omega$ and odd $\Omega.$

Now consider $f(x)=(1+x+x^2+…+x^{a_1})(1+x+x^2+…+x^{a_2})…(1+x+x^2+…+x^{a_k})$

The coefficient of $x^r$ in above expansion is equal to the number of solutions of this equation:

$$x_1+x_2+…+x_k=r$$
$$0 \le x_i \le a_i$$
which is the number of divisors of $n$ with $\Omega$ equals to $r$.

Hence, $f(-1)=D.$

But $f(-1)$ is $0$ if at least one of $a_i$ is odd and $f(-1)=1$ if $n$ is a perfect square. $Q.E.D$

As a second solution:

It’s easy to check $\lambda=1_{Sq}*\mu$

$[$ Actually the summation has only one term.$]$

Now convolve both sides with the $1$ function [which is inverse of $\mu$]

$$\lambda * 1=1_{Sq}*\mu*1=1_{Sq}$$

.