<s>[INST] A question on differentiation : Let $$f(x)=\sin^{-1}(2x\sqrt{1-x^2})$$
I found out $f'(x)$ in three methods and got three different answers ! 
1) Putting $x=\cos\theta$, we get $f(x)=2\cos^{-1}x$, on differentiating this we get 
$$f'(x)=\frac{-2}{\sqrt{1-x^2}}$$
2) Putting $x=\sin\theta$, we get $f(x)=2\sin^{-1}x$, on differentiating we get 
$$f'(x)=\frac{2}{\sqrt{1-x^2}}$$
This is contradicting with the previous result that we arrived at by substituting $x=\cos\theta$. Can someone help me out with the correct solution for this problem!
 [/INST] One should, before starting differentiating, check where the expression is defined. The function $f$ is defined where $-1\le 2x\sqrt{1-x^2}\le1$, that is,
$$
4x^2(1-x^2)\le 1
$$
which is satisfied for all $x$. Thus the function $f$ is defined in $[-1,1]$ because of the square root.
Apply the chain rule; the derivative of $t\mapsto\arcsin t$ is $1/\sqrt{1-t^2}$; the derivative of $2x\sqrt{1-x^2}$ is
$$
2\left(\sqrt{1-x^2}+x\cdot\frac{-x}{\sqrt{1-x^2}}\right)
=\frac{2(1-2x^2)}{\sqrt{1-x^2}}
$$
For $t=2x\sqrt{1-x^2}$ we have
$$
1-t^2=1-4x^2(1-x^2)=1-4x^2+4x^4=(1-2x^2)^2
$$
so
$$
\frac{1}{\sqrt{1-t^2}}=\frac{1}{|1-2x^2|}
$$
and doing the product gives
$$
f'(x)=\frac{1}{|1-2x^2|}\frac{2(1-2x^2)}{\sqrt{1-x^2}}
=\begin{cases}
\frac{2}{\sqrt{1-x^2}} &\text{if $1-2x^2>0$}\\[2ex]
-\frac{2}{\sqrt{1-x^2}} &\text{if $1-2x^2<0$}
\end{cases}
$$
Thus your seemingly contradictory results are “explained”. The function is not differentiable where $x^2=1/2$.

You can use the derivative for simplifying the expression of $f$. For instance, when $-\frac{1}{\sqrt{2}}<x<-\frac{1}{\sqrt{2}}$, you know that
$$
f(x)=C_1+2\arcsin x
$$
and you can determine that $C_1=0$ by computing $f(0)=0$ and $2\arcsin0=0$. For $-1<x<-\frac{1}{\sqrt{2}}$, you have
$$
f(x)=C_2-2\arcsin x
$$
and computing in $-1$ tells $f(-1)=0$, $-2\arcsin(-1)=\pi$, so $C_2=-\pi$. For $\frac{1}{\sqrt{2}}<x<1$, again
$$
f(x)=C_3-2\arcsin x
$$
and $f(1)=0$, $-2\arcsin1=-\pi$, so $C_3=\pi$. Hence
$$
f(x)=\begin{cases}
-\pi-2\arcsin x & \text{for }x\in[-1,-1/\sqrt{2})\\
2\arcsin x & \text{for }x\in[-1/\sqrt{2},1/\sqrt{2}]\\
\pi-2\arcsin x & \text{for }x\in(1/\sqrt{2},1]
\end{cases}
$$
You can check that 
$$
-\pi-2\arcsin\frac{-1}{\sqrt{2}}=-\pi+\frac{\pi}{2}
=-\frac{\pi}{2}=2\arcsin\frac{-1}{\sqrt{2}}
$$
and
$$
\pi-2\arcsin\frac{1}{\sqrt{2}}=\pi-\frac{\pi}{2}=\frac{\pi}{2}
=2\arcsin\frac{1}{\sqrt{2}}
$$
confirming that $f$ is everywhere continuous.
</s>