Fubini's Theorem

Everyone learns the trick in multivariable calculus. To compute a double integral over a rectangle you do not attack the two dimensions at once — you integrate one variable at a time, holding the other fixed, and you may take the variables in either order:

\iint_{[a,b]\times[c,d]} f \,=\, \int_a^b\!\left(\int_c^d f(x,y)\,dy\right)dx \,=\, \int_c^d\!\left(\int_a^b f(x,y)\,dx\right)dy.

In first-year calculus this is presented as an obvious convenience, true for every function you will ever draw. It is not obvious, and it is not always true. This page answers, with full rigour, the question that calculus quietly skips: exactly when is it legal to replace a double integral by an iterated one, and to swap the order? The answer comes in two theorems that work as a matched pair. Tonelli says that for a non-negative function the swap is always allowed — no fine print at all. Fubini says that for a signed function the swap is allowed precisely when the function is integrable — and that one hypothesis is genuinely indispensable, as a famous counterexample where the two orders give +\tfrac{\pi}{4} and -\tfrac{\pi}{4} will show.

The setup: product measures and three integrals

Fix two measure spaces (X, \mathcal{F}, \mu) and (Y, \mathcal{G}, \nu) (both \sigma-finite — the whole space is a countable union of finite-measure pieces, which is the hypothesis that makes everything below work). To integrate over the product X \times Y we need a \sigma-algebra and a measure on it. The natural building blocks are measurable rectangles A \times B with A \in \mathcal{F} and B \in \mathcal{G}. The product \sigma-algebra \mathcal{F} \otimes \mathcal{G} is the smallest \sigma-algebra containing all of them, and the product measure \mu \times \nu is the unique measure whose value on a rectangle is the product of the side measures:

(\mu \times \nu)(A \times B) \,=\, \mu(A)\,\nu(B).

(When \mu and \nu are both length on \mathbb{R}, \mu \times \nu is exactly area on the plane — a rectangle's "measure" is base times height, as it should be.) With this in hand there are now three different things one might mean by "the integral of f over the product": one genuine double integral, and two iterated ones,

\underbrace{\int_{X\times Y} f \, d(\mu\times\nu)}_{\text{double}}, \qquad \underbrace{\int_X\!\left(\int_Y f\,d\nu\right)d\mu}_{\text{integrate }y\text{ first}}, \qquad \underbrace{\int_Y\!\left(\int_X f\,d\mu\right)d\nu}_{\text{integrate }x\text{ first}},

and there is no a priori reason the three should agree. The double integral treats X\times Y as one space and weighs level sets in the plane; each iterated integral first collapses one dimension — for a fixed x it integrates the slice y \mapsto f(x,y), producing a function of x, then integrates that. Tonelli and Fubini are the theorems that say when the three collapse to one number.

The picture: integrate each slice, then integrate the slices

Here is the geometric heart of iterated integration, older than measure theory itself — it is Cavalieri's principle. Think of the solid sitting under the graph z = f(x,y) over a rectangle. Slice it with a plane at a fixed x; that cross-section has an area

A(x) \,=\, \int_Y f(x, y)\, d\nu \quad\text{(the inner integral)},

and the total volume is what you get by sweeping the slice across and adding up the slice areas — \int_X A(x)\,d\mu. That double sweep is the iterated integral. Below, the curve is the slice-area function A(x) for the separable example f(x,y) = xy on [0,2]\times[0,3] (so A(x) = x\int_0^3 y\,dy = \tfrac92 x). Drag the slider to sweep x to the right; the shaded area is the running iterated integral, and it climbs to the full double integral \iint xy = \bigl(\int_0^2 x\,dx\bigr)\bigl(\int_0^3 y\,dy\bigr) = 2\cdot\tfrac92 = 9.

The whole question of Fubini and Tonelli is whether sweeping in the other direction — slicing at fixed y instead — gives the same total. For volumes of honest solids it plainly does; the surprise is that for wildly oscillating signed integrands it can fail, and the two sweeps can disagree.

Tonelli's theorem: for f \ge 0, always

The first theorem is astonishingly generous. It asks for nothing but non-negativity.

Let (X,\mathcal{F},\mu) and (Y,\mathcal{G},\nu) be \sigma-finite, and let f : X\times Y \to [0,\infty] be \mathcal{F}\otimes\mathcal{G}-measurable and non-negative. Then the slice functions and inner integrals are measurable, and all three integrals are equal in [0,\infty]:

\int_{X\times Y}\! f\, d(\mu\times\nu) = \int_X\!\left(\int_Y f\,d\nu\right)d\mu = \int_Y\!\left(\int_X f\,d\mu\right)d\nu.

No integrability hypothesis appears. The common value is allowed to be +\infty — and if one of the three is +\infty, so are the others. This is exactly what makes Tonelli so useful: for a non-negative integrand you may always compute a double integral as an iterated one, and always swap the order, with no checking. The underlying reason is the Monotone Convergence Theorem: approximate f from below by simple functions on rectangles, where equality of the three integrals is just (\mu\times\nu)(A\times B) = \mu(A)\nu(B), and let the staircases climb — monotone limits pass through all three integrals in lockstep.

Fubini's theorem: for integrable f

For a function that takes both signs the cancellation between positive and negative parts can wreck everything, so Fubini demands one thing: that f be integrable on the product, meaning its absolute value has finite double integral.

With (X,\mathcal{F},\mu), (Y,\mathcal{G},\nu) \sigma-finite, let f : X\times Y \to \mathbb{R} be measurable with

\int_{X\times Y} |f|\, d(\mu\times\nu) \,<\, \infty.

Then:

In practice Fubini and Tonelli are always used together, in a fixed two-step ritual:

Remember it as "Tonelli to check, Fubini to swap". The non-negativity of |f| is what makes Step 1 free; the finiteness it establishes is what makes Step 2 legal. Skip Step 1 and you are gambling — as the next section shows, you can lose.

The counterexample: when the two orders disagree

Fubini's integrability hypothesis is not bookkeeping you can wave away. Drop it and the two iterated integrals can both exist, both be finite — and be different numbers. The classic witness lives on the unit square (0,1)\times(0,1):

f(x,y) \,=\, \frac{x^2 - y^2}{(x^2 + y^2)^2}.

The key observation is that f is a perfect y-derivative: since \dfrac{\partial}{\partial y}\!\left(\dfrac{-y}{x^2+y^2}\right) = \dfrac{x^2-y^2}{(x^2+y^2)^2}, integrating first in y is a clean fundamental-theorem calculation:

\int_0^1 f(x,y)\,dy = \left[\frac{-y}{x^2+y^2}\right]_{y=0}^{1} = \frac{-1}{x^2+1}, \qquad \int_0^1\!\left(\int_0^1 f\,dy\right)dx = \int_0^1 \frac{-1}{x^2+1}\,dx = -\frac{\pi}{4}.

But f is antisymmetric under swapping the variables: f(y,x) = -f(x,y). So doing the x-integral first just flips the sign of the whole computation:

\int_0^1\!\left(\int_0^1 f\,dx\right)dy = +\frac{\pi}{4} \;\neq\; -\frac{\pi}{4} = \int_0^1\!\left(\int_0^1 f\,dy\right)dx.

Both iterated integrals exist, both are perfectly finite, and yet they disagree. The order of integration changed the answer. What went wrong is exactly the hypothesis we skipped: near the origin f blows up so violently that \iint_{(0,1)^2} |f|\, dx\,dy = +\infty. Tonelli, applied to |f|, would have reported that infinity in Step 1 and warned us off — Fubini never applied, so there was never any right to swap. The disagreement is the theorem's hypothesis making itself heard.

Long before Lebesgue, Bonaventura Cavalieri (1635) argued that two solids with equal-area cross-sections at every height have equal volume — "slice and compare". That is exactly the inner integral A(x) = \int_Y f(x,y)\,d\nu being integrated over x, and Tonelli is its modern, fully rigorous form: it certifies that summing slice areas really does reconstruct the whole, for every non-negative measurable integrand, however jagged.

The same theorem does a second job that looks unrelated: it lets you swap a sum and an integral. A series \sum_n a_n(x) is an integral against counting measure on \mathbb{N}, so \sum_n \int a_n = \int \sum_n a_n is just Tonelli on the product X \times \mathbb{N}free whenever the terms are non-negative (a_n(x)\ge 0), no uniform convergence required. Interchanging \sum and \int for non-negative terms, a workhorse of analysis and probability, is a one-line corollary of Tonelli.

Four traps where students misuse (or over-trust) the swap: