One of my classes has online notes containing theorems. One of the theorems is "Assume that $R=[a,b]\times[c,d]$ is a rectangle in the $xy$ plane. Let $f$ be a function on $R$, and assume that $f$ is integrable on $R$, and for every $y\in[c,d]$, the function $f_y:[a,b]\to\mathbb{R}$ defined by $f_y:=f(x,y)$ is integrable on $[a,b]$. Then the function $g:[c,d]\to\mathbb{R}$ defined by $g(y):=\int^b_af(x,y)dx$ is integrable on $[c,d]$, and $$\int\int_RfdA=\int^d_cg(y)dy=\int^d_c\left(\int^b_af(x,y)dx\right)dy."$$ They say the proof is left as an exercise, but I don't know how to do it.
A hint was that I could first show that for every $k\in\{1,\dots,K\}$ and for every $y\in[y_{k-1},y_k]$, we have that $$g(y)\geq\sum^J_{j=1}m_{jk}(f)(x_j-x_{j-1}).$$ Thanks in advance!
This is a consequence of Fubini's theorem. A proof for Riemann integration follows.
Consider a partition $P$ of $R$ into $mn$ rectangles $I_j\times J_k$ where the intervals $I_j$ form a partition $P_x$ of $[a,b]$ and the intervals $J_k$ form a partition $P_y$ of $[c,d]$.
Let $m_{jk}(f) = \inf_{(x,y) \in I_j\times J_k}f(x,y)$ and $M_{jk}(f) = \sup_{(x,y) \in I_j\times J_k}f(x,y)$.
For each $y \in J_k$ we have $m_{jk}(f) \leqslant \inf_{x \in I_j}f(x,y)$ and
$$\sum_{j}m_{jk}(f)l(I_j) \leqslant \sum_{j}\inf_{x \in I_j}f(x,y)l(I_j) = \underbrace{L(f(\cdot,y),P_x)}_{\text{lower sum for integral over [a,b]}} \leqslant \inf_{y \in J_k}\int_a^b f(x,y) \, dx,$$
Thus,
$$\underbrace{L(f,P)}_{\text{lower sum for integral over } [a,b] \times [c,d]} \\= \sum_j \sum_km_{jk}(f)l(I_j)l(J_k) \leqslant \sum_k\inf_{y \in J_k}\int_a^b f(x,y) \, dy \,l(J_k)\leqslant \int_c^d\int_a^b f(x,y) \, dx \, dy$$
Similarly, we can show
$$\int_c^d\int_a^b f(x,y) \, dx \, dy \leqslant \underbrace{U(f,P)}_{\text{upper sum for integral over } [a,b] \times [c,d]}$$
Consequently we have both
$$\tag{*}L(f,P \leqslant \int_R f \leqslant U(f,P), \\ L(f,P \leqslant \int_c^d\int_a^b f(x,y) \, dx \, dy \leqslant U(f,P)$$
Since $f$ is integrable over $R$, for any $\epsilon > 0$ there exists a partition $P$ such that $U(f,P) - L(f,P) < \epsilon$. With both integrals in (*) sandwiched between any lower and upper sums it follows that
$$\int_R f = \int_c^d\int_a^b f(x,y) \, dx \, dy$$