TITLE: Find a bijection $g:\mathbb{R} \longrightarrow \mathbb{R}\setminus \{0\}$
QUESTION [2 upvotes]: Find an explicit bijection $g:\mathbb{R} \longrightarrow \mathbb{R}\setminus \{0\}$.
I'm sure I'm close to figuring this one out, but not quite there yet. My first idea was $g(x) = 
        \begin{cases}
        x+1, \text{if } x\geq0 \\
        x, \text{if } x<0\\
        \end{cases}$, but this is not surjective (eg. 1/2)
I think I'm getting mixed up when creating this map because since I can't map 0 to itself, I have to map it to something else, which means that I can't map that thing to itself either lest the function be noninjective, and so on.
To fix this problem I was also thinking along the lines of $g(x) = 
        \begin{cases}
        x+1, \text{ if } x \in \mathbb{N} \\
        x, \text{if } x \in \mathbb{R} \setminus \mathbb{N}\\
        \end{cases}$ where $\mathbb{N}$ denotes the non-negative integers.

REPLY [1 votes]: So, and this has been asked before,  but, the basic idea would be to use a shift function like you were considering on a countable subset, and just define it to be the identity otherwise.
So $g(x)=\begin  {cases}x,\,\forall x\in\mathbb R\setminus\mathbb Z_+\\x+1,\,\forall x\in\mathbb Z_+\end{cases} $.
I remember @Did has a  highly upvoted answer to this effect.
{"set_name": "stack_exchange", "score": 2, "question_id": 4124915}