# Continuity of a "minimal distance" projection $f:(X,d) \to (K, d_{|K})$ for a compact $K \subset X$. (Hint preferred)

Let $(X,d)$ be a metric space and $K$ be a compact subset of $X$.

1. Show that for every $x \in X$ there exists $k_x \in K$ such that $$d(x,K)=d(x,k_x)$$
2. 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)|<ε$.
We have $$d(y,k_y)+ε < d(y,k_x)+ε < d(x,k_x)+2ε < d(x,A) \le d(y,A)+ε$$ and thus $d(y,K)<d(y,A)$, hence $k_y\notin A$
• Thank you for the hint, but could you please clarify why this inequality implies $k_y \neq a_y$? There also seems to be no usage of the fact that $k_x$ is unique (if $k_x$ is not unique we can just make $f$ associate $x$ to one of the many $k_x$ but in this case $f$ need not be continuous and yet your inequality still holds i think). Aug 21, 2015 at 12:22
• @MarkoKarbevski: I've edited my post. I must have missed the error. I hope it's correct now. And the uniqueness of $k_x$ implies that $d(x,k_x)<d(x,a_x)$. Aug 21, 2015 at 16:10
• Do you also think that $f(x)$ is a 1-Lipschitz function? Aug 23, 2015 at 2:37
• Answer to my own question: No it is not neccessarily, if we work in the plane $\mathbb{R}^2 - \{(0,y)| y\in \mathbb{R} \}$ and set $K= \{ (-2,0), (2,0) \}$ then for the points $A(-\frac{1}{2},0), B(\frac{1}{2},0)$ we have $d(f(A),f(B))=4>1=d(A,B)$. Aug 23, 2015 at 12:06