Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How to define a bijection between $(0,1)$ and $(0,1]$? Or any other open and closed intervals?

If the intervals are both open like $(-1,2)\text{ and }(-5,4)$ I do a cheap trick (don't know if that's how you're supposed to do it): I make a function $f : (-1, 2)\rightarrow (-5, 4)$ of the form $f(x)=mx+b$ by \begin{align*} -5 = f(-1) &= m(-1)+b \\ 4 = f(2) &= m(2) + b \end{align*} Solving for $m$ and $b$ I find $m=3\text{ and }b=-2$ so then $f(x)=3x-2.$

Then I show that $f$ is a bijection by showing that it is injective and surjective.

share|cite|improve this question
Similar question on Quora: – Martin Sleziak Feb 3 at 18:48
up vote 130 down vote accepted

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$.

share|cite|improve this answer
+1. This is a beautiful argument. – user17762 Jun 21 '12 at 6:36
Do you know of any sets not made of distinct elements? – Marc van Leeuwen Aug 31 '12 at 10:01
@MarcvanLeeuwen This (awkward) formulation is to make sure one understands that $x_n\ne x_k$ for every $n\ne k$. – Did Aug 31 '12 at 14:05
"Choose an infinite sequence $(x_n)_{n\geq1}$ of distinct elements of $(0,1)$" might do. – Marc van Leeuwen Aug 31 '12 at 14:14
@GastónBurrull Well, "choose" does not refer to the axiom of choice here but simply to the fact that any such sequence (for example the one you suggest) does the job. (But perhaps your comment was tongue-in-cheek... :-)) – Did Apr 1 '13 at 8:07

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.

share|cite|improve this answer

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.

share|cite|improve this answer
thanks that makes it a lot clear for me. If I was to follow that logic for lets say [0,1]^2 and [0,2]^2 would I solve for [0,1] and [0,2] first by letting A = {0,1} and b = {0,2} and then f: A->B ? – user1411893 Jun 20 '12 at 12:35
Between $[0,1]^2$ and $[0,2]^2$, I would rather use the bijection $(x,y)\mapsto(2x,2y)$. – Did Jun 20 '12 at 14:53

We will show that both sets are in bijection with $S^1\times \mathbb{Z}$.

Consider $(0,1)$. This is in bijection with $\mathbb{R}$ (for example, scale the interval to $(-\pi/2, \pi/2)$ and apply the tangent function). We can map $\mathbb{R}$ to $S^1\times \mathbb{Z}$ bijectively using the map $t\rightarrow (e^{2\pi i t},\lfloor t \rfloor)$.

Any set homeomorphic to $(0,1]$ can be put into bijection with $S^1$ using the map $t\rightarrow e^{2\pi i t}$. It remains to show that $(0,1]$ is in bijection with countably many copies of itself. To see this, note that the map $x\rightarrow -\frac{1}{x}$ takes $(0,1]$ to $(-\infty, -1]$, and consider the partition

$$\cdots (-4,-3],\ (-3,-2],\ (-2,-1].$$

This seems unnecessarily complicated, and I think you can just map both sets to $\mathbb{R}$ and circumvent the circle stuff, but this is how I figured it out.

share|cite|improve this answer
+1. Actually, my mental image of this is a bijection with $(0,1]\times\mathbb Z$ rather than with $S^1\times\mathbb Z$ but this construction is definitely worthwhile to remember. – Did Jun 21 '12 at 6:56
Here is another way to say the same thing. I reverse the half-open intervals. I want to show that the intervals $A=\left[ 0,\infty \right)$ and $B= \left( -\infty,\infty \right)$ are in bijective correspondence. By chopping up in half-open pieces (of length one) like $\ldots, \left[ 3,4 \right) , \left[ 4,5 \right) , \left[ 5,6 \right) ,\ldots$, the interval $A$ is naturally in correspondence $A \approx \left[ 0,1 \right) \times\mathbb{N}$, while for $B$ that is $B \approx \left[ 0,1 \right) \times\mathbb{Z}$. But since it is known that $\mathbb{N}$ and $\mathbb{Z}$ are "equal", we are done. – Jeppe Stig Nielsen Jun 30 '15 at 14:44

I thought to supplement Did's answer with this picture that I sketched.

enter image description here

The blue line represents the set $\color{#0073CF}{(0,1) - \{x_n\}^{\infty}_{n \geq 1}}$.
The orange circles are elements of the infinite sequence $\color{#FF4F00}{X = \{x_n\}^{\infty}_{n \geq 1}}$, but I plotted only 4 (I chose 4 arbitrarily) circles because it is impossible to plot all elements of an infinite sequence.
Subscripts (The order of the points) were arbitrarily assigned to each orange points.
So the depiction above of $f : (0,1] \rightarrow (0,1) $ can be defined with this formula:

$f(\color{#FF4F00}{x_n}) = \color{#FF4F00}{x_{n + 1}} \quad \forall \;n \geq 0$ and
$f(\color{#0073CF}{x}) = \color{#0073CF}{x} \qquad \quad \forall \; \color{#0073CF}{x \in {(0,1) - \{x_n\}^{\infty}_{n \geq 1}}}$.

share|cite|improve this answer
+1 I did not understand this at all without the picture and especially the last two lines. – Todd Wilcox Sep 17 '15 at 19:04
@ToddWilcox "especially the last two lines" This is interesting, sort of, since "the last two lines" are in my answer. – Did Nov 25 '15 at 9:28
@ToddWilcox Did I mention votes? – Did Nov 25 '15 at 12:12

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.