Show $f:\Bbb{R}\to\mathbb{R}$ given by $f(x)=2x\cdot |x|+3$ is injective and surjective.

Minor comment:

I notice that when $x \le 0$, for example, in case $2$, $x_1 \le 0$, you wrote

$$f(x_1) = -2x_1\cdot |-x_1|+3=-2x_1^2+3$$

which is techniquely correct.

even though I would evaluate it as follows:

$$f(x_1) = 2x_1|x_1|+3=2x_1(-x_1)+3=-2x_1^2+3$$

There is a mistake in your surjective part as you wrote

If $x\le 0, y=-2x\cdot -x + 3$

The statement is not true.

You might like to consider $y \ge 3$ and $y<3$ for your surjectivity proof.


$$f(x)=\begin{cases} 2x^2+3, & x \ge 0\\ -2x^2+3, & x<0 \end{cases}$$

Injectivity: It is alright to verify the $4$ cases as you did. Also note that $f$ increases on $[0, \infty)$ and increases on $[-\infty, 0]$, hence it is an increasing function on $(-\infty, \infty)$, hence we have injectivity.

Surjective: We have $f([0, \infty))= [3, \infty)$ and $f((-\infty, 0])=(-\infty, 3]$, hence it is surjective.