Fubini's theorem cannot be applied

I've been trying to tackle the following question: Consider the function $$f:\mathbb{R}^2\to\mathbb{R}$$ defined by $$f=2\cdot 1_M-3\cdot 1_N$$, where $$M=\{(x,y):y\geq 0,x-2\leq y Show by direct computation that $$\int_{\mathbb{R}}\left(\int_{\mathbb{R}} f(x,y) \,dx\right)dy \ne \int_{\mathbb{R}}\left( \int_{\mathbb{R}} f(x,y) \,dy \right)dx$$ I did the calculations but I'm not sure it really comes out like this, I'm confused. But beyond the calculations the most interesting question would be why can't Fubini's theorem be applied? I would appreciate a detailed answer because I'm so confused with this.

I know (in very abbreviated notation) that:

Fubini's theorem: If $$f\in L^1(X\times Y)$$ then $$\int_X\int_Y f=\int_Y\int_X f=\int_{X\times Y}f$$.

Tonelli's theorem: If $$f\ge 0$$ then $$\int_X\int_Y f=\int_Y\int_X f=\int_{X\times Y}f$$.

• Putting Fubini and Tonelli's theorem together yields the following result: $f\in L^1(X\times Y,\mu\otimes\nu)$ iff $\{f\neq0\}$ is covered by countable $\mu\otimes\nu$-integrable sets, and either $\int_X(\int_Y |f(x,y)|\nu(dy))\mu(dx)<\infty$ or $\int_Y(\int_X|f(x,y)|\,mu(dx))\nu(dy)<\infty$. In such a case, both $\int_X(\int_Y f(x,y)\nu(dy)\mu(dx)$ and $\int_Y(\int_Xf(x,y)\mu(dx))\nu(dy)$ exists and are the same. In your problem $\int_X\int_y|f|=\infty=\int_Y\int_x|f|$ Jul 21, 2021 at 21:32

The function is also not in $$L^1(X \times Y)$$, so Fubini cannot be applied. Note that $$M$$ and $$N$$ are disjoint sets of infinite measure, and $$|f(x)| \ge 2$$ for $$x \in M \cup N$$.