Show that $n$ is square-free if and only if the sum over all divisors of $\mu(d)^2\varphi(d)$ is $n$ 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$?
 A: Taking the trouble to typeset this in mathematical notation
we have that
$$\sum_{d|n} \mu(d)^2 \phi(d)
= \sum_{S\subseteq Q} \prod_{p\in S} (p-1).$$
where $Q$ is the set of prime factors of $n.$
This equals
$$\left.\prod_{p\in Q} (1+(p-1)x)\right|_{x=1}$$
by the combinatorial subset construction.
Simplifying we get
$$\prod_{p\in Q} p.$$
So the  function in question is  the product of the  prime divisors of
$n.$
 Now for the foreward direction obviously if $n$ is squarefree then
$\prod_{p\in Q} p  = n.$ On the  other hand if $\prod_{p\in Q}  p = n$
then $n$ must  be squarefree because if it  isn't we have $\prod_{p\in
Q} p \lt n,$ a contradiction.
A: I'd just like to record an alternative solution.
Note that 
$$\sum_{d\mid n} \varphi(d) =n,$$ and $\mu(d)^2$ is either 0 or 1, so 
$$\sum_{d\mid n} \mu(d)^2\varphi(d) =n$$
if and only if for no $d\mid n$ we have $\mu(d)=0$. This is true if and only if no divisor $d$ of $n$ is divisible by the square of a prime if and only if all divisors of $n$ are square-free. Lastly, this is true if and only if $n$ is square-free.
Hence $$\sum_{d\mid n} \mu(d)^2\varphi(d) =n$$
if and only if $n$ is square-free as desired.
