Homeomorphic subsets of rationals The set of rationals in $[0,1]$ is homeomorphic to the set of rationals in $(0,1)$ by a result of Sierpiński. Is there a direct proof? 
 A: Yes, there is a direct proof. I’ll show first that $X=(0,1)\cap\Bbb Q$ is homeomorphic to $Y=[0,1)\cap\Bbb Q$.
Fix $\alpha\in(0,1)\setminus\Bbb Q$. For $n\in\Bbb N$ let $I_n=(\alpha^{n+1},\alpha^n)\cap\Bbb Q$; then $\{I_n:n\in\Bbb N\}$ is a partition of $X$ into open intervals. (Note that for me $\Bbb N$ includes $0$.) Define a new linear order $\preceq$ on $Y$ as follows. 

Let $x,y\in Y$.
  
  
*
  
*If $x,y\in I_n$ for some $n\in\Bbb N$, then $x\preceq y$ iff $x\le y$. 
  
*If $x\in I_{2m}$ and $y\in I_{2n}$ for distinct $m,n\in\Bbb N$, then $x\preceq y$ iff $m<n$.  
  
*If $x\in I_{2m+1}$ and $y\in I_{2n+1}$ for distinct $m,n\in\Bbb N$, then $x\preceq y$ iff $m>n$.  
  
*If $x\in I_{2m}$ and $y\in I_{2n+1}$ for some $m,n\in\Bbb N$, then $x\preceq y$.  
  
*If $x\in I_{2n}$ for some $n\in\Bbb N$, then $x\preceq 0$.  
  
*If $x\in I_{2n+1}$ for some $n\in\Bbb N$, then $0\preceq x$.
  

Schematically, $\preceq$ is the left-to-right order in the following diagram, where each $I_n$ retains its usual internal order:
$$I_0\quad I_2\quad I_4\quad\ldots\quad 0\quad\ldots\quad I_5\quad I_3\quad I_1$$
It’s not hard to verify that $\preceq$ is a dense linear order on $Y$ and that the associated order topology is just the usual topology on the set $Y$.
For $n\in\Bbb N$ let $\beta_n=\frac12(1-\alpha^n)$ and $\gamma_n=\frac12(1+\alpha^n)$, and let $J_{2n}=(\beta_n,\beta_{n+1})\cap\Bbb Q$ and $J_{2n+1}=(\gamma_{n+1},\gamma_n)\cap\Bbb Q$. Then $\{J_{2n}:n\in\Bbb N\}$ is a partition of $\left(0,\frac12\right)\cap\Bbb Q$ into open intervals, $\{J_{2n+1}:n\in\Bbb N\}$ is a partition of $\left(\frac12,1\right)\cap\Bbb Q$ into open intervals, and $X$ ‘looks like’ this as a linear order:
$$J_0\quad J_2\quad J_4\quad\ldots\quad\frac12\quad\ldots\quad J_5\quad J_3\quad J_1\;.$$
For each $n\in\Bbb N$ let $f_n:I_n\to J_n$ be an order-isomorphism; it’s easy enough to write down an explicit formula for $f_n$ as a linear function, if one really wants to take the trouble. Finally, let $f=\left\{\left\langle 0,\frac12\right\rangle\right\}\cup\bigcup_{n\in\Bbb N}f_n$; i.e.,
$$f:Y\to X:y\mapsto\begin{cases}
f_n(y),&\text{if }y\in J_n\text{ for some }n\in\Bbb N\\
\frac12,&\text{if }y=0\;.
\end{cases}$$
It’s straightforward to verify that $f$ is a homeomorphism. (Note that if one knows the result that every countable dense linear order is order-isomorphic to $\Bbb Q$, the fact that $X$ and $Y$ are homeomorphic is immediate once one has the order $\preceq$.)
To complete the proof that $X$ is homeomorphic to $[0,1]\cap\Bbb Q$, just notice that $X$ is the disjoint union of the clopen sets $(0,\alpha)\cap\Bbb Q$ and $(\alpha,1)\cap\Bbb Q$, and $[0,1]\cap\Bbb Q$ is the disjoint union of the clopen sets $[0,\alpha)\cap\Bbb Q$ and $(\alpha,1]\cap\Bbb Q$. By what we’ve already proved, $(0,\alpha)\cap\Bbb Q$ is homeomorphic to $[0,\alpha)\cap\Bbb Q$, and $(\alpha,1)\cap\Bbb Q$ is homeomorphic to $(\alpha,1]\cap\Bbb Q$, so $X$ is homeomorphic to $[0,1]\cap\Bbb Q$.
