# Order of integration - Region bounded by trigonometric functions

Consider the following integral:

$$\int_{\frac{\pi}{4}}^{\frac{5\pi}{4}}\int_{\cos(x)}^{\sin(x)}dydx = \int_{\frac{\pi}{4}}^{\frac{5\pi}{4}}\left(\sin(x)-\cos(x)\right)dx=\left[-\cos(x)-\sin(x)\right]_{\frac{\pi}{4}}^{\frac{5\pi}{4}}=2\sqrt{2}$$

I would like like to switch the order of integration. I have broken the region bounded by the trig functions into 5 subregions in order to avoid integrating across an interval that splits any particular definition for the inverse functions. I know some symmetry could help simplify the calculations but does not help with my misunderstanding:

1) $\arccos(y)\leq x\leq\arcsin(y)\qquad -\frac{1}{\sqrt{2}}\leq y \leq \frac{1}{\sqrt{2}}\qquad$ $y$ is decreasing

2) $\arcsin(y)\leq x\leq \frac{\pi}{2} \qquad \frac{1}{\sqrt{2}}\leq y\leq 1\qquad$ $y$ is increasing

3) $\frac{\pi}{2}\leq x\leq\arcsin(y) \qquad \frac{1}{\sqrt{2}}\leq y \leq 1\qquad$ $y$ is decreasing

4) $\arccos(y)\leq x\leq \pi \qquad -1\leq y\leq-\frac{1}{\sqrt{2}}\qquad$ $y$ is decreasing

5) $\pi\leq x\leq\arccos(y)\qquad -1\leq y\leq-\frac{1}{\sqrt{2}}\qquad$ $y$ is increasing

Working through this problem I have tried to reason by looking at increasing or decreasing $y$ in terms of increasing $x$. This seems to work in all regions but 4) and 5). There is a sign change that I cannot account for. So I have the following corresponding integrals for the $dxdy$ integration order:

1) $\int_{\frac{1}{\sqrt{2}}}^{\frac{-1}{\sqrt{2}}}\int_{\arccos(y)}^{\arcsin(y)}dxdy = \frac{\pi}{\sqrt{2}}$

2) $\int_{\frac{1}{\sqrt{2}}}^{1}\int_{\arcsin(y)}^{\frac{\pi}{2}}dxdy = \frac{1}{\sqrt{2}}-\frac{\pi}{4\sqrt{2}}$

3) $\int_{1}^{\frac{1}{\sqrt{2}}}\int_{\frac{\pi}{2}}^{\arcsin(y)}dxdy = \frac{1}{\sqrt{2}}-\frac{\pi}{4\sqrt{2}}$

4) $\int_{\frac{-1}{\sqrt{2}}}^{-1}\int_{\arccos(y)}^{\pi}dxdy = -\left(\frac{1}{\sqrt{2}}-\frac{\pi}{4\sqrt{2}}\right)$

5) $\int_{-1}^{\frac{-1}{\sqrt{2}}}\int_{\pi}^{\arccos(y)}dxdy = -\left(\frac{1}{\sqrt{2}}-\frac{\pi}{4\sqrt{2}}\right)$

Integrals 4 and 5 evaluate to minus their respective areas. I'm a bit confused as to the reasoning.

I think i finally got this one. The bounded region under consideration crosses over the domain of definition for both the $\arcsin(y)$ and $\arccos(y)$. The standard domain of definition for these functions is:

$-\frac{\pi}{2}\leq arcsin(y)\leq\frac{\pi}{2}\qquad0\leq\arccos(y)\leq\pi$

The way I finally realized what was happening here was by investigating the graph of the inverse functions on their standard domains and asking myself the following question:

How can I continuously extend the graph of these inverses to include the bounded region?

From this, one sees that multiplying the $\arcsin(y)$ by -1 and adding $\pi$ provides a continuous extension that covers the bounded region. Likewise for $\arccos(y)$ multiply by -1 and add $2\pi$. With this insight, the region can be broken into 3 subregions:

1) $\arcsin(y)\leq x\leq\pi-\arcsin(y)\qquad \frac{1}{\sqrt{2}}\leq y\leq1$

2) $\arccos(y)\leq x\leq\pi-\arcsin(y)\qquad \frac{-1}{\sqrt{2}}\leq y\leq\frac{1}{\sqrt{2}}$

3) $\arccos(y)\leq x\leq2\pi-\arccos(y)\qquad -1\leq y\leq\frac{-1}{\sqrt{2}}$

The area of the bounded region follows from integrating over these 3 subregions.

-
In integral 4, you have the lower limit of integration on $y$ greater than the upper limit of integration. This causes a multiplication by -1 of the area. For integral 5, arccos(y) is always less than $\pi$, so the inner integral has its limits of integration reversed from usual, again multipying area by -1. –  coffeemath Nov 1 '12 at 2:47
yeah, so in integral 4 you see the problem, in integral 5 the curve I am integrating up to is not $\arccos(y)$ but $2\pi-\arccos(y)$. This problem has been quite the struggle!! –  JEM Nov 1 '12 at 2:53
Does it work out now? I looked at the region and found it was somewhat simple in the $y$ direction, always needing only one "slice", but requiring I think three integrals, for the pieces above $1/\sqrt{2}$, below the negative of that, and in between. –  coffeemath Nov 1 '12 at 3:00
Yeah, using the 3 regions at the end of the post and integrating in the order $dxdy$ works out. Lower to higher outer limits of integration in all three cases. –  JEM Nov 1 '12 at 3:03

I don't think the given $x$-intervals are correct. E.g., on the sine curve the points with $x>{\pi\over2}$ don't satisfy $x=\arcsin(y)$. I would also strongly suggest to consider $y$ as an increasing variable throughout in order to avoid sign errors. But let's start at the beginning.
The considered integral ($=: J$) is over the domain $$B:=\bigl\{(x,y)\ \bigm|\ {\pi\over4}\leq x\leq{5\pi\over4},\ \cos x\leq y\leq\sin x\bigr\}$$ in the $(x,y)$-plane, see the following figure:
Changing the order of integration means making $y$ the outer variable. The outer integral is over the $y$-interval bounded by $\min\{y\ |\ \exists x:\ (x,y)\in B\}$ and $\max\{y\ |\ \exists x:\ (x,y)\in B\}$, i.e., over the interval $[{-1},1]$. For each $y$ in this interval we have to determine the set $$B_y:=\{ x\ |\ (x,y)\in B\}$$ obtained by intersecting $B$ with a horizontal line at level $y$. The figure shows that all sets $B_y$ are intervals and so are determined by their endpoints $a(y):=\min B_y$ and $b(y):=\max B_y$.
Looking a the figure we see that there are in fact three regimes for the functions $a(y)$ and $b(y)$, corresponding to the $y$-intervals $\bigl[{-1},-{1\over\sqrt{2}}\bigr]$, $\ \bigl[{-{1\over\sqrt{2}}},{1\over\sqrt{2}}\bigr]$, and $\bigl[{1\over\sqrt{2}},1\bigr]$. Being careful about the domains of the inverse trigonometric functions we obtain the following: \eqalign{ -1\leq y\leq-{1\over\sqrt{2}}: \qquad &a(y)=\arccos(y),\quad b(y)=2\pi-\arccos(y), \cr -{1\over\sqrt{2}}\leq y\leq{1\over\sqrt{2}}: \qquad &a(y)=\arccos(y),\quad b(y)=\pi-\arcsin(y), \cr {1\over\sqrt{2}}\leq y\leq1: \qquad &a(y)=\arcsin(y),\quad b(y)=\pi-\arcsin(y) \ .\cr} It follows that the integral $J$ now becomes the following sum of three integrals: $$J=\int_{-1}^{-1/\sqrt{2}}\int_{\arccos(y)}^{2\pi-\arccos(y)} dx\ dy +\int_{-1/\sqrt{2}}^{1/\sqrt{2}}\int_{\arccos(y)}^{\pi-\arcsin(y)} dx\ dy + \int_{1/\sqrt{2}}^1\int_{\arcsin(y)}^{\pi-\arcsin(y)} dx\ dy \ .$$