Using the limit point property in metric spaces to prove existence of maximum distance.

Let $M$ be a metric space and suppose that $K \subset M$ is a non-empty compact set. So if $p$ is any element of $M$, then there is a point $q$ that belongs to $K$, such that $d(p,x)\leq d(p,q)$ for every $x$ that belongs to $K$. Prove this using the the definition of compactness in terms of open coverings, and again, using the limit point property.

I got the first part, any help with the second?

-

HINT: Let $x\in M$ be arbitrary, and let $r=\inf\{d(x,p):p\in K\}$. For each $n\in\Bbb Z^+$ there is a point $p_n\in K$ such that $d(x,p_n)<r+\frac1n$. Consider the subset $P=\{p_n:n\in\Bbb Z^+\}$ of $K$. (Be a little careful: there are actually two cases, since $P$ may be either finite or infinite.)
Try and show that a continuous function from a compact set achieves a maximum in the image using the limit point approach. Then consider the function $d:K \to \mathbb{R}$ where $d(x) = d(p, x)$. This is certainly a continuous function so it must achieve a maximum.
In case you are having trouble showing the first part, note that the image of a compact set under a continuous function is compact. Since this compact set is in $\mathbb{R}$ we know that it has a least upper bound $k$. Then $k_n = k - \frac{1}{n}$ is a sequence in $d(K)$. This is an increasing sequence that converges to $k$. Now this sequence is in $d(K)$, which is compact which means that it has a subsequence that converges in $d(K)$, call it $k_{n_k}$. Why is the limit of $k_{n_k}$ the same as $k_n$?