# Can we conclude that $f=g$ a.e. if $\int _Efd\mu =\int _Egd\mu$ for all measurable sets $E$?

Let $$(X,\Sigma,\mu )$$ be a measure space and $$f,g:X\to\color{red}{[0,\infty ]}$$ measurable functions. If $$\int _Efd\mu =\int _Egd\mu$$ for all $$E\in \Sigma$$, can we conclude that $$f=g$$ a.e.?

I know that that proposition is true if $$\mu$$ if finite and the difference $$f(x)-g(x)$$ is well defined for all $$x\in X$$. However I don't know if that proposition is still true in the general case.

• For ($\sigma$-)finite measures, it is true by a similar argument to the usual one. (WLOG $\mu(E) > 0$ where $E = \{x : f(x) < g(x)\}$. Write $E = \bigcup_{n, m} \{x : f(x) + \frac 1n \le g(x)\ \text{and}\ f(x) \le m\}$. At least one of these sets has positive measure...) Apr 16 at 15:49
There are measure spaces where all measurable sets have measure $$0$$ or $$\infty$$. In such a space, let $$f$$ and $$g$$ be two different positive constants.
[EDIT] More generally, suppose there is a measurable set $$M$$ such that $$\mu(M) = \infty$$ and all measurable subsets of $$M$$ have measure either $$0$$ or $$\infty$$. Then you can take $$f = \chi_M$$ (the indicator function of $$M$$) and $$g = 2 \chi_M$$, and $$\int_A f \; d\mu = \int_A g \; d\mu = \cases{ 0 & if \mu(A \cap M) = 0\cr \infty & otherwise}$$ for all measurable $$A$$.
Conversely, suppose there is no such $$M$$, $$f$$ and $$g$$ are nonnegative measurable functions, and it's not true that $$f = g$$ a.e. Then at least one of the measurable sets $$\{x: f(x) \le a < b \le g(x) \}$$ and $$\{x: f(x) \ge a > b \ge g(x)\}$$ has measure $$> 0$$ for some $$a,b\in [0,\infty)$$. By assumption, some measurable subset $$A$$ of such a set has $$0 < \mu(A) < \infty$$. Then we have either $$\int_A f(x)\; dx \le a \mu(A) < b \mu(A)\le \int_A g(x)\; dx$$ or $$\int_A f(x)\; dx \ge a \mu(A) > b \mu(A) \ge \int_A g(x)\; dx$$.
• Could you please tell me in what conditions that proposition is true? Because according to this answer, that proposition should be true if the difference $f-g$ is well-defined. Apr 16 at 15:46
• The issue is not really whether $f - g$ is well-defined, it's whether $\int_E f \; d\mu - \int_E g \; d\mu$ is well-defined. Apr 16 at 16:21