While I was solving exercise problems from "Calculus on Manifolds by Michael Spivak", I got stuck with this one:
Given that $f$ and $g$ are integrable on $[a,b]$, prove that $$\left|\int_a^b f.g\right| \leq \sqrt{\int_a^b f^2}.\sqrt{\int_a^b g^2}$$
Here's what I did:
Case 1: $\forall \lambda \in \mathbb{R}$, consider
\begin{align*} \int_a^b (f-\lambda g)^2 &> 0 \\ \implies \lambda^2\int_a^b g^2 - 2\lambda \int_a^b f.g + \int_a^b f^2 &> 0 \\ \end{align*}
which is a quadratic in $\lambda$ with no real roots, therefore, the discriminant is negative
\begin{align*} \left(2\int_a^b f.g\right)^2 - 4\left(\int_a^b f^2\right).\left(\int_a^b g^2\right) &< 0 \\ \implies \left|\int_a^b f.g\right| \lt \sqrt{\int_a^b f^2}.\sqrt{\int_a^b g^2} \end{align*}
Case 2: $\exists\lambda \in \mathbb{R}$ such that $\int_a^b (f-\lambda g)^2 = 0$
At first, I thought, it should definitely be $f - \lambda g = 0$ which gives equality case of the given inequality.
But then I realized that it is not always true, when I came across the following example: Let $f: [0,1] \rightarrow \mathbb{R}$
$$f(x)= \begin{cases}1 &\text{ if } x=0\\ \frac{1}{\sqrt{n}} &\text{ if } x=\frac{m}{n} \in \Bbb{Q} \text{ with } \gcd(n,m)=1 \text{ and } n>0 \\ 0 &\text{ otherwise } \\ \end{cases}$$
Well, I evaluated that $\int_0^1 f^2 = 0$ in this case (if I am not going wrong here?!).
So, what conditions are implied on $f$ when $\int_a^b f^2 = 0$ given that $f$ is integrable?
For that exercise ($\int_a^b (f - \lambda g)^2 = 0$), Spivak gives the hint as to consider, what happens when $f$ and $g$ are continuous, but I couldn't see how that helps.