If $f\left(x\right)=-\frac{x\left|x\right|}{1+x^{2}}$ then find $f^{-1}\left(x\right)$ Q:

If $f\left(x\right)=-\frac{x\left|x\right|}{1+x^{2}}$ then find $f^{-1}\left(x\right)$

My approach:

*

*Dividing the cases when $x\ge0$ and when $x\le0$ to break free of modulus.

*Re-arranging the terms to get the expression of x in terms of y.

*Here's what I got:


When  $x\ge0$:
$$x=\sqrt{\frac{-y}{1+y}}$$ $$\to\ y\ ∈\ \left(-1,0\right] Now, y\to x$$
so, $f^{-1}\left(x\right)=\sqrt{-\frac{x}{1+x}}$ when $x\le0$


When $x\le0$:
$$x=-\sqrt{\frac{y}{1-y}}$$
when $y\ ∈\ \left[0.1\right)$ Now replacing $y\to x$
We get, $f^{-1}\left(x\right)=-\sqrt{\frac{x}{1-x}}\ ;\ x\ge0$

But I have to show that the inverse function $f^{-1}\left(x\right)$=$\operatorname{sgn}\left(-x\right)\sqrt{\frac{\left|x\right|}{1-\left|x\right|}}$
This is where I'm getting stuck. I am unable to convert my answer into this form, mainly because I'm not able to convert the cases into this expression. Is there any step-by-step systematic way in which I can do the same? Any help or guide will be greatly appreciated.
Edit:
Since we got $f^{-1}\left(x\right)$ and the cases,:
$f^{-1}\left(x\right)=-\sqrt{\frac{x}{1-x}}\ ;\ x\ge0$ and
$f^{-1}\left(x\right)=\sqrt{-\frac{x}{1+x}}$ when $x\le0$,
to write it in given form we need something that will give - sign when $x>0$ so we will use sgn(-x), and rest is just use of modulus so that we can make the general answer.
 A: The sign function is given by
$$\operatorname{sgn}(x)=\begin{cases}-1, \space\text{if}\space x<0\\ 0, \space\space\text{if}\space x=0\\1, \space\text{if}\space x>0\end{cases}$$
and the modulus of $x$ is given by
$$|x|=\begin{cases}x, \space\text{if}\space x\geq0\\ -x, \space\text{if}\space x<0\\\end{cases}$$
Thus the inverse can be written as
$$f^{-1}\left(x\right)=\operatorname{sgn}\left(-x\right)\sqrt{\frac{\left|x\right|}{1-\left|x\right|}}=\begin{cases}-\sqrt{\frac{x}{1-x}}, \space\text{if} \space x\geq0 \\ \sqrt{\frac{-x}{1+x}}, \space\text{if} \space x<0 \end{cases}$$
A: What you have done is correct. All you have to do is switch $x$ and $y$. You writing $f^{-1}(y)$ in terms of $y$ so change $y$ to $x$ to get $f^{-1}(x)$. Note that  $f(x)$ is positive precisely when $x$ is positive.
However you can also avoid considering the cases $x \geq 0$ and $x,$ by taking absolute values:
$|f(x)|=\frac {x^{2}} {1+x^{2}}$ which gives $|x|=\frac  1{\sqrt {1-|f(x)|}}$. Now calculate $x$ from $f(x)=-\frac {x|x|} {1+x^{2}}$.
