# Possible measures of a set $E$ when for any interval $I$, $\mu(E\cap I) = \int_I f$

I'm trying to solve the following problem (self-study) regarding Lebesgue measure in $\mathbb{R}$:

Let $E \subset [a,b]$, and suppose there is a continuous function $f:[a,b]\to\mathbb{R}$ such that for any subinterval $I \subset [a,b]$, $\mu(E \cap I) = \int_I f \, d\mu$. Show that either $\mu(E) = 0$ or $\mu(E) = b - a$.

I don't seem to be getting much of anywhere, so a gentle nudge in the right direction would be appreciated. It did occur to me that the continuity of $f$ must be important, so I used the "integral mean value theorem" to show that for all $I_k = (a_k, b_k)$, there is a $c_k$ such that $\mu(E\cup I_k) = \int_{I_k} f = f(c_k)(b_k - a_k)$. Still, I'm not sure that's getting me anywhere...

• Sorry, 'm' was a typo and $\mu$ is meant to refer to Lebesgue measure. – bosmacs Sep 3 '13 at 20:17

Notice that $0\leqslant f\leqslant 1$.

As an open set is a countable disjoint union of open intervals, we have $\mu(E\cap O)=\int_Of\mathrm d\mu$ for each open subset of $[a,b]$, and by regularity, this can be extended to every Borel subset. We thus get that for any Borel subset $S$ of $[a,b]$, $$\int_S(\chi_E(x)-f(x))\mathrm dx=0,$$ hence $f=\chi_E$ almost everywhere. Conclude, using continuity of $f$.

• What was $S$? An arbitrary Borel subset of $[a,b]$? – bosmacs Sep 3 '13 at 20:39
• Yes. Edited now. – Davide Giraudo Sep 3 '13 at 20:40