Why does Fubini's theorem not hold/apply to this function? Given the function
$$ f(x,y) = \begin{cases} e^{y-x}, & x > y \geq 0 \\ -e^{x-y}, & 0 \leq x \leq y \end{cases}$$
I have already determined that
$$ \int_0^\infty \left( \int_0^\infty f(x,y) \, dx \right) dy = 1$$
and
$$ \int_0^\infty \left( \int_0^\infty f(x,y) \, dy \right) dx = -1.$$
So it would appear that Fubini does not hold, however, $f(x,y)$ seems to be Lebesgue integrable on $R^2$ since it starts at $1$ or $-1$ on the diagonal and tends to zero away from the diagonal. What is the true issue in applying Fubini's here?
 A: You should expect that Fubini's theorem might fail because the integral of $|f|$ is infinite. Here's a geometrically intuitive reason for that.
Considering $\varepsilon=1/2$, by continuity of $\exp$ there is a $\delta>0$ so that $|f(x,y)|>1/2$ for $(x,y)$ within $\delta$ of the diagonal. Now this $\delta$-band around the diagonal has infinite measure, and the integrand is at least $1/2$ inside it. Something very similar happens in the classic examples of failures of Fubini's theorem on $(\mathbb{N} \times \mathbb{N},c \times c)$.
A: $$\int\limits_{\{(x,y): x>y>0\}} f(x,y)\,d(x,y) = \int_0^\infty \left( \int_y^\infty e^{y-x} \, dx\right) \, dy = \int_0^\infty 1\,dy = \infty.
$$
It is only when the positive and negative parts of the integral are both infinite that the conclusion of Fubini's theorem can fail to hold.  But notice that the assumption in Fubini's theorem is even stronger than that they are not both infinite.  It is that they are both finite.  When they're not both finite, Fubini's theorem is not applicable.
