# diameter on a compact metric space

I have troubles showing the following:

Let $(X,\rho)$ be a compact metric space and $F \subset X$ a closed subset. Prove that if diam $F < \infty$, then there exist $x_{0}, y_{0} \in F$ such that diam $F= \rho(x_{0},y_{0})$.

It looks so trivial yet hard to find the trick.

-
Consider $\rho: F \times F \to [0,\infty)$ and observe that a continuous function on a compact set attains its maximum. The condition on the diameter of $F$ is superfluous (since $X$ has finite diameter already). –  t.b. Mar 26 '12 at 22:00
Another way to see that compact metric sets have a finite diameter, fix $x\in X$ and consider the open cover by $B(x,r)=\{y\in X\mid d(x,y)<r\}$ for $r\in\mathbb R^+$. By compactness there is a finite subcover $B(x,r_1),\ldots,B(x,r_n)$ let $r$ be the maximal radius amongst $r_1,\ldots,r_n$. We have if so that $X\subseteq B(x,r)$ and thus has a finite diameter. –  Asaf Karagila Mar 26 '12 at 22:47

Since $F$ is closed in $X$, it is compact. Then $F \times F$ is compact, too, and $\rho: F \times F \to [0,\infty)$ is a continuous function on a compact set, so it attains its maximum. In other words, there is a point $(x_0,y_0) \in F \times F$ such that $\rho(x_0,y_0) = \max{\{\rho(x,y)\,:\,(x,y) \in F \times F\}} = \operatorname{diam}{F}$ which is precisely the statement you ask about.
1. We didn't use that $F$ has finite diameter, because it follows from our argument.
2. It would be enough to assume that $F$ is a compact subset of $X$ instead of assuming compactness of $X$ itself.
3. Compactness is necessary: equip a countable set $X = \{x_n\}_{n \geq 2}$ with the metric given by $d(x_n,x_m) = \max{\{1-1/n,1-1/m\}}$ if $n \neq m$. Then $\operatorname{diam}{X} = 1$ but no two points are at distance $1$ to each other.
@t.b. Which metric is it that makes $F \times F$ compact and $p: F \times F \rightarrow [0,\infty)$ a continuous function? –  Dosomemaths Oct 12 '13 at 15:51