Let $f$ and $g$ be functions in $L^1(\mathbb{R})$ such that $$ \int_E f \, dm = \int_E g \, dm $$ for every measurable subset $E$ of $\mathbb{R}$. Prove that $f = g$ almost everywhere on $\mathbb{R}$.
Proof
note that $$ \int_E f \, dm = \int_E g \, dm $$ then
$ \int_E f \, dm -\int_E g \, dm = 0, $ and by the property of Lebesgue integrals it holds that $ \int_E (f -g) dm = 0 $ then f=g almost everywhere
Is this proof correct?
Even if $f$ is not non-negative almost everywhere, if you have that $\int_{E}f\,dm=0$ for all measurable $E$, then $f=0$ a.e.
Consider $E_{n}=\{x:f(x)\geq \frac{1}{n}\}$. Then if possible let $m(E_{n})>0$.
Then you have that $\int_{E_{n}}f\,dm\geq \frac{1}{n}\cdot m(E_{n})>0$ which is a contradiction.
Hence $m(E_{n})=0$ for each $n$.
Hence, if $P=\bigcup_{n=1}^{\infty}E_{n}=\{x:f(x)> 0\}$, then $m(P)=0$ by subadditivity.
Similarly, if $M_{n}=\{x:f(x)\leq -\frac{1}{n}\}$, then by the same argument, $m(M_{n})=0$ for each $n$.
Hence if $N=\bigcup_{n=1}^{\infty}M_{n}=\{x:f(x)<0\}$, then $m(N)=0$.
Thus $m(P\cup N)=m(\{x:f(x)\neq 0\})=0$
Thus $f(x)=0$ a.e.
Now apply this to $f-g$ to get that $f-g=0$ a.e. which means $f=g$ a.e.