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$ Say that $f\in\mathcal{R}[a,b]$ and $f(x)≥0$ almost everywhere.
Say also that $\int^b_a f\geq 0$
I'm trying to 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$$
If $f(x) = g(x)$ almost everywhere, then using the given information about $f(x)$, we can assume that $\int^b_a g\geq 0$ also on this interval.
It seems rather risky (in terms of mathematical reasoning) to say that "$a = b$ almost everywhere, hence the integral, derivative, etc. of $a$ equals that of $b$".
Is there a general theorem or rule I should be using to construct this proof?
 A: 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$$
A: 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.$
A: Yet another answer.
Let $d=f-g$ and note that $d$ is Riemann integrable, bounded (by say $K$) and $d(x) = 0$ ae. $x \in [a,b]$.
Let $E= \{ x | d(x) \neq 0 \}$, we have $mE = 0$. Let $\epsilon>0$, then there are open intervals $I_n$ such that $E \subset \cup_n I_n$ and $\sum_n mI_n < \epsilon$. Since $[a,b]$ is compact, $E$ is covered by a finite number of intervals. Hence we can find a partition $P$ such
$U(d,P)-L(d,P) < 2K \epsilon$. It follows that $\int_a^b d(x)dx = 0$. Since $f=g+d$ we have the desired result by linearity of the integral.
