Let $(X,d)$ be a metric space and let $A\subseteq X$ be a non empty compact subset.
Define $d(A) = \sup \{d(x,y):x,y\in A\}$.
Exercise: Show that $x,y\in A$ exist such that $d(A) = d(x,y).$
I know that:
Since $A$ is a non empty compact subset, $A$ is closed.
$A$ is closed implies that if $B_\epsilon(x) \cap A \neq \emptyset$ for every $\epsilon >0$, then $x\in A$.
My solution:
Showing that $x,y \in A$ exist such that $d(A) = d(x,y)$, is equivalent to showing that $\inf(A) \in A$ and $\sup(A) \in A$, right? Take $a = \inf(A)$ and suppose that $B_\epsilon(a) \cap A = \emptyset$. We can find $\bar{a} = a + \epsilon/2$ such that $\bar{a} > a$ and $\bar{a} \notin A$, since $\bar{a} \in B_\epsilon(a)$. This is a contradiction because this would mean that $a$ is not the infimum of $A$. Therefore $B_\epsilon(a) \cap A \neq \emptyset$, and $a\in A$. The same reasoning can be used for the supremum of $A$.
Question: Is my solution correct? Or should I be more elaborate/careful when concluding that proving the exercise is essentially showing that $\inf(A) \in A$ and $\sup(A) \in A$?