Question of Lebesgue integrals to show functions are the same \mu a.e Let $f$ and $g \in L(X,\mathbb{X},\mu)$ be such that
$\int f d \mu = \int g d\mu < \infty$ and $\int_E f d \mu = \int_E g d\mu$ for all $E \in \mathbb{X}$
Show that $f(x)=g(x) \mu$ a.e $x$.
I feel that the set $\{x \in X : |f(x)-g(x)| > \frac{1}{n} \}$ is important but I cannot see how to incorporate into a solution.
Furthermore I cannot see why we need the $< \infty$
 A: Instead of using $\{x\in X:|f(x)-g(x)|>\frac{1}{n}\}$ consider spliting it into 2 set, one is $f>g$ and one is $g>f$. Notice that each of these set is a possible $E$ too.
The $\infty$ part is to ensure that integrating $f$ and $g$ would be finite on every $E$. This ensure that $\int_{E}fd\mu-\int_{E}gd\mu=0$. Without knowing the finiteness of the integral, that might be $\infty-\infty$ which is ill-defined.
A: Let $A=\{x\in X: f(x)\ne g(x)\}$ and $A_n=\{x\in X: |f(x)-g(x)|>1/n\}$. We need to show that $\mu(A)=0$. But as 
$$
A=\bigcup_{n=1}^\infty A_n,
$$
it suffices to show that $\mu(A_n)=0$, for all $n$. Also, let
\begin{align}
A_n &=\{x\in X: |f(x)-g(x)|>1/n\} 
\\&=\{x\in X: f(x)-g(x)>1/n\}\cup\{x\in X: g(x)-f(x)>1/n\}=
B_n\cup C_n.
\end{align}
It now suffices to show that $\mu(B_n)=\mu(C_n)=0$.
We know that
$$
\int_{B_n}g\,d\mu=\int_{B_n}f\,d\mu\ge\int_{B_n}\left(g+ \frac{1}{n}\right)\,d\mu
=\int_{B_n}g\,d\mu+\frac{1}{n}\mu(B_n),
$$
which implies that $\mu(B_n)=0$. Simliarly, we can obtain that $\mu(C_n)=0$.
A: Take $E_+ = \{ x \, | \, f(x) > g(x) \}$ and $E_- = \{ x \, | \, g(x) > f(x) \}$. Then $\int_{E_+} (f - g) \, d\mu = 0$ and $\int_{E_-} (g-f) \, d\mu = 0$. Since $g-f = |f-g|$ on $E_-$ and $f-g = |f-g|$ on $E_+$, this means $\int_X |f-g| \, d\mu = 0$, from which we deduce that $\mu(E_+ \cup E_-) = 0$, i.e. $f=g$ $\mu$-almost everywhere.
Hope that helps,
A: Okay, so we have that $\int_E (f - g) \, d\mu = 0$ for all measurable sets $E$. Instead of working with $|f - g|$ I think it's more convenient to divide $X$ into three parts, the set on which $f - g$ is positive, the set on which it is zero, and the set on which is negative since since these three cases capture the entire function anyways.
If we consider the positive part $E_+ = \{x \, ; \, f(x) - g(x) > 0\}$ then $\int_E (f - g) \, d\mu = 0$ will holds since $E_+$ is a measurable set but any integral of a positive function is only zero if $\mu(E_+) = 0$. 
This might be familiar but if it is not we can prove it using the sequence of sets you suggested $E_n = \{x \,; \, f(x) - g(x) > \frac{1}{n}\}$. Now $E_n$ is monotonically increasing sequence of sets converging to to $E$ so
$\lim_{n \to \infty }\mu(E_n) = \mu(E)$
will hold. However we also have that
$0 = \int_{E_n}(f - g) \, d\mu > \frac{1}{n}\mu(E_n) \geq 0 \Rightarrow \mu(E_n) =0$
will holds for all $n$ meaning $\mu(E)$ is 'a limit of zeros' so $\mu(E) = 0$ directly follows. 
Completely analogously we find that $E_-$, the set on which $f - g$ is negative is also of measure zero so all that is left is that $f - g = 0$ a.e .
