I was evaluating a double integral using the following iterated integral: $$\int_{-\infty}^{\infty} \int_{0}^{1} \frac{2xy}{x^2+1} dy dx$$
This simplifies down to: $$\lim_{\lambda \to \infty} \left[\left(\int_{-\lambda}^{\lambda} \frac{2x}{x^2+1} dx \right) \left(\int_{0}^{1} y dy \right) \right]$$ This ultimately gives me: $$\frac{1}{2} \lim_{\lambda \to \infty} [\ln{(\lambda^2 + 1)} - \ln{(\lambda^2 + 1)}]$$ Now this should evaluate to 0.
However, the single-variable integral in terms of $x$ is one of those Cauchy Principal Value integrals, where the integral technically diverges but it is possible to assign a value to it.
Using my method, however, I can't seem to get the result that the integral diverges - the limit only returns 0.
I don't know how mathematically correct this is.
Any help would be appreciated.
Your method fails when you assume
$\displaystyle \int_{-\infty}^{\infty} = \lim_{n\to\infty}\int_{-n}^{n}$
The problem here is that infinity is not a value (as you know), but something we approach. And when we talk about approaching something it is natural to also talk about how fast we are approaching. As the limit is infinity, we should arrive at the same answer no matter how slow or how fast we are going. In other words
$\displaystyle \lim_{n\to \infty}\int_{-n}^{n}\quad \text{and} \quad \lim_{n\to \infty} \int_{-n}^{2n}$
Should evaluate to the same thing thing. In other words, the limit has to be independent of the speed we are approaching the limit. The easiest way to fix your equality is to write
$\displaystyle \int_{-\infty}^{\infty} = \lim_{\substack{n\to\infty\\m \to \infty}}\int_{-n}^{m}$
If you now evaluate your integral you will see that you obtain different answers deppending on how fast $m$ approaches infinity compared to $n$.
Your approach of assuming that the function approaches infinity at the same speed is often refereed to as the Cauchy Principal Value or P.V for short. So it is correct to write
$\displaystyle \text{P.V} \int_{-\infty}^{\infty} = \lim_{n\to\infty}\int_{-n}^{n}$
EDIT: You can also say that your approach fails when you assume
$\displaystyle \lim_{n \to \infty} f_n + \lim_{n \to \infty} g_n = \lim_{n \to \infty} (f_n + g_n)$
Which only holds if both $\lim_{n \to \infty} f_n$ and $\lim_{n \to \infty} g_n$ exists (converges).