inverse of a funtion I'm trying to calculate the inverse of the function:
$$y= \tan \left( \cos^{-1}  \frac{x}{x+2} \right)  $$
In my opinion it is $y=  \frac{2 \cos ( \tan^{-1} x )}{1-\cos ( \tan^{-1} x )}  $ but in my book it is reported :
$f(x)\begin{cases} -2\left( \frac{\sqrt{1+x^2}-1}{x^2} \right) &  x < 0\\
-1 & x = 0\\2 \left( \frac{\sqrt{1+x^2}+1}{x^2} \right) & x>0 \end{cases}$
Can someone explain me the passages?
 A: Hint
$$y= \tan\big[ \arccos(f(x)) \big]=\frac{\sqrt{1-f(x)^2}}{f(x)}$$  could help you.
A: Let's first see your solution,
$$f(x)=\tan \left( \cos^{-1} \frac{x}{x+2} \right) \\ f^{-1}(x)= \frac{2 \cos ( \tan^{-1} x )}{1-\cos ( \tan^{-1} x )} $$
Fo example, Consider $x=-1$, $f(0)= \tan \pi  = 0 $ , and by your result we do not get the same value. It can't be the inverse function anyway.
Assuming that you don't know much about inverse function,
You can read it here, I'll just use the facts.
For a relation to be a function, every element in domain must have only one image in the co-domain. Thus only bijective functions are invertible.
Usually, it is needed to first prove that the function is bijective or not. I'll skip that in this answer.

As you can see it's bijective, and the domain is restricted to $x \ge -1$ because $-1\le \frac{x}{x+2} \le 1$
$\cos^{-1} \left( \frac{x}{x+2} \right)$ can be written as $\tan^{-1}\left( \frac{2\sqrt{x+1}}{x} \right)$
So, $$ y=\tan \left( \cos^{-1} \frac{x}{x+2} \right)  \\ = \frac{2\sqrt{x+1}}{x} $$
Rearrange, and square both sides to remove the sqaure root, find the roots in terms of $x$.
The radical term can have both ($+$ and $-$) signs,
$$\pm \sqrt{b^2-4ac}$$
and to see which sign to use, it's best to see assume couple of values of $x$ and get the value(s) of $y$ from the original function, and see which sign satisfies that relation, in the inverse function.
Like $f(-1)=0$ so $f^{-1}(0)=-1$ must hold true.
Be careful when dealing with squares or square roots, because they can have restrictions, hence the function is piecewise. It is easier to that by looking at the graph, though in an exam you won't have it. It's useful to check  the domain, and where your function is negative, positive, zero

EDIT:   for converting one Inverse trigonometric function to another Inverse trigonometric function, quickly, see the triangle, in yoir case, let $$ \theta =cos^{-1}\left(\frac{y}{1} \right) \\ \cos \theta =y$$ here, adjacent side, $BC=y$ and hypotenuse is $1$ , find out the other side by Pythagoras theorem, $AB=\sqrt{1-y^2}$
now you have
All three sides, you can find any trigonometric ratio, by their basic definition. for example,  $\sin \theta = \frac{AB}{AC} =\frac{\sqrt{1-y^2}}{1}$ $$ \theta = \sin^{-1}(\sqrt{1-y^2})$$ or $$cos^{-1}(y)=\sin^{-1}(\sqrt{1-y^2})$$

