This lecture will conclude our discussion on metric spaces with completion of metric spaces.
Definition. Let $X=(X,d)$ and $\tilde X=(\tilde X,d)$ be two metric space. A mapping $T: X\longrightarrow\tilde X$ is said to be an isometry of $T$ preserves distances, i.e.
$$\forall x,y\in X,\ \tilde d(Tx,Ty)=d(x,y).$$ The space $X$ is said to be isometric with $\tilde X$ if there exists a bijective isometry of $X$ onto $\tilde X$.
Theorem [Completion] For a metric space $(X,d)$ there exists a complete metric space $\hat X=(\hat X,\hat d)$ which has s subspace $W$ that is isometric with $X$ and is dense in $\hat X$. $\hat X$ is called the completion of $X$ and it is unique up to isometries.
Proof. This will be a lengthy proof and I have divided it into steps.
Step 1. Construction of $\hat X=(\hat X,\hat d)$.
Let $(x_n)$ and $(y_n)$ be Cauchy sequences in $X$. We say $(x_n)$ is equivalent to $(x_n’)$, and write $(x_n)\sim (x_n’)$, if
$$\lim_{n\to\infty}d(x_n,x_n’)=0.$$ $\sim$ is actually an equivalence relation on the set of all Cauchy sequences of $X$. Clearly $\sim$ is reflexive and symmetric. Let us show that $\sim$ is also transitive. Let $(x_n)\sim (x_n’)$ and $(x_n’)\sim (x_n^{\prime\prime})$. Then
$$\lim_{n\to\infty}d(x_nx_n’)=0\ \mbox{and}\ \lim_{n\to\infty}d(x_n’,x_n^{\prime\prime})=0.$$
\begin{align*}
\lim_{n\to\infty}d(x_n,x_n^{\prime\prime})&\leq\lim_{n\to\infty}d(x_n,x_n’)+\lim_{n\to\infty}d(x_n’,x_n^{\prime\prime})\\
&=0
\end{align*}
Let $\hat X$ be the set of all equivalence classes $\hat x,\hat y,\cdots$ of Cauchy sequences. Define
$$\hat d(\hat x,\hat y)=\lim_{n\to\infty}d(x_n,y_n),$$
where $x_n\in\hat x$ and $y_n\in\hat y$. We claim that $\hat d$ is a metric on $\hat X$. It suffices to show that $\hat d$ is well-defined. The conditions (M1)-(M3) hold due to the fact that $d$ is a metric. First we show that $\hat d(\hat x,\hat y)$ exists. It follows from (M3) that
$$d(x_n,y_n)\leq d(x_n,x_m)+d(x_m,y_m)+d(y_m,y_n)$$ and so we have
$$d(x_n,y_n)-d(x_m,y_m)\leq d(x_n,x_m)+d(y_m,y_n).$$ Similarly, we obtain
$$d(x_m,y_m)-d(x_n,y_n)\leq d(x_n,x_m)+d(y_m,y_n).$$ Hence,
$$|d(x_n,y_n)-d(x_m,y_m)|\leq d(x_n,x_m)+d(y_m,y_n)\rightarrow 0$$ as $n,m\rightarrow\infty$, i.e.
$$\lim_{n,m\to\infty}|d(x_n,y_n)-d(x_m,y_m)|=0.$$
Since $\mathbb{R}$ is complete, $\displaystyle\lim_{n\to\infty}d(x_n,y_n)$ exists. Now we show that the limit is independent of the choice of representatives $(x_n)$ and $(y_n)$. If $(x_n)\sim (x_n’)$ and $(y_n)\sim(y_n’)$, then
$$|d(x_n,y_n)-d(x_n’,y_n’)|\leq d(x_n,x_m)+d(y_m,y_n)\rightarrow 0$$ as $n\to\infty$.
Step 2. Construction of an isometry $T: X\longrightarrow W\subset \hat X$.
For each $b\in X$, let $\hat b$ be the equivalence class of the Cauchy sequence $(b,b,b,\cdots)$. Then $T(b):=\hat b\in\hat X$. Now,
$$\hat d(Tb,Tc)=\hat d(\hat b,\hat c)=d(b,c).$$ So, $T$ is an isometry. An isometry is automatically injective. $T$ is onto since since $T(X)=W$. Let us show that $W$ is dense in $\hat X$. Let $\hat x\in \hat X$ and let $(x_n)\in\hat x$. Since $(x_n)$ is Cauchy, given $\epsilon>0$ $\exists N$ such that $d(x_n,x_N)<\frac{\epsilon}{2}$ $\forall n\geq N$. Let $(x_N,x_N,\cdots)\in\hat x_N$. Then $\hat x_N\in W$.
\begin{align*}
\hat d(\hat x,\hat x_N)=\lim_{n\to\infty}d(x_n,x_N)\leq\frac{\epsilon}{2}<\epsilon&\Longrightarrow \hat x_N\in B(\hat x,\epsilon)\\
&\Longrightarrow B(\hat x,\epsilon)\cap W\ne\emptyset.
\end{align*}
Hence, $\bar W=\hat X$ i.e. $W$ is dense in $\hat X$.
Step 3. Completeness of $\hat X$.
Let $(\hat x_n)$ be any Cauchy sequence in $\hat X$. Since $W$ is dense in $\hat X$, $\forall \hat x_n$, $\exists\hat z_n\in W$ such that $\hat d(\hat x_n,\hat z_n)<\frac{1}{n}$.
\begin{align*}
\hat d(\hat z_m,\hat z_n)&\leq \hat d(\hat z_n,\hat x_m)+\hat d(\hat x_m,\hat x_n)+\hat d(\hat x_n,\hat z_n)\\
&<\frac{1}{m}+\hat d(\hat x_m,\hat x_n)+\frac{1}{n}.
\end{align*}
Given $\epsilon>0$ by Archimedean property $\exists$ a positive integer $N_1$ such that $N>\frac{\epsilon}{3}$. Since $(\hat x_n)$ is a Cauchy sequence, $\exists$ a positive integer $N_2$ such that $\hat d(\hat x_m,\hat x_n)<\frac{\epsilon}{3}$ $\forall m,n\geq N$. Let $N=\max\{N_1,N_2\}$. Then $\forall m,n\geq N$, $\hat d(\hat z_m,\hat z_n)<\epsilon$ i.e. $(\hat z_m)$ is Cauchy. Since $T: X\longrightarrow W$ is an isometry and $\hat z_m\in W$, the sequence $(z_m)$, where $z_m=T^{-1}\hat z_m$, is Cauchy in $X$. Let $\hat x\in\hat X$ be the class to which $(z_m)$ belongs. Show that $\hat x$ is the limit of $(\hat x_n)$. For each $n=1,2,\cdots$,
\begin{align*}
\hat d(\hat x_n,\hat x)&\leq \hat d(\hat x_n,\hat z_n)+\hat d(\hat z_n,\hat x)\\
&<\frac{1}{n}+\hat d(\hat z_n,\hat x)\\
&=\frac{1}{n}+\lim_{m\to\infty}d(z_n,z_m)
\end{align*} since $(z_m)\in\hat x$ and $(z_n,z_n,\cdots)\in\hat z_n\in W$. This implies that $\displaystyle\lim_{n\to\infty}\hat d(\hat x_n,\hat x)=0$ i.e. the Cauchy sequence $(\hat x_n)$ in $\hat X$ has the limit $\hat x\in\hat X$. Therefore, $\hat X$ is complete.
Step 4. Uniqueness of $\hat X$ up to isometries.
Suppose that $(\tilde X,\tilde d)$ is another completion of $X$ i.e. it is a complete metric space with a subspace $\tilde W$ dense in $\tilde X$ and isometric with $X$. We show that $\hat X$ is isometric with $\tilde X$. Let $X$ is isometric with $W$ and $\tilde W$ via isometries $T$ and $\tilde T$, respectively. Then $W$ is isometric with $\tilde W$ via the isometry $\rho=\tilde T\circ T^{-1}$.
$$\begin{array}{ccc}
& & W\\
& \nearrow &\downarrow\\
X & \longrightarrow & \tilde{W}
\end{array}$$
Let $\hat x\in\hat X$. Then $\exists$ a sequence in $(\hat x_n)\in W$ such that $\displaystyle\lim_{n\to\infty}\hat x_n=\hat x$. $(\hat x_n)$ is a Cauchy sequence and $\rho$ is an isometry, so $(\tilde x_n)$, where $\tilde x_n:=\rho\hat x_n$, is a Cauchy sequence in $\tilde W\subset \tilde X$. Since $\tilde X$ is complete, $\exists\tilde x\in\tilde X$ such that $\displaystyle\lim_{n\to\infty}\tilde x_n=\tilde x$. Define a mapping $\psi:\hat X\longrightarrow\tilde X$ by $\psi\hat x=\tilde x$. Then we claim that $\hat X$ is isometric with $\tilde X$ via $\psi$.
Step A. $\psi$ is well-defined.
It suffices to show that $T\hat x$ does not depend on the choice of $(\hat x_n)\in W$ such that $\displaystyle\lim_{n\to\infty}\hat x_n=\hat x$. Let $(\hat x_n’)$ be another sequence in $W$ such that $\displaystyle\lim_{n\to\infty}\hat x_n’=\hat x$. Then $(\tilde x_n’)$, where $\tilde x_n’=\rho\hat x_n’$, is a Cauchy sequence in $\tilde W$ and so $\exists\tilde x’\in\tilde X$ such that $\displaystyle\lim_{n\to\infty}\tilde x_n’=\tilde x’$. Now,
\begin{align*}
\tilde d(\tilde x,\tilde x’)&=\lim_{n\to\infty}\tilde d(\tilde x_n,\tilde x_n’)\\
&=\lim_{n\to\infty}\hat d(\hat x_n,\hat x_n’)\ (\rho\ \mbox{is an isometry})\\
&=\hat d(\hat x,\hat x)\\
&=0.
\end{align*}
Hence, $\tilde x=\tilde x’$.
Step B. $\psi$ is onto.
Let $\tilde x\in\tilde X$. Then $\exists$ a sequence $(\tilde x_n)$ in $\tilde W$ such that $\displaystyle\lim_{n\to\infty}\tilde x_n=\tilde x$. $(\tilde x_n)$ is Cauchy (since it is a convergent sequence) and $\rho^{-1}$ is an isometry, so the sequence $(\hat x_n)\subset \hat X$, where $\hat x_n=\rho^{-1}\tilde x_n$, is Cauchy. Since $\hat X$ is complete, $\exists\hat x\in\hat X$ such that $\displaystyle\lim_{n\to\infty}\hat x_n=\hat x$. Clearly $\psi\hat x=\tilde x$ and hence $\psi$ is onto.
Step C. $\psi$ is an isometry.
Let $\hat x,\hat y\in\hat X$. Then $\exists$ sequences $(\hat x_n)$, $(\hat y_n)$ in $W$ such that $\displaystyle\lim_{n\to\infty}\hat x_n=\hat x$ and $\displaystyle\lim_{n\to\infty}\hat y_n=\hat y$, respectively.
\begin{align*}
\hat d(\hat x,\hat y)&=\lim_{n\to\infty}\hat d(\hat x_n,\hat y_n)\\
&=\lim_{n\to\infty}\tilde d(\tilde x_n,\tilde y_n)\ (\tilde x_n:=\rho\hat x_n,\ \tilde y_n:=\rho y_n)\\
&=\tilde d(\tilde x,\tilde y)\ (\lim_{n\to\infty}\tilde x_n=\tilde x,\ \lim_{n\to\infty}\tilde y_n=\tilde y)\\
&=\tilde d(\psi\hat x,\psi\hat y).
\end{align*}
Thus, $\psi$ is an isometry.
Remember that an isometry from a metric space into another metric space is automatically one-to-one. Therefore, $\hat X$ is isometric with $\tilde X$ via $\psi$.
Intuitively speaking, the completion of a metric space $X$ can be achieved by adding to $X$ all its limit points. Recall that if $x$ is a limit point of $X$, then there exists a sequence $(x_n)$ in $X$ such that $\displaystyle\lim_{n\to\infty}x_n=x$. This is a reminiscence of extending from rational numbers $\mathbb{Q}$ to real numbers $\mathbb{R}$ (which is complete) by adding to $\mathbb{Q}$ all its limit points (irrational numbers).