Distance function in a complete metric space

$K$ is non-empty

For all $k>0$, there exists $n_k$ such that $|d(x, A_{n_k})-d(x)|<\frac{1}{2^k}$. To simplify the notation, write $|d(x, A_{n})-d(x)|<\frac{1}{2^n}$ instead. In particular, for $x\in A_{n}$, we have $d(x)<2^{-n}$. Now, construct the sequence $x_k$ as follows:

  1. $x_1\in A_1$
  2. Suppose $x_{k}$ has already been chosen. Note that $|d(x,A_{k+1})-d(x,A_{k})|\leq |d(x, A_{k+1})-d(x)|+|d(x, A_{k})-d(x)|<2^{-(k-1)}$. In particular, for $x_k\in A_{k}$, $d(x_k,A_{k+1})<2^{-(k-1)}$. That means we can choose $x_{k+1}\in A_{k+1}$ such that $d(x_k,x_{k+1})<2^{-(k-1)}$.

Such a sequence chosen this way is clearly a Cauchy sequence. It converges to a limit $x_0$. Since $d(x)$ is a continuous function (as the uniform limit of $d(x,A_n)$), we have $d(x_0)=0$.

Inequality in one direction

Since the convergence is uniform, for all $\epsilon >0$ there exists $N\in \mathbb Z$ such that for all $n>N$, we have $|d(x,A_n)-d(x)|<\epsilon, \forall x\in E$. That means $\bigcup_{k=n}^\infty A_k$ lies in a $\epsilon$-neighborhood of $K$. Therefore, $\inf_{z\in A_n, y\in K}d(z,y)<\epsilon$ for all $n>N$.

Therefore, $$ d(x,K)=\inf_{y\in K}d(x,y)\leq\inf_{y\in K, z\in A_n}(d(x,z)+d(z,y))\leq\inf_{z\in A_n}(d(x,z)+\epsilon)\\\leq d(x, A_n)+\epsilon $$

Note: $\inf_{y\in K, z\in A_n}(d(x,z)+d(z,y))\leq\inf_{z\in A_n}(d(x,z)+\epsilon)$ is true because for all $z\in A_n$ there exists $y\in K$ such that $d(y,z)<\epsilon$.

Inequality in the other direction

Claim. $K= \bigcap_{n_0=0}^\infty\overline{\bigcup_{n=n_0}^\infty A_n}$.

To prove this, suppose first that $d(x)=0$. Then $d(x, A_n) \to 0$, i.e. $\forall k>0,\exists N,\forall n\geq N_k, d(x,A_n)<1/k$. Let $n_k=1+\max_{r\leq k} \{N_r\}$. Then $(n_r)$ is an increasing sequence of integers. Since $d(x,A_{n_k})<1/k$, we can choose $x_k\in A_{n_k}$ such that $d(x,x_k)<1/k$. Then $x_k \to x$, so $K\subseteq \bigcap_{n_0=0}^\infty\overline{\bigcup_{n=n_0}^\infty A_n}$.

Conversely, if $x\in \bigcap_{n_0=0}^\infty\overline{\bigcup_{n=n_0}^\infty A_n}$, then choose the sequence $x_k$ as follows.

  1. Define $m_1=1$.
  2. Suppose $m_{k-1}$ have already been defined. We have $x\in \overline{\bigcup_{n=m_{k-1}+1}^\infty A_n}$, so there exists a sequence $(y_r^{(k)})_{r=1}^\infty$ in ${\bigcup_{n=m_{k-1}+1}^\infty A_n}$ that converges to $x$. There exists $r$ such that $d(x,y_r^{(k)})<1/k$. Let $x_k=y_r^{(k)}$.
  3. Define $m_{k}\geq m_{k-1}+1$ be an integer such that $y_r^{(k)}\in A_{m_{k}}$.

Then we obtain a sequence $(x_k)_{k=1}^\infty$ that satisfy the following properties:

  • $x_k\to x$ as $k \to \infty$.
  • $x_k\in A_{m_k}$.

It is easy to see that $d(x)=0$ due to the continuity of the metric and uniform convergence.


Now let $x\in E$; there exists a sequence $\xi_k$ in $E$ such that $d(x,K)=\lim_{k\to \infty} d(x,\xi_k)$. Since $K$ is compact we may assume that $\xi_k$ tends to a limit $\xi\in K$. We may also assume that $d(\xi_k, \xi)<\frac{1}{3k}$. So $d(x, K)=d (x,\xi)$. By the discussion above there exists sequences $(y_r^{(k)})_{r=1}^\infty$ such that

  • $y_r^{(k)}\to \xi_k$ as $r\to \infty$;
  • $y_r^{(k)}\in A_{m_{r,k}}$
  • $d(y_r^{(k)}, \xi_k)<\frac{1}{3k}, \forall r$

Using the second part of the proof above. We can, in fact, stipulate that $m_{r+1,k}\geq m_{r,k}$ by modifying the construction a little. Now, let $$ x_k=y_k^{(k)}, m_{k,k}=m_k, $$ so $x_k \to \xi$, $x_k \in A_{m_k}$.

Therefore, we have $$ d(x,K)=d(x, \xi)= \lim_{k\to \infty} d(x, x_k) \geq \lim_{k\to \infty} d(x, A_{m_k})=\lim_{k\to \infty} d(x, A_{k})= d(x). $$

The proof is now complete.