Compute $\iint_R \left|\cos(2x)-\cos(y)\right|\mathrm{d}x\mathrm{d}y$ I need help computing the following integral:
$$I = \iint_R \left|\cos(2x)-\cos(y)\right|\mathrm{d}x\mathrm{d}y$$
Where $R=[0,\pi]\times [0,\pi].$
I plugged this double integral in WA and I got $8$ as the result. Also I did it plotting $\cos(2x)-\cos(y)\geq 0$ and splitting the integral in intervals depending of the absolute value. My doubt is that I tried another way and it didn't work.
Consider that $\cos(2x)-\cos(y) = -2\sin\left(\left(\frac{2x+y}{2}\right)\right)\sin\left(\left(\frac{2x-y}{2}\right)\right)$ and the change of variables $u=\frac{2x+y}{2}, v = \frac{2x-y}{2}$. The absolute value of the jacobian determinant of this transformation is $1$. Also, given that $0 \leq x \leq \pi$ and $0 \leq y \leq \pi$, we can compute that $0 \leq \frac{2x+y}{2} = u \leq \frac{3 \pi}{2}$ and $-\frac{\pi}{2} \leq \frac{2x-y}{2}=v \leq \pi$. In that case, we will get that
$$I = \int_0^{\frac{3\pi}{2}} \int_{-\frac{\pi}{2}}^{\pi} \left|-2\sin(u)\sin(v)\right| \mathrm{d}v \mathrm{d}u$$
but the result of the last integral is $18$ according to WA.
What is wrong with this method?
 A: Your method has a flaw with respect to the integration domain in the $u-v$ plane.
It is correct that using the transformation $u=x+y/2$ and $v=x-y/2$ we have $x=(u+v)/2$ and $y=u-v$. Then, the Jacobian is $1$.
But the transformation of $R$ in the $x-y$ plane does not map to the rectangle in the $u-v$ plane that has line segments along the $u$ axis and $v$ axis.
Note that we have the following:
The vertices of the rectangle $R$ are located at $(0,0)$, $(0,\pi)$, $(\pi,0)$, and $\pi,\pi)$.
The segment from $(0,0)$ to $(\pi,0)$ in the $x-y$ plane transforms into the segment along $v=u$ from $(0,0)$ to $(\pi,\pi)$ in the $u-v$ plane.
The segment from $(\pi,0)$ to $(\pi,\pi)$ in the $x-y$ plane transforms into the segment along $v=2\pi-u$ from $(\pi,\pi)$ to $(3\pi/2,\pi/2)$ in the $u-v$ plane.
The segment from $(\pi,\pi)$ to $(0,\pi)$ in the $x-y$ plane transforms into the segment along $v=u-\pi$ from $(3\pi/2,\pi/2)$ to $(\pi/2,-\pi/2)$ in the $u-v$ plane.
The segment from $(0,0)$ to $(\pi,0)$ in the $x-y$ plane transforms into the segment along $v=-u$ from $(\pi/2,-\pi/2)$ to $(0,0)$ in the $u-v$ plane.
Can you set up the correct limits of integration in the $u-v$ plane now?
