Prove whether or not the following statements are True or False.
1) Let $K$ be a compact subset of $\mathbb{R}$ (w.r.t. the usual metric). Then, there exists a continious function $f: K \rightarrow \mathbb{R}$ with $f(K) = \mathbb{R}$.
2) Let $K$ be a compact subset of $\mathbb{R}$ (w.r.t. the usual metric). Then, there exists a continious function $f: K \rightarrow \mathbb{R}$ with $f(K) = (0, 1)$.
From what I understand, continuous functions map compact sets to compact sets. For 1), clearly $\mathbb{R}$ isn't bounded, so it is not compact. This means we cannot have a continuous function $f$ such that $f(K) = \mathbb{R}$.
Similarly, in 2) $(0, 1)$ is not closed. Using a similar argument for 1), we can conclude that there cannot be such a $f$ s.t. $f(K) = (0, 1)$. So, both 1) and 2) are false.
Am I correct, or at least on the right track? Am I understanding compact sets/continuous functions correctly? Thank you.
In fact, $\mathbb R$ is not compact. And neither is $(0,1)$. Now, the way of proving that neither of them can be equal to $f(K)$ consists in using the fact that, if $f$ is continuous and $K$ is compact, then $f(K)$ is compact too.