Prove that if $f$ and $g$ are integrable functions on $[a, b]$ such that $f(x) = g(x)$ almost everywhere, then $\int^b_a f = \int^b_a g$

Let $h = f-g$. Then $h$ is Riemann integrable and $h= 0$ almost everywhere, i.e., E=$\{x \in [a,b]: h(x) \neq 0\}$ has measure zero.

Consider any partition $P$ of $[a,b]$. Every subinterval $I$ has positive length (and consequently positive measure). It follows that $I \not\subset E$ and there exists a point in $I$ where $h(x) = 0$. The infimum of $h$ on any such interval must be no greater than $0$ and the supremum of $h$ must be no smaller than $0$. Hence, for any partition $P$, the lower and upper Darboux sums satisfy

$$L(P,h) \leqslant 0 \leqslant U(P,h),$$

and for the lower and upper Darboux integrals,

$$\underline{\int_a}^bh = \sup_P L(P,h) \leqslant 0 \leqslant \inf_P U(P,h) = \overline{\int_a^b} h$$

But since $h$ is Riemann integrable, the lower and upper integrals are equal and, hence,

$$\int_a^b h := \underline{\int_a}^bh= \overline{\int_a^b} h=0$$


If $f=g$ almost everywhere, then $f-g=0$ almost everywhere. The set of values of $x$ at which $f(x)-g(x)\ne0$ is the set of values of $x$ at which $f(x)\ne g(x),$ and that set was assumed to have measure $0.$

It is given that $f\ge0$ almost everywhere, and although that does not mean that $g\ge0$ everywhere, it does mean that $g\ge0$ almost everywhere.

$\int_a^b h$ is defined as the least upper bound of the integrals of nonnegative simple functions not exceeding $h.$ The set of points at which such a simple function is positive must be a subset of the set of points at which $h$ is positive, and a subset of a set of measure $0$ has measure $0.$ Thus the integral of such a simple function must be $0.$