Asymptotic formula for $\sum_{n \le x} \frac{\varphi(n)}{n^2}$

Here is yet another problem I can’t seem to do by myself… I am supposed to prove that
$$\sum_{n \le x} \frac{\varphi(n)}{n^2}=\frac{\log x}{\zeta(2)}+\frac{\gamma}{\zeta(2)}-A+O \left(\frac{\log x}{x} \right),$$
where $\gamma$ is the Euler-Mascheroni constant and $A= \sum_{n=1}^\infty \frac{\mu(n) \log n}{n^2}$. I might be close to solving it, but what I end up with doesn’t seem quite right. So far I’ve got:
$$
\begin{align*}
\sum_{n \le x} \frac{\varphi(n)}{n^2} &= \sum_{n \le x} \frac{1}{n^2} \sum_{d \mid n} \mu(d) \frac{n}{d} \\
&= \sum_{n \le x} \frac{1}{n} \sum_{d \le x/n} \frac{\mu(d)}{d^2} \\
&= \sum_{n \le x} \frac{1}{n} \left( \sum_{d=1}^\infty \frac{\mu(d)}{d^2}- \sum_{d>x/n} \frac{\mu(d)}{d^2} \right) \\
&= \sum_{n \le x} \frac{1}{n} \left( \frac{1}{\zeta(2)}- \sum_{d>x/n} \frac{\mu(d)}{d^2} \right) \\
&= \frac{1}{\zeta(2)} \left(\log x + \gamma +O(x^{-1}) \right) – \sum_{n \le x} \frac{1}{n}\sum_{d>x/n} \frac{\mu(d)}{d^2}.
\end{align*}
$$
So. I suppose my main problem is the rightmost sum, I have no idea what to do with it! I’m not sure where $A$ comes into the picture either. I tried getting something useful out of
$$
\begin{align*}
& \sum_{n \le x} \frac{1}{n} \left( \frac{1}{\zeta(2)}- \sum_{d>x/n} \frac{\mu(d)}{d^2} \right) +A-A \\
&= \left( \frac{1}{\zeta(2)} \left(\log x + \gamma +O(x^{-1}) \right) – A \right) – \sum_{n \le x} \frac{1}{n}\sum_{d>x/n} \frac{\mu(d)}{d^2} + A,
\end{align*}
$$
but I quickly realized that I had no clue what I was doing. Any help would be much appreciated.

Solutions Collecting From Web of "Asymptotic formula for $\sum_{n \le x} \frac{\varphi(n)}{n^2}$"

I tried this by switching the sums at the beginning so

$\displaystyle\sum_{n\le x}\frac{\phi(n)}{n^2}=\sum_{d\le x}\frac{\mu(d)}{d^2}\sum_{q\le\frac{x}{d}}\frac{1}{q}=\sum_{d\le x}\frac{\mu(d)}{d^2} \left (\log\left(\frac{x}{d}\right)+C+O\left(\frac{d}{x}\right)\right)$ using Thm 3.2(a) of Apostol p.55 (where $C$ is the Euler constant).
Then use
$\displaystyle\sum_{d\le x}\frac{\mu(d)}{d^2}=\frac{1}{\zeta(2)}+O\left(\frac{1}{x}\right)$ Apostol p.61.

Then use $\displaystyle\sum_{d\le x}\frac{\mu(d)\log d}{d^2}=A-\sum_{d>x}\frac{\mu(d)\log d}{d^2}$.

This last sum is $\displaystyle O\left(\sum_{d>x}\frac{\log d}{d^2}\right)$ and then use:

$0<\displaystyle \sum_{d>x}\frac{\log d}{d^2}=\sum_{d>x}\frac{\log d}{d^\frac{1}{2}}.\frac{1}{d^\frac{3}{2}}<\frac{\log x}{x^\frac{1}{2}}\sum_{d>x}\frac{1}{d^\frac{3}{2}}$ and Thm 3.2(c) p.55 for the error term

$\displaystyle O\left(\frac{\log x}{x}\right)$ and the $A$ in the question.

You were indeed almost there. All that’s left to do is just switch the order of summation on the last sum. I won’t fill in all the details but here’s a start:

$$\begin{align}
\sum_{1 \leq n \leq x} ~\sum_{d > x/n} \frac{1}{n} \frac{\mu(d)}{d^2} &=
\sum_{d \geq 2} \frac{\mu(d)}{d^2}\sum_{\frac{x}{d}< n \leq x} \frac{1}{n}
\end{align}$$

Noticing that

$$
\sum_{\frac{x}{d} < n \leq x}\frac{1}{n} = \sum_{n \leq x}\frac{1}{n} – \sum_{n \leq x/d}\frac{1}{n} = \log d + O\left(\frac{d}{x}\right)
$$

should do it. To check that the error terms behave correctly, let’s see where we’re at. We (okay, You) have shown:

$$\sum_{n \le x} \frac{\varphi(n)}{n^2}=\frac{\log x}{\zeta(2)}+\frac{\gamma}{\zeta(2)}-A + \sum_{d \geq 2} \frac{\mu(d)}{d^2} \cdot O\left( \frac{d}{x} \right).$$

It remains to show that

$$
\sum_{d \geq 2} \frac{\mu(d)}{d^2} \cdot O\left( \frac{d}{x} \right) = \sum_{d \geq 2} \frac{\mu(d)}{d} O\left( \frac{1}{x} \right) = O\left(\frac{\log x}{x} \right)\tag{$\ast$}
$$

We can actually do a little better (and unless I’m missing something, I’m not sure where the $\log x$ term comes from – maybe it is just a safety net). First, we use that

$$
\sum_{n \geq 1} \frac{\mu(n)}{n^s} = \frac{1}{\zeta(s)}.
$$

If you have not seen this before this should be justified. It follows from the formula for $\mu(n)$, when you write the Euler product for the sum. In turn this implies that

$$
\sum_{n \geq 1} \frac{\mu(n)}{n} = \lim_{s \to 1^+} \sum_{n \geq 1} \frac{\mu(n)}{n^s} = \lim_{s \to 1^+} \frac{1}{\zeta(s)} = 0.
$$

This is nice since we then get that

$$
\sum_{d \geq 2} \frac{\mu(d)}{d} = \sum_{d \geq 1} \frac{\mu(d)}{d} – 1 = -1.
$$

This proves $(\ast)$.

Consider Dirichlet series, related to the problem at hand:
$$
g(s) = \sum_{n=1}^\infty \frac{\varphi(n)}{n^{2+s}} = \frac{\zeta(s+1)}{\zeta(s+2)}
$$

We can now recover behavior of $A(x) = \sum_{n \le x} \frac{\varphi(n)}{n^s}$ by employing Perron’s formula, using $c > 0$:
$$
A(x) = \frac{1}{2 \pi i} \int_{c – i \infty}^{c + i \infty} \frac{\zeta(z+1)}{\zeta(z+2)} \frac{x^z}{z} \mathrm{d} z = \mathcal{L}^{-1}_z\left( \frac{\zeta(z+1)}{\zeta(z+2)} \frac{1}{z} \right)(\log x)
$$

For large $x$, the main contribution comes from the pole of ratio of zeta functions at $z = 0$. Using
$$
\frac{\zeta(z+1)}{\zeta(z+2)} \sim \frac{1}{\zeta(2)} \left( \frac{1}{z} + \gamma – \zeta^\prime(2)\right) + O(z)
$$
Since $\mathcal{L}^{-1}_z\left( \frac{1}{z^{n+1}} \right)(s) = \frac{s^n}{n!}$ we have
$$
A(x) = \frac{\log x}{\zeta(2)} + \left( \frac{\gamma}{\zeta(2)} – \frac{\zeta^\prime(2)}{\zeta(2)} \right) + \mathcal{L}^{-1}_z\left( \frac{\zeta(z+1)}{\zeta(z+2)} \frac{1}{z} – \frac{1}{\zeta(2) z^2} – \frac{\gamma – \zeta^\prime(2)}{\zeta(2) z} \right)(\log x)
$$
Notice that $\frac{\zeta^\prime(s)}{\zeta(s)} = \sum_{n=1}^\infty \frac{\mu(n) \log(n)}{n^s}$, hence $\frac{\zeta^\prime(2)}{\zeta(2)} = A$.

It remains to be shown that the remainder term is small.

Rather belatedly (for the benefit of anyone who stumbles across this page in future), while I like apatch’s answer, there is a slight issue with the step to prove
$$\left|\sum_{d>x}\frac{\mu(d)\log d}{d^2}\right| \leq \sum_{d>x}\frac{\log d}{d^2} = O\left(\frac{\log x}{x}\right).$$
What follows is now a summary of my post about this question, and the answer contained therein.

Specifically, you can’t say
$$\sum_{d>x}\frac{\log d}{d^2} = \sum_{d>x}\frac{\log d}{d^\frac{1}{2}}.\frac{1}{d^\frac{3}{2}}<\frac{\log x}{x^\frac{1}{2}}\sum_{d>x}\frac{1}{d^\frac{3}{2}}$$
because $\frac{\log x}{\sqrt{x}}$ only reaches its maximum around $x\approx 7.39$, well above the $x>2$ condition stated in the question.

Instead, you need to approximate the sum by the integral
$$\sum_{d>x}\frac{\log d}{d^2} \leq \frac{\log x}{x^2} + \int_x^\infty \frac{\log t}{t^2}dt$$
and then (e.g.) solve the integral using parts.