$$\newcommand{\id}{\mathrm{id}}$$ $$\newcommand{\Span}{\mathrm{span}}$$ $$\newcommand{\kernel}{\mathrm{null}\,}$$ $$\newcommand{\range}{\mathrm{range}\,}$$ $$\newcommand{\RealPart}{\mathrm{Re}}$$ $$\newcommand{\ImaginaryPart}{\mathrm{Im}}$$ $$\newcommand{\Argument}{\mathrm{Arg}}$$ $$\newcommand{\norm}[1]{\| #1 \|}$$ $$\newcommand{\inner}[2]{\langle #1, #2 \rangle}$$ $$\newcommand{\Span}{\mathrm{span}}$$

# 10.2: Iterated integrals and Fubini theorem

[ "article:topic", "iterated integrals", "authorname:lebl", "Fubini theorem", "showtoc:no" ]

$$\newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} }$$

$$\newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}}$$

## Iterated integrals and Fubini theorem

The Riemann integral in several variables is hard to compute from the definition. For one-dimensional Riemann integral we have the fundamental theorem of calculus (FIXME) and we can compute many integrals without having to appeal to the definition of the integral. We will rewrite a a Riemann integral in several variables into several one dimensional Riemann integrals by iterating. However, if $$f \colon [0,1]^2 \to {\mathbb{R}}$$ is a Riemann integrable function, it is not immediately clear if the three expressions $\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$ are equal, or if the last two are even well-defined.

Define $f(x,y) := \begin{cases} 1 & \text{ if x=\nicefrac{1}{2} and y \in {\mathbb{Q}},} \\ 0 & \text{ otherwise.} \end{cases}$ Then $$f$$ is Riemann integrable on $$R := [0,1]^2$$ and $$\int_R f = 0$$. Furthermore, $$\int_0^1 \int_0^1 f(x,y) \, dx \, dy = 0$$. However $\int_0^1 f(\nicefrac{1}{2},y) \, dy$ does not exist, so we cannot even write $$\int_0^1 \int_0^1 f(x,y) \, dy \, dx$$.

Proof: Let us start with integrability of $$f$$. We simply take 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 \}$$ . The subrectangles of the partition are $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] .$ We have $$m_1 = M_1 = 0$$, $$m_2 =0$$, $$M_2 = 1$$, and $$m_3 = M_3 = 0$$. Therefore, $L(P,f) = m_1 (\nicefrac{1}{2}-\epsilon) \cdot 1 + m_2 (2\epsilon) \cdot 1 + m_3 (\nicefrac{1}{2}-\epsilon) \cdot 1 = 0 ,$ and $U(P,f) = M_1 (\nicefrac{1}{2}-\epsilon) \cdot 1 + M_2 (2\epsilon) \cdot 1 + M_3 (\nicefrac{1}{2}-\epsilon) \cdot 1 = 2 \epsilon .$ The upper and lower sum are arbitrarily close and the lower sum is always zero, so the function is integrable and $$\int_R f = 0$$.

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

However if $$x=\nicefrac{1}{2}$$, 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 .

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

We split $${\mathbb{R}}^{n+m}$$ into two parts. That is, we write the coordinates on $${\mathbb{R}}^{n+m} = {\mathbb{R}}^n \times {\mathbb{R}}^m$$ as $$(x,y)$$ where $$x \in {\mathbb{R}}^n$$ and $$y \in {\mathbb{R}}^m$$. For a function $$f(x,y)$$ we write $f_x(y) := f(x,y)$ when $$x$$ is fixed and we wish to speak of the function in terms of $$y$$. We write $f^y(x) := f(x,y)$ when $$y$$ is fixed and we wish to speak of the function in terms of $$x$$.

[mv:fubinivA] Let $$R \times S \subset {\mathbb{R}}^n \times {\mathbb{R}}^m$$ be a closed rectangle and $$f \colon R \times S \to {\mathbb{R}}$$ be integrable. The functions $$g \colon R \to {\mathbb{R}}$$ and $$h \colon R \to {\mathbb{R}}$$ defined by $g(x) := \underline{\int_S} f_x \qquad \text{and} \qquad h(x) := \overline{\int_S} f_x$ are integrable over $$R$$ and $\int_R g = \int_R h = \int_{R \times S} f .$

In other words $\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 .$ If it turns out that $$f_x$$ is integrable for all $$x$$, for example when $$f$$ is continuous, then we obtain the more familiar $\int_{R \times S} f = \int_R \int_S f(x,y) \, dy \, dx .$

Let $$P$$ be a partition of $$R$$ and $$P'$$ be a partition of $$S$$. 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'$$. Then $$P \times P'$$ is the partition whose subrectangles are $$R_j \times R'_k$$ for all $$1 \leq j \leq N$$ and all $$1 \leq k \leq K$$.

Let $m_{j,k} := \inf_{(x,y) \in R_j \times R'_k} f(x,y) .$ We notice that $$V(R_j \times R'_k) = V(R_j)V(R'_k)$$ and hence $L(P \times P',f) = \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) .$ If we let $m_k(x) := \inf_{y \in R'_k} f(x,y) = \inf_{y \in R'_k} f_x(y) ,$ then of course if $$x \in R_j$$ then $$m_{j,k} \leq m_k(x)$$. Therefore $\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) .$ As we have the inequality for all $$x \in R_j$$ we have $\sum_{k=1}^K m_{j,k} \, V(R'_k) \leq \inf_{x \in {\mathbb{R}}_j} g(x) .$ We thus obtain $L(P \times P',f) \leq \sum_{j=1}^N \left( \inf_{x \in {\mathbb{R}}_j} g(x) \right) V(R_j) = L(P,g) .$

Similarly $$U(P \times P',f) \geq U(P,h)$$, and the proof of this inequality is left as an exercise.

Putting this together we have $L(P \times P',f) \leq L(P,g) \leq U(P,g) \leq U(P,h) \leq U(P \times P',f) .$ And since $$f$$ is integrable, it must be that $$g$$ is integrable as $U(P,g) - L(P,g) \leq U(P \times P',f) - L(P \times P',f) ,$ and we can make the right hand side arbitrarily small. Furthermore as $$L(P \times P',f) \leq L(P,g) \leq U(P \times P',f)$$ we must have that $$\int_R g = \int_{R \times S} f$$.

Similarly we have $L(P \times P',f) \leq L(P,g) \leq L(P,h) \leq U(P,h) \leq U(P \times P',f) ,$ and hence $U(P,h) - L(P,h) \leq U(P \times P',f) - L(P \times P',f) .$ So if $$f$$ is integrable so is $$h$$, and as $$L(P \times P',f) \leq L(P,h) \leq U(P \times P',f)$$ we must have that $$\int_R h = \int_{R \times S} f$$.

We can also do the iterated integration in opposite order. The proof of this version is almost identical to version A, and we leave it as an exercise to the reader.

[mv:fubinivB] Let $$R \times S \subset {\mathbb{R}}^n \times {\mathbb{R}}^m$$ be a closed rectangle and $$f \colon R \times S \to {\mathbb{R}}$$ be integrable. The functions $$g \colon S \to {\mathbb{R}}$$ and $$h \colon S \to {\mathbb{R}}$$ defined by $g(x) := \underline{\int_S} f^y \qquad \text{and} \qquad h(x) := \overline{\int_S} f^x$ are integrable over $$S$$ and $\int_S g = \int_S h = \int_{R \times S} f .$

That is we also have $\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 .$

Next suppose that $$f_x$$ and $$f^y$$ are integrable for simplicity. For example, suppose that $$f$$ is continuous. Then by putting the two versions together we obtain the familiar $\int_{R \times S} f = \int_R \int_S f(x,y) \, dy \, dx = \int_S \int_R f(x,y) \, dx \, dy .$

Often the Fubini theorem is stated in two dimensions for a continuous function $$f \colon R \to {\mathbb{R}}$$ on a rectangle $$R = [a,b] \times [c,d]$$. Then the Fubini theorem states that $\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 .$ And the Fubini theorem is commonly thought of as the theorem that allows us to swap the order of iterated integrals.

We can also obtain the 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 {\mathbb{R}}^n$$ be a closed rectangle and let $$f \colon R \to {\mathbb{R}}$$ be continuous. Then $\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 .$

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

### Exercises

Prove the assertion $$U(P \times P',f) \geq U(P,h)$$ from the proof of .

Prove .

FIXME