Existence of one-to-one continuous function from $[0,1]$ to $(0,1)$, from $\Bbb R$ to $[0,1]$, from $\Bbb R$ to $(0,1)$, and from $(0,1]$ to $(0,1)$ Problem-In which of the following cases there exist a one-to-one continuous function from $S$ to $T$,
(a) $S=[0,1]$ to $T=(0,1)$
(b) $S=\Bbb R$ to $T=[0,1]$
(c) $S=\Bbb R$ to $T=(0,1)$
(d) $S=(0,1]$ to $T=(0,1)$
Attempt-  I think (a) false since continuous function preserves compactness but what about others don't know . Please someone explain.
Thanks in advance.
 A: Such a function exists in all four cases. The key idea is that any interval in the real numbers can be continuously mapped into any other interval just by stretching or squashing and then shifting it over.
For example, in (a), define $f$ by $f(x) = x / 2 + 1/4$. Check that this is continuous as a function $\Bbb{R} \to \Bbb{R}$, that $f(x) \in T$ whenever $x \in S$, and that $f$ is one-to-one.
(Note that $f$ is not onto. It is true that because $S$ is compact, the image $f(S)$ must also be compact, but the image is not all of $T$, so the argument you sketched does not work. It's fine for $f$ to map $S$ to a compact subspace of $T$ even though $T$ is not compact.)
In (b), let's start by defining a function $g: \Bbb{R} \to \Bbb{R}$ whose image is bounded. Define $g(x) = e^x$ (for $x \le 0$), $g(x) = 2 - e^{-x}$ (for $x \ge 0$). This is clearly continuous on the left side $x \le 0$ and on the right side $x \ge 0$, and because the two sides agree at $0$, it's continuous on $\Bbb{R}$. The image of $g$ is $(0, 2)$, and $g$ is strictly increasing and therefore one-to-one. Now you can easily modify $g$ so that its image is inside $[0, 1]$.
(c) and (d) are similar, and I'll leave them for you.
