Why can't I change order of integration when computing double integral? 
$$m=\int_{sinx}^{cosx}\int_0^{\pi/4}ydxdy\\=\int_{sinx}^{cosx}\left.yx\right|_{x=0}^{x=\pi/4}dy\\=\int_{sinx}^{cosx}\frac{\pi y}{4}dy\\=\frac{\pi(cos^2x-sin^2x)}{8}$$
Shouldn't you get the same answer regardless of order? That intuitively makes sense. Why does this not work?
 A: As I can see the region above, we can set the following double integrals:
$$m=\int_{y=0}^{\sqrt{2}/2}ydy\int_0^{x=\cos^{-1}y}dx+\int_{y=\sqrt{2}/2}^1ydy\int_0^{x=\sin^{-1}y}dx$$ But existing the arc functions make your approach easier, as you can see above in the fig? However the inner integrals with respect to $y$ can be solved by using the integration by parts.
A: Since $\sin(x)\le y\le\cos(x)$, we have $x\le\sin^{-1}(y)$ and $x\le\cos^{-1}(y)$ (cos is decreasing). Thus, changing the order of integration gives
$$
\begin{align}
\int_0^{\pi/4}\int_{\sin(x)}^{\cos(x)}y\,\mathrm{d}y\,\mathrm{d}x
&=\int_0^1\int_0^{\min\left(\sin^{-1}(y),\cos^{-1}(y)\right)}y\,\mathrm{d}x\,\mathrm{d}y\\
&=\int_0^{1/\sqrt2}\int_0^{\sin^{-1}(y)}y\,\mathrm{d}x\,\mathrm{d}y
+\int_{1/\sqrt2}^1\int_0^{\cos^{-1}(y)}y\,\mathrm{d}x\,\mathrm{d}y\\
&=\int_0^{1/\sqrt2}\sin^{-1}(y)y\,\mathrm{d}y
+\int_{1/\sqrt2}^1\cos^{-1}(y)y\,\mathrm{d}y\\
&=\int_0^{\pi/4}u\sin(u)\,\cos(u)\mathrm{d}u
+\int_0^{\pi/4}u\cos(u)\,\sin(u)\mathrm{d}u\\
&=\int_0^{\pi/4}u\sin(2u)\,\mathrm{d}u\\
&=\left[-\frac u2\cos(2u)\right]_0^{\pi/4}+\frac12\int_0^{\pi/4}\cos(2u)\,\mathrm{d}u\\
&=0+\frac12\left[\frac12\sin(2u)\right]_0^{\pi/4}\\
&=\frac14
\end{align}
$$
