Show that $n$ is square-free if and only if $\sum _{d\mid n} \mu (d)^2\varphi (d) = n$.

Attempt:

The only non-zero terms in the sum are the terms where $d = p_{i_1}\cdots p_{i_l}$ where $p_{i_1},\cdots ,p_{i_l}$ are distinct primes.

Then the sum becomes $\sum_{d\mid n}\varphi(d)$ where $d = p_{i_1}\cdots p_{i_l}$.

Now is there a way to show that this sum equals $n$?