# Isometry in compact metric space

Let $(M,d)$ be a compact metric space and $f: M \rightarrow M$ a continuous function. I'm trying to prove that if $d(f(x),f(y)) \geq d(x,y)$ for every $x,y \in M$, then $f$ is an isometry. This is how far I could get: Since $f$ is a continuous function, the set $\{(x,y) \in M \times M : d(f(x),f(y)) = d(x,y)\}$ is closed, and hence compact. By symmetry, it is of the form $N \times N$. Thus, $N$ (with the metric induced by $M$) is a compact metric space such that $d(f(x),f(y)) = d(x,y)$ for every $x,y \in N$. I already know that this implies that the restriction of $f$ to $N$ is an isometry of $N$, but how to prove that the open set $M \setminus N$ is empty?

-
Hint: suppose $x,y\in M$ are such that $d(fx,fy)>d(x,y)$. By induction, get a sequence of points $z_n$ such that $d(z_n,y)>d(z_{n-1},y)$ for all $n$. Combine with compactness of $M$. –  wildildildlife Jul 14 '11 at 13:06
A good exercise as a follow-up: prove that $f$ must also be surjective. –  Mark Jul 14 '11 at 16:18

Sorry for resurrecting such an old thread, but I have a proof using $\epsilon$-nets that is different from the one linked above. (Edit: the solution "linked above" got deleted, so for reference: http://www.artofproblemsolving.com/Forum/viewtopic.php?p=123891#p123891.) Note that we are not assuming $f$ to be continuous as a given.

Lemma 1. Let $\epsilon > 0$. Then there exists $n_\epsilon < \infty$ such that given any set of $n_\epsilon$ distinct points in $M$, two of them lie distance less than $\epsilon$ apart.

Proof. Take $n_\epsilon - 1$ to be the size of an $\epsilon/10$ net for $M$; then given any $n_\epsilon$ distinct points, two are within distance $\epsilon/10$ of one of the points picked to define the $\epsilon/10$ net, hence distance at most $\epsilon/5$ apart. $\square$

Corollary 1. For any $\epsilon > 0$, there is a number $N_\epsilon$ such that

1. There exist points $p_1, \dots, p_{N_\epsilon} \in M$ such that $d(p_i, p_j) \ge \epsilon$ for all $1 \le i < j \le N_\epsilon$.
2. Given any $N_\epsilon + 1$ points in $M$, there must be two of distance less than $\epsilon$ apart.
3. Whenever $q_1, \dots, q_{N_\epsilon} \in M$ have all pairwise distances at least $\epsilon$, they form an $\epsilon$-net.

Proof. Take $N_\epsilon$ to be the maximum cardinality of an $\epsilon$-net for $X$. Such a number must exist by the lemma, and properties (1)-(3) are immediate. $\square$

Lemma 2. Let $Y$ be the set of $N_\epsilon$-tuples in $M$ whose entries form $\epsilon$-nets for $M$. Then $Y$ is compact.

Proof. Note the metric on $M^{N_\epsilon}$ is $$d((p_1, \dots, p_{N_\epsilon}), (q_1, \dots, q_{N_\epsilon})) = \max_{1 \le i \le N_\epsilon} d(p_i, q_i).$$ A product of two compact metric spaces is compact, and so by induction on the number of spaces, any finite product of metric spaces is compact, and so by induction on the number of spaces, any finite product of metric spaces is compact. Thus $M^{N_\epsilon}$ is compact.

To finish the lemma, we need only show $Y$ is closed in $M^{N_\epsilon}$. For $1 \le i < j \le N_\epsilon$, let $f_{ij}(p_1, \dots, p_{N_\epsilon}) = d(p_i, p_j)$. Then $f_{ij}$ is continuous. Since $$Y = \bigcap_{1 \le i < j \le N_\epsilon} f_{ij}^{-1}([\epsilon, \infty))$$ by (3) in the corollary, $Y$ is an intersection of closed subsets of $M$. Thus $Y$ is compact. $\square$

Corollary 2. $$\sum_{i=1}^{N_\epsilon - 1} \sum_{j = i+1}^{N_\epsilon} d(x_i, x_j)$$ attains a maximum value on $Y$. If $(p_1, \dots, p_{N_\epsilon})$ is a point where this maximum is attained, then for $1 \le i,\, j \le N_\epsilon$, $d(f(p_i) f(p_j)) = d(p_i, p_j)$.

Proof. The first assertion follows from compactness. For the second, we are given that $d(p_i, p_j) \le d(f(p_i), f(p_j))$, and if equality did not hold for all $i$, $j$, we would have $d(f(p_i), f(p_j)) \ge \epsilon$ for $i \neq j$, so $(f(p_1), \dots, f(p_{N_\epsilon})) \in Y$, but $$\sum_{i=1}^{N_\epsilon - 1} \sum_{j=i+1}^{N_\epsilon} d(f(p_i), f(p_j)) > \sum_{i=1}^{N_\epsilon -1} \sum_{j=i+1}^{N_\epsilon} d(p_i, p_j).$$This contradicts $(p_1, \dots, p_{N_\epsilon})$ being a maximizer. $\square$

Now for the proof of the original result. By the above, it follows that for all $n \in \mathbb{N}$, there exists a ${1\over{n}}$ net that $f$ maps isometrically into $M$. Let $x,\, y \in M$. For all $n \in \mathbb{N}$, pick $x_n,\,y_n$ such that $d(x, x_n) < {1\over{n}}$, and $d(y, y_n) < {1\over{n}}$, and such that $x_n,\,y_n$ are in a ${1\over{n}}$ net with isometric $f$-image. Then $$d(f(x), f(y)) = \lim_{n\to\infty} d(f(x_n), f(y_n)) = \lim_{n \to \infty} d(x_n, y_n) = d(x, y).$$

-