Counterexample in Fubini's Theorem (non-integrable function) Fubini's theorem tells us that (for measurable functions on a product of $σ$-finite measure spaces) if the integral of the absolute value is finite, then the order of integration does not matter
Here is a counterexample that shows why you can't drop the assumption that the original function is integrable in Fubini's theorem:

A simple example to show that the repeated integrals can be different in general is to take the two measure spaces to be the positive integers, and to take the function $f(x,y)$ to be $1$ if $x=y$, $−1$ if $x=y+1$, and $0$ otherwise. Then the two repeated integrals have different values $0$ and $1$.

Can somebody explain why the original function is not integrable and then show me how the two iterated integrals are not equal? 
Here is my attempt at understanding this:
Let $\mathbb{Z}_1$ and $\mathbb{Z}_2$ be the two measure spaces, with (I assume?) to be a counting measure. Then apparently it's true that:
$$\int_{\mathbb{Z}_2} \int_{\mathbb{Z}_1}f^y(x)\,dx\,dy \neq \int_{\mathbb{Z}_1} \int_{\mathbb{Z}_2}f_x(y)\,dy\,dx $$
But it seems like $$\int_{\mathbb{Z}_1}f^y(x)\,dx=\int_{\mathbb{Z}_2}f_x(y)\,dy=0$$
So therefore both sides of the integral, no matter which order, will equal $0$. 
It seems like $\int_{\mathbb{Z}_1}f^y(x)dx=0$ because there are only two values of $x$ where this integral is going to be nonzero, once when it's $-1$ and once when it's $1$. The same argument seems to apply if we integrate with respect to $dy$ first. What am I doing wrong here?
Furthermore, why is the original functions absolute value is not finite? Thank you so much.
 A: Suppose $\mu_1=\mu_2$ are counting measures on $\Omega_1=\Omega_2=\{1,2,\ldots\}$. 
Define the following function on $\Omega_1\times\Omega_2$:
$$f(i,j)=\begin{cases}1&,\text{ if }i=j 
\\ -1&,\text{ if }i=j+1
\\ 0&,\text{ otherwise }
\end{cases}$$
We can write out the values of $f(i,j)$ in a matrix form like 
$$[f(i,j)]=\begin{bmatrix}1&0&0&0&\cdots
\\ -1&1&0&0&\cdots
\\0&-1&1&0&\cdots
\\0&0&-1&1&\cdots
\\\vdots&\vdots&0&-1&\cdots
\\\vdots&\vdots&\vdots&\vdots&\ddots
\\0&0&0&0&\cdots
\end{bmatrix}$$
Only the first row sums to $1$, each of the remaining rows sum to $0$. Also sum of each column is $0$. 
Therefore, $$\int\left(\int f(x,y)\,d\mu_2(y)\right)d\mu_1(x)=\sum_{i=1}^\infty \left(\sum_{j=1}^\infty f(i,j)\right)=1$$
And $$\int\left(\int f(x,y)\,d\mu_1(x)\right)d\mu_2(y)=\sum_{j=1}^\infty \left(\sum_{i=1}^\infty f(i,j)\right)=0$$
However, 
\begin{align}
\iint|f(x,y)|\,d\mu_1(x)\,d\mu_2(y)&=\sum_{i=1}^\infty\sum_{j=1}^\infty|f(i,j)|
\\&=\sum_{i=1}^\infty\left(\sum_{j=1}^\infty |f(i,j)|\right)\quad,\small\text{ by Fubini/Tonelli, since }|f|\ge 0
\\&=1+2+2+\cdots
\\&=\infty
\end{align}
So $f$ is not $\mu$-integrable where $\mu=\mu_1\otimes\mu_2$ is the product measure.
