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

functionsproof-writingsolution-verification

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

Here's what I did:

Injective: Suppose $f(x_1)$ = $f(x_2)$. If $f$ is injective, then it must follow that $x_1$ = $x_2$.

Case 1) $x_1\ge 0$, $x_2\ge 0$

$f\left(x_1\right)\:=\:2x_1\cdot \left|x_1\right|+3$.

Since $x_1\ge0$ and $x_2\ge0$:

we have $2x_1^2+3$ = $f(x_2)$ = $2x_2^2+3$ = $x_1$ = $x_2$ as needed.


Case 2) $x_1\le0$, $x_2\le0$

$f\left(x_1\right)\:=\:-2x_1\cdot \left|-x_1\right|+3$.

Since $x_1\le0$, $x_2\le0$,

we have $f\left(x_1\right)\:=\:-2x_1\cdot \left|-x_1\right|+3$. = $f(x_2)$ = $-2x_2^2+3$ = $x_1$ = $x_2$ as needed.


Case 3) $x_1\ge0$, $x_2\le0$

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

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

$\rightarrow$ $x_1 \ne x_2$ contradiction


Case 3) $x_1\le0$, $x_2\ge0$

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

$f(x_2) = 2x_2\cdot |x_2|+3$

$\rightarrow$ $x_1 \ne x_2$ contradiction

Since one of the examples cases yields $x_1 = x_2$, we can conclude that $f$ is injective.

Surjective: Let $f(x)$ = $y$

We have $y=2x\cdot \left|x\right|+3$

If $x\ge0$, $y = 2x\cdot \:x+3$. Solving for $x$, we get
$x=\sqrt{\frac{y-3}{2}},\:x=-\sqrt{\frac{y-3}{2}}$

If $x\le0$, $y = -2x\cdot \:-x+3$. Solving for $x$, we still get $x=\sqrt{\frac{y-3}{2}},\:x=-\sqrt{\frac{y-3}{2}}$

Thus, we will have a $y$ value for all $x\in \mathbb{R}$ hence, $f$ is surjective.


I don't know if this is right, can someone provide some feedback?

Best Answer

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.