TITLE: Null measure set and integrals
QUESTION [8 upvotes]: Let $f,g:[a,b] \rightarrow \mathbb{R}$ be integrable functions and $$X=\{x \in [a,b];f(x) \ne g(x)\}$$
be a set with zero measure.
Prove that $$\int_a^b f(x)dx=\int_a^b g(x)dx$$ and show two functions $f \ne g$ such that $X$ is infinite and has zero measure.
How can i do this in a context of Riemman integration? I saw some anserws in other questions but it wasn't very helpfull.

REPLY [7 votes]: We can prove this in the context of Riemann integration just using one measure-related fact: the measure of a non-empty interval is positive.
If $f$ and $g$ are Riemann integrable, then so is $h := f-g$ and $X = \{x \in [a,b]:h(x) \neq 0\}$ is given to be of measure zero.
For any partition $P: a = x_0 < x_1 < \ldots <x_n = b $, each subinterval $I_j = [x_{j-1},x_j]$ has positive measure and, hence, there is a point $x \in I_j$ where $h(x) = 0$.  This implies that $\inf_{x \in I_j} h(x) \leqslant 0 \leqslant \sup_{x \in I_j} h(x)$ and, consequently for upper and lower Darboux sums we have
$$\tag{1}L(P,h) \leqslant 0 \leqslant U(P,h)$$
Since $h$ is Riemann integrable we have for all $P$,
$$\tag{2}L(P,h) \leqslant \int_a^b h(x) \, dx \leqslant U(P,h)$$
and for any $\epsilon >0$, there exists a partition $P_\epsilon$ where $U(P_\epsilon,h) - L(P_\epsilon,h) < \epsilon$
In view of   (1) and (2) this implies that
$$-\epsilon < -(U(P_\epsilon,h) - L(P_\epsilon,h)) \leqslant \int_a^bh(x) \,dx \leqslant U(P_\epsilon,h) - L(P_\epsilon,h) < \epsilon$$
Since $\epsilon$ can be arbitrarily close to zero, it follows that
$$\int_a^bf(x) \, dx - \int_a^b g(x) \, dx = \int_a^bh(x) \,dx = 0$$