I came across a very confusing question.

Which of the following statements are true about the open interval $\displaystyle (0,1)$ and the closed interval $\displaystyle [0,1]$?

- There is a continuous function from $\displaystyle (0,1)$
__onto__ $\displaystyle [0,1]$. - There is a continuous function from $\displaystyle [0,1]$
__onto__ $\displaystyle (0,1)$. - There is a continuous
__one-to-one__ function from $\displaystyle (0,1)$ __onto__ $\displaystyle [0,1]$.

It's immediately clear to me that 3 is wrong because the inverse image of a closed set has to be closed and it isn't, but what about the other two?

Statement 2 requires that the function be onto but not one-to-one. If it is onto, then the entire closed unit interval gets mapped to the open unit interval, so the inverse image of $\displaystyle (0,1)$ should be $\displaystyle [0,1]$ and open sets should have on open inverse image.

Why doesn't the same argument work for statement 1? The answer key of the book says that statement one is the only correct one. If one is indeed true, is there a simple example of such a continuous function?