I'm trying to understand general conditions that permit switching integrals as in
$$\int_a^\infty \int_a^\infty f(x,y) dx dy = \int_a^\infty \int_a^\infty f(x,y) dy dx $$
if $f$ is not nonnegative or nonpositive and the integrals $\int_a^\infty f(x,y)dx, \int_a^\infty f(x,y)dy$ are improper Riemann integrals that are not absolutely convergent. So Fubini-Tonelli theorem does not apply here.
Is it sufficient that $\int_a^\infty f(x,y)dx, \int_a^\infty f(x,y)dy$ are uniformly convergent for $x,y \in [0,\infty)$? How is it proved if true?
For conditionally convergent improper integrals where the hypotheses of Tonelli's and Fubini's theorems are not met, uniform convergence of inner integrals
$$\int_a^\infty f(x,y)\, dx\,\,\,\ (y\geqslant b), \quad \int_b^\infty f(x,y)\, dy\,\,\,\ (x\geqslant a),$$
is not sufficient to ensure that the iterated integrals are equal when the order of integration is switched.
The function $f(x,y) = \frac{x^2-y^2}{(x^2+y^2)^2}$ is typically used as a counterexample where the order of integration cannot be switched when the absolute integrability hypothesis of Fubini's theorem is dropped. It also serves our purpose here.
From $\frac {x^2-y^2}{(x^2+y^2)^2} = \frac{\partial}{\partial y} \left(\frac{y}{x^2 + y^2}\right) = -\frac{\partial}{\partial x} \left(\frac{x}{x^2 + y^2}\right),$ it is easily shown that
$$\frac{\pi}{4}=\int_1^\infty \left(\int_1^\infty \frac {x^2-y^2}{(x^2+y^2)^2}\, dx\right)\, dy\neq \int_1^\infty \left(\int_1^\infty \frac {x^2-y^2}{(x^2+y^2)^2}\, dy\right)\, dx= - \frac{\pi}{4}$$
However, both the inner integrals are uniformly convergent. Note that for all $c \geqslant 1$ and $y \geqslant 1$
$$\left|\int_c^\infty f(x,y) \,dx\right| = \left|-\int_c^\infty \frac{\partial}{\partial x} \left(\frac{x}{x^2 + y^2}\right)\,dx\right|= \frac{c}{c^2+y^2}\leqslant \frac{1}{c}$$
Thus, for any $\epsilon > 0$ there exists $C(\epsilon)= 1/\epsilon$ independent of $y$ such that for all $c > C(\epsilon)$ the remainder on the LHS is less than $\epsilon$. By the same argument the inner integral with respect to $dy$ is uniformly convergent as well.