integral of $\arcsin(\sin(x))$ I'm having trouble with this integral
$$\int\arcsin(\sin x)\,\mathrm dx$$
The problem is with the intervals of definition for each function :/ if someone could dumb it down for me.   


*

*$\arcsin\colon [-1, 1] \to [-\pi/2, \pi/2]$.  

*$\sin:\mathbb{R}\to [-1, 1]$.


right?
But what about $\arcsin(\sin x)$ ?
 A: My previous hint was a bit misleading - hence here is a (the comments are still appropriate)
CORRECTED HINT 
On $I= [-\pi/2,\pi/2]$ the sine function grows from $\sin(-\pi/2)=-1$ to $\sin(\pi/2)=1$, hence it is invertible on $I$. The inverse, $\arcsin$, is defined on $[-1,1]$ and has the property $\arcsin(\sin x) = x$ if $-\pi/2\le x\le \pi/2$.
Since $\sin$ is $2\pi$-peiodic we must have $\arcsin(\sin (x+2n\pi))=\arcsin(\sin(x))$ for all $x$ and integers $n$. 
Hence it is sufficient to understand $\arcsin(\sin x)$ for $\pi/2\le x\le 3\pi/2$, to achieve that use $\sin(x+\pi)=\sin (-x)$.
When you see the function there will be not problem to perform any integration.
A: Since $\sin(x)$ can take $ \mathbb R$ and outputs $[-1, 1]$ and $\arcsin(x)$ can take $[-1, 1]$ and output $[-\pi/2, \pi/2]$ , then it stands to reason that the constraints for $\arcsin(\sin(x))$ would be $\mathbb R \rightarrow [-\pi/2, \pi/2]$.
A: Let's have $f(x)=\arcsin(\sin(x))$ and calculate $\displaystyle F(x)=\int_0^x f(t)dt$
Since $f$ is $2\pi-$periodic and $F(2\pi)=0$ by symetry, we have that $F$ is $2\pi-$periodic too.

The idea to introduce $s(x)=\operatorname{sgn}(\cos(x))$ will be useful to find a closed form.
$F(x)=x\arcsin(\sin(x))-\frac{s(x)}2x^2+C(x)$ 
In fact his formula is correct on $1$ period interval under the condition that we assign a constant value for $C(x)$ in each of the $3$ intervals described below. 

But I'll propose a slightly different form : $F(x)=s(x)(\frac 12f(x)^2)+B(x)$ where $B(x)$ is piecewise constant too, but zero on two of the intervals. 
Under this form the periodicity of $F$ is more obvious knowing that $f$ is periodic.

$\displaystyle x\in[0,\frac{\pi}{2}];\quad F(x)=\int_0^x tdt=\frac {x^2}2$
$\displaystyle x\in[\frac{\pi}{2},\frac{3\pi}{2}];\quad F(x)=F(\frac{\pi}2)+\int_{\frac\pi2}^x (\pi-t)dt=\frac {\pi^2}8+\bigg[\pi t-\frac{t^2}2\bigg]_{\frac{\pi}2}^x=\pi x-\frac{x^2}2-\frac{\pi^2}4$
$\displaystyle x\in[\frac{3\pi}{2},2\pi];\quad F(x)=F(\frac{3\pi}2)+\int_{\frac{3\pi}2}^x (t-2\pi)dt=\frac {\pi^2}8+\bigg[\frac{t^2}2-2\pi t\bigg]_{\frac{3\pi}2}^x=\frac{x^2}2-2\pi x+2\pi^2$

$\begin{cases}
x\in[0,\frac{\pi}{2}] & f(x)=x & s(x)=+1 & \frac 12s(x)f(x)^2=\frac {x^2}2 & B(x)=0\\ 
x\in[\frac{\pi}{2},\frac{3\pi}{2}] & f(x)=\pi-x & s(x)=-1 & \frac 12s(x)f(x)^2=-\frac{\pi^2}2+\pi x-\frac {x^2}2 & B(x)=\frac{\pi^2}4\\ 
x\in[\frac{3\pi}{2},2\pi] & f(t)=x-2\pi & s(x)=+1 & \frac 12s(x)f(x)^2=\frac{x^2}2-2\pi x+2\pi^2 & B(x)=0\\ 
\end{cases}$
Now if we consider $\displaystyle \frac{1-s(x)}2=\chi_{[\frac{\pi}{2},\frac{3\pi}{2}]+2k\pi}$ then $B(x)=\big(\frac{1-s(x)}2\big)\frac{\pi^2}4$
Finally a simplified closed form for $F(x)$ can be given by :

$\displaystyle \int_0^x \arcsin(\sin(t))dt=\frac{\pi^2}8+\operatorname{sgn}(\cos(x))\bigg(\frac{\arcsin(\sin(x))^2}2-\frac{\pi^2}8\bigg)$

