Let $I\subset \Bbb R$ be an interval and let $g\in L^1(I)$ integrable over $I$ such that $$\int_a^b g(x) dx=0\qquad \forall\,\, a,b\in I. $$
I would like to prove that $g=0$ a.e. without using density argument. My idea is to consider the set $$A=\{x\in I\,:\, |g(x)|>0\}= \bigcup_{n\geq1} A_n $$ where $$A_n=\{x\in I\,:\, |g(x)|>\frac{1}{n}\}.$$
How to show that $|A_n|=0$, i.e., $A_n$ is of measure zero?
In this way we can conclude that $|A|=0$ and hence $g=0$ almost everywhere.