# Proving $(0,1)$ and $[0,1]$ have the same cardinality [duplicate]

Prove $(0,1)$ and $[0,1]$ have the same cardinality.

I've seen questions similar to this but I'm still having trouble. I know that for $2$ sets to have the same cardinality there must exist a bijection function from one set to the other. I think I can create a bijection function from $(0,1)$ to $[0,1]$, but I'm not sure how the opposite. I'm having trouble creating a function that makes $[0,1]$ to $(0,1)$. Best I can think of would be something like $x \over 2$.

Help would be great.

• If you create a bijection, it goes both ways, so you only need one. This has been answered several times on this site. Nov 4, 2014 at 21:26
• If you have a bijection $(0,1) \longrightarrow [0,1]$, then its inverse map is a bijection $[0,1] \longrightarrow (0,1)$. Maybe you meant an injection? Nov 4, 2014 at 21:26
• possible duplicate of How do I define a bijection between $(0,1)$ and $(0,1]$? and this Nov 4, 2014 at 21:28

Use Hilbert's Hotel.

First identify a countable subset of $(0,1)$, say $H = \{ \frac1n : n \in \mathbb N\}$.

Then define $f:(0,1) \to [0,1]$ so that

$$\frac12 \mapsto 0$$ $$\frac13 \mapsto 1$$ $$\frac{1}{n} \mapsto \frac{1}{n-2}, n \gt 3$$ $$f(x) = x, \text{for } x \notin H$$

• Hotel Hilbert, nice. Hard to believe it's not also an Eagles song. Nov 4, 2014 at 21:57
• @SimonS Never! Not The Eagles. Please! Hilbert's Hotel is too beautiful. But hey, if that's your thing ;) Nov 4, 2014 at 22:04
• We should give more names to examples or constructions like this. I'm convinced I'll remember this one for some time because of the name together with its elegance. Thanks for posting. Nov 4, 2014 at 22:07
• @nwr Is $H$ really a subset of $(0,1)$? After all, $1\in H$ does not fall into $(0,1)$.
– Boar
Nov 3, 2021 at 13:25
• @Steve Good point. I should have spotted that. Nov 3, 2021 at 20:25

You can trivially find a bijection between $(0,1)$ and $(1/4,3/4)\subset[0,1]$, hence $\mathrm{Card} (0,1) \leq \mathrm{Card} [0,1]$.

Likewise, there is a trivial bijection between $[1/4,3/4]\subset(0,1)$ and $[0,1]$, hence $\mathrm{Card} [0,1] \leq \mathrm{Card} (0,1)$.

By trivial, I mean a linear function $t\to at+b$ with some numbers $a,b$.

Thus $\mathrm{Card} [0,1] = \mathrm{Card} (0,1)$.