If $\int_x^z f=0$ for every $z\in[x,y]$, then $f(a)=0$ a.e. on $[x,y]$. I have to prove the following statement:

Let $f$ be bounded measurable function on$[x,y]$. Suppose that $\int_x^z f=0$ for every $z\in[x,y]$, then $f(a)=0$ a.e. on $[x,y]$.

I suppose that $f$ is not equal to $0$ a.e. on $[x,y]$, so we must have $f>0$ or $f<0$. Now I don't know how to find an interval $I$ of the form $[x,z]$ such that
$$\int_I f\ge \frac1 n m(I).$$
Please help me.
 A: Here is a proof that follows a fairly standard pattern. (That is, show that the condition holds on intervals, open sets and then on an arbitrary measurable set. In this case we do not need to complete the last step,
but this is a good pattern to know.)
We have $\int_a^b f = \int_x^b f - \int_x^a f = 0$ for any suitable $a,b$. Hence $\int_If = 0$ for any interval $I \subset [x,y]$. This is clearly true on the finite union of disjoint intervals as well.
Let $B$ be a bound on $|f|$ and let $U \subset [x,y]$ be open. Then we can write
$U = \cup_k I_k$, where $I_k$ is a collection of disjoint open intervals. Since
$f (x)1_{\cup_{k=1}^n I_k} (x) \to f(x)  1_U (x)$, and all functions are uniformly bounded by $B$, we have $\int_U f = 0$.
Let $P = \{ z | f(z) >0 \}$ and suppose $mP>0$. Then $L=\int_P f >0$. Now choose an open $U$ such that $P \subset U$ and $m (U \setminus P) < { L \over 2 B (y-x)}$. Then
$\int_U f = \int_P f + \int_{U \setminus P} f > { L \over 2}>0$, which is
a contradiction.
Applying the same analysis to $-f$ shows that $f$ is zero ae.
A: Here's an idea: since $\int_x^z f(t)\,dt = 0$ for all $z$, we can consider two different $z$, then
$$\int_x^{z_1}f(t)\,dt = 0 = \int_x^{z_2} f(t)\,dt.$$
Subtracting, we get
$$\int_{z_1}^{z_2} f(t)\,dt = 0.$$
This holds for all $z_1,z_2\in(x,y)$ and so the integral of $f$ vanishes on sets of arbitrarily small measure. What can you conclude from here?
A: Let $g : \Bbb R \to \Bbb R$ be given by $g(t) = f(t)\cdot 1_{[x,y]}(t)$. Then $\int_x^t g = 0$ for all $t \in \Bbb R$. Thus $\int_a^b g = 0$ for every interval $[a,b]$ in $\Bbb R$. This implies $\int_A g = 0$ whenever $A$ is a disjoint union of finitely many intervals. Since every open set is a countable union of disjoint open intervals, the dominated convergence theorem ensures $\int_U g = 0$ for every open set $U$. Now given a measurable set $B$, there exists a decreasing sequence $\{A_n\}_{n = 1}^\infty$ of open sets such that if $A = \cap_{n = 1}^\infty A_n$, then $A \setminus B$ has measure zero. The dominated convergence theorem yields $\int_A g = \lim \int_{A_n} g = 0$. So $$\int_B g = \int g\cdot 1_B = \int g\cdot 1_A = \int_A g = 0$$ This shows that $\int_B g = 0$ for all measurable sets $B$, and consequently $g(t) = 0$ for almost every $t \in \Bbb R$. Therefore $f(t) = 0$ for almost every $t \in [x,y]$.
