Compact set and continuous function Let $(E,d), (E',d')$ be two metric space, and $f:E\rightarrow E'$ an injective function such that the image of any compact set from $E$ is compact in $E'$. 
How can I prove that $f$ is continuous?
Thank you.
 A: Consider the image of a sequence $x_n \to x$ together with $x$... 
A: Suppose $x_n \to x$. Let $y_n = f(x_n), y=f(x)$. We want to show that $y_n \to y$.
Let $D_n = \{x_n,x_{n+1},...\} \cup \{x\}$ and 
$R_n = \{y_n,y_{n+1},...\} \cup \{y\}$. We see that both sets are compact. Let
$D = \cap_n D_n$,$ R = \cap_n R_n$. We see that $D = \{x\}$.
Note that since $R_n$ is compact, it contains all accumulation points of the sequence $y_n$. Hence $R$ contains all accumulation points of the sequence $y_n$. Also note that any subsequence of $y_n$ must have an accumulation point.
Hence, to show that $y_n \to y$, it is sufficient to show that $R = \{y\}$.
Suppose $z \in R$, but $z \neq y$. Then $f^{-1}(\{z\}) \cap D_n \neq \emptyset$ for all $n$. However, since $f$ is injective, we see that $f^{-1}(\{z\})$ is a 
single point, hence, in fact, we have $f^{-1}(\{z\}) \subset D_n $ for all $n$.
This implies $\{x\}=f^{-1}(\{z\})$, a contradiction. Hence $R = \{y\}$.
Note: To see the necessity of injectivity in this proof, take $f=1_\mathbb{Q}$, then any set is mapped into a compact set, but $f$ is
clearly not continuous.
