Prove that [0,1] is equivalent to (0,1) and give an explicit description of a 1-1 function from [0,1] onto (0,1) The problem is stated as follows:

Show that there is a one-to-one correspondence between the points of the closed interval $[0,1]$ and the points of the open interval $(0,1)$.  Give an explicit description of such a correspondence.

Now, I think I can prove the first part of the problem by demonstrating the following:
Define $f: (0,1) \to \mathbb{R}$ as follows.
For $n \in \mathbb{N}$, $n \geq 2$, $\space{ }f(\frac{1}{n}) = \frac{1}{n-1}$ 
and for all other $x \in (0,1)$, $\space{}f(x) = x$


*

*Prove that $f$ is a $1-1$ function from $(0,1)$ onto $(0,1]$

*Slightly modify the above function to prove that $[0,1)$ is equivalent to $[0,1]$

*Prove that $[0,1)$ is equivalent to $(0,1]$
Since the "equivalent to" relation is both symmetric and transitive, it should follow that $[0,1]$ is equivalent to $(0,1)$.  Hence, there does exist a one-to-one correspondence between $[0,1]$ and $(0,1)$.
I have no trouble with the above.  My problem is in "finding an explicit description of such a correspondence."  Can I modify the above function, or will that not suffice?

I would just let $a_n=2^{-n}$ for $n=0,1,2,\ldots$., and $I_n=(a_{n+1},a_{n})$.  Then
$$(0,1)=\bigcup_{n=0}^{\infty}I_n \cup \bigcup_{n=1}^{\infty}\{a_{n}\}$$
and
$$
[0,1]=\bigcup_{n=0}^{\infty}I_n \cup \bigcup_{n=0}^{\infty}\{a_{n}\}\cup \{0\}.$$
The function that maps $0$ to $a_1$, $a_n$ to $a_{n+2}$ for all $n$, and is the identity on each interval $I_n$, is a bijective mapping from $[0,1]$ to $(0,1)$.  That is,
$$
f(x)=\begin{cases}
1/2 & \text{if} \; x=0 \\
x/4 & \text{if} \; x=2^{-n} \; \text{for} \; n\in\mathbb{N}\\
x & \text{otherwise}.
  \end{cases}
$$
Its inverse is simply
$$
f^{-1}(x)=\begin{cases}
0 & \text{if} \; x=1/2 \\
4x & \text{if} \; x=2^{-n} \; \text{for} \; n\ge 2\\
x & \text{otherwise}.
  \end{cases}
$$
