TITLE: About two functions whose Lebesgue integral on all sets of a $\sigma-$algebra are equal
QUESTION [5 upvotes]: Let $X$ be an infinite set and $\mathcal{F}$ be a $\sigma-$algrbra with infinite sets on $X$. Given on $X$ a measure $\mu$. 
Let $f$ and $g$ be two $\mathcal{F}-$measurable functions. Is it necessary that if $$ \int_A f d\mu = \int_A g d\mu, \forall A \in \mathcal{F}$$
then $f = g$ ($\mu-$a.e)?
I feel that the answer for this is positive, but I can't prove the statement above nor give a counter-example. Please give me a hint. Thank you.

REPLY [7 votes]: Yes. Assume $f$ and $g$ are $\mathcal{F}$-measurable. Then by assumption you have
$$0=\int_{\{f>g\}}fd\mu-\int_{\{f>g\}}gd\mu=\int_{\{f>g\}}(f-g)d\mu$$
Since $(f-g)\cdot1_{\{f>g\}}\ge 0$, you have $\mu(\{f>g\})=0$ and $\mu(\{f<g\})=0$ analogously.
Remark: This property is used to define conditional expectation, which is an important concept in stochastics.

REPLY [4 votes]: Hint:
$\{ f\neq g\}= \underset{n\in \mathbb{N}}{\bigcup} \{   f-g \geq \frac{1}{n} \} \cup \underset{n\in \mathbb{N}}{\bigcup} \{  g-f \geq \frac{1}{n} \}  $