# Minimum distance from a point to a closed set.

#### caffeinemachine

##### Well-known member
MHB Math Scholar
Hello MHB.

Here'a a question I found in a Problem book:

Let $Y$ be a non-empty closed subset of a metric space $M$ and $x$ be any point in $M$. Show that $\inf\{d(x,y):y\in Y\}=d(x,y_0)$ for some $y_0\in Y$.

My approach is:
Say $I=\inf\{d(x,y):y\in Y\}$. Assume that the proposition is false. Now there exists a sequence $\{y_n\}$ in $Y$ such that $d(x,y_n)<I+1/n$ for all positive integers $n$. If I could somehow show that some subsequence of $y_n$ converges then I'd be done. I can do that if it were given that $M$ is compact but I am not able to prove without this extra hypothesis. Can anybody help?

#### Fernando Revilla

##### Well-known member
MHB Math Helper
Consider the metric space $M=[-1,0)\cup (0,1]$ with the usual distance $d(s,t)=|t-s|$. Choose the set $Y=(0,1]$ (it is closed in $M$) and $x=-1$. Then,
$$\inf \{d(x,y):y\in Y\}=\inf \{|y+1|:y\in (0,1]\}=1$$
However, $d(-1,y_0)\neq 1$ for all $y_0\in Y.$

#### caffeinemachine

##### Well-known member
MHB Math Scholar
Consider the metric space $M=[-1,0)\cup (0,1]$ with the usual distance $d(s,t)=|t-s|$. Choose the set $Y=(0,1]$ (it is closed in $M$) and $x=-1$. Then,
$$\inf \{d(x,y):y\in Y\}=\inf \{|y+1|:y\in (0,1]\}=1$$
However, $d(-1,y_0)\neq 1$ for all $y_0\in Y.$
Thank you Fernando Revilla for this counterexample. I too thought the question is wrong but this is exactly how it was printed. I think we should have a compact metric space to make the question correct.

#### Fernando Revilla

##### Well-known member
MHB Math Helper
Certainly, the result is true if $Y$ is a compact set. There exists a sequence $y_n$ in $Y$ such that $\lim d(x,y_n)=d(x,Y).$ As $M$ is a metric space, $Y$ is sequentally compact, so there exists a subsequence $y_{n_k}$ in $Y$ such that $\lim y_{n_k}=y_0$ with $y_0\in Y.$ Since $d$ is a continuous function, $d(x,y_0)=d(x,Y).$

The result can be easily generalized if we consider $X\subset M$ compact instead of $X=\{x\}$ (which is trivially compact).