If $f\in \mathcal{R}[a,b]$ satisfies $\int_a^b |f(x)|dx=0$ then $f=0$ almost everywhere.

I was trying to prove that if $f\in C[a,b]$ satisfies $\int_a^b |f(x)|dx=0$ then $f=0$, and I found some way to prove it without problem.

But my initial attempt to proving was about proving first that $f=0$ almost everywhere, and then, since $f$ is continuous, extend the result to prove that $f=0$ everywhere. I liked this approach so I want to know if there is some elementary way to prove that if $f\in \mathcal{R}[a,b]$ satisfies $\int_a^b |f(x)|dx=0$ then $f=0$ almost everywhere.


Very generally, if $(X,\mu)$ is a measure space, and $f:X \rightarrow \mathbb{R}$ is measurable and satisfies $\int_{X} |f(x)|d\mu = 0$, then $f = 0$ almost everywhere.

To see why, note that:

$$\{x \mid f(x) \neq 0\} = \bigcup_{n \in \mathbb{N}} \{x \mid |f(x)| > 1/n\}$$

Letting $A_n = \{x \mid |f(x)| > 1/n\}$, we know $|f| > \frac{1}{n}1_{A_n}$, where $1_{A_n}$ is the function which is $1$ on $A_n$ and $0$ elsewhere hence $0 = \int_X |f| d\mu \geq \int_X \frac{1}{n}1_{A_n}d\mu = \frac{1}{n}\mu(A_n)$. We get $\mu(A_n) = 0$, and therefore $\{x \mid f(x) \neq 0\}$ is the countable union of measure-zero sets and so has measure zero.

--

Now, any positive function on $[a,b]$ which is Riemann integrable is also Lebesgue integrable, and the integrals agree. But you can prove this without needing measure theory and just using the definition of Riemann integrability on $[a,b]$ (though this proof is very similar to the above):

Assuming $f$ is Riemann integrable and $\int_a^b |f(x)|\, dx = 0$, given any $\varepsilon > 0$ we can find a partition $P$ of $[a,b]$ such that the upper sum $U(|f|,P) < \varepsilon$. Then for any real number $\delta > 0$, consider just the intervals $I$ in $P$ such that $\sup_{x \in I}|f(x)| \geq \delta$. If the total length of these intervals is $L$, these intervals contribute at least $L\delta$ to the sum $U(|f|,P)$, hence we have $L < \varepsilon/\delta$.

Now fix $\varepsilon_0$, and pick $\varepsilon = \varepsilon_02^{-n}/n$ and $\delta = 1/n$, and the above paragraph shows that we can cover all points where $|f(x)| \geq 1/n$ by intervals whose total length $L$ is $< \varepsilon_02^{-n}$. Then taking the union of all these intervals over $n \in \mathbb{N}$, we get intervals covering the entire set $\{x \mid |f(x)| > 0\}$ whose total length is $< \varepsilon_0$. Since $\varepsilon_0$ was arbitrary, this completes the proof that this set has measure zero.

--

As a last comment, I'll just say that the continuity assumption actually makes this proof way easier, and there's no need for fancy measure theory: If $f(x_0) \neq 0$ then by continuity there is some $\varepsilon > 0$ and $\delta > 0$ such that $|f(x)| \geq \varepsilon$ for $|x - x_0| \leq \delta$, and so you have $\int_a^{b}|f(x)|\, dx \geq \varepsilon \delta$


Look at the set $$A=\{x \in [a,b] \mid f(x) \neq 0\}$$ We want to prove that $A$ is of Lebesgue measure zero. The measure of $A$ is equal to $$\lambda(A)=\int 1_A d\lambda = \int_A d\lambda(x)$$ Suppose this is non-zero then by the definition of $A$ (more precisely the fact that $\forall x\in A:f(x)\neq0$) $$0 < \int_A |f(x)| d\lambda(x)$$ Integrating this over the bigger set $[a,b]$ (and using that we only use positive functions) gives $$0 < \int_A |f(x)| d\lambda(x)\leq \int_{[a,b]} |f(x)| d\lambda(x)$$ But because we know that $|f(x)|$ is Riemann integrable on $[a,b]$, we know that the Lebesgue integral and the Riemann integral are equal: $$0 < \int_A |f(x)| d\lambda(x)< \int_a^b |f(x)| dx$$

By contrapostion we have what you asked.

To continue the proof you asked this for, have a look at: Does $f(x)$ is continuous and $f = 0$ a.e. imply $f=0$ everywhere?