Find Derivative of f(x) = arcsin(sin(x)) and graph it

A tutorial on how to find the first derivative of f(x) = arcsin(sin(x)) and graph f and f' for x in R.

Graphs of sin(x) and arcsin(sin(x))

Since the domain of f is R and sin(x) is periodic, then f(x) = arcsin(sin(x)) is also a periodic function.
As x increases from 0 to ?/2, sin(x) increases from 0 to 1 and arcsin(sin(x)) increases from 0 to ?/2. In fact for x in [0 , ?/2] arcsin(sin(x)) = x. As x increases from [?/2 , 3?/2], sin(x) decreases from 1 to -1 and arcsin(sin(x)) decreases from ?/2 to -?/2. As x increases from 3?/2 to 2?, sin(x) increases from -1 to 0 and arcsin(sin(x)) increases from 3?/2 to 2?.
Since sin(x) has a period of 2?, arcsin(sin(x)) also has a period of 2?. The graph below shows the graphs of arcsin(sin(x)) and sin(x) from 0 to 2?.

The graph below shows the graphs of arcsin(sin(x)) and sin(x) over 3 periods.

Domain of f: (-? , +?)
Range of f: [-?/2 , ?/2]

Derivative of f(x) = arcsin(sin(x)) and its Graph

f(x) is a composite function and the derivative is computed using the chain rule as follows: Let u = sin(x)
Hence f(x) = arctan(u(x))
Apply the chain rule of differentiation
f '(x) = du/dx d(arcsin(u))/du = cos(x) * 1 / √(1 - u^{2})
= cos(x) * 1 / (1 - sin^{2}(x))
= cos(x) / √(sin^{2}(x))
= cos(x) / | cos(x) |
Below is shown arcsin(sin(x)) in red and its derivative in blue. Note that the derivative is undefined for values of x for which cos(x) = 0, which means at x = ?/2 + k*?, where k is an integer. For these same values of x, arcsin(sin(x)) has either a maximum value equal to ?/2 or a minimum value equal to -?/2.
Note that although arcsin(sin(x)) is continuous for all values of x its derivative is undefined at certain values of x.