Prove that a function $f:\mathbb R \to\mathbb R$ given by $f(x) = x\left|x\right|$ is a bijection So I know in order to prove a function is bijective, you need to prove that it is both injective and surjective. I know that to prove it is an injection, I need to make $f(x) = f(y)$, and try to get $x=y$ from that, but I can't seem to manipulate the equations to do so. 
Also, how would I prove that this is surjective? 
 A: Note that $|f(x)|=x^2$. Also note that $f(-x)=-f(x)$.
Assume $f(x)=f(y)$. Then $|f(x)|=|f(y)|$, so $x^2=y^2$ and $x=y$ or $x=-y$. In the latter case, $f(y)=-f(x)$, so $f(x)=f(y)=0$, which means $x=y=0$.
Let $y\in\Bbb R$ be given. If $y\ge 0$ then $y=f(\sqrt y)$. If $y<0$ then $y=f(-\sqrt{-y})$.

Possibly simpler alternative: Show that $f$ is a bijection $[0,\infty)\to [0,\infty)$, and also a bijection $(-\infty,0)\to(-\infty,0)$.
A: $$\text{Suppose } x\left| x \right| = y\left| y\right|. \tag 1$$
Either $x\ge0$ or $x<0.$
If $x\ge0$ then we cannot have $y<0$ since then one side of line $(1)$ would be positive and the other negative. So we would have $y\ge0.$ But if $x\ge0$ and $y\ge 0$ then $x\left|x\right| = x^2,$ and similarly we have $y\left|y\right|=y^2.$ So we have $x^2 = y^2.$ That means $x=\pm y,$ but they're both $\ge 0.$ So $x=y.$
That's if $x\ge0.$ Now figure out what happens if $x<0.$
A: It has the inverse function
$$ g(x) = \begin{cases} x/\lvert x \rvert^{1/2} & x \neq 0 \\ 0 & x=0 \end{cases}. $$
