Let $X$ be a compact metric space with metric $d$ and let $f \in C (X, X)$ and such that $d (f(a ),f(b))\ge d (a, b)$ for all $a$ and $b$ in $X.$ Show that $d(f(a), f(b)) = d(a, b)$ for all $a$ and $b$ in $X.$
My attempt:
$X$ is compact implies that $f(X)$ is also compact, since $f$ is continuous. Also, $f$ is uniformly continuous.
On the contrary, let us assume that there exists a pair of points $(x,y) \in X^2$ such that $d (f(x ),f(y)) > d (x, y).$ Since, $X$ is compact, diameter of $X$ is finite, say $M.$ And there exits points $x_0,y_0 \in X$ such that $d(x_0,y_0)=M.$
Suppose that $(x_0,y_0)=(x,y),$ we are done with the contradiction that $d (f(x_0 ),f(y_0)) > d (x_0, y_0)>M,$ since diameter of $f(X) \subseteq X$ is atmost M.
Now we are left with the case where $d(x,y) < M.$
I am stuck here. Please help. Thanks in advance.