# If $X$ is a compact subset of $M$, $y \in X'$, then there exists a point $a \in X$ such that $d(a,y) \leq d(x,y)$ for all $x \in X$

In exercise 43.7 of Johnsonbaugh/Pfaffenberger - Foundations of Mathematical Analysis, we seek to show that if $X \subset M$ is compact, then if $y \in X'$ then there exists a point $a \in X$ such that $d(a,y) \leq d(x,y)$ for all $x \in X$. Moreover, we are asked to show by example that this fails if $X$ is merely closed. I feel as if my proof does not work, since I cannot come up with a an example of a closed subset for which this fails. I've looked at this question, and I think I understand how that works. However, I still fail to see how it would fail if $X$ were closed but not compact.

My "proof":

Suppose the conclusion fails, i.e. for any $a \in X$ there exists $x \in X$ such that $d(a,y) > d(x,y)$. Let $\{x_n\}$ be such a sequence in $X$. Then, since $X$ is compact, $\{x_n\}$ has a convergent subsequence, $\{x_{n,j}\}$. Since $X$ is compact, $lim_{j \to \infty}x_{n,j} = b$ is in $X$. But then $d(b,y) \leq d(x_{n,j},y)$ for all $x_{n,j}$. So we have the conclusion.

• What is $X'$ here? And what is $M$? – Arnaud Mortier Jul 13 '18 at 15:51
• You started with “Suppose the conclusion fails”. WHich contradiction did you obtain fram that assumption? – José Carlos Santos Jul 13 '18 at 15:52
• @ArnaudMortier the book doesn't specify in this example, but has used $X'$ to mean the complement of $X$ before, so I assumed it means that. – perpetuallyconfused Jul 13 '18 at 15:54
• Weird but ok, and what is $M$? – Arnaud Mortier Jul 13 '18 at 15:54
• No it doesn't, all $x_{n,j}$ doesn't mean all $x$. – Arnaud Mortier Jul 13 '18 at 15:56

Consider $M=[-1,0)\cup(0,1]$. Let $Y=\{-1\}$ and $X=(0,1]$. Note that $X$ is closed in $M$ since $[0,1]\cap M=X$. Now for $y\in Y$, $d(X,y):=\inf_{x\in X} d(x,y)=1$ while $d(x,y)>1$ for any fixed $x\in X$. Thus, there is no $x\in X$ for which the minimum distance is obtained.
For a counter-example when $X$ is closed but not compact, let $M=\Bbb Q$ with $d(x,y)=|x-y|.$ Let $X=M\cap (\sqrt 2\;, \infty)$ and $y=0.$
For a counter-example when, also, $d$ is a complete metric, let $M=\Bbb R\cup \{y\}$ where $y\not\in \Bbb R.$ For $u,v\in \Bbb R$ let $d(u,v)=\frac {|u-v|}{1+|u-v|}.$ For $u\in \Bbb R$ let $d(u,y)=2-d(u,0).$ And let $X=\Bbb R.$