show that $g$ is integrable, with $f=g$ except in finite set and $f$ integrable

Let $f,g:A\subset\mathbb{R}^N\to[0,\infty)$, $f$ is Riemann integrable, and $g=f$ except in finite set, $A$ is a N-dimensional closed cell. Show that $g$ is Riemann integrable and $\int_Af(x)dx=\int_Ag(x)$

I tried to define $h(x)=g(x)-f(x)$, and prove that the integral exists and is zero. For that we could maybe use the lebesgue measure $\lambda(D_h)$, of the discontinuities of $h$, but I don't think it works, because if the difference between $g$ and $f$ was infinite and countable, the set would still have measure zero, but $g$ wouldn't be integrable.

Is there another way to prove it?

Let $B$ be the set of all $x \in A$ such that $f(x) \neq g(x)$. Then $B$ is finite by assumption and $B \subset A$. So $B$ has Lebesgue measure $0$. Note that $A = A\setminus B \cup B$; so the measure of $A$ is the measure of $A \setminus B$ plus the measure of $B$, and hence $A = A \setminus B$ in measure. Note that $A \setminus B$ is the set of all $x \in A$ such that $f(x) = g(x)$. Then $\int_{A}f = \int_{A\setminus B} f = \int_{A \setminus B} g = \int_{A}g$.

Note: The Riemann and Lebesgue integration consideration in the question was just made clear after this answer was posted.

• But if $B$ was infinite and countable, Lebesgue measure would still be zero, but $g$ wouldn't be integrable. Although intuitive, I still can't see the difference between finite and infinite countable. – Bruno Mazeto Jun 20 '17 at 18:23
• Could u come again? I did not get your current question. – Megadeth Jun 20 '17 at 18:25
• @BrunoMazeto when you are talking about integrability you are referring to Riemann integrability right? – clark Jun 20 '17 at 18:31
• Sorry, I thought that it would be clear, as I didn't learn Lebesgue integration. I'm talking about Riemann integration – Bruno Mazeto Jun 20 '17 at 18:35
• @YngwieMalmsteen I put an example in the comments of the other answer. Just to be clear, it's Riemann integration. Sorry about the confusion. – Bruno Mazeto Jun 20 '17 at 18:38

Of course, $f=g$ almost everywhere (because finite sets have the Lebesgue measure zero). So, the set of discontinuity points of $g$ is also of measure zero (trivial observation based on discontinuities of $f$ and its integrability). So, $g$ is (Riemann) integrable.

• I understand, but if I have $f(x) = 0$ and $g(x) = 0$ for $x$ irrational and $g(x) = 1$ for $x$ rational, the difference has still measure zero, but than $g$ is not integrable. And this argument doesn't work, does it? – Bruno Mazeto Jun 20 '17 at 18:15
• I'm not sure continuty points are relevant since Lebesgue integrable functions can extremely discontinuous (even discontinuous everywhere). Plus it is never stated that $f$ has any continuity properties. – User8128 Jun 20 '17 at 18:15
• @BrunoMazeto such $g$ is integrable in the Lebesgue sense and integrates to zero since it is zero a.e. – User8128 Jun 20 '17 at 18:16
• @User8128 the question is regular Riemann integration. Should I add this to the question? – Bruno Mazeto Jun 20 '17 at 18:18
• @BrunoMazeto Definitely! As of now, you added the lebesgue-measure tag to the question, which strongly suggests that you consider Lebesgue integratoin, not Riemann – Hagen von Eitzen Jun 20 '17 at 18:33