Note that,
sin(pi/2+x)=sin(pi/2)cos(x)+cos(pi/2)cos(x),
sin(pi/2+x)=cos(x).
We see that,
cos(2x)=sin(pi/2+2x).
Due to the periodicity of sin(x) we have that sin(pi-x)=sin(x), and sin(x)=sin(x+2npi) with n in ZZ. (This can be seen from expanding sin(pi-x) using the sine addition formulae).
Define
f(x)="arcsin"(cos(2x)).
Then we have
f(x)="arcsin"(sin(pi/2+2x+2npi)).
Look at the function "arcsin"(x) pictured below.
graph{arcsin(x) [-10, 10, -5, 5]}
it takes in an argument between 0 and 1 and outputs the principle value of x in -pi/2<=x<=pi/2 that would make sin(x) output that value.
So, we have that pi/2+2x+2npi needs to be between -pi/2 and pi/2.
I.e.,
2x+pi(2n+1/2)< pi/2,
2x< pi(1/2-1/2-2n),
2x< -2npi,
x< -npi.
And,
2x+pi(2n+1/2)> -pi/2,
2x> -pi(1+2n),
x> -npi-1/2pi
As n is an arbitrary integer we can easily let n=-n and see that for (n-1/2)pi<x<npi that f(x)=2x+pi/2(1-4n).
Notice that for n in ZZ as we require this leaves some portions of f(x) undefined.
We can use sin(pi-x)=sin(x) and define f(x) as,
f(x) = "arcsin"(sin(pi-pi/2-2x-2npi)),
f(x)="arcsin"(sin(pi/2-2x-2npi)),
f(x)="arcsin"(sin(pi/2-2x+2npi)).
We need to solve the same inequalities as before,
pi/2-2x+2npi > -pi/2 gives x< pi/2+npi.
pi/2-2x+2npi < pi/2 gives x> npi.
Then we see that for npi < x < pi/2+npi, f(x)=-2x+pi/2(4n+1). Now f(x) is defined for all x.
Then,
f(x) = { (2x+pi/2(1-4n), (n-1/2)pi<=x<=npi), (-2x+pi/2(1+4n), npi<=x<=(n+1/2)pi) :} for n in ZZ.