I found this exercise:
$f:K \rightarrow K$ where $K$ is compact and $||f(x) - f(y)|| = ||x - y||$, for all $x, y$ in K, implies $f$ is bijective. Hint: show that $f$ is injective and continuous and consider the sequence $x_j = f(x_{j−1})$, where $x_0 \notin f(K)$. Show that $||x_j - x_{j+m}|| = ||x_0 - x_m||$ and arrive at a contradiction.
I've been able to show that $f$ is injective and continuous, but I have no idea how to use the hint to show surjection. Any ideas? Thanks in advance.