Specific application of Cauchy-Schwarz and Large Sieve 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?
 A: As she writes, first apply Cauchy-Schwarz, and only then apply the large sieve (twice).
The relevant instance of Cauchy-Schwarz is
$$|x_1 x_2| \le \frac{|x_1|^2+|x_2|^2}{2},$$
which, by replacing $x_1$ and $x_2$ by $x_1\sqrt{C}$ and $x_2/\sqrt{C}$ ($C>0$) becomes
$$|x_1 x_2| \le \frac{C |x_1|^2 + C^{-1} |x_2|^2}{2}.$$
We apply it with $x_1=\sum_{a \in \mathcal{A}} \chi(a)$ and $x_2 = \sum_{b \in \mathcal{B}}\chi(b)$ and with $C$ to be determined later (but independent of $\chi$). We obtain that the relevant sum is
$$\le \frac{1}{2}\left(  C\sum_{q \le Q} \frac{q}{\phi(q)}\sum_{\substack{\chi \bmod q\\ \text{primitive}}}\left|\sum_{a \in \mathcal{A}} \chi(a)\right|^2 + C^{-1}\sum_{q \le Q} \frac{q}{\phi(q)}\sum_{\substack{\chi \bmod q\\ \text{primitive}}} \left|\sum_{b \in \mathcal{B}} \chi(b)\right|^2 \right),$$
which, by two applications of the large sieve, is
$$\le \frac{1}{2}(Q^2  + N)\left( CA+ C^{-1} B\right).$$
Now take $C=\sqrt{B/A}$.
A: 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.
