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?
 A: 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.
A: It's been a few months and I think I finally understood it,

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? $\tag{0}$

All things can be made good by explicitly defining the domain of substitution and working in explicit function arguments. Notice that when we say, $ x = \tan \phi$ , what we are really saying is that::
$$ x( \phi) = \tan \phi$$
We parameterize $x$ as some function of $\phi$ when undoing the substitution we have to find $\phi(x)$ i.e: the inverse of the mentioned map. To make things easy, let's say we consider $\phi$ to be in $\left[ - \frac{\pi}{2}, \frac{\pi}{2} \right]$, it is clear that that $x(\phi)$ is bijective... but this can't work... why?
Well remember than the range of the sine inverse is meant to be  $\left[- \frac{\pi}{2}, \frac{\pi}{2} \right]$, in case where $\phi = \frac{\pi}{2}$, we get get:
$$ \sin^{-1}( \lim_{x \to \infty} \frac{2x}{1+x^2}) \overset{x(\phi) = \tan \phi}{=} 2\phi=2 \frac{\pi}{2} = \pi $$
This is not really the sine inverse we know of.. maybe it could be some cousin of sine inverse.
Similar issues for when $ \phi \in [0, \pi]$... so it seems there are not direct answers. However, we can fix this restricting ourselves by only talking about the portion of the mapping :
$$ \phi(x) :  \left[ -\infty,\infty \right] \to \left[ - \frac{\pi}{4} , \frac{\pi}{4} \right] \tag{1}$$
i.e : keep $\phi \in \left[ -\frac{\pi}{4} , \frac{\pi}{4} \right]$
In this case, $ 2 \phi$ is still in $ \frac{\pi}{2}$.. which is the behaviour we except for $\sin x$
Now, here is another question can we relate $ 2 \tan^{-1} (x)$ and $ \sin^{-1} \frac{2x}{1+x^2}$ when for the rest of the real line? As you may expect from Lisbon's answer, yes, yes you can... but how?
Let's just work with $\tan^{-1} (x)$ for simplicity, for $x>1$, we have map:
$$ [ 1 , \infty ] \to  \left[  \frac{\pi}{4}, \frac{\pi}{2}\right]$$
And the mapping for $\sin^{-1} \frac{2x}{1+x^2}$ is:
$$ [1, \infty] \to \left[ \frac{\pi}{4} , \frac{\pi}{2}\right]$$
So... what's the problem now? Notice that at $x=1$ tan inverse takes $ \frac{\pi}{4}$ and sine inverse (referring to the one with the arguement of $\frac{2x}{1+x^2} $of course) takes $ \frac{\pi}{2}$. The issue is that sine inverse starts from the finish line and the tan inverse from the start. To fix this, make sine inverse start from the finish line:
$$ \tan^{-1} (x) = \frac{\pi}{2} - \frac{\sin^{-1} ( \frac{2x}{1+x^2})}{2}$$
A doubt is if both runners are actually running with equal speed, to answer that I simply point with my finger to equation (1) and (0)
