The density of square-free integers satisfying a congruence relation The square-free integers have density $6/\pi^2$ in the sense that
$$\sum_{n\leq x}\mu^2(n)=6/\pi^2\cdot x+o(x).$$

In analogy to Dirichlet's theorem on arithmetic progressions, what is known about
  $$\frac1x\cdot\!\!\!\!\!\sum_{\substack{n\leq x\\ n\equiv a\pmod b}}\!\!\!\!\!\!\mu^2(n)$$
  if $\gcd(a,b)$ is square-free? Is it true that it has a limit and that it does not depend on $a$? That is, that it equals
  $$\frac6{b\pi^2}\prod_{p^2\mid b}\frac1{1-p^{-2}}$$

Related: Counting square free numbers co-prime to $m$
 A: For $(a,q) = 1$, we write
\[\sum_{\substack{n \leq x \\ n \equiv a \pmod{q}}} \mu^2(n) = \frac{1}{\varphi(q)} \sum_{\chi \pmod{q}} \overline{\chi}(a) \sum_{n \leq x} \mu^2(n) \chi(n).\]
Note that $\mu^2(n) \chi(n)$ is a multiplicative function with $\mu^2(p^k) \chi(p^k)$ equal to $1$ if $k = 0$, $\chi(p)$ if $k = 1$, and $0$ if $k \geq 2$. It follows that for $\Re(s) > 1$,
\[\sum_{n = 1}^{\infty} \frac{\mu^2(n) \chi(n)}{n^s} = \prod_p\left(1 + \frac{\chi(p)}{p^s}\right) = \prod_p \frac{1 - \chi^2(p) p^{-2s}}{1 - \chi(p) p^{-s}} = \frac{L(s,\chi)}{L(2s,\chi^2)}.
\]
So for $\sigma > 1$ and $x > 1$ a noninteger, Perron's inversion formula implies that
\[\sum_{\substack{n \leq x \\ n \equiv a \pmod{q}}} \mu^2(n) = \frac{1}{\varphi(q)} \sum_{\chi \pmod{q}} \overline{\chi}(a) \frac{1}{2\pi i} \int_{\sigma - i\infty}^{\sigma + i\infty} \frac{L(s,\chi)}{L(2s,\chi^2)} \frac{x^s}{s} \, ds.\]
We may move the line of integration to the left of the line $\Re(s) = 1$, picking up a pole at $s = 1$ only when $\chi$ is the principal character. Since
\[\frac{L(s,\chi_0)}{L(2s,\chi_0^2)} = \prod_{p \mid q} \frac{1 - p^{-s}}{1 - p^{-2s}} \frac{\zeta(s)}{\zeta(2s)},\]
$\zeta(2) = \pi^2/6$, and $\varphi(q) = q \prod_{p \mid q} (1 - p^{-1})$, we obtain by Cauchy's residue theorem that
\[\sum_{\substack{n \leq x \\ n \equiv a \pmod{q}}} \mu^2(n) = \frac{1}{q} \prod_{p \mid q} \frac{1}{1 - p^{-2}} \frac{6}{\pi^2} x + O_q(x^{1 - \delta})\]
for some $\delta > 0$. (We can take $\delta < 1/2$ easily; with a little work using zero-free regions of $L(s,\chi)$, we can get an error term of the form $O_q(\sqrt{x} e^{-c\sqrt{\log x}})$.)

Alternatively, here is a proof by more elementary methods. Again,
\[\sum_{\substack{n \leq x \\ n \equiv a \pmod{q}}} \mu^2(n) = \frac{1}{\varphi(q)} \sum_{\chi \pmod{q}} \overline{\chi}(a) \sum_{n \leq x} \mu^2(n) \chi(n).\]
We write $\mu^2(n) = \sum_{cd^2 = n} \mu(d)$ and interchange the order of summation, so that we get
\[\frac{1}{\varphi(q)} \sum_{\chi \pmod{q}} \overline{\chi}(a) \sum_{d \leq \sqrt{x}} \mu(d) \chi^2(d) \sum_{c \leq \frac{x}{d^2}} \chi(c).\]
If $\chi$ is principal, the inner sum is $\frac{\varphi(q)}{q} \frac{x}{d^2} + O_q(1)$; in fact, the error term is easily shown to be $O(\sqrt{q} \log q)$. If $\chi$ is nonprincipal, the inner sum is $O_q(1)$; in fact, it is $O(\sqrt{q} \log q)$ by the Polya-Vinogradov inequality. So we get
\[\frac{x}{q} \sum_{d \leq \sqrt{x}} \frac{\mu(d) \chi_0(d)}{d^2} + O\left(\frac{\sqrt{q} \log q}{\varphi(q)} \sum_{\chi \pmod{q}} \sum_{d \leq \sqrt{x}} 1\right).\]
The second term is $O(\sqrt{xq} \log q)$. The first term is equal to
\[\frac{x}{q} \sum_{d = 1}^{\infty} \frac{\mu(d) \chi_0(d)}{d^2} - \frac{x}{q} \sum_{d > \sqrt{x}} \frac{\mu(d) \chi_0(d)}{d^2}.\]
The first term is
\[\frac{x}{q L(2,\chi_0)} = \frac{1}{q} \prod_{p \mid q} \frac{1}{1 - p^{-2}} \frac{6}{\pi^2} x,\]
while the second term is easily seen to be $O\left(\frac{\sqrt{x}}{q}\right)$. So we get
\[\sum_{\substack{n \leq x \\ n \equiv a \pmod{q}}} \mu^2(n) = \frac{1}{q} \prod_{p \mid q} \frac{1}{1 - p^{-2}} \frac{6}{\pi^2} x + O\left(\sqrt{x q} \log q\right).\]
