## Section10.2Iterated integrals and Fubini theorem

Note: 1–2 lectures

The Riemann integral in several variables is hard to compute by the definition. For one-dimensional Riemann integral, we have the fundamental theorem of calculus, and we can compute many integrals without having to appeal to the definition of the integral. We will rewrite a Riemann integral in several variables into several one-dimensional Riemann integrals by iterating. However, if $$f \colon [0,1]^2 \to \R$$ is a Riemann integrable function, it is not immediately clear if the three expressions

\begin{equation*} \int_{[0,1]^2} f , \qquad \int_0^1 \int_0^1 f(x,y) \, dx \, dy , \qquad \text{and} \qquad \int_0^1 \int_0^1 f(x,y) \, dy \, dx \end{equation*}

are equal, or if the last two are even well-defined.

### Example10.2.1.

Define

\begin{equation*} f(x,y) := \begin{cases} 1 & \text{if } x=\nicefrac{1}{2} \text{ and } y \in \Q, \\ 0 & \text{otherwise.} \end{cases} \end{equation*}

Then $$f$$ is Riemann integrable on $$R := [0,1]^2$$ and $$\int_R f = 0\text{.}$$ Furthermore, $$\int_0^1 \int_0^1 f(x,y) \, dx \, dy = 0\text{.}$$ However,

\begin{equation*} \int_0^1 f(\nicefrac{1}{2},y) \, dy \end{equation*}

does not exist, so we cannot even write $$\int_0^1 \int_0^1 f(x,y) \, dy \, dx\text{.}$$

Proof: Let us start with integrability of $$f\text{.}$$ Consider the partition of $$[0,1]^2$$ where the partition in the $$x$$ direction is $$\{ 0, \nicefrac{1}{2}-\epsilon, \nicefrac{1}{2}+\epsilon,1\}$$ and in the $$y$$ direction $$\{ 0, 1 \}\text{.}$$ The subrectangles of the partition are

\begin{equation*} R_1 := [0, \nicefrac{1}{2}-\epsilon] \times [0,1], \qquad R_2 := [\nicefrac{1}{2}-\epsilon, \nicefrac{1}{2}+\epsilon] \times [0,1], \qquad R_3 := [\nicefrac{1}{2}+\epsilon,1] \times [0,1] . \end{equation*}

We have $$m_1 = M_1 = 0\text{,}$$ $$m_2 =0\text{,}$$ $$M_2 = 1\text{,}$$ and $$m_3 = M_3 = 0\text{.}$$ Therefore,

\begin{equation*} L(P,f) = m_1 V(R_1) + m_2 V(R_2) + m_3 V(R_3) = 0 (\nicefrac{1}{2}-\epsilon) + 0 (2\epsilon) + 0 (\nicefrac{1}{2}-\epsilon) = 0 , \end{equation*}

and

\begin{equation*} U(P,f) = M_1 V(R_1) + M_2 V(R_2) + M_3 V(R_3) = 0 (\nicefrac{1}{2}-\epsilon) + 1 (2\epsilon) + 0 (\nicefrac{1}{2}-\epsilon) = 2 \epsilon . \end{equation*}

The upper and lower sums are arbitrarily close and the lower sum is always zero, so the function is integrable and $$\int_R f = 0\text{.}$$

For every fixed $$y\text{,}$$ the function that takes $$x$$ to $$f(x,y)$$ is zero except perhaps at a single point $$x=\nicefrac{1}{2}\text{.}$$ Such a function is integrable and $$\int_0^1 f(x,y) \, dx = 0\text{.}$$ Therefore, $$\int_0^1 \int_0^1 f(x,y) \, dx \, dy = 0\text{.}$$

However, if $$x=\nicefrac{1}{2}\text{,}$$ the function that takes $$y$$ to $$f(\nicefrac{1}{2},y)$$ is the nonintegrable function that is 1 on the rationals and 0 on the irrationals. See Example 5.1.4.

We solve this problem of undefined inside integrals by using the upper and lower integrals, which are always defined.

Split the coordinates of $$\R^{n+m}$$ into two parts: Write the coordinates on $$\R^{n+m} = \R^n \times \R^m$$ as $$(x,y)$$ where $$x \in \R^n$$ and $$y \in \R^m\text{.}$$ For a function $$f(x,y)\text{,}$$ write

\begin{equation*} f_x(y) := f(x,y) \end{equation*}

when $$x$$ is fixed and we wish to speak of the function in terms of $$y\text{.}$$ Write

\begin{equation*} f^y(x) := f(x,y) \end{equation*}

when $$y$$ is fixed and we wish to speak of the function in terms of $$x\text{.}$$

In other words,

\begin{equation*} \int_{R \times S} f = \int_R \left( \underline{\int_S} f(x,y) \, dy \right) \, dx = \int_R \left( \overline{\int_S} f(x,y) \, dy \right) \, dx . \end{equation*}

If it turns out that $$f_x$$ is integrable for all $$x\text{,}$$ for example when $$f$$ is continuous, then we obtain the more familiar

\begin{equation*} \int_{R \times S} f = \int_R \int_S f(x,y) \, dy \, dx . \end{equation*}

### Proof.

Any partition of $$R \times S$$ is a concatenation of a partition of $$R$$ and a partition of $$S\text{.}$$ That is, write a partition of $$R \times S$$ as $$(P,P') = (P_1,P_2,\ldots,P_n,P'_1,P'_2,\ldots,P'_m)\text{,}$$ where $$P = (P_1,P_2,\ldots,P_n)$$ and $$P' = (P'_1,P'_2,\ldots,P'_m)$$ are partitions of $$R$$ and $$S$$ respectively. Let $$R_1,R_2,\ldots,R_N$$ be the subrectangles of $$P$$ and $$R'_1,R'_2,\ldots,R'_K$$ be the subrectangles of $$P'\text{.}$$ Then the subrectangles of $$(P,P')$$ are $$R_j \times R'_k$$ where $$1 \leq j \leq N$$ and $$1 \leq k \leq K\text{.}$$

Let

\begin{equation*} m_{j,k} := \inf_{(x,y) \in R_j \times R'_k} f(x,y) . \end{equation*}

We notice that $$V(R_j \times R'_k) = V(R_j)V(R'_k)$$ and hence

\begin{equation*} L\bigl((P,P'),f\bigr) = \sum_{j=1}^N \sum_{k=1}^K m_{j,k} \, V(R_j \times R'_k) = \sum_{j=1}^N \left( \sum_{k=1}^K m_{j,k} \, V(R'_k) \right) V(R_j) . \end{equation*}

If we let

\begin{equation*} m_k(x) := \inf_{y \in R'_k} f(x,y) = \inf_{y \in R'_k} f_x(y) , \end{equation*}

then for $$x \in R_j\text{,}$$ we have $$m_{j,k} \leq m_k(x)\text{.}$$ Therefore,

\begin{equation*} \sum_{k=1}^K m_{j,k} \, V(R'_k) \leq \sum_{k=1}^K m_k(x) \, V(R'_k) = L(P',f_x) \leq \underline{\int_S} f_x = g(x) . \end{equation*}

As the inequality holds for all $$x \in R_j\text{,}$$ we have

\begin{equation*} \sum_{k=1}^K m_{j,k} \, V(R'_k) \leq \inf_{x \in R_j} g(x) . \end{equation*}

We thus obtain

\begin{equation*} L\bigl((P,P'),f\bigr) \leq \sum_{j=1}^N \left( \inf_{x \in R_j} g(x) \right) V(R_j) = L(P,g) . \end{equation*}

Similarly, $$U\bigl((P,P'),f) \geq U(P,h)\text{,}$$ and the proof of this inequality is left as an exercise. Putting the two inequalities together with the fact that $$g(x) \leq h(x)$$ for all $$x\text{,}$$ we have

\begin{equation*} L\bigl((P,P'),f\bigr) \leq L(P,g) \leq U(P,g) \leq U(P,h) \leq U\bigl((P,P'),f\bigr) . \end{equation*}

And since $$f$$ is integrable, it must be that $$g$$ is integrable as

\begin{equation*} U(P,g) - L(P,g) \leq U\bigl((P,P'),f\bigr) - L\bigl((P,P'),f\bigr) , \end{equation*}

and we can make the right-hand side arbitrarily small. As for any partition we have $$L\bigl((P,P'),f\bigr) \leq L(P,g) \leq U\bigl((P,P'),f\bigr)\text{,}$$ we must have $$\int_R g = \int_{R \times S} f\text{.}$$

Similarly,

\begin{equation*} L\bigl((P,P'),f\bigr) \leq L(P,g) \leq L(P,h) \leq U(P,h) \leq U\bigl((P,P'),f\bigr) , \end{equation*}

and hence

\begin{equation*} U(P,h) - L(P,h) \leq U\bigl((P,P'),f\bigr) - L\bigl((P,P'),f\bigr) . \end{equation*}

If $$f$$ is integrable, so is $$h\text{.}$$ As $$L\bigl((P,P'),f\bigr) \leq L(P,h) \leq U\bigl((P,P'),f\bigr)$$ we must have that $$\int_R h = \int_{R \times S} f\text{.}$$

We can also do the iterated integration in the opposite order. The proof of this version is almost identical to version A (or follows quickly from version A). We leave it as an exercise to the reader.

That is,

\begin{equation*} \int_{R \times S} f = \int_S \left( \underline{\int_R} f(x,y) \, dx \right) \, dy = \int_S \left( \overline{\int_R} f(x,y) \, dx \right) \, dy . \end{equation*}

Next suppose $$f_x$$ and $$f^y$$ are integrable. For example, suppose $$f$$ is continuous. By putting the two versions together we obtain the familiar

\begin{equation*} \int_{R \times S} f = \int_R \int_S f(x,y) \, dy \, dx = \int_S \int_R f(x,y) \, dx \, dy . \end{equation*}

Often the Fubini theorem is stated in two dimensions for a continuous function $$f \colon R \to \R$$ on a rectangle $$R = [a,b] \times [c,d]\text{.}$$ Then the Fubini theorem states that

\begin{equation*} \int_R f = \int_a^b \int_c^d f(x,y) \,dy\,dx = \int_c^d \int_a^b f(x,y) \,dx\,dy . \end{equation*}

The Fubini theorem is commonly thought of as the theorem that allows us to swap the order of iterated integrals, although there are many variations on Fubini, and we have seen but two of them.

Repeatedly applying Fubini theorem gets us the following corollary: Let $$R := [a_1,b_1] \times [a_2,b_2] \times \cdots \times [a_n,b_n] \subset \R^n$$ be a closed rectangle and let $$f \colon R \to \R$$ be continuous. Then

\begin{equation*} \int_R f = \int_{a_1}^{b_1} \int_{a_2}^{b_2} \cdots \int_{a_n}^{b_n} f(x_1,x_2,\ldots,x_n) \, dx_n \, dx_{n-1} \cdots dx_1 . \end{equation*}

Clearly we may switch the order of integration to any order we please. We may also relax the continuity requirement by making sure that all the intermediate functions are integrable, or by using upper or lower integrals appropriately.

### Subsection10.2.1Exercises

#### Exercise10.2.1.

Compute $$\int_{0}^1 \int_{-1}^1 xe^{xy} \, dx \, dy$$ in a simple way.

#### Exercise10.2.2.

Prove the assertion $$U\bigl((P,P'),f\bigr) \geq U(P,h)$$ from the proof of Theorem 10.2.2.

#### Exercise10.2.4.

Let $$R:=[a,b] \times [c,d]$$ and $$f(x,y)$$ is an integrable function on $$R$$ such that for every fixed $$y\text{,}$$ the function that takes $$x$$ to $$f(x,y)$$ is zero except at finitely many points. Show

\begin{equation*} \int_R f = 0 . \end{equation*}

#### Exercise10.2.5.

Let $$R:=[a,b] \times [c,d]$$ and $$f(x,y) := g(x)h(y)$$ for two continuous functions $$g \colon [a,b] \to \R$$ and $$h \colon [c,d] \to \R\text{.}$$ Prove

\begin{equation*} \int_R f = \left(\int_a^b g\right)\left(\int_c^d h\right) . \end{equation*}

#### Exercise10.2.6.

Compute (using calculus)

\begin{equation*} \int_0^1 \int_0^1 \frac{x^2-y^2}{{(x^2+y^2)}^2} \, dx \, dy \qquad \text{and} \qquad \int_0^1 \int_0^1 \frac{x^2-y^2}{{(x^2+y^2)}^2} \, dy \, dx . \end{equation*}

You will need to interpret the integrals as improper, that is, the limit of $$\int_\epsilon^1$$ as $$\epsilon \to 0^+\text{.}$$

#### Exercise10.2.7.

Suppose $$f(x,y) := g(x)$$ where $$g \colon [a,b] \to \R$$ is Riemann integrable. Show that $$f$$ is Riemann integrable for every $$R = [a,b] \times [c,d]$$ and

\begin{equation*} \int_R f = (d-c) \int_a^b g . \end{equation*}

#### Exercise10.2.8.

Define $$f \colon [-1,1] \times [0,1] \to \R$$ by

\begin{equation*} f(x,y) := \begin{cases} x & \text{if } y \in \Q, \\ 0 & \text{else.} \end{cases} \end{equation*}
1. Show $$\int_0^1 \int_{-1}^1 f(x,y) \, dx \, dy$$ exists, but $$\int_{-1}^1 \int_0^1 f(x,y) \, dy \, dx$$ does not.

2. Compute $$\int_{-1}^1 \overline{\int_0^1} f(x,y) \, dy \, dx$$ and $$\int_{-1}^1 \underline{\int_0^1} f(x,y) \, dy \, dx\text{.}$$

3. Show $$f$$ is not Riemann integrable on $$[-1,1] \times [0,1]$$ (use Fubini).

#### Exercise10.2.9.

Define $$f \colon [0,1] \times [0,1] \to \R$$ by

\begin{equation*} f(x,y) := \begin{cases} \nicefrac{1}{q} & \text{if } x \in \Q, y \in \Q, \text{ and } y=\nicefrac{p}{q} \text{ in lowest terms,} \\ 0 & \text{else.} \end{cases} \end{equation*}
1. Show $$f$$ is Riemann integrable on $$[0,1] \times [0,1]\text{.}$$

2. Find $$\overline{\int_0^1} f(x,y) \, dx$$ and $$\underline{\int_0^1} f(x,y) \, dx$$ for all $$y \in [0,1]\text{,}$$ and show they are unequal for all $$y \in \Q\text{.}$$

3. Show $$\int_0^1 \int_0^1 f(x,y) \, dy \, dx$$ exists, but $$\int_0^1 \int_0^1 f(x,y) \, dx \, dy$$ does not.

Note: By Fubini, $$\int_0^1 \overline{\int_0^1} f(x,y) \, dy \, dx$$ and $$\int_0^1 \underline{\int_0^1} f(x,y) \, dy \, dx$$ do exist and equal the integral of $$f$$ on $$R\text{.}$$

Named after the Italian mathematician Guido Fubini 2  (1879–1943).
https://en.wikipedia.org/wiki/Guido_Fubini
For a higher quality printout use the PDF versions: https://www.jirka.org/ra/realanal.pdf or https://www.jirka.org/ra/realanal2.pdf