Showing that $\lim_{Q\to\infty}\frac{1}{Q^2}\sum_{n=1}^{Q}\sum_{k=1}^Q \mu(n)\mu(k)\gcd(n,k)=0$ and a twin identity Recently I have been working with the mobius function, and I stumbled about a pair of very nice identities that I would like to see proved. The first (and main) one is the identity
\begin{equation}\lim_{Q\to\infty}\frac{1}{Q^2}\sum_{n=1}^{Q}\sum_{k=1}^Q \mu(n)\mu(k)\gcd(n,k)=0\tag{1}\end{equation}
where $\mu(n)$ is the Mobius function, and the second very related identity is showing that
\begin{equation}\sum_{n=1}^{Q}\sum_{k=1}^Q \frac{\mu(n)\mu(k)}{\mathrm{lcm}(n,k)}=O_{Q\to\infty}(1)\tag{2}\end{equation}
The motivation behind these questions are relatively straightforward. It is commonly believed that there is a sort of "Mobius pseudo-randomness principle" which states that the assignment of $\mu(n)$ to $\pm1$ is essentially random. A good measure of this would be showing that $\sum_{d|n}\mu(d)$ not only cancels when all terms are included, but also in it's truncated form
$\sum_{d|n \,d<Q}\mu(d)$ as well.
We can see using manipulations that
$$\mathbb{E}_{n\in\mathbb{N}}\left[\left(\sum_{\substack{d|n \\d<Q}}\mu(d)\right)^2\right]=\sum_{n=1}^{Q-1}\sum_{k=1}^{Q-1} \frac{\mu(n)\mu(k)}{\mathrm{lcm}(n,k)}$$
and
$$\frac{1}{Q}\sqrt{\mathbb{E}_{n\in\mathbb{N}}\left[\left(\sum_{\substack{d|n \\d<Q}}d\mu(d)\right)^2\right]}=\sqrt{\frac{1}{Q^2}\sum_{n=1}^{Q-1}\sum_{k=1}^{Q-1} \mu(n)\mu(k)\gcd(n,k)}$$
this means that getting these two identities which do not seem too hard to prove (especially the first) would help us justify the belief that the Mobius function is near pseudo-random.
EDIT:
I think that an avenue towards proving the first identity would be getting estimates on the single variable sum
$$\sum_{k=1}^Q\mu(k)\gcd(n,k)$$
for some fixed $n$, possibly in the form
$$\left|\sum_{k=1}^Q\mu(k)\gcd(n,k)\right|=O_{Q\to\infty, n
\to
\infty}\left(\log(n)Q^{1-\epsilon}\right)$$
which would be enough to establish the identity. Does anyone know of any such results?
 A: $$\sum_{n=1}^Q\sum_{k=1}^Q\mu(n)\mu(k)\gcd(n,k)=S_{\mu}(Q),\quad\sum_{n=1}^Q\sum_{k=1}^Q\frac{\mu(n)\mu(k)}{\operatorname{lcm}(n,k)}=S_{\eta}(Q),$$ where $\eta(n):=\mu(n)/n$, and for any $f:\mathbb{N}\to\mathbb{R}$, $$S_f(n):=\sum_{a=1}^{n}\sum_{b=1}^{n}f(a)f(b)\gcd(a,b)=\color{blue}{\sum_{a=1}^{n}\varphi(a)F_f(n,a)},\\F_f(n,a):=G_f(\lfloor n/a\rfloor,a)^2,\qquad G_f(n,a):=\sum_{b=1}^{n}f(ab),$$ where $\varphi$ is Euler's totient function; for a proof, we rewrite the LHS as $$S_f(n)=\sum_{d=1}^{n}dS_f(n,d),\quad S_f(n,d):=\sum_{\substack{1\leqslant a,b\leqslant n\\\gcd(a,b)=d}}f(a)f(b),$$
and see that $$\sum_{k\geqslant 1}S_f(n,kd)=\sum_{\substack{1\leqslant a,b\leqslant n\\d\,\mid\,\gcd(a,b)}}f(a)f(b)=\Bigg(\sum_{\substack{1\leqslant a\leqslant n\\d\,\mid\,a}}f(a)\Bigg)^2=F_f(n,d);$$ now Möbius inversion gives $S_f(n,d)=\sum_{k\geqslant 1}\mu(k)F_f(n,kd)$, and we're done: $$S_f(n)=\sum_{d=1}^{n}d\sum_{k\geqslant 1}\mu(k)F_f(n,kd)=\sum_{a=1}^{n}F_f(n,a)\sum_{d\,\mid\,a}d\mu(a/d)=\sum_{a=1}^{n}F_f(n,a)\varphi(a).$$

Now, to prove the boundedness of $S_\mu(n)/n^2$ and $S_\eta(n)$, we need good enough estimates of $G_\mu$ and $G_\eta$. Note that $G_\mu(n,1)$ is the Mertens function, so these are not too easy to get (if we don't assume RH). One can show that $$G_\mu(n,a)=\mu(a)nR_\mu(n,a),\qquad G_\eta(n,a)=\frac{\mu(a)}{a}R_\eta(n,a),$$ and there exist constants $A,B$ such that $|R_{[\mu,\eta]}(n,a)|\leqslant Ae^{-B\sqrt{\log n}}$ (I've outlined the approach in this answer). This way, both $S_\mu(n)/n^2$ and $S_\eta(n)$ are bounded above by $A\sum_{a=1}^n a^{-1}e^{-B\sqrt{\log(n/a)}}$, which is bounded w.r.t. $n$ (consider the sum over $n/2^k<a\leqslant 2n/2^k$ over $k>0$).

Note also that $\liminf_{n\to\infty}S_\mu(n)/n^2$ is nonzero. This can be seen as follows. If $a>n/2$, then $F_\mu(n,a)=|\mu(a)|$, thus $S_\mu(n)\geqslant\kappa(n)-\kappa(n/2)$ where $\kappa(x)=\sum_{n\leqslant x}\varphi(n)|\mu(n)|$ (one gets even better estimates by considering $a>n/3$, $a>n/4$, etc. but this is increasingly complicated). Now $$\sum_{n=1}^\infty\frac{\varphi(n)|\mu(n)|}{n^s}=\prod_{p\in\mathcal{P}}\left(1+\frac{p-1}{p^s}\right)=\zeta(s-1)Z(s)$$ with $Z(s)$ regular on $\Re s>3/2$, hence Perron's formula gives (a nonzero result) $$\lim_{x\to\infty}\frac{\kappa(x)}{x^2}=\frac{Z(2)}{2}=\frac12\prod_{p\in\mathcal{P}}\left(1-\frac{2}{p^2}+\frac{1}{p^3}\right)\color{LightGray}{\approx 0.21412475283854722\ldots}$$
A: This is a supplementary answer with estimates, for integers $0<a\leqslant n$ with $a$ squarefree, of $$R_\mu(n,a):=\frac1n\sum_{b=1}^n\frac{\mu(ab)}{\mu(a)},\qquad R_\eta(n,a):=\sum_{b=1}^n\frac{\mu(ab)}{b\mu(a)}.$$
The summands are multiplicative w.r.t. $b$, and the corresponding Dirichlet series is $$\frac{1}{\zeta_a(s)}:=\sum_{n=1}^\infty\frac{\mu(an)}{n^s\mu(a)}=\prod_{p\nmid a}(1-p^{-s}).\qquad(\Re s>1)$$
Here we would use Perron's formula with the shift-the-contour approach (see below) if we could isolate zeros of $\zeta(s)$ from $\Re s=1$ (and a little bit more). If we don't assume RH, the results we have are limited. Say (see section 3.11 of Titchmarsh's book on $\zeta$-function),

There exist positive constants $C_\zeta$, $C_\sigma$, $T_0$ such that, for any $T\geqslant T_0$, we have $$|\zeta(s)|\leqslant C_\zeta\log T,\qquad 1/|\zeta(s)|\leqslant C_\zeta\log T\tag{$\zeta$}\label{zetaest}$$ for any $s=\sigma+it$ with $1-C_\sigma/\log T\leqslant\sigma\leqslant 2$ and $T_0\leqslant|t|\leqslant T$.

Compare to the case of PNT, when the Dirichlet series is $\zeta'(s)/\zeta(s)$.

So we have to limit the integration in Perron's formula to a finite range, which introduces an error term.

Suppose that $f(s)=\sum_{n=1}^\infty a_n n^{-s}$ converges absolutely at $s=\sigma+it$ with $\sigma>\sigma_a\geqslant 0$, and let $g(\sigma)=\sum_{n=1}^\infty|a_n|n^{-\sigma}$, $\sigma_0>\sigma_a$, $T_0>1$, and $|a_n|\leqslant h(x)$ for $x/2\leqslant n\leqslant 2x$. Then there is a constant $C$ such that, for any $T_0\leqslant T\leqslant x$ and $\sigma_a<\sigma\leqslant\sigma_0$, we have $$\begin{gathered}\sum_{n\leqslant x}a_n=\frac{1}{2\pi i}\int_{\sigma-iT}^{\sigma+iT}f(s)\frac{x^s}{s}\,ds+\Delta,\\|\Delta|\leqslant C\big(x^\sigma g(\sigma)+xh(x)\log T\big)/T.\end{gathered}\tag{$\smallint$}\label{perrons}$$

The idea for a proof, as well as for Perron's formula itself, is (here $T,y,\sigma>0$) $$\frac{1}{2\pi i}\int_{\sigma-iT}^{\sigma+iT}\frac{y^s}{s}\,ds=I(y)+\Delta',\quad I(y)=\begin{cases}1,&y\leqslant 1,\\0,&y>1\end{cases},\quad|\Delta'|\leqslant y^\sigma\min\left\{1,\frac{1}{\pi T|\log y|}\right\}.$$ (The estimate $|\Delta'|\leqslant y^{\sigma}$ comes from completing the contour by circular arcs, centered at the origin, to the left of $\Re s=\sigma$ if $y\leqslant 1$ and to the right otherwise; the other estimate for $y\neq 1$ is obtained by using rectangular contours instead of circles.)
Now we put $y=x/n$, multiply by $a_n$ and sum over $n$; this gives $$|\Delta|\leqslant\sum_{n=1}^\infty|a_n|\left(\frac{x}{n}\right)^\sigma\min\left\{1,\frac{1}{\pi T|\log(x/n)|}\right\}=\Sigma_1+\Sigma_2,$$ where $\Sigma_1$ is the sum over $n$ with $x/2\leqslant n\leqslant 2x$, and $\Sigma_2$ takes the rest. Further let $\Sigma_1=\Sigma_1^-+\Sigma_1^0+\Sigma_1^+$ with the sums over $x/2\leqslant n\leqslant xe^{-1/\pi T}$, $xe^{-1/\pi T}<n<xe^{1/\pi T}$, and $xe^{1/\pi T}\leqslant n\leqslant 2x$, respectively.
Writing "$A\ll B$" for "there exist a positive constant $C$ such that $A\leqslant CB$", we then have
\begin{align*}
T\Sigma_2&\leqslant\frac{1}{\pi\log 2}\sum_{n=1}^\infty|a_n|\left(\frac{x}{n}\right)^\sigma\ll x^\sigma g(\sigma),
\\T\Sigma_1^0&\ll Th(x)x(e^{1/\pi T}-e^{-1/\pi T})\ll xh(x),\qquad\color{gray}{[\text{we use }x\geqslant T\text{ here!}]}
\\T\Sigma_1^-&\ll h(x)\int_{x/2}^{xe^{-1/\pi T}}\frac{dt}{\log x-\log t}=xh(x)\int_{1/\pi T}^{\log2}\frac{e^{-z}}{z}\,dz\ll xh(x)\log T,
\\T\Sigma_1^+&\ll h(x)\int_{xe^{1/\pi T}}^{2x}\frac{dt}{\log t-\log x}=xh(x)\int_{1/\pi T}^{\log2}\frac{e^{z}}{z}\,dz\ll xh(x)\log T.
\end{align*}

To estimate $R_\mu$, we apply $\eqref{perrons}$ to $f(s)=1/\zeta_a(s)$ and $\sigma=1+1/\log x$. Here $$x^\sigma=ex\ll x,\qquad h(x)=1,\\g(\sigma)\leqslant\zeta(\sigma)\ll\frac{1}{\sigma-1}=\log x,$$ so that $|\Delta|\ll(x\log x)/T$. Now we take $\sigma_1=1-C_\sigma/\log T$ from $\eqref{zetaest}$ and use $$\int_\Gamma\frac{x^s\,ds}{s\zeta_a(s)}\,ds=0,$$ where $\Gamma$ is the boundary of $[\sigma_1,\sigma]+i[-T,T]$ (this is the "shift-the-contour" approach mentioned in the beginning). Further, $\eqref{zetaest}$ implies $1/|\zeta_a(s)|\ll(\log x)^2$ $\color{red}{\text{(FIXME)}}$ uniformly w.r.t. $a\leqslant x$ and $s\in\Gamma$.
Hence the "horizontal" integrals are $\ll(\log x)^2/T\int_{\sigma_1}^\sigma x^s\,ds\ll(x\log x)/T$ in absolute value (i.e. the same order as $|\Delta|$), and for the "vertical" integral we have $$\left|\int_{\sigma_1-iT}^{\sigma_1+iT}\frac{x^s\,ds}{s\zeta_a(s)}\right|\ll x^{\sigma_1}(\log x)^2\int_{-T}^T\frac{dt}{|\sigma_1+it|}\ll x^{\sigma_1}(\log x)^3,$$ giving the following estimate for the absolute value of the RHS of $\eqref{perrons}$: $${}\ll\frac{x\log x}{T}+x(\log x)^3\exp\left(-C_\sigma\frac{\log x}{\log T}\right).$$ At $T=\exp\sqrt{C_\sigma\log x}$, this is $\ll x\exp(-C\sqrt{\log x})$ if $C^2<C_\sigma$.
Finally, there exist positive constants $A,B$ such that $|R_\mu(n,a)|\leqslant A\exp(-B\sqrt{\log n})$.
For $R_\eta$, things are similar. Here $f(s)=1/\zeta_a(1+s)$, $\sigma=1/\log x$, $h(x)=2/x$, $g(\sigma)\ll\log x$ again, so that $|\Delta|\ll(\log x)/T$ this time; now $\sigma_1=-C_\sigma/\log T$, and $\int_\Gamma=0$ again (since $s=0$ is a removable singularity). Doing all the estimates, we arrive at the same bound.
