<s>[INST] Piecewise equivalence of trigonometric inverses In this website, it is a theorem that:
$$ 2 \tan^{-1}(x)=  \begin{cases} \sin^{-1} \frac{2x}{1+x^2}, x \in [-1,1] \cr
 \pi-\sin^{-1} \frac{2x}{1+x^2}, x >1 \cr -\pi - \sin^{-1} \frac{2x}{1+x^2}, x<1  \end{cases}$$
Why is there such a piecewise definition? I considered proving equivalence of tan inverse and sine inverse and I was only able to achieve the first definition.

My proof:
We begin with $ \sin^{-1} \frac{2x}{1+x^2}$ , substitute $ x = \tan \phi$ , the previous result simplfies as $ \sin^{-1} ( 2 \tan \phi \cos^2 \phi) = \sin^{-1} ( 2 \sin \phi \cos \phi) = 2 \phi = 2\tan^{-1} (x)$.  Where is my mistake?
 [/INST] The arcsine function, $\arcsin : [-1,1] \to [-\frac \pi 2, \frac \pi 2]$ ($\color{red}{\mathit{note\ the \  codomain}}$ , and the function is often written as $\sin^{-1}$ but I prefer $\arcsin$) is defined as follows : if $a \in [-1,1]$ we can find a unique $x \in [-\frac \pi 2, \frac \pi 2]$ such that $\sin x  =a$. We let $x = \arcsin a$.
Since there may be many $x$ such that $\sin x = a$, it is important to specify the codomain of the arcsine, so that we need not worry about multiple values.
Similarly, $\arctan : \mathbb R \to (-\frac \pi 2, \frac \pi 2)$ is defined as : for $a \in \mathbb R$ there is a unique $-\frac \pi 2 < x <\frac \pi 2$ with $\tan x =a$. We let $x = \arctan a$.
Now, we must prove the given statement. First of all, note that $-1\leq \frac{2x}{1+x^2} \leq 1$ for all values of $x$, so certainly $\arcsin \frac{2x}{1+x^2}$ is defined.

Now let $x \in \mathbb R$ and $\phi = \arctan x$ so that $x = \tan \phi$. Note that $-\frac \pi 2 < \phi < \frac \pi 2$. The argument you make shows that $$
\frac{2x}{1+x^2} = \sin 2 \phi
$$
and therefore, $$
\arcsin\left(\frac{2x}{1+x^2}\right) = \arcsin(\sin 2 \phi)
$$
Now, we would like to simplify the RHS. For this, we cannot simply cancel out the two functions, because of codomain issues.
For example, let $x = 2$. Then the LHS is $\arcsin \frac 45 = 53.13^\circ$. On the RHS : we have $\phi = \arctan 2 = 63.43^\circ$ so $2 \phi = 126.86^\circ$. So clearly, $LHS \neq 2 \phi$ always, which is what one would have expected if one could cancel the $\sin$ and $\arcsin$.
In fact, we have $\arcsin(\sin 2 \phi) = \theta$ where $\theta$ is the unique angle in $[-\frac \pi 2, \frac \pi 2]$ such that $\sin 2 \phi = \sin \theta$. Then we can write $\arcsin(\frac{2x}{1+x^2}) = \theta$. Now, we need the dependence between $2 \phi$ and $\theta$.
For this, note that the points of problem are those where the codomain breaks. For example at $\phi = \frac \pi 4$, we have $2 \phi = \frac \pi 2$ which is still in the $\arcsin$ codomain. Take $\phi$ a little higher and that is lost. So the relation between $\phi$ and $\theta$ is expected to change at the point $\frac \pi 4$, and similarly at $\phi = \frac {-\pi}4$ as well, for the lower end of the codomain breaks then.
So we can break into three cases depending upon these break points :

*

*If $2 \phi \in [-\frac \pi 2 , \frac \pi 2]$ then of course $\theta = 2 \phi$.


*If $2\phi \in (\frac \pi 2 , \pi]$ then $\sin(\pi - x) = \sin x$ gives $\sin(\pi - 2\phi) = \sin 2 \phi$ so $\theta = \pi - 2\phi$ (which lies in the codomain).


*If $2 \phi \in [-\pi , -\frac \pi 2)$ then $\sin(-\pi-x) = -\sin(\pi + x) = \sin x$ so $\sin(-\pi - 2\phi) = \sin(2 \phi)$, and hence $\theta = -\pi - 2 \phi$.
Now, we need to express $\theta$ in terms of $x$, not $\phi$, and the break needs to be in terms of $x$. From our usual trigonometry relations, we know that $x>1, x<1,x \in [-1,1]$ if and only if $2 \phi > \frac \pi 2 , 2\phi < - \frac \pi 2, 2\phi \in [-\frac \pi 2, \frac \pi 2]$ respectively.
Therefore, we get :

*

*If $-1 \leq x \leq 1$ then $\arcsin\left(\frac{2x}{1+x^2}\right) = 2 \phi$.


*If $x>1$ then $\arcsin\left(\frac{2x}{1+x^2}\right) =\pi- 2 \phi$.


*If $x<1$ then $\arcsin\left(\frac{2x}{1+x^2}\right) =-\pi- 2 \phi$
Bring $2\phi$ to one side in each of these equations makes it the subject of the equation, and you have the definition given by the website. So the piecewise nature of the definition reflects the breaks in the arcsin codomain which can only be compensated on a case-by-case basis.
</s>