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

## marked as duplicate by Ross Millikan, Carl Mummert, Mark Bennet, Quixotic, gnometoruleNov 5 '14 at 0:01

• If you create a bijection, it goes both ways, so you only need one. This has been answered several times on this site. – Ross Millikan Nov 4 '14 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? – Crostul Nov 4 '14 at 21:26
• possible duplicate of How do I define a bijection between $(0,1)$ and $(0,1]$? and this – Ross Millikan Nov 4 '14 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. – Simon S Nov 4 '14 at 21:57
• @SimonS Never! Not The Eagles. Please! Hilbert's Hotel is too beautiful. But hey, if that's your thing ;) – Epsilon Nov 4 '14 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. – Simon S Nov 4 '14 at 22:07

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