(Different) derivatives of $f(x) = \arcsin\left(\left(5 x + 12 \sqrt{1-x^2}\right)/13\right)$ via two different substitutions? We have been given a function to differentiate:

$$f(x) =  \arcsin \left(\frac{5x + 12\sqrt{1-x^2}}{13}\right)$$

My teacher told me the method to substitute $ x= \sin\vartheta$ which would simplify the argument of $\arcsin$ to $$\frac{5}{13}\sin \vartheta + \frac{12}{13}\cos \vartheta $$ and further into $\sin(\vartheta + \alpha)$ where $ \alpha =  \arctan\left(\frac{12}{5}\right)$ therefore the function gets reduced into $f(x) =  \arctan\left(\frac{12}{5}\right) + \arcsin(x)$ giving $$f'(x) =  \frac{1}{\sqrt{1-x^2}}$$. However when I substitute $x = \cos\vartheta $, the argument reduces to : $$\frac{5}{13}\cos\vartheta + \frac{12}{13}\sin\vartheta$$ and further into $\sin(\alpha + \vartheta)$ where $\alpha =  \arctan\left(\frac{5}{12}\right)$ but this time the function gets reduced to $$f(x) =  \arctan\left(\frac{5}{12}\right) + \arccos(x)$$
thus $$f'(x) =  \frac{-1}{\sqrt{1-x^2}}$$ Hence we obtain two different derivatives for the same function and I cannot understand why. I tried plotting the argument and different simplification and got that they are not always equal but cannot figure out the reason.
 A: You are right up to the point 
$$f(x)=\arcsin[\sin(\theta +\alpha)],\>\>\>\>\>\theta \in [-\frac\pi2, \frac\pi2],\> \alpha =\arctan\frac{12}5$$
Note that the range of $f(x)=\arcsin()\in [-\frac\pi2, \frac\pi2]$ and 
$$\theta+\alpha \in [-\frac\pi2+\alpha, \frac\pi2+\alpha]$$
is outside the range for $ \theta>\frac\pi2-\alpha$, hence $f(x) \ne \theta+\alpha$. Instead,   for the subdomain $ \theta\in[\frac\pi2-\alpha, \frac\pi2]$, the expression $\theta+\alpha -\pi \in [-\frac\pi2, 0]$ is in the range and 
$$f(x) =\arcsin[\sin(\theta +\alpha)]
=-\arcsin[\sin(\theta +\alpha-\pi)]=-(\theta +\alpha-\pi)
$$
Therefore,
$$\begin{align}
& f(x)= \theta +\alpha , \>\>\>\>\> \theta\in [-\frac\pi2, \frac\pi2-\alpha)\\
& f(x)= -(\theta +\alpha-\pi), \>\>\>\>\> \theta\in [\frac\pi2-\alpha,\frac\pi2]\\
\end{align}$$
and, with $\sin(\frac\pi2-\alpha)= \frac5{13}$,
$$\begin{align}
& f’(x)=\theta’(x)= ( \arcsin x )’= \frac1{\sqrt{1-x^2}}, \>\>\>\>\> x\in [-1, \frac5{13})\\
& f’(x) =-\theta’(x)= -\frac1{\sqrt{1-x^2}}, \>\>\>\>\> x\in [\frac5{13},1]\\
\end{align}$$
i.e. it’s derivative has different function forms for the two sub domains. Similar analysis can be applied to the substitution $x=\cos \theta$, which leads to the same result above.
A: HINT.-$(5,12,13)$ is  a Pythagorean triple so what is the relation between $\arctan\left(\frac{12}{5}\right)$ and $\arctan\left(\frac{5}{12}\right)$?
A: I assume that the reason for the "paradox" was clarified already in comments, but possibly there is still a need to go a little bit deeper into details:
Your error has its root in the assumption:
$$
\arcsin(\sin x)=x.
$$
However the equality is valid only in the range $-\frac\pi2\le x\le \frac\pi2$ whereas the correct expression for all real $x$ is:
$$
\arcsin(\sin x)=(-1)^m\left(x-m\pi\right),\quad\text{with}\quad m=\left\lfloor\frac{x}\pi+\frac12\right\rfloor.\tag1
$$
In view of this the expression resulting from the substitution $x=\sin\vartheta$ reads:
$$\arcsin\left(\sin\left(\vartheta+\arcsin\frac{12}{13}\right)\right)=\begin{cases}
\frac\pi2-\arcsin\frac5{13}+\vartheta;& \vartheta\le \arcsin\frac{5}{13}\\
\frac\pi2+\arcsin\frac{5}{13}-\vartheta;& \vartheta\ge \arcsin\frac{5}{13}
\end{cases}
$$
or
$$
f(x)=\begin{cases}
\frac\pi2-\arcsin\frac5{13}+\arcsin x;& x\le\frac{5}{13}\\
\frac\pi2+\arcsin\frac{5}{13}-\arcsin x;& x\ge\frac{5}{13}.
\end{cases}
$$
Now it should be obvious that the derivative is discontinuous at $x=\frac5{13}$ taking the values
$$
f'(x)=\pm\frac1{\sqrt{1-x^2}},
$$
to the left and to the right from the point $x=\frac5{13}$. 
The same result will be obtained with the substitution $x=\cos\vartheta$ as well.
