Do we need the $f,g \geq 0$ condition for $\int f \ d\mu = \int g \ d\mu$? My lecture notes state the following corollary:

Let $f,g \in \mathcal M_\bar{{\mathbb R}}$ (that is, numerical measurable functions), $f=g$ $\mu$-almost everywhere and $f,g \geq 0$. Then $\int f \ d\mu = \int g \ d\mu$.

I don't really see where we use the condition $f,g \geq 0$.
Let's look what is used in the simple proof. We define $N:=\{ f \neq g \}$ and use that

If $f \in \mathcal M_\bar{{\mathbb R}}$ and $\mu(N)=0$ then $\int f \ d\mu =0$

Do we need the condition $f \geq 0$ for that? It doesn't look like we do.
 A: You can easily obtain a very similar result for not necessarily nonnegative functions from the result you have cited:
Let $f,g$ be measurable and such that $\int f~d\mu$ and $\int g~d\mu$ exist (which we need not assume for nonnegative measurable functions), and such that $f=g$ $\mu$-almost everywhere.
Then,
there exists a measurable set $N$ such that $\mu(N)=0$ and $\{f\neq g\}\subset N$.
Since $f$ and $g$ are measurable,
we can write $f=f^+-f^-$ and $g=g^+-g^-$,
where $f^+,f^-,g^+,g^-\geq0$ are measurable (indeed,
we define $f^+=\max\{f,0\}$ and $f^-=\max\{-f,0\}$).
Suppose that $x$ is such that $f^+(x)\neq g^+(x)$.
Then,
we know that $\max\{f(x),0\}\neq\max\{g(x),0\}$,
which necessarily implies that $f(x)\neq g(x)$ (Indeed,
$f(x)=g(x)$ clearly implies that $\max\{f(x),0\}=\max\{g(x),0\}$).
Therefore,
this implies that $\{f^+\neq g^+\}\subset N$,
and thus $f^+= g^+$ $\mu$-almost everywhere.
Similarly,
we can show that $f^-=g^-$ $\mu$-a.e.
Finally,
we obtain by linearity of integrals and the result you cite that
$$\int f-g~d\mu=\int f^+-f^--g^++g^-~d\mu=\int f^+-g^+~d\mu+\int g^--g^+=0.$$
A: I think we need the non-negative condition. Actually, this problem only give us $f,g$ are measurable functions, we don't know the values of $f, g$ are finite almost everywhere. If $f, g\geq 0$, we can use $$\int f=\int_0^\infty m(\{x: f(x)\geq t\})dt=\int_0^\infty m(\{x: g(x)\geq t\})dt=\int g$$. 
When we don't know that $f,g$ are non-negative or not, because $f^+=g^+,a.e$; $f^-=g^-$, a.e. Then in same way we can get $\int f^+=\int g^+, \int f^-=\int g^-$, but now the problem comes, when you calculate $\int f=\int f^+- \int f^-$, you even don't know whether $f^-$ is integrable or not, $\int f^-$ can take the value $+\infty$, so you can't get $\int f=\int f^+- \int f^-=\int g^+- \int g^-=\int g.$
