How to define a bijection between $(0,1)$ and $(0,1]$?

Choose an infinite sequence $(x_n)_{n\geqslant1}$ of distinct elements of $(0,1)$. Let $X=\{x_n\mid n\geqslant1\}$, hence $X\subset(0,1)$. Let $x_0=1$. Define $f(x_n)=x_{n+1}$ for every $n\geqslant0$ and $f(x)=x$ for every $x$ in $(0,1)\setminus X$. Then $f$ is defined on $(0,1]$ and the map $f:(0,1]\to(0,1)$ is bijective.

To sum up, one extracts a copy of $\mathbb N$ from $(0,1)$ and one uses the fact that the map $n\mapsto n+1$ is a bijection between $\mathbb N\cup\{0\}$ and $\mathbb N$.


Try something like the function in the following picture:

enter image description here


If you only have to show that such bijection exists, you can use Cantor-Bernstein theorem and $(0,1)\subseteq (0,1] \subseteq (0,2)$. See also open and closed intervals have the same cardinality at PlanetMath.


Let $A=\{\frac{1}{2},\frac{1}{3},...\}$,$B=\{1,\frac{1}{2},\frac{1}{3},...\}$. Define $f:A\rightarrow B$ such that $f(\frac{1}{n})=\frac{1}{n-1}$.It is easy to show that $f$ is a bijection. Then define a function $g:(0,1) \rightarrow (0,1]$ such that

$g(x)=x$ if $x$ is not in $A$ , otherwise $g(x)=f(x)$.

Then $g$ is a required bijection from $(0,1)$ to $(0,1]$.

Remark: We can always solve this kind of question by picking a countable proper subset from (say) $(0,1)$ and then define a bijection $f$ so that the image of $f$ is a little bit bigger than its domain and then define a function which is equal to $f$ on the picked countable set and identity function outside that set.