# Construct an explicit bijection $f:[0,1] \to (0,1]$, where $[0,1]$ is the closed interval in $\mathbb R$ and $(0,1]$ is half open. [duplicate]

The problem:

Construct an explicit bijection $f:[0,1] \to (0,1]$, where $[0,1]$ is the closed interval in $\mathbb R$ and $(0,1]$ is half open.

My Thoughts:

I imagine that I am to use the fact that there is an injection $\mathbb N \to [0,1]$ whose image contains $\{0\}$ and consider the fact that a set $X$ is infinite iff it contains a proper subset $S \subset X$ with $\lvert S \rvert = \lvert X \rvert$ (because we did something similar in class). I also have a part of proof that we did in class that I believe is supposed to help with this problem; it states the following: Start with an injection $g: \mathbb N \to X$ and then define a set $S=F(X)$ where $F$ is an injective (but NOT surjective) function $X \to X$ with $F(x) = x$ if $x \notin \text{image}(g)$ and $f(g(k)) = g(2k)$ if $x=g(k) \in \text{image}(g)$. Honestly, I'm having a lot of trouble even following this proof, so I could be wrong. Anyway, any help here would be appreciated. I feel really lost on this one. Thanks!

## marked as duplicate by Martin Sleziak, N. F. Taussig, Jeremy Rickard, A.S, user98602 May 9 '15 at 20:59

define $x_0 = 0$ and $x_n = 1/n$ for $n \geq 1$ ... define $f:[0,1] \to (0,1]$ $f(x)= x$ if $x\neq x_i , i\geq 0$ and $f(x_i) = x_{i+1} , i \geq 0$
Partition $[0,1]$ into two subsets:
$$A \;\; =\;\; \left \{0, \left .\frac{1}{2^n} \; \right | \; n \in \mathbb{N}\right \}$$
and the complement $A^c$. Define $f:[0,1] \to (0,1]$ by
$$f(x) \;\; =\;\; \begin{cases} x, & \text{if} \; x \in A^c \\ \frac{1}{2}, & \text{if} \; x = 0\\ \frac{1}{2^{n+1}}, & \text{if} \; x = \frac{1}{2^n} \end{cases}.$$