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.


Solution 1:

For the sake of having an answer:

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.

Remarks.

  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.