# the relationship between measurable sets and intervals

$f:\mathbb R\to \mathbb R$ is a Lebesgue measurable function and $$\int_J f(x)\,dx\ge 0$$ for any finite interval $J$, I want to prove $$\int_E f(x)\,dx\ge 0$$ for any Lebesgue measurable set $E$.

first the $\int_O f(x)\,dx\ge 0$ holds for any open sets $O$, next there is a $G_\delta$ set $G$ such that $E\subset G$ and $\mu(G-E)=0$. How to prove the proposition for $G$, I can't make a progress because $G$ is the intersection of open sets but not union.

The fact that $\int_J f(x)\,dx\ge 0$ for all finite intervals $J\subset\mathbb{R}$ means that $f(x)\geq 0$ for almost all $x\in\mathbb{R}$, so for any measurable set $E$ we have $\int_E f(x)\,dx\ge 0$.
Your first part: since $E$ is measurable, for any $\varepsilon>0$ there exists such union of pairwise disjoint intervals $J=\bigcup\limits_{n\in\mathbb{N}}I_n$ that $E\subset J$ and $\mu(J-E)<\varepsilon$.
So $\int_J f\,d\mu = \sum_{n\in\mathbb{N}}\int_{I_n} f\,d\mu \geq 0$ and $$\int\limits_E f\,d\mu=\int\limits_J f\,d\mu-\int\limits_{J-E} f\,d\mu\ \ \geq\ \ 0 - \mu(J-E)*const$$ and hence for any $\varepsilon>0:\ \int_E f\,d\mu \geq -\varepsilon*const$ hence $\int_E f\,d\mu \geq 0$.
Your second part: follows immediately from the first, because if there exists such set $A$ of strictly positive measure that $f<0$ on $A$, than $\int_A f\,d\mu < 0$. But by the first part $\int_A f\,d\mu\geq 0$ which is a contradiction.
• can you explain why $f(x)\ge 0$ a.e. ? the original exercise has 2 parts, the first is the post, the second is to prove $f\ge 0$, I think I need to prove the first part at first, the second part can be proved directly? – Lookout Jun 24 '16 at 9:21