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!

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
