TITLE: Cauchy Schwarz for integrals (as Spivak would have it done)
QUESTION [5 upvotes]: One of the first problems in Spivak's Calculus on Manifolds asks you to prove the Cauchy-Schwarz inequality for real integrable functions, namely, that $|\int_{a}^{b}fg|^2 \leq |\int_a^bf^2||\int_a^bg^2|$. Now, the easiest way I see of doing this is to argue that $\int_{a}^{b}(f - \lambda g)^2$, where $\lambda \in \mathbb{R}$, is a quadratic with at most one real solution, so the discriminant must be non-negative. However, he gives a cryptic hint to consider seperately the cases of $\int_{a}^{b}(f - \lambda g)^2 = 0$ and $\int_{a}^{b}(f - \lambda g)^2 > 0$. The second case boils down to, essentially, my solution, save for the fact that arguing there's no real solution is a smidge easier than arguing there's at most one real solution. The first case, however, has always left me vaguely mystified, and any attempt I've taken to use it has always had me run into a brick wall. I would argue someting relating to sets of measure $0$, but this has the unfortunate problem of Spivak not defining such sets until two chapters later. So, does anyone have any idea what Spivak would have done?
Specifically, the question is 1-6. (a) on page 4.

REPLY [4 votes]: The Cauchy-Schwartz inequality can be proved using only the basic properties of Riemann integration (no reference to measure $0$), regardless of what Spivak may be hinting. One necessary component is that if $h \geqslant 0$ is Riemann integrable, then $\int_a^b h \geqslant 0$.  This follows because any lower sum must be non-negative when $h \geqslant 0$ and, consequently, for any partition $P$ we have
$$0 \leqslant L(P,h) \leqslant \sup_{P'} L(P',h) = \int_a^b h.$$
Thus, for any $\lambda \in \mathbb{R}$ it follows that
$$\tag{*}\lambda^2 \int_a^bg^2 - 2\lambda\int_a^bfg + \int_a^bf^2 = \int_a^b(f - \lambda g)^2 \geqslant 0$$
If $\int_a^b f^2 > 0$ and $\int_a^b g^2 > 0$, we can take $\lambda = \sqrt{\int_a^b f^2}/\sqrt{\int_a^b g^2}$ to find
$$2 \frac{\sqrt{\int_a^b f^2}}{\sqrt{\int_a^b g^2}}\int_a^b fg \leqslant \int_a^bf^2 + \frac{\int_a^b f^2}{\int_a^b g^2}\int_a^b g^2 = 2 \int_a^b f^2,$$
whence, $\int_a^bfg \leqslant \sqrt{\int_a^b f^2}\sqrt{\int_a^b g^2}.$
Similarly taking $\lambda = - \sqrt{\int_a^b f^2}/\sqrt{\int_a^b g^2}$ we can show that $\int_a^bfg \geqslant -\sqrt{\int_a^b f^2}\sqrt{\int_a^b g^2},$ and it follows that
$$\tag{**}\left|\int_a^b fg \right| \leqslant \sqrt{\int_a^b f^2}\sqrt{\int_a^b g^2}$$
It remains to consider the cases where one or both of $\int_a^b f^2$ and $\int_a^b g^2$ equals $0$.
If $\int_a^b g^2 = 0$ and $\int_a^b f^2 > 0$, then substituting into (*) we obtain
$$\int_a^b f^2 - 2\lambda\int_a^b fg \geqslant 0.$$
This can only be true for every $\lambda \in \mathbb{R}$ if $\int_a^b fg = 0$ and (**) is true with strict equality.  Switching the roles of $f$ and $g$ this can be proved when $\int_a^b f^2 = 0$ and $\int_a^b g^2 > 0$, as well.
Finally, if $\int_a^b f^2 = \int_a^b g^2 = 0$, then since $|fg| \leqslant f^2 + g^2$ it follows that
$$\left|\int_a^b fg  \right| \leqslant \int_a^b |fg| \leqslant \int_a^b f^2 + \int_a^b g^2 = 0,$$
and again (**) is true with strict equality.