$A$ : closed set in $\mathbb{R}^n$
$B$ : compact set in $\mathbb{R}^n$
$A \cap B=\phi.$
$d$ : distance function
Then, prove that
\begin{equation}
\text{For all } x \in B, \text{ there exists } a_x \in A \text{ such that } d(x, A)=d(x, a_x).
\end{equation}
$\bigg(d(x,A)=\inf\{d(x,y) | y \in A\} \bigg)$
I think that I should use the continuity of distance function.
For all $x\in B$,
define
$f(x):=d(x,A) \ (x\in B).$
Because $B$ is compact and $f$ is continuous, $f(B)$ is also compact. Thus there exists maximum value and minimum value of $f(B)$.
But this idea didn't work.
I would like you to give me some ideas.
Best Answer
Compactness of $B$ is not needed!
$d(x,A)$ can be written as $\lim d(x,a_n)$ for some squence $(a_n) \subset A$. Now boundedness of $d(x,a_n)$ implies boundedness of $(a_n)$. Hence there is a subsequence converging to some $a_x$. Since $A$ is closed we see that $a_x \in A$. Can you see that $d(x,A)=d(x,a_x)$?