Zero integral implies zero function almost everywhere Assume $f$ is Riemann integrable and further assume that $\int_a^x f=0$ for all $x$. How would I go about showing that $f$ itself is $0$ almost everywhere?
I am new to Lebesgue's measure theory so I am hoping for a somewhat elementary proof if possible?
I know that almost everywhere means all except a set of measure zero. I was wondering if I could get a point to start on? We are told $f$ is Riemann integrable, so that means by Lebesgue's criterion for Riemann integration that there are at most countably infinitely many discontinuities. Thank you!
 A: The statement remains true without Riemann integrability constraint — Lebesgue integrability of $f$ is sufficient (as was suggested by gorzardfu). So let $\int_a^xf=0$ for all $x\in\mathbb{R}$. This implies that $\int_y^zf=0$ for any $y,z\in\mathbb{R},\ y<z$, as $\int_y^zf=\int_a^zf-\int_a^yf$, as was noted in menag's answer. So $\int_If=0$ for any interval $I\subset\mathbb{R}$, and so for any Borel set, and hence for any measurable set.
Suppose $f>0$ on some set $A\subset\mathbb{R}$ of strictly positive measure. That means that for some $\varepsilon>0$ we have $f>\varepsilon$ on some $B\subset A$ of strictly positive measure and so $\int_B f>\mu(B)\cdot\varepsilon>0$, which is a contradition.

Another way of looking at this is to define $g(x)=\int_a^xf$. Then $f$ is a weak derivative of $g$. On $\mathbb{R}$ it implies, in particular, that $g$ is differentiable almost everywhere and $g'=f$ a.e.. And since $g\equiv0$ on $\mathbb{R}$, we have $f=0$ a.e..
A: We have $\int_x^y f = \int_a^y f - \int_a^x f = 0$. Now assume $f(b) > 0$ for some $b$ and that $f$ is continuous at $b$ (otherwise we're still in a set with measure $0$ by Lebesgue's criterion). Then there is $\varepsilon > 0$ with $f(y) > f(b)/2$ for all $y \in (b - 2\varepsilon, b + 2\varepsilon)$. In patricular, since $[b - \varepsilon, b + \varepsilon] \subseteq (b - 2\varepsilon, b + 2\varepsilon)$, we have $f([b - \varepsilon, b + \varepsilon]) \subseteq [f(b)/2, \infty)$. Thus
$$\int_{b - \varepsilon}^{b + \varepsilon} f \geq \int_{b - \varepsilon}^{b + \varepsilon} f(b)/2 = 2 \varepsilon f(b)/2 = \varepsilon f(b)> 0.$$
Contradiction.
