TITLE: Q is dense in R and Completions
QUESTION [7 upvotes]: What is the relation between the fact that $\mathbb{Q}$ is dense in $\mathbb{R}$ and the fact that the completion of $\mathbb{Q}$ is $\mathbb{R}$? Or in general, that is if $A$ is dense in a metric space $B$, what's the relation between the completion of $A$ and $B$?

REPLY [3 votes]: Given a metric space $X$ with distance $d$, you can construct the set $\tilde{X}=C/\sim$ where $C$ is the set of all Cauchy sequences in $X$ and you declare that
$$
\forall s,t\in C,\qquad s\sim t\iff\lim_{n\to\infty}d(s_n,t_n)=0.
$$
Then, $\tilde{X}$ becomes a metric space under the distance
$$
\tilde{d}([s],[t])=\lim_{n\to\infty}d(s_n,t_n)
$$
(one needs to check well-definedness). Then one sees that $X$ embeds isometrically in $\tilde{X}$ as $x\mapsto[\{x\}]$ (class of the constant sequence at $x$) and proves that

$\tilde{X}$ is complete under $\tilde d$;
$X$ is dense in $\tilde X$;
If $X^\prime$ is a complete metric space in which $X$ embeds isometrically as a dense subspace, then there exists a canonical isometry $X^\prime\rightarrow\tilde{X}$ which is the identity on $X$.

The space $\tilde{X}$ is called the completion of $X$.
The reals $\Bbb R$ are the completion of $\Bbb Q$ under the euclidean metric induced by the standard absolute value.
By taking the $p$-adic absolute values on $\Bbb Q$ one may construct the complete field ${\Bbb Q}_p$ of $p$-adic numbers.
The celebrated theorem of Ostrowski says that $\Bbb R$ and the ${\Bbb Q}_p$ are essentially all the possible ways to construct a complete space out of ${\Bbb Q}$.