How to construct a bijection from $(0, 1)$ to $[0, 1]$? [duplicate]

Possible Duplicate:
Bijection between an open and a closed interval
How do I define a bijection between $(0,1)$ and $(0,1]$?

I wonder if I can cut the interval $(0,1)$ into three pieces: $(0, \frac{1}{3})\cup(\frac{1}{3},\frac{2}{3})\cup(\frac{2}{3},1)$, in which I'm able to map point $\frac{1}{3}$ and $\frac{2}{3}$ to $0$ and $1$ respectively. Now the question remained is how to build a bijection mapping from those three intervels to $(0,1)$.

Or, my method just goes in a wrong direction. Any correct approaches?


Consider the sequence $$ \frac 12, \frac 13, \frac 14, \frac 15, \dots, \frac 1n, \dots $$ Map every other point $f : (0,1) \to [0,1]$ that is not in this sequence to itself, and then map the above sequence to the corresponding points in this one : $$ 0, 1, \frac 12, \frac 13, \frac 14, \dots. $$ In other words, map $\frac 12$ to $0$, $\frac 13$ to $1$, and then map $\frac 1n$ to $\frac 1{n-2}$ for $n \ge 4$.

The reason why you can map some set into some bigger set bijectively is precisely because they are infinite, so you must exploit this fact. If you don't, you have no chance.

Now to answer your actual question, the trick you try to use doesn't feel relevant to me ; I'm not saying there is absolutely no way it could work, because I actually know there is, since your set (the union of the three intervals) and the interval $(0,1)$ have the same cardinality. The problem with your idea is that I don't think a construction will naturally come out of it. In general, to map bijectively a set into a bigger one you must be "moving things around", so I expect any fairly understandable construction involving your idea to be similar to the one I've shown you.

Hope that helps,


The idea you mention, with mild modification, will work. Please note that what is below is a minor variant of the solution given by Patrick da Silva.

Your decomposition of $(0,1)$ is not quite complete. We want to write $$(0,1)=\left(0,\frac{1}{3}\right) \cup\left\{\frac{1}{3}\right\} \cup \left(\frac{1}{3},\frac{2}{3}\right)\cup \left\{\frac{2}{3}\right\}\cup \left(\frac{2}{3},1\right),$$ so $5$ "intervals," two of them kind of boring. From now on, we will call $\frac{2}{3}$ by the more cumbersome name $1-\frac{1}{3}$.

Use the identity function on the two endintervals $\left(0,\frac{1}{3}\right)$ and $\left(1-\frac{1}{3},1\right)$, and map $\frac{1}{3}$ to $0$, and $1-\frac{1}{3}$ to $1$.

This leaves $\left(\frac{1}{3},1-\frac{1}{3}\right)$, which needs to be bijectively mapped to $\left[\frac{1}{3},1-\frac{1}{3}\right]$.

Use the same trick on the interval $\left(\frac{1}{3},1-\frac{1}{3}\right)$ that we used on $(0,1)$. So this time the two special points "inside" that will be mapped to $\frac{1}{3}$ and $1-\frac{1}{3}$ respectively are $\frac{1}{3}+\frac{1}{9}$ and $1-\frac{1}{3}-\frac{1}{9}$. That leaves $\left(\frac{1}{3}+\frac{1}{9},1-\frac{1}{3}-\frac{1}{9}\right)$ to be mapped bijectively to $\left[\frac{1}{3}+\frac{1}{9},1-\frac{1}{3}-\frac{1}{9}\right]$. Continue, forever. As pointed out by Patrick da Silva, the point $\frac{1}{2}$ is not dealt with in this process: simply map it to itself.

It would be notationally a little simpler to use the same idea to map $(-1,1)$ bijectively to $[-1,1]$, and use linear functions to take $(0,1)$ to $(-1,10$, and $[-1,1]$ to $[0,1]$ toadjust to our situation.

The advantage is that first "middle" interval is $\left(-\frac{1}{3},\frac{1}{3}\right)$, the second middle interval is $\left(-\frac{1}{9},\frac{1}{9}\right)$, and so on.