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