# Distance between a sequences and compact sets

Let $(X,d)$ be a metric space, and $K\subset X$ compact. Define for $x\in X$, $$\rho(x, K)=\inf_{y\in K}d(x,y).$$ Let $(x_n)_n\subset X$ be a sequence in $X$ such that $\rho(x_n,K)\to 0$. Is it true that $(x_n)_n$ has a convergent subsequence with limit $x_0$ in $K$?

-
It's not true true without further assumptions on the sequence. For example it fails when the sequence is convergent to a point which in not in $K$. – Davide Giraudo Jul 10 '12 at 15:27
Did you mean $\rho(x_0,K) = 0$? – Rudy the Reindeer Jul 10 '12 at 15:29
Otherwise here is a counterexample: $X = \mathbb R$, $K = [3,4]$, $x_n = \frac1n$. – Rudy the Reindeer Jul 10 '12 at 15:30
I don't understand how $\rho$ is related to the question – Norbert Jul 10 '12 at 15:30
@Matt N, Norbert I forgot to mention that $\rho(x_n,K)\to 0$. I've just fixed it – Jim Jul 10 '12 at 15:40

The map $y\mapsto d(x,y)$ is continuous for each $x\in X$ fixed, and since $K$ is compact, for each $x$ we can find $y(x)$ such that $d(x,y(x))=d(x,K)$.
Let $y_n\in K$ such that $d(x_n,y_n)=d(x_n,K)$. Then by Bolzano-Weierstrass theorem, we can find a subsequence $\{y_{n_k}\}$ which converges to some $y$ ($\in K$, since $K$ is closed). Since $$d(x_{n_k},y)\leq d(x_{n_k},y_{n_k})+d(y_{n_k},y),$$ and the two terms in the right hand side converge to $0$ as $k\to +\infty$, we have found a subsequence of $\{x_n\}$ which converges to some $y\in K$.