# Is $g : \mathbb R →\mathbb R$, $g(x) = |x|$ one-to-one and onto?

So, here is my function, in which I am to prove or disprove both if it is onto and one-to-one:

Deﬁne $g : \mathbb R →\mathbb R$ by $g(x) = |x|$.

For onto, can I say that it is not, because if we take any negative number such as $x = -1$, we get the positive value of that number in the image, which means that all the negative numbers in the codomain are not matched to an element in the domain?

For one-to-one, can't I say that it isn't there will be two elements in the domain that point to the same element in the codomain?

• It is not $1-1$, since $f(x_1)=f(x_2)$ doesn't necessarily imply that $x_1=x_2$. Take for example $f(2)=f(-2)=2$, but $2\neq -2$. It is not onto, since anything less than zero on the y-axis isn't being used (in the codomain). So, yes, what you've said is correct. – Sujaan Kunalan Nov 24 '14 at 6:17
• The absolute value function $\Bbb R\to\Bbb R$ sends $1$ to $1$, but it is not injective. – Marc van Leeuwen Nov 24 '14 at 6:45

## 2 Answers

Yes, you can. It's best to give an explicit example, too; you should describe two particular numbers $a\neq b$ such that $g(a)=g(b)$.

• That's what I ended up doing, too. Thanks! – JCMcRae Nov 24 '14 at 6:27

It is one-to-one iff the graph satisfies the "horizontal line test". Just look at the graph and the answer should be clear.