Double Integral Question on unit square Hints on solving following double integral will be appreciated.
$$\int_0^1 \int_0^1 \frac{x^2-y^2}{(x^2+y^2)^2} \text{d}y \ \text{d}x$$
 A: The integral does not converge. By various tricks, you can cause some kind of iterated calculation to give any value you like. 
You can cut up the domain into parts. For $x^2 + y^2 \geq 1$ there is no trouble. Furthermore, there is a $\pm$ symmetry across the $45^\circ$ line $y=x.$ So, we consider the part $$ x^2 + y^2 \leq 1, \; \; y \leq x. $$ On this part, the integral is, indeed, $$ \int_0^{\pi/4}  \int_0^{1} \frac{\cos 2 \theta}{r} dr d\theta = \frac{1}{2 }  \int_0^{1} \frac{1}{r} dr = \left.\frac{1}{2 } \log r \; \right\rvert_{r=0}^{r=1} $$ which does not work.
There is surely some good way to write the traditional vertical bar symbol denoting the evaluation step for a one-variable integral. I think it will work if I make the $r$ values into an array with a blank line or two in the middle. That's better, array, with matching \left|  and \right. which produces nothing as the right delimiter; if I had put \right| there would be a second vertical bar.
http://en.wikipedia.org/wiki/Multiple_integral#Multiple_improper_integral 
A: Since the integrand has a non-integrable singularity at the origin, we must evaluate it by iterated integration. So let's consider the inner integral first:
$$\begin{align}
\int_0^1 \frac{x^2-y^2}{(x^2+y^2)^2}\, dy &= \frac{1}{x}\int_0^{1/x} \frac{1-t^2}{(1+t^2)^2}\, dt \qquad\qquad\qquad\qquad\qquad (y = x\cdot t)\\
&= \frac{1}{2x} \int_0^{2\arctan(1/x)} \frac{1 - \tan^2 (\varphi/2)}{(1+\tan^2(\varphi/2))^2}(1+\tan^2(\varphi/2))\, d\varphi\quad (t = \tan (\varphi/2))\\
&= \frac{1}{2x} \int_0^{2\arctan(1/x)} \frac{\cos^2(\varphi/2) - \sin^2(\varphi/2)}{\cos^2(\varphi/2)+\sin^2(\varphi/2)}\, d\varphi\\
&= \frac{1}{2x} \int_0^{2\arctan(1/x)} \cos\varphi\,d\varphi\\
&= \frac{1}{2x} \sin \left(2\arctan(1/x)\right)\\
&= \frac{1}{x} \sin \left(\arctan(1/x)\right)\cos\left(\arctan(1/x)\right)\\
&= \frac{1}{x} \frac{1/x}{\sqrt{1+1/x^2}}\frac{1}{\sqrt{1+1/x^2}}\\
&= \frac{1}{1+x^2}
\end{align}$$
From the on, it's very simple,
$$\int_0^1 \frac{dx}{1+x^2} = \arctan 1 = \frac{\pi}{4}.$$
Note that the other order of integration,
$$\int_0^1\int_0^1 \frac{x^2-y^2}{(x^2+y^2)^2}\, dx\,dy$$
leads to the value $-\frac{\pi}{4}$.
A: Just split the integral as
$$ \int_0^1 \int_0^1 \frac{x^2-y^2}{(x^2+y^2)^2} \text{d}y \ \text{d}x
=  \int_0^1 \int_0^1 \frac{x^2}{(x^2+y^2)^2} \text{d}y \ \text{d}x
- \int_0^1 \int_0^1 \frac{y^2}{(x^2+y^2)^2} \text{d}y \ \text{d}x. $$
Now, just use standard integration techniques to evaluate the integrals. For instance 
$$ \int_{0}^{1}\frac{1}{(x^2+y^2)^2}dy=\frac{xy}{x^2 + y^2} + \frac{\arctan(y/x))}{2x}\Big|_{0}^{1} =\dots.  $$
A: \begin{align}
\frac{x^{2} - y^{2}}{(x^{2}+y^{2})^{2}}
&=
{x^{2} + y^{2} -2y^{2} \over \left(x^{2} + y^{2}\right)^{2}}
=
{1 \over \left(x^{2} + y^{2}\right)^{2}}\,\left\lbrack%
{\partial y \over \partial y}\,\left(x^{2} + y^{2}\right)
-
{\partial\left(x^{2} + y^{2}\right) \over \partial y}\,y
\right\rbrack
\\[3mm]&=
{\partial \over \partial y}\left(y \over x^{2} + y^{2}\right)\,,
\qquad\qquad
\left(x, y\right) \not= \left(0, 0\right)
\\[5mm]&
\end{align}
\begin{align}
\lim_{\epsilon \to 0^{+}}\int_\epsilon^1 \int_0^1 \frac{x^2-y^2}{(x^2+y^2)^2} \text{d}y \ \text{d}x
&=
\lim_{\epsilon \to 0^{+}}\int_{\epsilon}^{1}\left.{y \over x^{2} + y^{2}}\right\vert_{\,y\ =\ 0}^{\,y\ =\ 1}\
{\rm d}x
=
\lim_{\epsilon \to 0^{+}}\int_{\epsilon}^{1}{{\rm d}x \over x^{2} + 1}
\\[3mm]&=
\arctan\left(1\right)
=
{\large{\pi \over 4}}
\end{align}
It seems to be the Mathematica package trick !!!: It's is equivalent to exclude $\left\lbrace \left(0,y\right)\ \ni\ y \in \left(0, 1\right) \right\rbrace$ and takes a limit after integration. It's like this:
\begin{align}
\int_{\epsilon}^{1}
\left.{y \over x^{2} + y^{2}}\right\vert_{\,y\ =\ 0}^{\,y\ =\ 1}\ {\rm d}x
=
\int_{\epsilon}^{1}{1 \over x^{2} + 1}\,{\rm d}x
=
{\pi \over 4} - \arctan\left(\epsilon\right) \to {\pi \over 4}
\end{align}
If you "exclude" both $x = 0$ and $y = 0$ you get:
$$
{\pi \over 4} - \arctan\left(\epsilon\right)-
\arctan\left(1 \over \epsilon\right) + \arctan\left(1\right) \to 0
$$
which is quite obvious ( the integral changes sign when $x \leftrightarrow y$ ).
The problem is related to the singular behavior of the 2D-Green function  of the Laplacian operator:
$\left.\nabla^{2}\ln\left(\rho\right)\right\vert_{\rho\ \not=\ 0} = 0$ but its integral around $\vec{\rho} = \vec{0}$ is $\not= 0$.
$\rho \equiv x\,\hat{x} + y\,\hat{y}$. It's common in 2D-Electrostatic.
For example 
\begin{align}
\int_0^1 \int_0^1 \frac{x^2-y^2}{(x^2+y^2)^2} \text{d}y \ \text{d}x
&=
\int_{S}\nabla\times\left({y \over x^{2} + y^{2}}\,\hat{x}\right)\cdot\hat{z}\,
{\rm d}x\,{\rm d}y
=
\oint\left({y \over x^{2} + y^{2}}\,\hat{x}\right)\cdot{\rm d}\vec{\rho}
\\[3mm]&=
\int_{1}^{0}{1 \over x^{2} + 1}\,\left(-{\rm d}x\right)
=
{\large{\pi \over 4}}
\end{align}
A: 0 by symmetry.Integrand changes sign across the diagonal
