# If $X$ is compact and $f:X \rightarrow Y$ is a dense continuous injection, then $f$ is a homeomorphism

I found this: Let $X$ be a compact space and $f:X \rightarrow Y$ a continuous injection. Let $f(X)$ be dense in $Y$. Prove that $f$ is a homeomorphism.

So, my question is: is it possible to prove that? I tried proving it and I couldn't, since Y is not necessarily a Hausdorff space.

The Hausdorff-condition is needed when proving that f is a closed mapping, but I guess you could do it some other way.

• Hausdorff is needed. Take $Y=X$ with the trivial topology and consider the identity map from $X$ to $Y$. – David Mitra Jul 24 '14 at 9:45
• Please consider changing the title, to be more informative. – Elimination Jul 24 '14 at 9:49
• Note that $f(X)$ is compact and thus closed in $Y$ under the assumption that $Y$ is Hausdorff. Together with being dense it implies that $f(X)=Y$. With that you apply the classical "continuous bijection from a compact space" argument. – freakish Nov 8 '18 at 18:46

It is necessary that $$Y$$ is Hausdorff. For a counterexample when $$Y$$ is not Hausdorff, let $$Y$$ be the set $$X$$ equipped with the trivial topology. Assume that the topology on $$X$$ is not the trivial topology. Then, the identity map from $$X$$ to $$Y$$ is injective, continuous, and the image is dense in $$Y$$ (in fact it is all of $$Y$$). However, $$f$$ is not a homeomorphism.