Proving injective continuous function is homeomorphism [duplicate]

If $$n\in\mathbb{N}$$, and X is a compact metric space, show that every continuous injective function $$f:X\to\mathbb{R}^n$$ is a homeomorphism of X. $$(f\subseteq\mathbb{R}^n)$$

So I persumed that I have to show that f is an open map from $$X\to\mathbb{R}^n$$: Let U be an open set in X. Then $$U^c$$ is closed in X, which is compact, so $$U^c$$ is also compact. Since $$f$$ is continuous $$f(U^c)$$ is compact in $$\mathbb{R}^n$$.

Then I got stuck. Does this lead to $$f(U^c)$$ being closed in $$\mathbb{R}^n$$? is it sufficient enough?

• You mean a homeomorphism onto its image right? so between $X$ and $f(X) \subset \Bbb R^n$. – Ruben Jun 24 '19 at 17:13

If $$U$$ is compact and $$f$$ continuous, then $$f(U)$$ is also compact. In addition, if $$f$$ is injective (that is, bijective from $$U$$ to $$f(U)$$), then $$f$$ has a continuous inverse. I think you can easily find proofs about the relevant theorems in any intro topology tutorial or, e.g., chapter 2 of Baby Rudin.