How to graph the function $y = \arccos(\sin x)$?

Below is my wrong solution:

By the formula $$\arccos x + \arcsin x = \pi / 2$$, for $$x \in [-1, 1]$$, I have

$$y = \frac{\pi}{2} - \arcsin(\sin x) \text{ (because \sin x \in [-1, 1])} \\ \implies y = \frac{\pi}{2} - x, \ \text{for x \in R}$$

But the correct solution in my book is

May anyone tell me why I am wrong and how to solve the question?

• This is because $\color{red}{\arcsin(\sin x)=x}$ does not hold for all real values of $x$. In fact, it only holds for $x\in \left[-\pi/2,\pi/2\right]$. Some more discussion can be found here for example. – Minus One-Twelfth Feb 24 '19 at 3:30
• Here is a video that discusses how to graph $\arcsin(\sin x)$. – Minus One-Twelfth Feb 24 '19 at 3:36
• Opps! I made a stupid mistake. – Wang Wenjun Feb 24 '19 at 3:38

The problem is that $$\arcsin(x)$$ is not equal to $$x$$ for all $$x \in \mathbb R$$. This is because $$\arcsin$$ is defined as $$\arcsin : [-1,1] \to [-\pi/2,\pi/2]$$ You can see from here that $$\arcsin$$ can only have values from $$[-\pi/2, \pi/2]$$. But, the expression $$y=\frac{\pi}{2}-x$$ can have any real value.
What you need to do is to somehow restrict $$x$$ to the interval $$[-\pi/2,\pi/2]$$. You do this by adding a constant, but that constant depends on the interval $$I\subset \mathbb R$$ that you are analyzing.
Namely, we have $$(\arccos(\sin x))' = -\frac{\cos x}{\sqrt{1-\sin^2x}} = -\frac{\cos x}{|\cos x|} = -\text{sgn}(\cos x)$$ for $$\cos x \neq 0$$. Then, by integrating we get $$y(x)=\arccos(\sin(x)) = -\int\text{sgn}(\cos x)\ dx = -x\cdot\text{sgn}(\cos x) +C$$ Because $$\arccos'(\sin x)$$ is not defined for $$\cos x = 0$$ i.e. $$x=(k+\frac{1}{2})\pi$$, $$k\in \mathbb Z$$, this integral is not defined in those points. Keep in mind that this constant depends on the interval $$[(k+\frac{1}{2})\pi,(k+\frac{3}{2})\pi]$$ that you are considering. To find the constant for each interval, use the fact that $$y(x)$$ is continuous and find some characteristic points that you can easily evaluate the function at. In your specific problem, determine the constant such that $$-x_k\cdot\text{sgn}(\cos x_k) +C=0$$ where $$x_k = \frac{4k+1}{2}\pi$$