Q:

Let $f: \mathbb{R} \to \mathbb{R}$ be defined by $f(x)=|x-1|$. Show that $f$ is neither one one nor onto function.

Let $f: \mathbb R\to \mathbb R$ be defined by $f(x)=|x-1|$. Show that $f$ is neither one one nor onto function.
My Attempt:
$$f(x)=|x-1|$$
For all $x \in \mathbb R$, the set of values of $f(x)$ are non negative real numbers. So, range of $f(\mathbb R)=[0, \infty)$. Hence, $f$ is not onto. 

A:

In order to be one to one, it should be valid that for every $x\neq y$ we have that $f(x)\neq f(y)$. Well, try $x=a+1$ and $y=1-a$, for every $a>0$. We have that:
$$f(a+1)=|a+1-1|=|a|=|-a|=|1-a-1|=f(1-a)$$
So, $f$ is clearly not one to one.
Since $$f(x)=|x-1|\geq0$$
it is also ivedent that $f$ is not onto $\mathbb{R}$.
Note: If we define $f:\mathbb{R}\to[0,+\infty)$ $f$ would be onto $[0,+\infty)$.

