Showing that an isometry of a compact space $X$ into itself is surjective let $f : X \to X $ be an isometry $d((f(x)),f(y)) = d(x,y)$ for all $x,y \in X$. It could easily be shown that $f$ is continuous and injective. Now if we let $X$ to be compact, need to show that it is surjective in this case. The proof proceeds as following:

Suppose $f(X) \neq X$. Then there exists a $a \in X$ such that $a \not \in f(X)$. The function $f$ is continuous, and since $X$ is compact so is $f(X)$. Notice that $f(X)$ is compact in $X$, being hausdorff $f(X)$ is closed, making $X - f(X)$ open. Then for this $a$, I can find a $\epsilon$ neighbourhood such that $B(a,\epsilon) \subset X - f(X)$.

This is ofc, not the whole proof. However I understood the other part easily, only problem I have is here that why $X$ is hausdorff so that $f(X)$ is closed in $X$. I'm not given that it is Hausdorff or anything.
Thanks!
 A: Suppose that $x \in X\setminus f(X)$. it follows that since $f(X)$ is closed, we have that $\epsilon=d(x,f(X))>0$ is well defined, and in particular, let $\bigcup_{\alpha \in A} U_{\alpha}$ be some cover of $X$ by open sets with diameter less than $\epsilon$. There exists some minimal $N$ (elements in $A$) so that this is possible. if $x \in U_\alpha$, then $U_\alpha \cap f(X)=\emptyset$, so $f(X)$ is covered by $N-1$ open sets, but $\bigcup_{i=1}^{n-1}f^{-1}(U_\alpha)$ is a cover of $X$, and all the diameters are less than $\epsilon$ since $f$ was an isometry, a contradiction.
A: $X$ is a metric space (because you are given a metric to work with).
Every metric space is "Hausdorff", which means any two distinct points have neighbourhoods which do not overlap.
One can prove that if $H$ is a compact Hausdorff space, and $f$ continuous, then $f(H)$ is compact. However, it's a bit weird that they talk about "Hausdorff", because they could have just said $X$ is a compact metric space, and $f$ is continuous, so $f(X)$ is compact.
This an outline for how to show that continuous functions preserve compactness:
Let $X, Y$ be metric spaces, $f:X\rightarrow Y$ continuous. Let $K \subset X$ compact. Choose an open cover $\mathcal{U}$ for $f(K)$. Then as the pre-image of open sets is open (by continuity), $\{f^{-1}(U):U\in\mathcal{U}\}$ is an open cover for $K$. Now by compactness you can choose a finite subcover, and then map this back to $Y$ to obtain a finite subcover for $f(K)$.
