# Equality in the Cauchy-Schwarz inequality for integrals

## Homework Statement

Regarding problem 1-6 in Spivak's Calculus on Manifolds: Let $f$ and $g$ be integrable on $[a,b]$. Prove that $|\int_a^b fg| ≤ (\int_a^b f^2)^\frac{1}{2}(\int_a^b g^2)^\frac{1}{2}$. Hint: Consider seperately the cases $0=\int_a^b (f-λg)^2$ for some $λ\inℝ$ and $0 < \int_a^b (f-λg)^2$ for all $λ\inℝ$

## The Attempt at a Solution

I can prove the inequality using Riemann sums and the regular Cauchy-Schwarz inequality, however I didn't see a way to prove that equality holds iff $0=\int_a^b (f-λg)^2$ for some $λ\inℝ$ using this method. Using the hint gave me a bit of trouble, I think i'm doing something wrong/there's an easier way to do it:

Case 1: $0<\int_a^b (f-λg)^2$ for all $λ\inℝ$
$\Rightarrow 0<\int_a^b f^2 - 2λ\int_a^b fg + λ^2\int_a^b g^2$ for all $λ\inℝ$
this is a quadratic equation in λ with no real roots, hence the discriminant is < 0:
$(2\int_a^b fg)^2 - 4\int_a^b g^2\int_a^b f^2<0 \Rightarrow |\int_a^b fg|<(\int_a^b f^2)^\frac{1}{2}(\int_a^b g^2)^\frac{1}{2}$
$\square$

Case 2: $0=\int_a^b (f-λg)^2$ for some $λ\inℝ$
$\Rightarrow 0=\int_a^b f^2 - 2λ\int_a^b fg + λ^2\int_a^b g^2$
This is a quadratic equation in λ (otherwise we can show easily that the result holds) with a real root, hence the discriminant is ≥ 0 and we proceed as before to get:
$(\int_a^b fg)^2≥(\int_a^b f^2)(\int_a^b g^2)$

We prove this case by contradiction. Suppose that $(\int_a^b fg)^2>(\int_a^b f^2)(\int_a^b g^2)$ such that $(\int_a^b fg)^2=(\int_a^b f^2)(\int_a^b g^2) + δ$ for some δ>0. Then there are exactly two roots λ1 and λ2. It follows that at least one of $\int_a^\frac{a+b}{2} (f-λg)^2$ or $\int_\frac{a+b}{2}^b (f-λg)^2$ has only λ1 and λ2 as roots. Suppose that it is $\int_\frac{a+b}{2}^b (f-λg)^2$, with the argument being similar otherwise.

Consider the function $$k_ε = \left\{\begin{matrix} g& &on\: [a,\frac{a+b}{2}) \\ g+ε& & on\: [\frac{a+b}{2},b] \end{matrix}\right.$$

We prove by contradiction that $0 < \int_a^b (f-λk_ε)^2$ for all $λ\inℝ$:
Suppose $0 = \int_a^b (f-λk_ε)^2$ for some $λ\inℝ$. This has at most 2 roots. We have:
$\int_a^b (f-λk_ε)^2 = \int_a^\frac{a+b}{2} (f-λg)^2 + \int_\frac{a+b}{2}^b (f-λ(g+ε))^2$.
Such that any roots must be λ1 or λ2. Without loss of generality, suppose λ1 is a root. Then:
$0 = \int_a^b (f-λ_1k_ε)^2 = \int_a^\frac{a+b}{2} (f-λ_1g)^2 + \int_\frac{a+b}{2}^b (f-λ_1(g+ε))^2$ (the first term is 0) $= \int_\frac{a+b}{2}^b (f-λ_1g)^2 - 2λ_1ε\int_\frac{a+b}{2}^b (f-λ_1g) + \int_\frac{a+b}{2}^b (λ_1ε)^2$ (the first two terms are 0) $=\int_\frac{a+b}{2}^b (λ_1ε)^2$
$\Rightarrow λ_1 = 0 \Rightarrow \int_a^b f^2 = 0 \Rightarrow \int_a^b fg = 0 \Rightarrow (\int_a^b fg)^2 = (\int_a^b f^2)(\int_a^b g^2)$ a contradiction!

So $0 < \int_a^b (f-λk_ε)^2$ for all $λ\inℝ \Rightarrow (\int_a^b fk_ε)^2<(\int_a^b f^2)(\int_a^b k_ε^2)$ by case 1. We rewrite this to get:
$(\int_a^b fg)^2 < (\int_a^b f^2)(\int_a^b g^2) + ε*N + ε^2*M$ for some $N,M\inℝ$
But we can take $ε = min(1,\frac{δ}{2|N|},\frac{δ}{2|M|})$ such that $εN≤ε|N|≤\frac{1}{2}δ$ and $ε^2M≤ε^2|M|≤ε|M|≤\frac{1}{2}δ$
But then $(\int_a^b fg)^2<(\int_a^b f^2)(\int_a^b g^2) + δ$
a contradiction! $\blacksquare$
Is there a simpler way to do this?

Oh wait.. once I prove the inequality using Riemann sums i'd just have to use the discriminant argument to show that equality holds in the second case!

Is there a simpler way to do this?

Maybe you can prove it like standard proof of Cauchy–Schwarz inequality:

$0 \le <x+\lambda y, x+\lambda y> = <x,x> + 2\lambda <x,y> + \lambda^2 <y,y>$, and then choosing that $\lambda = -\dfrac{<x,y>}{<y,y>}$ you will get $|<x,y>|^2 \le <x,x> <y,y>$

So, maybe, but maybe, you can use $\lambda = -\dfrac{<f,g>}{<g,g>} = -\dfrac{\int_a^b fg}{\int_a^b g^2}$

Yes, that definitely works too. Thanks!