Is a function determined by its integrals over open sets? If $f \in L^1(\mathbb R)$ satisfies
$$
  \int_U f = 0
$$
for every open set $U \subset \mathbb R$, then is it true that $f = 0$ a.e.?
 A: Your assumption implies that $\int_E f = 0 $ for every compact set $E$. But since every positive measure set has a positive measure compact subset, none of the sets $\{x : f(x) > 0\}$, $\{x : f(x) < 0\}$ can have positive measure.
A: Since $f$ is measurable, the set $A=\{x\in\mathbb{R}\mid f(x)>0\}$ is measurable. Therefore, by regularity of the Lebesgue measure,  $m$, for every $\varepsilon>0$ there exists an open set $U$ such that  $A\subset U$ and $m(U\setminus A)<\varepsilon$. Let $f^+$ and $f^-$ denote the positive and negative part if $f$. Then, we have
$$
0=\int_U f\, dm= \int_A f^+\, dm-\int_{U\setminus A} f^-\, dm
$$
Note that the measure $\mu$ on the Lebesgue measurable subsets of $\mathbb{R}$ defined by
$$
\mu(A)=\int_{A} f^-\, dm
$$
Is absolutely continuous with respect to $m$. Hence, for every $n$ and $B$ measurable there exists a $\delta_n$ such that $\mu(B)<1/n$ if $m(B)<\delta_n$. Taking $\varepsilon=\delta_n$ yields a sequence of open sets $U_n$ such that $m(U_n\setminus A)<\delta_n$. Hence, we have
$$
0\leq \int_A f^+\, dm=\int_{U_n\setminus A} f^-\, dm< \frac{1}{n}
$$
And this is valid for every $n$. Therefore, we should have $\int_A f^+\, dm=0$ and since $f^+\geq 0$, this implies that $f^+=0$ a.e.
Using a similar argument, we can find that $f^-=0$ a.e. which gives the result.
