<s>[INST] Double integral over a region Given $f(x,y)=\displaystyle\frac{x^2}{x^2+y^2}$ and $D=\{(x,y) : 0 \leq x \leq 1, x^2 \leq y \leq 2-x^2\}$ i have to solve $\displaystyle\int\displaystyle\int_Df(x,y)dA$.
Here's my try:
(1) Changing variables
$x = \sqrt{v-u}$, $y= v+u$.
(1.1) Since $0 \leq x \leq 1$, then $0 \leq v-u \leq 1 \rightarrow u \leq v \leq 1+u$
(1.2) Since $x^2 \leq y \leq 2-x^2$, then $v-u \leq v+u \leq 2-v+u \rightarrow -u \leq u \rightarrow 0\leq u$ and $v \leq 2-v \rightarrow v \leq 1$
(1.3) It seems that now i should integrate over  $S = \{(u,v) : 0\leq u \leq v \leq 1 \}$ (the upper triangle in $[0,1]\times[0,1]$ ?), so i may as well put $S = \{(u,v) : 0 \leq v \leq 1, 0 \leq u \leq v  \}$.
(2) Alright, what do i need to calculate the integral?
(2.1) First, i should calculate the Jacobian
$ \displaystyle\frac{\partial(x,y)}{\partial(u,v)} = \left| \begin{array}{cc}
\frac{\partial x}{\partial u} & \frac{\partial x}{\partial v} \\
\frac{\partial y}{\partial u} & \frac{\partial y}{\partial v} \\
\end{array} \right| = \left| \begin{array}{cc}
-\frac{1}{2\sqrt{v-u}} & \frac{1}{2\sqrt{v-u}} \\
1 & 1 \\
\end{array} \right| = -\frac{1}{\sqrt{v-u}}$
(2.2) Then i have to solve $\displaystyle\int_0^1\displaystyle\int_0^v \frac{v-u}{(v-u)+(v^2+2uv+u^2)}\bigg(-\frac{1}{\sqrt{v-u}} \bigg)dvdu$
$=-\displaystyle\int_0^1\displaystyle\int_0^v \frac{\sqrt{v-u}}{v^2+v(1+2u) + (u^2-u) }dvdu$
(2.3) Well, here i'm stuck.I've been thinking about taking $z = \sqrt{v-u}$ and then $dz = \displaystyle\frac{1}{2\sqrt{v-u}}dv$ wich means $dv = 2zdz$, this would lead to an integral of the form
$2\displaystyle\int\displaystyle\int \frac{z^2}{z^2+z(1+4u)+ 4u^2 }dvdu = 2\displaystyle\int\displaystyle\int \frac{z^2}{(z+(\frac{1}{2}+2u))^2-2u }dvdu$ and if i put $w = z+(\frac{1}{2}+2u)$ i'll have $2\displaystyle\int\displaystyle\int \frac{(w-\frac{1}{2}-2u)^2}{w^2-2u }dwdu$ but it seems that the last one will lead to some ugly shaped solution and i would have a hard time getting the final answer.
What would be the best way to solve this?
 [/INST] $$
\begin{align}
&\int_0^1\int_{x^2}^{2-x^2}\frac{x^2}{x^2+y^2}\,\mathrm{d}y\,\mathrm{d}x\tag{1}\\
&=\int_0^1\int_{x}^{\frac2x-x}\frac{x}{1+y^2}\,\mathrm{d}y\,\mathrm{d}x\tag{2}\\
&=\int_0^1x\left(\arctan\left(\frac2x-x\right)-\arctan(x)\right)\,\mathrm{d}x\tag{3}\\
&=\int_0^1x\arctan\left(\frac{2(1-x^2)}{x(3-x^2)}\right)\,\mathrm{d}x\tag{4}\\
&=\int_0^1\frac{x^2}{2}\frac{\frac{2(3+x^4)}{x^2(3-x^2)^2}}{1+\left(\frac{2(1-x^2)}{x(3-x^2)}\right)^2}\,\mathrm{d}x\tag{5}\\
&=\int_0^1\frac{x^2(3+x^4)}{x^2(3-x^2)^2+4(1-x^2)^2}\,\mathrm{d}x\tag{6}\\
&=\int_0^1\left(1-\frac1{2(1+x^2)}+\frac{5x^2-4}{2(x^4-3x^2+4)}\right)\,\mathrm{d}x\tag{7}\\
&=1-\frac\pi8+\int_0^1\frac14\left(\frac{\sqrt7x-2}{x^2-\sqrt7x+2}-\frac{\sqrt7x+2}{x^2+\sqrt7x+2}\right)\,\mathrm{d}x\tag{8}\\
&=1-\frac\pi8+\int_0^1\frac{\sqrt7}{8}\left(\frac{2x-\sqrt7}{x^2-\sqrt7x+2}-\frac{2x+\sqrt7}{x^2+\sqrt7x+2}\right)\,\mathrm{d}x\\
&+\int_0^1\frac32\left(\frac1{(2x-\sqrt7)^2+1}+\frac1{(2x+\sqrt7)^2+1}\right)\,\mathrm{d}x\tag{9}\\
&=1-\frac\pi8+\frac{\sqrt7}{8}\log\left(\frac{3-\sqrt7}{3+\sqrt7}\right)\\
&+\frac34(\arctan(2-\sqrt7)+\arctan(2+\sqrt7))\tag{10}\\
&=1+\frac\pi{16}+\frac{\sqrt7}{8}\log(8-3\sqrt7)\tag{11}
\end{align}
$$
Justification:
$\ \;(1)$: get limits from the problem
$\ \;(2)$: change variables $y\mapsto xy$
$\ \;(3)$: integrate in $y$
$\ \;(4)$: combine arctans
$\ \;(5)$: integrate by parts
$\ \;(6)$: algebra
$\ \;(7)$: partial fractions
$\ \;(8)$: integrate and partial fractions
$\ \;(9)$: separate into easily integrable pieces
$(10)$: integrate
$(11)$: simplify: $\quad\frac{3-\sqrt7}{3+\sqrt7}=8-3\sqrt7\quad$ and $\quad\arctan(2-\sqrt7)+\arctan(2+\sqrt7)=\frac\pi4$  
</s>