Prove $\sum_{d | n} \mu(d) (\log(d))^2=0$ If $n$ is a positive integer with more than 2 distinct prime factors, how to prove that $\sum_{d | n} \mu(d) (\log(d))^2=0$?
I struggle on how to continue from this.
Suppose $n=p_1 p_2 ... p_r$, because $\mu(d) \neq 0$ for square free $n$.
$\sum_{d | n} \mu(d) \log^2(d)=(-1)\sum_{p_i|n}\log^2(p_i)+(-1)^2\sum_{p_i|n,p_j|n,p_i\neq p_j}\log^2(p_i p_j)+...+(-1)^r\log^2(p_1 p_2 ... p_r)$
I thought of changing $\log^2(p_i p_j)$ to $(\log p_i + \log p_j)^2$, but still stuck.
How to prove this statement? If the way that I've shown won't work, feel free to suggest another way to prove this.
 A: As you said, WLOG we can assume $n$ is square-free. Let $P$ be the set of prime divisors of $n$. Firstly, if $a(n)$ is additive and $n$ is composite, then
$$\sum_{d|n}\mu(d)a(d)=\sum_{S\subseteq P}(-1)^{|S|}a\left(\prod_{p\in S}p\right)=\sum_{S\subseteq P}(-1)^{|S|}\sum_{p\in S}a\left(p\right)=0$$ by the inclusion-exclusion principle. While $\log(n)^2$ is not additive, $\log(n)$ is. Rewriting your expansion of the sum in question more compactly
$$\sum_{d\mid n}\mu(d)\log(d)^2=\sum_{S\subseteq P}(-1)^{|S|}\log\left(\prod_{p\in S}p\right)^2\\  =\sum_{S\subseteq P}(-1)^{|S|} \sum_{p\in S}\sum_{q\in S}\log p \log q\\ =\sum_{p\in P}\log p\sum_{S\subseteq P\\ p\in S}(-1)^{|S|}\sum_{q\in S}\log q\\ =\sum_{p\in P}\log p\sum_{S\subseteq P-\{p\}}(-1)^{|S|}\left(\log p+\sum_{q\in S}\log q\right).$$
Now,
$$\sum_{S\subseteq P-\{p\}}(-1)^{|S|}\sum_{q\in S}\log q=\sum_{d\mid n/p}\mu(d)\log(d)=0$$
if $n/p$ is composite. By the inclusion-exclusion principle, $$\sum_{S\subseteq P-\{p\}}(-1)^{|S|}\log p = \log p\sum_{S\subseteq P-\{p\}}(-1)^{|S|}=0$$
if $n$ is composite ($|P-\{p\}|\geq 1)$. We conclude that if $n$ has at least $3$ prime divisors, then
$$\sum_{d\mid n}\mu(d)\log(d)^2=0.$$
This analysis works for the square of any additive function $a(n)$ and can be generalized through induction to show that
$$\sum_{d\mid n}\mu(d)a(d)^k=0$$ if $n$ has at least $k+1$ distinct prime factors.
A: As you noted, it's obvious that $\prod_{i=1}^k p_i^{a_i}$ (where $p_i$ is prime and $a_i\geq 1$) and $\prod_{i=1}^k p_i$ will have the same result when the sum is evaluated, so let's just assume that $n=\prod_{i=1}^k p_i$
Denote $S_i$ as the set of all divisors of $n$ that contain exactly $i$ prime factors. For example, $S_0=\{\}$, $S_1=\{p_1,p_2,\ldots p_k\}$ and $S_n=\{p_1p_2\ldots p_k\}$.
Our sum is equivalent to
$$\sum_{i=0}^k\sum_{s\in S_i} \mu(s)\log^2(s)$$
$$=\sum_{i=0}^k (-1)^i\sum_{s\in S_i} \log^2(s)$$
While we can directly compute this inner sum, it will be better to exploit symmetry. For a fixed $i$, we will have $\binom{k}{i}$ different possibilities for $s$. We will then expand $(\log s)^2$, where $s$ is a product of $i$ primes. For any $s$, this expansion will have $i$ terms of the form $\log^2 p$ (where $p$ is a prime) and  $i(i-1)$ terms of the form $(\log p)(\log q)$ (where $p$ and $q$ are distinct primes). Using the fact that this sum is symmetric, we get that for a fixed $i$,
$$\sum_{s\in S_i} \log^2 (s)=\frac{i}{k}\binom{k}{i}\sum_{j=1}^k \log^2 (p_j)+\frac{i(i-1)}{k(k-1)}\binom{k}{i}\sum_{\substack{l,m\in [1,k]\\l\neq m}}(\log p_l)(\log p_m)$$
We can define the sums $\sum_{j=1}^k \log^2 (p_j)$ and $\sum_{\substack{l,m\in [1,k]\\l\neq m}}(\log p_l)(\log p_m)$ as constant $P_1$ and $P_2$. Hence, our original expression is equivalent to
$$=\sum_{i=0}^k (-1)^i\left(\frac{i}{k}\binom{k}{i}P_1+\frac{i(i-1)}{k(k-1)}\binom{k}{i}P_2\right)$$
$$=\sum_{i=0}^k (-1)^i\left(\binom{k-1}{i-1}P_1+\binom{k-2}{i-2}P_2\right)$$
$$=P_1\sum_{i=0}^k \binom{k-1}{i-1}(-1)^i+P_2\sum_{i=0}^k\binom{k-2}{i-2}(-1)^i$$
When $k-2>0$, using binomial theorem, both of these sums evaluate to $0$, hence our expression is equivalent to
$$=P_1(0)+P_2(0)$$
$$=\boxed{0}$$
