If $f\in C^0([a,b])$ then $\int^b_a|f(x)|^pdx=0$ implies $f(x)=0$ $\forall x \in [a,b]$

I would like to show that

If $$f\in C^0([a,b]),p\geq 1$$ then $$\int^b_a|f(x)|^pdx=0$$ implies $$f(x)=0$$ $$\forall x \in [a,b].$$

This is how I argue:

Since $$|f(x)|\geq 0$$ and $$f$$ is continuous then the only way the integral can equal $$0$$ is if $$f(x)=0$$ for all $$x \in [a,b]$$

Would this be wrong or not rigorous enough?

• No, not rigorous. Where did you use continuity? – Kavi Rama Murthy May 19 '20 at 12:19
• @KaviRamaMurthy Do I need to use it? It is said in the definition of the function. But could you explain what exactly i'm missing? – user634512 May 19 '20 at 12:20
• in your proof what happens when p is 0 – Monocerotis May 19 '20 at 12:21
• If $f(x)=0$ for $x \neq 0$ and $1$ for $x=0$ then $\int |f|^{p}$ exists and equals $0$ but the function is not $0$. Continuity is very important. – Kavi Rama Murthy May 19 '20 at 12:23
• Why is it that the only way the integral can be zero is when $f\equiv 0$? – Sam May 19 '20 at 12:25

As mentioned in the comments your argument was not rigorous as you didn't justify your statement: "the only way the integral can equal $$0$$ is if $$f(x)=0$$ for all $$x \in [a,b]$$."
Proof: Suppose there exists $$x_0 \in [a,b]$$ such that $$f(x_0) \neq 0.$$ Then $$\epsilon=|f(x_0)|^p>0.$$ Continuity of $$f$$ implies there exists $$\delta>0$$ such that \begin{align*}x\in[a,b],|x-x_0|<\delta &\implies ||f|^p(x)-|f|^p(x_0)|<\frac{\epsilon}{2}\\&\implies ||f|^p(x)-\epsilon|<\frac{\epsilon}{2}\\&\implies|f(x)|^p>\frac{\epsilon}{2}.\end{align*}
Therefore $$\int_a^b |f(x)|^p\,dx\geq \int_{x_0-\delta}^{x_0+\delta}|f(x)|^p\,dx>\epsilon\delta>0$$ which is a contradiction.
(Note: You can always choose $$\delta>0$$ small enough so that $$(x_0-\delta,x_0+\delta)\subseteq [a,b].$$)
• just a small doubt from a student. Here $||f|^p(x)-|f|^p(x_0)|<\frac{\epsilon}{2}$ why have you specifically chosen $\frac{\epsilon}{2}$ please... – Monocerotis May 19 '20 at 14:12
• @Monocerotis Oh you could choose anything less than $\epsilon,$ just to obtain the final term is $>0.$ – Sahiba Arora May 19 '20 at 16:32