TITLE: Specific application of Cauchy-Schwarz and Large Sieve
QUESTION [5 upvotes]: Im reading a paper by Matomaki here, and the following is stated (I'm paraphrasing):
"By the Cauchy-Schwarz inequality and the large sieve, we have
$$\sum_{q \leq Q}\frac{q}{\phi(q)}\sum_{\substack{\chi\text{(mod $q$)}\\\text{primtiive}}} \big{|}\sum_{a \in \mathcal{A}}\chi(a)\sum_{b \in \mathcal{B}}\chi(b) \big{|} \leq (Q^2 + N)(AB)^{1/2}$$
where $Q,N$ are positive integers and $\mathcal{A}, \mathcal{B}\subseteq \{1,...,N\}$ and $|\mathcal{A}| = A$ and $|\mathcal{B}| = B$."
Now I am not so concerned with the application of the large sieve, but I am a little confused about how she applied Cauchy-Schwarz. Of course the large sieve she is referring to states
$$\sum_{q \leq Q}\frac{q}{\phi(q)}\sum_{\substack{\chi\text{(mod $q$)}\\\text{primtiive}}} \big{|}\sum_{n \leq N }a_n\chi(n)\big{|}^2 \leq (Q^2 + N)\sum_{n \leq N}|a_n|^2.$$
But I am unsure of how she used Cauchy-Schwarz, especially with multiplicative characters. Does anyone have any thoughts?

REPLY [11 votes]: The answer of Ofir Gorodetsky is perfectly fine, but one can also apply the Cauchy-Schwarz inequality for $L^2$ spaces directly.
Indeed, let us consider the $L^2$ space of functions on the set of pairs $(q,\chi)$, where the measure of the pair $(q,\chi)$ is $q/\phi(q)$. Then, for any complex-valued functions $f$ and $g$ on the set of these pairs, the inequality says that
$$\sum_{\substack{q \leq Q\\\text{$\chi$ mod $q$}\\\text{primitive}}}\frac{q}{\phi(q)}|f(q,\chi)g(q,\chi)|\leq\Biggl(\sum_{\substack{q \leq Q\\\text{$\chi$ mod $q$}\\\text{primitive}}}\frac{q}{\phi(q)}|f(q,\chi)|^2\Biggr)^{1/2}\Biggl(\sum_{\substack{q \leq Q\\\text{$\chi$ mod $q$}\\\text{primitive}}}\frac{q}{\phi(q)}|g(q,\chi)|^2\Biggr)^{1/2}.$$
Applying this for
$$f(q,\chi):=\sum_{a\in\mathcal{A}}\chi(a)
\qquad\text{and}\qquad
g(q,\chi):=\sum_{b\in\mathcal{B}}\chi(b)$$
yields the claimed result (using the large sieve inequality).
The point is that the result is purely formal from the Cauchy-Schwarz inequality. Ofir Gorodetsky's response adapts the usual proof of the Cauchy-Schwarz inequality to this situation.