Problem Statement: Let $X = Y = R$ and let $B$ be the Borel $\sigma$-algebra. Define $$ f(x,y) = \left\{ {\begin{array}{*{20}{c}} 1&{x \ge 0{\text{ and }}x \le y < x + 1}\\ { - 1,}&{x \ge 0{\text{ and }}x + 1 \le y < x + 2}\\ {0,}&{{\text{ else }}} \end{array}} \right.$$
Show that $\int \int f(x,y) dy dx \neq \int \int f(x,y) dx dy$, why does this not contradict the Fubini-Tonelli theorem?
My attempt at a solution: I think that I have calculated the first integral as $0$. Holding $x$ fixed, we can see that either $\int f(x,y) dy = 0$, if we had fixed $x < 0$, or $\int f(x,y) dy = 1 -1 = 0$, if we had fixed $x$ anywhere else. Thus, the left integral is $0$, I think. But, I can't calculate the right integral! I am having a hard time figuring out how to fix $y$ and calculate it.
We have
$$\begin{align} \iint f(x,y)\,dy\,dx&=\int_0^{\infty}\left(\int_{x}^{x+1}(1)dy+\int_{x+1}^{x+2}(-1)dy\right)\,dx\\\\ &=\int_0^{\infty}0\,dx=0 \end{align}$$
Thus,
$$\bbox[5px,border:2px solid #C0A000]{\iint f(x,y)\,dy\,dx=0}$$
Reversing the order of integration yields
$$\begin{align} \iint f(x,y)\,dx\,dy&=\int_0^{1}\left(\int_{0}^{y}(1)dx\right)\,dy\\\\ &+\int_1^2\left(\int_{0}^{y-1}(-1)dx+\int_{y-1}^{y}(1)\,dx\right)\,dy\\\\ &+\int_2^{\infty}\left(\int_{y-2}^{y-1}(-1)\,dx+\int_{y-1}^{y}(1)\right)\,dy\\\\ &=\frac12+\frac12+0\\\\ &=1 \end{align}$$
Thus,
$$\bbox[5px,border:2px solid #C0A000]{\iint f(x,y)\,dx\,dy=1}$$
Therefore,
$$\bbox[5px,border:2px solid #C0A000]{\iint f(x,y)\,dy\,dx \ne \iint f(x,y)\,dx\,dy}$$
and the iterated integrals are not equal.