Problem in measure theory -proof verification Let $f:\Bbb R\to \Bbb R$ be a bounded Lebesgue measurable function such that for all $a,b\in \Bbb R$ with $-\infty<a<b<\infty$ we have $\int _a^b f=0$.

Show that $\int_Ef=0$ for each subset $E$ of $\Bbb R$ of finite Lebesgue measure.

My try:
Since $m(E)<\infty $ so I can find a sequence of disjoint open intervals say $I_n;n\ge 1$ such that $E\subset \cup_{n=1}^\infty  I_n$ and $m(E)\le \sum I_n$.
Then $E=E\cap (\cup I_n) =\cup (I_n\cap E)$.
Then $m(E)=\sum_{n=1}^\infty m(I_n\cap E)$
So $\int _E f=\int _{\cup {(E\cap I_n)}}f=\sum _{n=1}^\infty (\int _{E\cap I_n} f)$
Justification for the above statement:
Define $f_n=f.\phi_n$ where $\phi _n$ denotes the characteristic function of $f$ over $\cup_{k=1}^n (E\cap I_k)$ .Now $f_n\to f $ pointwise .Also $|f_n|\le |f|$ and since $f$ is bounded so $\int_E |f|<\infty $ and thus  $f$ is integrable .
By Dominated Convergence Theorem we have $\int \lim f_n=\lim\int f_n\implies \lim\int f_n=\int f$
After filling in the details I found that $\int _{\cup {(E\cap I_n)}}f=\sum _{n=1}^\infty (\int _{E\cap I_n} f)$
End of Justification
Again ,$(\int _{E\cap I_n} f)\le \int _{I_n} f$ and $\int _{I_n} f=0$ as $\int _a ^ b f=0$(by hypothesis) for all $-\infty<a<b<\infty$
And hence $\int_E f=0$
Please check whether the steps are correct or not and please suggest the required edits.Looking forward to all.
 A: I decided to go ahead dn post a solution rather than cluttering the comments with too many updates.
In your argument, you covered $E$ with open intervals $I_n$ such that $m(E) \leq \sum m(I_n)$. But you did not exploit the fact that it is possible to do this as economically as desired, meaning that for any $\epsilon > 0$, it is possible to choose the $I_n$ such that $m(E) \leq \sum m(I_n) < m(E) + \epsilon$. I think you will need this in order to ensure that the integral of $f$ on the "leftover" part $\left(\bigcup I_n\right) \setminus E$) is small. An argument along these lines follows.

Since $f$ is bounded, we have $|f| \leq M$ for some constant $M \geq 0$. Let $\epsilon > 0$. Since $m(E) < \infty$, we can find an open set $O \supseteq E$ such that $m(E) \leq m(O) < m(E) + \epsilon/M$.

Now $O$ is equal to the disjoint union $E \cup (O \setminus E)$, so $m(O) = m(O \setminus E) + m(E)$. All of these measures are finite, so we can rearrange to get $m(O \setminus E) = m(O) - m(E)$.  This means that the inequality $m(E) \leq m(O) < m(E) + \epsilon/M$ can be rewritten as
$$0 \leq m(O\setminus E) < \epsilon/M$$
Again because $O = E \cup (O \setminus E)$ is a disjoint union, we have
$$\int_O f = \int_E f + \int_{O \setminus E}f$$
These integrals all exist and are finite since $f$ is bounded and measurable and the integrals are taken over sets of finite measure. Now,
$$\left|\int_{O \setminus E} f\right| \leq \int_{O \setminus E} M = m(O \setminus E)M \leq \epsilon$$
Therefore,
$$\left|\int_O f - \int_E f\right| = \left| \int_{O \setminus E} f\right| \leq \epsilon$$
Since $O$ is an open subset of $\mathbb R$, it can be expressed uniquely as a disjoint union of open intervals $O = \bigcup_{n=1}^{\infty}I_n$, and each $I_n$ has finite measure since $\sum_{n=1}^{\infty}m(I_n) = m(O) < \infty$.
Write $U_n = \bigcup_{k=1}^{n}I_k$, so $U_n \uparrow O$. Define $g_n = f\chi_{U_n}$ and $g = f\chi_O$. Then $g_n \to g$ pointwise, and $g$ also serves as a dominating function, because 
$$|g_n| = |f \chi_{U_n}| = |f|\chi_{U_n} \leq |f|\chi_O = |f\chi_O| = |g|$$
and
$$\int_{\mathbb R} |g| = \int_O |f| \leq \int_O M = m(O)M < \infty$$
Therefore the dominated convergence applies, and 
$$\lim_{n\to\infty}\int_{U_n}f = \lim_{n \to \infty}\int_{\mathbb R}g_n = \int_{\mathbb R}g = \int_O f$$
Now, by hypothesis we have $\int_{I_n}f = 0$. Therefore, $\int_{U_n}f = \sum_{k=1}^{n}\int_{I_k}f = 0$ since $U_n = \bigcup_{k=1}^{n}I_k$ is a finite disjoint union. This means that
$$\lim_{n\to\infty}\int_{U_n}f = 0$$
Since this is the left hand side of the previous chain of equalities, the right hand side is also zero:
$$\int_{O}f = 0$$
Finally, 
$$\begin{aligned}
\left|\int_E f\right| &= \left|\int_{E}f - \int_O f +\int_O f\right| \\
& \leq \left|\int_E f - \int_O f\right| + \left|\int_O f\right| \\
&\leq \epsilon + 0 \\
&= \epsilon \\
\end{aligned}$$
As $\epsilon > 0$ was arbitrary, we conclude that $\int_E f = 0$.
A: Note. The fact that $\int_{(a,b)} f dx =0$ on every interval does not imply automatically (not without proper justification that)  $\int f_n =0$. This is because $E\cap I_n$ is not necessarily an interval. 
Let's do it in more generality, and we'll try to use different approaches from what was already given.  We will only assume  that $f$ is measurable and integrable on any bounded interval (aka locally integrable), and that $\int_{(a,b)} f dx= 0$ for any two reals $a<b$.   
One way to do this, if you already know differentiation is to use Lebesgue differentiation theorem. That is $\lim_{\epsilon\to 0} \frac{1}{2\epsilon}\int_{(x-\epsilon,x+\epsilon)} f(t) dt =f(x)$ a.e.
Here is another method. Fix $N$. Let ${\cal A}=\{A\subset (-N,N):\int_A f =0$. In this definition we only take Lebesgue measurable sets. Observe that ${\cal A}$ is a $\sigma$-algebra on $(-N,N)$:
1. Empty set is there. 2. If $A$ is there, so is its relative complement in $(-N,N)$ (because $\int_{(-N,N)} f =0$. 3. It is closed under countable unions (use dominated convergence with the dominating function ${\bf 1}_{(-N,N)}(x)|f(x)|$. By assumption ${\cal A}$ contains all open intervals in $(-N,N)$. As a result, ${\cal A}$ contains the Borel $\sigma$-algebra on $(-N,N)$ (because latter is smallest one containing all open intervals there). But as we know, every Lebesgue measurable set is a union of a Borel set ($F_{\sigma}$) and a null set. Therefore the only Lebesgue measurable sets which may not be in ${\cal A}$ are null sets, but these have no effect on the value of the integral. Therefore, ${\cal A}$ contains all Lebesgue measurable sets in $(-N,N)$. From this you continue directly to show that $f=0$ a.e. on $(-N,N)$ (what is the integral on the set of points where $f>\epsilon$ ?), and since this is true for any $N$, the result follows. 
