Show that $\sum_{n \le x} \phi (n)=\frac{x^2}{2\zeta(2)}+ O(x \log x)$ How do I show that  $\sum_{n \le x} \phi (n)=\frac{x^2}{2\zeta(2)}+ O(x \log x)$, 
where $O$ denotes the big-$O$ notation.
And we already know that $\phi (n) =  \sum_{d|n} \mu (d) \frac{n}{d}$.
I believe that I could approach something also from the previous question I posted but I couldn't make the relation.
 A: As you stated, we know $\phi(n) = \sum_{d | n} \mu(d)\frac{n}{d}$. It is slightly more suggestive to rewrite this as $\phi(n) = \sum_{d | n} \mu(d)\text{id}(\frac{n}{d})$, where $\text{id}$ is the identity function. Using this representation of $\phi$ in your first equation gives:
$$\sum \limits_{n \le x} \phi(n) = \sum \limits_{n \le x} \sum \limits_{d|n} \mu(d)\text{id}\left(\frac{n}{d}\right)$$
Swapping the sums, we get:
\begin{align}
\sum \limits_{n \le x} \phi(n) &= \sum \limits_{d \le x} \mu(d)\sum \limits_{k \le x/d} \text{id}(k) \\ 
&= \sum \limits_{d \le x} \mu(d)\left(\frac{x^2}{2d^2} + O\left(\frac{x}{d}\right)\right) \\ 
&= \frac{x^2}{2}\sum \limits_{d \le x} \frac{\mu(d)}{d^2} + O\left(x\sum \limits_{d \le x} \frac{1}{d}\right) \\
&= \frac{x^2}{2}\left( \frac{1}{\zeta(2)} - \sum \limits_{d>x}\frac{\mu(d)}{d^2} \right) + O\left(x\log x\right) \\
&= \frac{x^2}{2\zeta(2)} + O(x\log x)
\end{align}
The last line follows from the fact that $\sum \limits_{d>x}\frac{\mu(d)}{d^2} = O\left(\frac{1}{x}\right)$, which can be proved by partial summation.
A: Here is an elementary computation. Using $\phi(n)=n\sum_{d|n}\frac{\mu(d)}{d}=\sum_{md=n}m\mu(d)$, we obtain
\begin{align*}
\sum_{n < x}\phi(n) & = \sum_{dm<x}m\mu(d) \\
 & =\sum_{d<x}\mu(d)\sum_{m<x/d}m \\
 & =\sum_{d<x}\mu(d)(\frac{1}{2}x^2/d^2+O(x/d))\\
 & =\frac{1}{2}x^2\sum_{d<x}d^{-2}\mu(d)+O(x\log{x}) \\
 & =\frac{1}{2\zeta(2)}x^2+O(x\log{x}).
\end{align*}
