Q:

Let $f$ be a nonnegative bounded measurable function on a set of finite measure $E.$ Assume $\int_E f = 0.$ Show that $f=0$ a.e. on $E.$

The following question is taken from Royden's $4$th Real Analysis, Chapter $4,$ question $16:$

Question $16:$ Let $f$ be a nonnegative bounded measurable function on a set of finite measure $E.$
      Assume $\int_E f = 0.$
      Show that $f=0$ a.e. on $E.$

My attempt: 
Let 
$$A :=\{ x\in E: f(x)=0 \}$$ and $$B:=\{x\in E: f(x)>0\}.$$
Then 
$$\int_E f = \int_A f + \int_B f = \int_B f = 0.$$
Since $f$ is positive on $B,$ in order for $\int_B f=0,$ one must have $m(B)=0,$ that is, Lebesgue measure of $B$ must be zero.
Therefore, $f=0$ a.e.
I am not sure whether the bolded sentence is correct or not. If yes, can someone provide a proof. Otherwise, can someone provide an example to show the sentence is false?

A:

Yes, it is correct, and it's the crucial part of this exercise. To flesh it out, instead of just considering $B = \{x: f(x)>0\},$ consider the countable partition $$B_1 = \{x:f(x)\ge 1\} \\B_2 = \{x: 1/2 \le f(x) < 1\}\\ B_3 = \{x: 1/3\le f(x) < 1/2\} $$ etc. Then we have $$ \int_{B}f(x) d\mu = \sum_{n=1}^\infty \int_{B_n} f(x)d\mu \ge \sum_{n=1}^\infty \mu(B_n) \frac{1}{n}.$$ The only way we can have $\int_B f(x) d\mu = 0$ is to have $\mu(B_n) = 0$ for all $n,$ which implies $\mu(B) = 0.$

A:

It is true.  Write
$$
B = \bigcup_{n=1}^{\infty}B_n
$$
where $B_n = \{x\in B~:~f(x)>1/n\}$.  If $m(B)>0$, then $m(B_n)>0$ for some $n$.  Now show that
$$
\int_B f >0.
$$

