Doubt on integration exercise from Spivak's Calculus on Manifolds. I've been studying integration in $\mathbb{R}^n$ in Spivak's Calculus on Manifolds, and I've started with the following problem: "Let $f,g:A\subset\mathbb{R}^n\to\mathbb{R}$ where $A$ is a closed rectangle in $\mathbb{R}^n$ be such that $f$ is integrable and $g=f$ except at finitely many points of $A$. Show that $g$ is integrable and that $\int_A g = \int_A f$". In what follows if $f$ is a bounded function in the set $S$, $M_S(f)=\sup\{f(x) : x \in S\}$ and $m_S(f)=\inf\{f(x) : x\in S\}$.
Now, I don't really know how to start. My idea was the following: given $\epsilon > 0$ I must show that there's a partition $P$ of $A$ such that $U(g,P)-L(g,P)<\epsilon$, where $U$ and $L$ denote the upper and lower sums respectively. Now suppose that the points where the functions differ are $x_1,\dots,x_n$. I can pick a partition $P$ such that for each point $x_i$ where the functions differ there is one rectangle $S_i$ contaning $x_i$ and no other of such points.
If $\mathcal{S}_P$ denotes the set of all subrectangles of $A$ partitioned by $P$, then let $U\subset \mathcal{S}_P$ denote the set of those $S_i$. Therefore, the upper sum of $g$ can be written
$$U(g,P)=\sum_{S\in \mathcal{S}_P} M_S(g)v(S)=\sum_{S\in\mathcal{S}_P\setminus U}M_S(g)v(S)+\sum_{i=1}^n M_{S_i}(g)v(S_i)$$
Now, since in the subrectangles $S \in \mathcal{S}_P\setminus U$ we have $g=f$, this is the same as
$$U(g,P)=U(f,P)+\sum_{i=1}^n M_{S_i}(g)v(S_i)$$
Simillarly, the lower sum can be written in the same way. Now, this gives us
$$U(g,P)-L(g,P)= U(f,P)-L(f,P) + \sum_{i=1}^n (M_{S_i}(g)-m_{S_i}(g))v(S_i).$$
Now, since $f$ is integrable, I know that I can find a partition such that $U(f,P)-L(f,P)$ is small as I want. If the partition doesn't contain different subrectangles with each $x_i$ in just one of them, I can refine it so that it happens, and it'll still satisfy the bound for the term $U(f,P)-L(f,P)$.
Now I just don't know what to do with the other term. Is this a good way to do this proof? Can someone give me just a hint on how to continue? If this is not a good way, I just want a hint on how to start it in a better way.
Thanks very much in advance!
 A: Perhaps a faster proof is to show that $f-g $ is integrable and $\int_A f-g=0$. To prove this, let's first pick an $\epsilon$. Since both $f$ and $g$ are bounded, so is $f-g$, and we can assume a bound $M$. Now note that $f-g=0$ except on a finite point set $\Gamma=\{x_1,\cdots,x_k\}$. Let $P$ be any partition which contains subrectangles $S_i$ with $v(S_i)=\epsilon/Mk$ and $x_i\in$ interior $S_i$. Then 
$$U(f,P)-L(f,P)=\sum_{S\ne S_i}\underbrace{(M(S)-m(S))}_{=\ 0} v(S) + \sum_{i=1}^{k} \underbrace{(M(S_i)-m(S_i))}_{\le\ M}\frac{\epsilon}{Mk}\le \epsilon$$
Since $\epsilon$ was arbitrary, we obtain the desired result.
A: Yes, you are doing it the right way, but you missed at one point.
The line
$$U(g,P)=U(f,P)+\sum_{i=1}^n M_{S_i}(g)v(S_i)$$
is in incorrect, because you should include the difference $\sum_{i=1}^n (M_{S_i}(g)-M_{S_i}(f))v(S_i)$, and an analogous difference for the lower sum. Next, try to make the rectangles $S_i$ small enough such that these differences can be as small as you want and the prove is done. Hope I made it clear.
