Let $(X,d)$ be a metric space and $K$ be a compact subset of $X$.
- Show that for every $x \in X$ there exists $k_x \in K$ such that $$d(x,K)=d(x,k_x)$$
- Suppose that for every $x\in X$, there exists a unique $k_x \in K$ such that $$d(x,k_x)= d(x,K).$$ Show that the projection $f:(X,d) \to (K, d_{|K})$, $f(x) = k_x$ is continuous.
I have solved the first question by extracting a convergent subsequence of the sequence $(k_n)$ in $K$ such that $d(x,k_n) - d(x,K)< \frac{1}{n}$.
Now for the second one, I supposed that the easiest path would be to show that if $A$ is closed in $K$ then $f^{-1}(A)$ is also closed, hoping to use the fact that a closed subset of a compact set is compact. However, I seem to be missing something:
Supposing that $f^{-1}(A)$ is non-empty, I choose a convergent sequence $(x_n) \in f^{-1} (A)^{\mathbb{N}}$ with limit $x_0$. Now i need to show that $f(x_0) \in A$ but it seems to lead me to a dead end.
Source: University exercise sheet
Let $x$ be a point in $X\setminus f^{-1}(A)$, and let $a_x$ be the closest point to $x$ from $A$ (such a point exists by compactness of $A$). Since $d(x,k_x)<d(x,a_x)$ by the uniqueness of $k_x$, we can consider the open ball $B_ε(x)$, where $$2\varepsilon=d(x,a_x)-d(x,k_x)>0$$ Take any $y\in B_ε(x)$. Can you finish from here and show that $y\notin f^{-1}(A)$ ? Hint: You'll need the fact that for any set $B$ in a metric space $X$, the distance $d(-,B):X\to\Bbb R$ is uniformly continuous. To be precise, given any $ε>0$, if two points $x,y\in X$ satisfy $d(x,y)<ε$, then $|d(x,B)-d(y,B)|<ε$.
Solution: