How to show that if $A$ is compact, $d(x,A)= d(x,a)$ for some $a \in A$? I really think I have no talents in topology. This is a part of a problem from Topology by Munkres:

Show that if $A$ is compact, $d(x,A)= d(x,a)$ for some $a \in A$. 

I always have the feeling that it is easy to understand the problem emotionally but hard to express it in math language. I am a student in Economics and I DO LOVE MATH. I really want to learn math well, could anyone give me some advice. Thanks so much!
 A: Let $f$ : A $\longrightarrow$ $\mathbb{R}$ such that a $\mapsto$ d(x, a), where $\mathbb{R}$ is the topological space induced by the $<$ relation, the order topology.
For all open intervals (b, c) in $\mathbb{R}$, $f^{-1}((b, c))$ = {a $\in$ A $\vert$ d(x, a) $>$ b} $\cap$ {a $\in$ A $\vert$ d(x, a) $<$ c}, an open set. Therefore $f$ is continuous.
(Munkres) Theorem 27.4 Let $f$ : X $\longrightarrow$ Y be continuous, where Y is an ordered set in the order topology. If X is compact, then there exists points c and d in X such that $f$(c) $\leq$ $f$(x) $\leq$ $f$(d) for every x $\in$ X
By Theorem 27.4, $\exists$ r $\in$ A, d(x, r) = inf{ d(x, a) $\vert$ a $\in$ A}
Therefore d(x, A) = d(x, a) for some a $\in$ A
A: Hint: Compact $\iff$ sequentially compact for metric spaces. Can you construct a sequence which must tend to the $a$ you want to find?
A: Hints:
(1) By definition of distance between points and set:
$$D:=d(x,A):=\inf_{a\in A}d(x,A)$$
(2) By definition of infimum:
$$\forall\,n\in\Bbb N\;\exists\,a_n\in A\;\;s.t.\;\;D\le d(x,a_n)\le D+\frac1n$$
(3) The sequence $\,\{a_n\}\,$ has a subsequence 
$$\,\{a_{n_k}\}\;\;s.t.\;\;a_{n_k}\xrightarrow[k\to\infty]{}a\in A$$
(4) The function distance $\,d(x,.): X\to\Bbb R_+\;$ from a metric space $\,X\,$ is continuous 
