Bijective function excluding 0 
Construct a bijective function $f:\mathbb R\to\mathbb R\setminus\{0\}$. Prove that the function is bijective.

Im having trouble with this... A few concepts that I get so far
is that function essentially should be representing $\mathbb R$, which in turn maps to the same set of real numbers excluding 0. Im thinking about proving its bijective by proving the function is both injective and surjective. Im thinking about doing $x^2+1$ but am uncertain if this is the right sort of track to take. Would really appreciate guidance
 A: The classic natural number shifting argument works:
$$f(x)=\begin{cases}x+1&x\in\mathbb N\\x&\text{else}\end{cases}$$
(Here $0\in\mathbb N$.)
Suppose $f(a)=f(b)$. Then either this value is not a positive integer, in which case $a=b$ (since the first case only produces positive integers), or it is a positive integer, whence $a=b=f(a)-1=f(b)-1$ again. Hence $f$ is injective.
Real numbers that are not positive integers are the images of themselves, while the positive integers are the images of their respective predecessors. Thus $f$ is also surjective, hence bijective.
The inverse function is
$$f^{-1}=\begin{cases}x-1&x\in\mathbb N,x\ne0\\x&\text{else}\end{cases}$$
A: Hint
Consider $A=\{1/n|n\in\mathbb{N}\}\cup \{0\}.$ Define:


*

*$x\in \mathbb{R}\setminus A\implies f(x)=x;$ 

*$f(0)=1;$ 

*$f(1)=1/2;$

*$f(1/2)=1/3;$
A: Here's a function I would use. Let $\mathbb{N}$ be the set of natural numbers ($0,1,2,3...$) including $0$
$$f(x) = \begin{cases} x+1&x\in\mathbb{N}\\x&x\notin\mathbb N\end{cases}$$
It's quite trivial to see that $f:\;\mathbb{R}\to\mathbb{R}\setminus\{0\}$. Showing injectivity and surjectivity with this piecewise function is quite easy, so give it a shot!
