[proofplan]
We convert the progression error into Dirichlet character sums by orthogonality on the finite group $(\mathbb{Z}/q\mathbb{Z})^\times$. [Parseval's identity](/theorems/434) on that finite group turns the mean square over reduced residue classes into a weighted mean square over characters. The analytic input is the large-sieve mean-square estimate for the von Mangoldt weight in Dirichlet characters; after applying it, the stated range consequence follows by comparing $x^2(\log x)^{-A}$ with $xQ\log x$.
[/proofplan]
[step:Declare the arithmetic functions and character sums used in the reduction]
Let $\Lambda: \mathbb{N} \to \mathbb{R}$ denote the von Mangoldt function, let $\varphi: \mathbb{N} \to \mathbb{N}$ denote Euler's totient function, and for integers $q \geq 1$ and $a$ with $\gcd(a,q)=1$ define
\begin{align*}
\psi(x;q,a) := \sum_{\substack{n \leq x ,\ n \equiv a \pmod q}} \Lambda(n).
\end{align*}
Let $\mathcal X(q)$ denote the finite set of Dirichlet characters modulo $q$.
For each fixed $x\ge 2$, define the character-sum map $\Psi_x:\mathcal X(q)\to\mathbb C$ by $\Psi_x(\chi):=\Psi(x,\chi)$, where
\begin{align*}
\Psi(x,\chi) := \sum_{n \leq x} \Lambda(n)\chi(n).
\end{align*}
Let $\chi_{0,q}$ denote the principal Dirichlet character modulo $q$, and define the centered character coefficient $M(x,\chi)$ by
\begin{align*}
M(x,\chi) := \Psi(x,\chi) - x\mathbb{1}_{\{\chi=\chi_{0,q}\}}.
\end{align*}
Here $\mathbb{1}_{\{\chi=\chi_{0,q}\}}$ is the indicator of the event that $\chi$ is the principal character modulo $q$.
[/step]
[step:Convert the reduced residue class error into a finite Fourier expansion]
Fix integers $q$ and $a$ with $1 \leq q \leq Q$ and $\gcd(a,q)=1$. Orthogonality of Dirichlet characters on the finite abelian group $(\mathbb{Z}/q\mathbb{Z})^\times$ gives, for every integer $n$,
\begin{align*}
\mathbb{1}_{\{n \equiv a \pmod q\}}\mathbb{1}_{\{\gcd(n,q)=1\}} = \frac{1}{\varphi(q)}\sum_{\chi \bmod q}\overline{\chi(a)}\chi(n).
\end{align*}
Because $\gcd(a,q)=1$, the congruence $n \equiv a \pmod q$ already implies $\gcd(n,q)=1$. Multiplying the orthogonality identity by $\Lambda(n)$ and summing over $1 \leq n \leq x$ gives
\begin{align*}
\psi(x;q,a) = \frac{1}{\varphi(q)}\sum_{\chi \bmod q}\overline{\chi(a)}\Psi(x,\chi).
\end{align*}
Since $\overline{\chi_{0,q}(a)}=1$, subtracting $x/\varphi(q)$ yields
\begin{align*}
\psi(x;q,a)-\frac{x}{\varphi(q)} = \frac{1}{\varphi(q)}\sum_{\chi \bmod q}\overline{\chi(a)}M(x,\chi).
\end{align*}
[guided]
The reason for introducing Dirichlet characters is that they are the Fourier characters of the finite group $(\mathbb{Z}/q\mathbb{Z})^\times$. For a fixed reduced residue class $a$, the orthogonality relation says that the function detecting the class $a$ among units modulo $q$ has the expansion
\begin{align*}
\mathbb{1}_{\{n \equiv a \pmod q\}}\mathbb{1}_{\{\gcd(n,q)=1\}} = \frac{1}{\varphi(q)}\sum_{\chi \bmod q}\overline{\chi(a)}\chi(n).
\end{align*}
This identity applies because $a$ is a unit modulo $q$, so the relevant finite group has exactly $\varphi(q)$ elements and its characters are precisely the Dirichlet characters modulo $q$ restricted to units.
Now multiply the identity by $\Lambda(n)$ and sum over all positive integers $n \leq x$. The left-hand side becomes the weighted count of integers $n \leq x$ lying in the residue class $a$ modulo $q$, namely
\begin{align*}
\sum_{n \leq x}\Lambda(n)\mathbb{1}_{\{n \equiv a \pmod q\}} = \psi(x;q,a),
\end{align*}
because $n \equiv a \pmod q$ and $\gcd(a,q)=1$ imply $\gcd(n,q)=1$. The right-hand side becomes
\begin{align*}
\frac{1}{\varphi(q)}\sum_{\chi \bmod q}\overline{\chi(a)}\sum_{n \leq x}\Lambda(n)\chi(n) = \frac{1}{\varphi(q)}\sum_{\chi \bmod q}\overline{\chi(a)}\Psi(x,\chi).
\end{align*}
The expected main term $x/\varphi(q)$ belongs to the principal character. Since $\overline{\chi_{0,q}(a)}=1$, subtracting $x/\varphi(q)$ is exactly the same as replacing $\Psi(x,\chi_{0,q})$ by $\Psi(x,\chi_{0,q})-x$ and leaving every non-principal character sum unchanged. With the definition
\begin{align*}
M(x,\chi) := \Psi(x,\chi) - x\mathbb{1}_{\{\chi=\chi_{0,q}\}},
\end{align*}
we therefore obtain
\begin{align*}
\psi(x;q,a)-\frac{x}{\varphi(q)} = \frac{1}{\varphi(q)}\sum_{\chi \bmod q}\overline{\chi(a)}M(x,\chi).
\end{align*}
This is the desired Fourier expansion of the arithmetic progression error.
[/guided]
[/step]
[step:Apply Parseval on $(\mathbb{Z}/q\mathbb{Z})^\times$]
For fixed $q$, define the function $F_q:(\mathbb{Z}/q\mathbb{Z})^\times \to \mathbb{C}$ by
\begin{align*}
F_q(a) := \psi(x;q,a)-\frac{x}{\varphi(q)}.
\end{align*}
The previous step writes $F_q$ as a finite [Fourier series](/page/Fourier%20Series) with Fourier coefficients $M(x,\chi)$. Parseval's identity for the finite group $(\mathbb{Z}/q\mathbb{Z})^\times$ gives
\begin{align*}
\sum_{\substack{a \pmod q ,\ \gcd(a,q)=1}} |F_q(a)|^2 = \frac{1}{\varphi(q)}\sum_{\chi \bmod q}|M(x,\chi)|^2.
\end{align*}
Substituting the definition of $F_q$ and summing over $1 \leq q \leq Q$ gives
\begin{align*}
\sum_{q\leq Q}\sum_{\substack{a \pmod q ,\ \gcd(a,q)=1}}\left|\psi(x;q,a)-\frac{x}{\varphi(q)}\right|^2 = \sum_{q\leq Q}\frac{1}{\varphi(q)}\sum_{\chi \bmod q}|M(x,\chi)|^2.
\end{align*}
[/step]
[step:Invoke the large-sieve mean-square estimate for von Mangoldt character sums]
We use the assumed large-sieve mean-square estimate for the von Mangoldt weight in Dirichlet characters, relabeling its constant $D_A$ as $C_A$: for every $A>0$ there is a constant $C_A>0$ such that, uniformly for $x\geq 2$ and $1\leq Q\leq x$,
\begin{align*}
\sum_{q\leq Q}\frac{1}{\varphi(q)}\sum_{\chi \bmod q}|\Psi(x,\chi)-x\mathbb{1}_{\{\chi=\chi_{0,q}\}}|^2 \leq C_A\left(xQ\log x + \frac{x^2}{(\log x)^A}\right).
\end{align*}
The hypotheses of this estimate match the present hypotheses: $A>0$, $x\geq 2$, and $1\leq Q\leq x$. Since the expression inside the absolute value is exactly $M(x,\chi)$, the identity from Parseval gives
\begin{align*}
\sum_{q\leq Q}\sum_{\substack{a \pmod q ,\ \gcd(a,q)=1}}\left|\psi(x;q,a)-\frac{x}{\varphi(q)}\right|^2 \leq C_A\left(xQ\log x + \frac{x^2}{(\log x)^A}\right).
\end{align*}
This is precisely the asserted estimate, with the implicit constant depending only on $A$.
[/step]
[step:Absorb the logarithmic error term in the stated lower range for $Q$]
Assume now that
\begin{align*}
x(\log x)^{-A-1}\leq Q\leq x.
\end{align*}
Multiplying the lower bound for $Q$ by $x\log x$ gives
\begin{align*}
\frac{x^2}{(\log x)^A}\leq xQ\log x.
\end{align*}
Therefore
\begin{align*}
xQ\log x + \frac{x^2}{(\log x)^A}\leq 2xQ\log x.
\end{align*}
The preceding estimate then becomes
\begin{align*}
\sum_{q\leq Q}\sum_{\substack{a \pmod q ,\ \gcd(a,q)=1}}\left|\psi(x;q,a)-\frac{x}{\varphi(q)}\right|^2 \leq 2C_A xQ\log x.
\end{align*}
Renaming $2C_A$ as the new $A$-dependent implicit constant proves the stated ``in particular'' bound.
[/step]