Give a Bijection between $\mathbb{R}\setminus\mathbb{Z}$ and $\mathbb{R}\setminus\mathbb{N}$ Give a Bijection between $\mathbb{R}\setminus\mathbb{Z}$ and $\mathbb{R}\setminus\mathbb{N}$
I got a bijection between $\mathbb{N}$ and  $\mathbb{Z}$
Given by
$\phi(1)=0$
$\phi(2)=-1$
$\phi(3)=1$
$\phi(4)=-2$
$\phi(5)=2$
$\phi(6)=-3$
But I cannot figure how to find a bijection between $\mathbb{R}\setminus\mathbb{Z}$ and $\mathbb{R}\setminus\mathbb{N}$
 A: The identity function almost works for $\mathbb R\setminus\mathbb N \to \mathbb R\setminus \mathbb Z$, except that you need to avoid hitting the negative integers. Use Hilbert's Hotel to make room for each of them, e.g.
$$ f(x) = \begin{cases} x + c & \text{if }x=-(n+1)+mc\text{ for some }n,m\in\mathbb N \\ x & \text{otherwise} \end{cases} $$
for some appropriate constant $c$.
Which numbers would work as $c$?
A: Let's start with the identity $f(x)=x\quad \forall x\in\mathbb R-\mathbb Z$
$(\mathbb R-\mathbb Z)$ and $(\mathbb R-\mathbb N)$ differ by $\mathbb 
N_{>0}$.
So to have a bijection you must basically make every positive integer disappear!
But the black hole $\mathbb N_{>0}\mapsto\varnothing$ is not a bijection.
Instead the idea is to hide them within the real numbers. We will send $1$ to a real which is not an integer, let say $\phi(1)=\frac 12$.
But location $\frac 12$ is already occupied by $f(\frac 12)=\frac 12$, so we will push it deeper with $\phi(\frac 12)=\frac 14$, and we have a conflict with $\frac 14$ now, so we will push it also $\phi(\frac 14)=\frac 18$ and so on...
Basically we shift the whole sequence $\frac 1{2^k}\mapsto\frac 1{2^{k+1}}$ a step deeper, that is freeing a hole in $\frac 12$ where we can put $1$.
Now where to put $2$ ?
Similarly we can shift the sequence of all $\frac 1{3^k}$, freeing a hole in $\frac 13$ and place $2$ there $\phi(2)=\frac 13$.
On so on, we shift the sequences of powers of primes numbers one step deeper $\phi(\frac 1{{p_n}^k})\mapsto\frac 1{{p_n}^{k+1}}$ this frees a hole in $\frac 1{p_n}$ where we can put $n$, i.e $\phi(n)=\frac 1{p_n}$

This is only one example. For instance you can shift the sequences $n+\frac 1{2^k}$ instead and send $n$ to the center of interval $]n,n+1[$ instead of using prime numbers.
More sophisticated sequences are possible, like the one by J.C.Santos for instance, but the principle is the same.
A: Something you can do is create extra gaps, and reduce the problem to a bijection between countable sets:
Take $\phi$ to be the identity on $\mathbb R - \frac12 \mathbb Z$. All you have to do then is find a bijection between $\frac12 \mathbb Z - \mathbb Z$ and $\frac12 \mathbb Z - \mathbb N$. On positive integers, take it to be the identity; on negative integers, construct a bijection between $-\mathbb N$ and $-\frac12\mathbb N$.
A: You can define a bijection $\psi\colon\mathbb{R}\setminus\mathbb{N}\longrightarrow\mathbb{R}\setminus\mathbb Z$ defining $\psi(x)=x$ if $x\not\in\left\{\frac1{n+1}\,\middle|\,n\in\mathbb N\right\}$ and then:


*

*$\psi(0)=\frac12$;

*$\psi(-1)=\frac14$;

*$\psi(-2)=\frac16$


and so on. Besides


*

*$\psi\left(\frac12\right)=\frac13$;

*$\psi\left(\frac13\right)=\frac15$;

*$\psi\left(\frac14\right)=\frac17$


and so on.
A: Rocket man commented that "Both of your sets are just a countable collection of disjoint intervals. Try thinking of your problem that way "
So $\mathbb R\setminus \mathbb Z = \cup_{z\in \mathbb Z} I_z$ where $I_z = (z-1,z)$
And $\mathbb R\setminus \mathbb N = \cup_{n\in \mathbb N} J_n$ where $J_n = (n-1, n)$ for $n>1$ and $J_1 = (-\infty, 1)$.
You found a bijection $\phi: \mathbb N \to \mathbb Z$.  
Now if you can find a sequence of bijections $\psi_n: J_n\to I_{\phi(n)}$ we'd be done:  We'd just need to define $\psi:\mathbb R\setminus \mathbb N\to \mathbb R\setminus \mathbb Z$ as: $\psi(x) = \psi_n(x)$ when $x \in J_n$.
....
to spell it out:
Let $\psi: \mathbb R\setminus N\to \mathbb R\setminus Z$ be defined as follows:
If $x \in \mathbb R\setminus N$ and $x > 1$ then there exists an $n$ so that $n-1 < x < n$.  For this $x$ let $\psi (x) = x - n + \phi(n)$.  Now $\phi(n)-1< \psi(x) < \phi(n)$ so $\psi(x) \in R\setminus Z$.
If $x \in \mathbb R\setminus N$ and $x \le 1$ then $x < 1$. So $x-1 < 0$ and $1-x > 0$ and $0 < \frac {1}{1-x} < 1$ and $-1< \frac {1}{1-x}-1< 0$. For this $x$ let $\psi(x) = \frac 1{1-x}-1$. Now $-1 < \psi(x) < 0$ so  $\psi(x) \in R\setminus Z$
We can verify this is a bijection:  
It's one to one:  If $x\ne y$.  $x < 1$ and $y < 1$ the $\psi(x) = \frac 1{1-x}$ and $\psi (y) = \frac 1{1-x}$.  $x= y\iff 1-x = 1-y \iff \frac 1{1-x}= \frac 1{1-y}$ so $\psi(x) \ne \psi (y)$.
If one of $x$ or $y$ (wolog $x$) is less than $1$ and the other (wolog $y$) is not then there is an $n>1$ so that $n-1 < y < n$.  And $\phi(n) \ne 0$. so  $\phi(n)-1 < \psi(y) < \phi(n)$ so $\psi(y) \not \in (-1,0)$. Whereas $\psi(x)\in (-1,0)$ so $\psi(x) \ne \psi(y)$.
If $n- 1 < x<n$ and $m-1< y < m$ and $m \ne n$, then $\phi(n) \ne \phi(m)$.  And $\phi(n)-1 < \psi(x)< \phi(n)$ while $\phi(m)-1 < \psi(y)< \phi(m)$.  So $\psi(x)\ne \psi(y)$.
Finally if $n-1<x,y< n$ then $x = y \iff x-n+\phi(n) = y-n+\phi(n) \iff \psi(x) = \psi (y)$.  So $\psi(x)\ne \psi(y)$.
$\psi$ is onto:  If $x\in \mathbb R\setminus Z$ then there is a unique $m$ so that $m-1< x < m$.  And there is a unique $n$ so that $\phi(n) = m$.
If $n \ne 1$ then $y =x-m + n$ will mean $n-1< x < n$ and $\psi(y) = x$.
If $n = 1$ then $m = 0$ and $-1 < x < 0$.  And $0 < x + 1< 1$ and  $\frac 1{x+1} > 1$ and let $y=1-\frac 1{x+1} < 0 < 1$. then $\psi(y) = x$.
