<s>[INST] What is $\arcsin(\cos{x})$ (Spivak Calculus exercise 15-18)? In the first part of the exercise I proved that $\sin(x+\frac{\pi}2)=\cos{x}$.
The second part is asking what $\arcsin(\cos{x})$ is. Presumably, they want a rule for unrestricted $x$.
We have $\arcsin(\cos{x})=\arcsin(\sin(x+\frac{\pi}2))$. It was said that the domain of $\sin$ usually restricted to $\left[-\frac{\pi}2, \frac{\pi}2\right]$, hence I assume that $x+\frac{\pi}2 \in \left[-\frac{\pi}2, \frac{\pi}2\right]$, and this set is also the co-domain of the $\arcsin$ function.
Since $\sin$ is periodic with period $2\pi$, $\sin(x+\frac{\pi}2)=\sin(2k\pi+x+\frac{\pi}2)$, $2k\pi+x+\frac{\pi}2 \in \left[2k\pi-\frac{\pi}2, 2k\pi+\frac{\pi}2\right], k \in \mathbb{Z}$.
And we have that $\arcsin(\sin(2k\pi+x+\frac{\pi}2))=2k\pi+x+\frac{\pi}2$.
But the answer in the solutions manual is $\begin{cases} x-2k\pi+\frac{\pi}2, x \in \left[2k\pi-\pi, 2k\pi\right] \\ 2k\pi+\frac{\pi}2-x, x \in \left[2k\pi, 2k\pi+\pi\right] \end{cases}$
I can plot the graph and see how $2k\pi+x+\frac{\pi}2$ doesn't work, but where did they get this piecewise function?
 [/INST] here's my solution based on @YvesDaoust's answer:
$\cos{x}=\sin\left({x}+\frac{\pi}2\right), x \in R$, hence $\arcsin(\cos(x)) = \arcsin\left(\sin\left({x}+\frac{\pi}2\right)\right)$
The co-domain of $\arcsin$ is $[-\frac{\pi}2,\frac{\pi}2]$, and we must restrict the domain of $\sin$ to the same interval, there are 2 cases, in therms of our $\sin(x+\frac{\pi}2)$:
Case 1: $x+\frac{\pi}2 \in [2k\pi-\frac{\pi}2, 2k\pi+\frac{\pi}2]$
Subtract $2k\pi$, $x+\frac{\pi}2-2k\pi \in [-\frac{\pi}2,\frac{\pi}2]$, moreover $\sin(x+\frac{\pi}2)=\sin(x+\frac{\pi}2-2k\pi)$, hence  $\arcsin(\cos(x))=x+\frac{\pi}2-2k\pi$ when $x \in [2k\pi-\pi, 2k\pi]$.
Case 2: $x+\frac{\pi}2 \in [2k\pi+\frac{\pi}2, 2k\pi+\frac{3\pi}2]$
$\pi-(x+\frac{\pi}2) \in [\pi-2k\pi-\frac{3\pi}2, \pi-2k\pi-\frac{\pi}2]=[-2k\pi-\frac{\pi}2, -2k\pi+\frac{\pi}2]$
Add $2k\pi$ to get the desired interval:
$\pi-(x+\frac{\pi}2)+2k\pi = \frac{\pi}2+2k\pi-x \in [-\frac{\pi}2, \frac{\pi}2]$
</s>