TITLE: How to solve $\int_0^1dx\int_0^1\frac{x^2-y^2}{(x^2+y^2)^2}\,dy$
QUESTION [2 upvotes]: The original question is:

Prove that:$$\begin{aligned}\\
\int_0^1dx\int_0^1\frac{x^2-y^2}{(x^2+y^2)^2}\,dy\neq\int_0^1dy&\int_0^1\frac{x^2-y^2}{(x^2+y^2)^2}\,dx\\
\end{aligned}\\$$

But I can't evaluate the integral $$\int_0^1dx\int_0^1\frac{x^2-y^2}{(x^2+y^2)^2}\,dy$$
At first, I assumed $x^2+y^2=z^2$. But, it is so complicated. Then, I assumed $x=r\cos\theta$ and $y=r\sin\theta$. But, I can't calculate the limits. Solving the equations I got three values of $\theta$ i.e. $\theta=0$, $\theta=\frac{\pi}{4}$ and $\theta=\frac{\pi}{2}$. I am just confused. Please help.

REPLY [3 votes]: \begin{align}
\text{Let } & y = x\tan \theta, \\[8pt]
\text{so that }& dy = x\sec^2\theta\,d\theta \\[8pt]
\text{and } & x^2 + y^2= x^2\sec^2\theta,
\end{align}
and as $y$ goes from $0$ to $1$ then $\theta$ goes from $0$ to $\arctan(1/x)$.
Then
\begin{align*}
& \int_0^1 \frac{x^2-y^2}{(x^2+y^2)^2} \, dy \\[8pt]
= {} & \int_0^{\arctan(1/x)} \frac{x^2 - x^2 \tan^2\theta}{(x^2 + x^2\tan^2\theta)^2} \big( x\sec^2\theta\,d\theta\big) \\[8pt]
= {} & \frac 1 x \int_0^{\arctan(1/x)} \frac{1-\tan^2 \theta}{\sec^2 \theta} \, d\theta \\[8pt]
= {} & \frac 1 x \int_0^{\arctan(1/x)} (\cos^2\theta-\sin^2\theta) \, d\theta \\[8pt]
= {} & \frac 1 x \int_0^{\arctan(1/x)} \cos(2\theta) \, d\theta
= \frac 1 {2x} \sin\left(2\arctan \frac 1 x\right) \\[8pt]
= {} & \frac 1 x \sin\left(\arctan \frac 1 x \right) \cos\left( \arctan \frac 1 x \right) \\[8pt]
= {} & \frac 1 x \cdot \frac 1 {\sqrt{1+x^2}} \cdot \frac x {\sqrt{1+x^2}} = \frac 1 {1+x^2}. \\[5pt]
\text{And then}
& \int_0^1 \frac{dx}{1+x^2} = \frac \pi 4.
\end{align*}
{"set_name": "stack_exchange", "score": 2, "question_id": 3768872}