Skip to main content

Section 2.1 Dense Sets

Before we can say what we mean by the completion of a metric space, we need the following concept.

Definition 2.1.

Let \((X,d)\) be a metric space. A set \(Y \subseteq X\) is called dense in \(X\) if for every \(x \in X\) and every \(\varepsilon \gt 0\text{,}\) there exists \(y \in Y\) such that \(d(x, y) \lt \varepsilon\text{.}\)
In other words, a set \(Y \subseteq X\) is dense in \(X\) if any point in \(X\) has points in \(Y\) arbitrarily close.

Example 2.2.

The set \(\Q\) of rational numbers is dense in \(\R\text{.}\)

Proof.

(i) \(\implies\) (ii).

Assume that \(Y\) is dense in \(X\text{.}\) Let \(x \in X\text{.}\) Then for every \(n \in \N\text{,}\) there exists a point \(y_n \in Y\) with \(d(y_n, x) \lt \frac{1}{n}\text{.}\) The resulting sequence \((y_n)_{n \in \N}\) has the property that \(x = \lim_{n \to \infty} y_n\text{.}\)

(ii) \(\implies\) (iii).

Assume that (ii) holds. Let \(x \in X\text{.}\) Then there exists a sequence \((y_n)_{n \in \N}\) in \(Y\) with \(x = \lim_{n \to \infty} y_n\text{.}\) Hence for any \(r \gt 0\text{,}\) there exists \(n \in \N\) such that \(y_n \in B_r(x)\text{.}\) In particular, it follows that \(B_r(x) \cap Y \ne \varnothing\text{.}\) Therefore, we see that \(X \subseteq \overline{Y}\text{.}\) It is clear that \(\overline{Y} \subseteq X\text{,}\) so \(X = \overline{Y}\text{.}\)

(iii) \(\implies\) (i).

Assume that \(\overline{Y} = X\text{.}\) Then for any \(x \in X\) and any \(\varepsilon \gt 0\text{,}\) there exists a point \(y \in B_\varepsilon(x) \cap Y\text{.}\) That is, it satisfies \(d(x, y) \lt \varepsilon\text{.}\)
The following lemma is extremely useful.

Proof.

Suppose that \(Y\) is complete and \(f \maps S \to Y\) is uniformly continuous. We define \(\hat{f} \maps X \to Y\) as follows. Given \(x \in X\text{,}\) we use density to choose a sequence \((s_n)_{n \in \N}\) in \(S\) such that \(x = \lim_{n \to \infty} s_n\text{.}\) Then in particular \(\seq sn\) is Cauchy, and so by Exercise 2.1.2 and the uniform continuity of \(f\text{,}\) the sequence \((f(s_n))_{n \in \N}\) is a Cauchy in \(Y\text{.}\) As \(Y\) is complete, this sequence is therefore convergent, and we set
\begin{equation*} \hat f(x) = \lim_{n \to \infty} f(s_n) \text{.} \end{equation*}
This gives rise to a well-defined map, because for any other sequence \((\tilde{s}_n)_{n \in \N}\) in \(S\) with the same limit \(x = \lim_{n \to \infty} \tilde{s}_n\text{,}\) we find that
\begin{equation*} d_X(s_n, \tilde{s}_n) \le d_X(s_n, x) + d_X(\tilde{s}_n, x) \to 0 \end{equation*}
as \(n \to \infty\text{.}\) Hence by the uniform continuity of \(f\text{,}\)
\begin{equation*} d_Y(f(\tilde{s}_n), \hat f(x)) \le d_Y(f(\tilde{s}_n), f(s_n)) + d_Y(f(s_n), \hat f(x)) \to 0 \end{equation*}
as \(n \to \infty\text{.}\) That is, we have \(\hat f(x) = \lim_{n \to \infty} f(\tilde{s}_n)\) as well.
Moreover, the map \(\hat{f}\) is continuous (even uniformly so). This follows from the uniform continuity of \(f\) again: for any \(\varepsilon \gt 0\) there exists \(\delta \gt 0\) such that \(d_Y(f(x), f(x')) \lt \frac{\varepsilon}{2}\) for all \(x, x' \in S\) with \(d_X(x, x') \lt \delta\text{.}\) Now let \(x, x' \in X\) with \(d_X(x, x') \lt \delta\text{.}\) If we choose sequences \((s_n)_{n \in \N}\) and \((s_n')_{n \in \N}\) in \(S\) converging to \(x\) and \(x'\text{,}\) respectively, then \(d_X(s_n, s_n') \lt \delta\) whenever \(n\) is sufficiently large. Hence \(d_Y(f(s_n), f(s_n')) \lt \frac{\varepsilon}{2}\text{.}\) It follows that
\begin{equation*} \begin{split} d_Y(\hat{f}(x), \hat{f}(x')) \amp \le d_Y(\hat{f}(x), f(s_n)) + d_Y(f(s_n), f(s_n')) + d_Y(f(s_n'), \hat{f}(x')) \\ \amp \lt d_Y(\hat{f}(x), f(s_n)) + \frac{\varepsilon}{2} + d_Y(f(s_n'), \hat{f}(x')) \end{split}\text{.} \end{equation*}
Passing to the limit \(n \to \infty\text{,}\) we obtain the inequality \(d_Y(\hat{f}(x), \hat{f}(x')) \lt \varepsilon\text{.}\)
Finally, we show that \(\hat{f}\) is the only continuous extension of \(f\) to \(X\text{.}\) Suppose that \(g \maps X \to Y\) is a continuous map such that \(g(s) = f(s)\) for all \(s \in S\text{.}\) Let \(x \in X\text{.}\) Choose a sequence \((s_n)_{n \in \N}\) in \(S\) converging to \(x\text{.}\) Then by the continuity,
\begin{equation*} g(x) = \lim_{n \to \infty} g(s_n) = \lim_{n \to \infty} f(s_n) = \hat{f}(x). \end{equation*}
This concludes the proof.
When working with a sequence (or a countably infinite set), we can often use step-by-step procedures to prove certain properties. This does not work for uncountably infinite sets. But if we have a sequence that is dense in a given metric space, then such arguments can still be useful. This is the motivation for the following concept.

Definition 2.5.

A metric space is separable if it contains a countable dense set.

Example 2.6.

The space \(\R\) is separable because it contains the countable dense set \(\Q\text{.}\)

Exercises Exercises

1. (PS5) Dense sets in product spaces.

Suppose that \((X, d_X)\) and \((Y, d_Y)\) are non-empty metric spaces. Consider two sets \(S \subseteq X\) and \(T \subseteq Y\text{.}\) Show that \(S \times T\) is dense in the product space \(X \times Y\) if and only if \(S\) is dense in \(X\) and \(T\) is dense in \(Y\text{.}\)
Hint 1.
It is worth looking back to Exercise 1.3.2, either for inspiration or as a potential tool.
Hint 2.
If you like sequences, you could use the sequence characterisation of density in Lemma 2.3.

2. (PS5) Uniform continuity and Cauchy sequences.

Let \((X,d_X)\) and \((Y,d_Y)\) be metric spaces. If \(\seq xn\) is a Cauchy sequence in \(X\text{,}\) and \(f \maps X \to Y\) is uniformly continuous, show that \((f(x_n))_{n\in\N}\) is a Cauchy sequence in \(Y\text{.}\)
Hint.
Use the uniform continuity of \(f\) first, and only then take advantage of the fact that \(\seq xn\) is Cauchy.

3. (PS5) Continuous extensions.

Let \(a,b \in \R\) with \(a\lt b\) and consider two functions \(f \maps [a,b] \to \R\) and \(g \maps [a,b] \cap \Q \to \R\) which agree on \([a,b] \cap \Q\text{,}\) that is
\begin{gather} f(x) = g(x) \quad \text{for all } x \in [a,b] \cap \Q\text{.}\tag{✶} \end{gather}
Show the following.
(a)
If \(f\) is continuous, then \(g\) is also continuous.
Hint.
Don’t overthink it.
(b)
If \(f\) is uniformly continuous, then \(g\) is also uniformly continuous.
Hint.
Again, don’t overthink it.
(c)
\([a,b] \cap \Q\) is a dense subset of \([a,b]\text{.}\)
(d)
If \(g\) is uniformly continuous, then there exists \(f \maps [a,b] \to \R\) which satisfies (✶) and is continuous.
(e)
Part d does not necessarily hold if uniform continuity is replaced by continuity. (Find a counterexample.)
Hint 1.
You’re looking for an \(g\) where any extension \(f\) is necessarily discontinuous.
Hint 2.
Find a function which misbehaves at a point in \([a,b] \without \Q\) but is otherwise continuous \([a,b] \to \R\text{,}\) and then let \(g\) be the restriction of this function to \([a,b] \cap \Q\text{.}\)

4. (PS6) \(\C\) is separable.

Consider the space \(\C\) with the norm \(|\blank|\) such that \(|x + iy| = \sqrt{x^2 + y^2}\) for \(x, y \in \R\text{.}\)
(a)
Show that \(\Q\) is not dense in \(\C\text{.}\)
Hint.
One way to start is to write down what it means for a set not to be dense, in the same way that in Exercise B.1 you wrote down what it means for a sequence not to converge. If you are having trouble accurately negating statements with quantifiers please come talk to me.
(b)
Show that \(\C\) is separable.
Hint 1.
If you’re having trouble thinking of a good candidate for a countable dense subset, take a look through Section 1.8, particularly Example 1.67 and Lemma 1.70.
Hint 2.
Once you’ve got your candidate for the countable dense subset, just argue directly using Definition 2.1. Alternatively, you could think about how \(\C\) is isometric to \(\R^2 = \R \times \R\text{,}\) and try to use Exercise 2.1.1.

5. Open subsets of separable spaces.

Let \((X,d)\) be a separable metric space, and let \(U \subset X\) be open. Show that \(U\text{,}\) viewed as a metric subspace, is also separable.

6. Separable spaces are second countable.

Let \((X,d)\) be a separable metric space, with \(X_0 \subset X\) a countable dense subset, and consider the collection
\begin{equation*} \mathcal B = \{ B_{1/n}(x_0) : x_0 \in X_0,\, n \in \N \} \end{equation*}
of balls in \(X\) whose centres lie in \(X_0\) and whose radii are of the form \(1/n\) for some \(n \in \N\text{.}\)
(a)
Show that \(\mathcal B\) is countable.
(b)
Show that any open set \(U \subseteq X\) can be written as a union of elements of \(\mathcal B\text{.}\)
Spaces with this property are called second countable.