Prove that this is one-one, but not onto $\Bbb R$.

$\Bbb R$ stands for real numbers.

$f(x) = \begin{cases} 2-x, & \text{if$x \le 1 \qquad \text{is one to one but not onto } \Bbb R $} \\ \frac{1}{x} , & \text{if$x >1$} \end{cases}$

I know how to prove that this is one to one by saying that an element in the domain maps too exactly one element in the range set.

$x\le1 \;\Rightarrow \; f(x) = f(y) \Rightarrow \; 2-x =2-y \Rightarrow x=y$

$x>1\Rightarrow$ $\frac{1}{x} = \frac{1}{y} \Rightarrow x=y$

We can say from this that this is one-one. I am having trouble understanding why this is not onto. I know that $0 \notin \Bbb x$. This is where I get lost. I know that a function is onto if every element in the range set has a preimage is the domain set. I am just not too sure what that means in applying to this problem.

• For example, it is I think easy to see that there is no $x$ such that $f(x)=-10$. By the way, your one-to-one is incomplete. You also need to check there is no $x$ and $y$ with $x\le 1$ and $y\gt 1$ such that $f(x)=f(y)$. – André Nicolas Jul 16 '16 at 22:10
• The mapping $f\colon?\to ?$ is defined by $$f(x) = \begin{cases} 2-x, & \text{if x \le 1}\\ \frac{1}{x} , & \text{if x >1 } \end{cases}$$ Those question marks become important. Presumably they are $\mathbb{R}$ and $\mathbb{R}$, but are they? – Daniel W. Farlow Jul 16 '16 at 22:11
• "I know that $0\notin\mathbb{R}$". This is not correct. Did you mean that $0$ is not in the image of $\mathbb{R}$, i.e. $0\notin f(\mathbb{R})$? – smcc Jul 16 '16 at 22:21
• What I mean is that $0 \notin x$ – Jon Jul 16 '16 at 22:22
• What do you mean by $0\not\in x$? – user84413 Jul 16 '16 at 22:23

It is not onto because the value of the function is always above zero. Thus, for example, $0\in\mathbb{R}$ but there is no $x\in\mathbb{R}$ such that $f(x)=0$.
To elaborate on Andre's comment, you need to add this to complete your proof that $f$ is one-to-one: For any $x\leq 1$ and $y>1$, $$f(x)=2-x\geq 1>\frac{1}{y}=f(y).$$
In showing this is one-to-one, you should also consider the case where $x>1$ and $y\le 1$ and show that in that case you cannot have $f(x)=f(y)$. What you've done takes care of the case where both are $>1$ or both are $\le 1$.
It's not onto $\mathbb R$ because no value of this function is negative or $0$.