Tutorials › Topology (Undergraduate) › Constructing Dense Sets in Familiar Spaces

Closed Sets, Closure, Interior and Boundary · Tutorial 121 of 799

Constructing Dense Sets in Familiar Spaces

Learn to verify familiar dense subsets and to build a countable dense set by choosing points from a countable basis.

Intermediate 10 min read

What You'll Learn

  • Test density by checking intersections with every nonempty open set.
  • Show that every open interval in the real line contains a rational number.
  • Construct an irrational number in any given open interval.
  • Use rational intervals to obtain a countable basis for the real line.
  • Choose one point from each nonempty basis element to construct a countable dense subset.
  • Apply coordinatewise rational approximation to construct a countable dense subset of the plane.

Density by Finding Points in Open Sets

A set can be dense even when it is small in a set-theoretic sense: the rational numbers are countable, but they occur in every open interval of the real line. The same idea gives a general construction. If a space has a countable basis, choosing one point from each nonempty basis element produces a countable set that meets every nonempty open set.

Recall that \(D\subseteq X\) is dense in a topological space \(X\) when \(\overline{D}=X\). By the neighborhood characterization of closure, this is equivalent to saying that every nonempty open subset of \(X\) intersects \(D\). Indeed, if \(\overline{D}=X\), every point of a nonempty open set is in \(\overline{D}\), so that open set meets \(D\). Conversely, if every nonempty open set meets \(D\), every open neighborhood of every \(x\in X\) meets \(D\), so \(x\in\overline{D}\).

Rationals and Irrationals in Every Interval

In \(\mathbb{R}\) with its standard topology, it is enough to find both kinds of numbers in every nonempty open interval \((a,b)\), where \(a,b\in\mathbb{R}\) and \(a<b\). The key input for the rational construction is the Archimedean property: for each positive real number \(\delta\), there is \(n\in\mathbb{N}\) with \(1/n<\delta\).

Proposition: Every nonempty open interval in \(\mathbb{R}\) contains a rational number and an irrational number. Consequently, both \(\mathbb{Q}\) and \(\mathbb{R}\setminus\mathbb{Q}\) are dense in \(\mathbb{R}\).

Proof. Let \(a<b\). Choose \(n\in\mathbb{N}\) so that \(1/n<b-a\). There is an integer \(m\) with \(na<m\leq na+1\); for example, take the least integer strictly greater than \(na\). Then $$ a<\frac{m}{n}\leq a+\frac{1}{n}<b. $$ Since \(m/n\in\mathbb{Q}\), the interval contains a rational.

For the irrational, first take a rational \(q\) with \(a<q<b\), as just proved. Choose \(n\in\mathbb{N}\) sufficiently large that \(\sqrt{2}/n<b-q\). Then \(q+\sqrt{2}/n\) is greater than \(q\) and less than \(b\). It is irrational: if it were rational, subtracting the rational \(q\) and multiplying by the integer \(n\) would make \(\sqrt{2}\) rational. To recall why this is impossible, if \(\sqrt{2}=u/v\) for relatively prime integers \(u,v\) with \(v\ne0\), then \(u^2=2v^2\). Thus \(u\) is even, so \(u=2k\) for an integer \(k\); substituting gives \(v^2=2k^2\), so \(v\) is even as well. This contradicts the assumption that \(u\) and \(v\) are relatively prime. Hence the interval contains an irrational. Every nonempty open subset of \(\mathbb{R}\) contains an open interval around one of its points, so the interval results imply that both sets meet every nonempty open set and are dense. \(\square\)

Worked Example: Finding Both Types in One Interval

Find a rational and an irrational number in \((7/5,3/2)\). Here \(7/5=28/20\), \(3/2=30/20\), and \(29/20\) lies strictly between them, so \(29/20\) is a rational in the interval.

For an irrational, take \(29/20+\sqrt{2}/100\). Since \(1<\sqrt{2}<2\), we have $$ \frac{29}{20}<\frac{29}{20}+\frac{\sqrt{2}}{100} <\frac{29}{20}+\frac{2}{100} =\frac{145}{100}+\frac{2}{100} =\frac{147}{100}<\frac{150}{100}=\frac{3}{2}. $$ Also \(29/20=145/100>140/100=7/5\). The proposed number is therefore strictly inside the interval. It is irrational because it is a rational number plus the nonzero rational multiple \(\sqrt{2}/100\) of an irrational number.

Check: the rational \(29/20\) satisfies \(28/20<29/20<30/20\). The irrational satisfies \(7/5<29/20<29/20+\sqrt{2}/100<147/100<3/2\), as required.

Constructing a Dense Set from a Countable Basis

A basis for a topology on \(X\) is a collection \(\mathcal{B}\) of open subsets of \(X\) such that every open set is a union of members of \(\mathcal{B}\). Equivalently, for every open \(U\) and every \(x\in U\), there is \(B\in\mathcal{B}\) with \(x\in B\subseteq U\). A space is second-countable if it has a basis with at most countably many members. The equivalence follows directly: if \(U\) is a union of basis elements, one of those elements contains each chosen \(x\in U\); and if the stated local condition holds, the union of all basis elements contained in \(U\) is exactly \(U\).

Theorem: Every second-countable topological space has a countable dense subset. The empty space has the dense subset \(\varnothing\); for a nonempty space, choose one point from each nonempty member of a countable basis and collect the chosen points.

Proof. If \(X=\varnothing\), then \(\overline{\varnothing}=\varnothing=X\), so the claim holds. Now suppose \(X\ne\varnothing\), and let \(\mathcal{B}\) be a countable basis. For each nonempty \(B\in\mathcal{B}\), choose \(x_B\in B\), and set \(D=\{x_B:B\in\mathcal{B},\ B\ne\varnothing\}\). This set is countable because it is the image of a subcollection of a countable collection. If \(U\subseteq X\) is nonempty and open, choose \(x\in U\). The basis property gives \(B\in\mathcal{B}\) with \(x\in B\subseteq U\). In particular, \(B\ne\varnothing\), and its selected point satisfies \(x_B\in B\subseteq U\). Thus every nonempty open set meets \(D\), which implies \(\overline{D}=X\). The selection from a countable family uses only countable choice; in the usual foundations with the axiom of choice it is available. \(\square\)

The construction needs only the basis property: it does not require the basis elements to be intervals or to have any special shape. The reason it works is that every nonempty open set contains at least one of the sets from which a point was selected.

Worked Example: Selecting Points from Rational Intervals

Let \(\mathbb{R}\) have its standard topology, and consider the collection \(\mathcal{B}=\{(r,s):r,s\in\mathbb{Q},\ r<s\}\). It is countable: each interval is specified by a pair of rationals, and the set of such pairs is countable. To verify the basis property, let \(U\) be open and \(x\in U\). There is \(\varepsilon>0\) such that \((x-\varepsilon,x+\varepsilon)\subseteq U\). By the rational-between-reals result, choose rationals \(r,s\) with \(x-\varepsilon<r<x<s<x+\varepsilon\). Then \(x\in(r,s)\subseteq U\), proving that \(\mathcal{B}\) is a basis.

For each such interval choose its midpoint \((r+s)/2\), which is rational. The set of all chosen midpoints is countable because it is indexed by the countable collection \(\mathcal{B}\). If \(U\) is any nonempty open set, it contains a basis interval \((r,s)\); the midpoint \((r+s)/2\) belongs to that interval and hence to \(U\). Therefore the set of chosen midpoints is dense.

Check: for the interval \((1/3,2/3)\), the selected midpoint is $$ \frac{\frac13+\frac23}{2}=\frac{1}{2}. $$ It satisfies \(1/3<1/2<2/3\). In general, if \(r<s\), then \((r+s)/2-r=(s-r)/2>0\) and \(s-(r+s)/2=(s-r)/2>0\), so the midpoint really is in the interval used to select it.

A Countable Dense Set in the Plane

The same approximation idea works in Euclidean space. The following example verifies density directly, using open balls in \(\mathbb{R}^2\) with the Euclidean metric. It also illustrates how density can be checked by making coordinate errors small enough that the whole Euclidean distance is small.

Worked Example: The Rational Grid in \(\mathbb{R}^2\)

Let \(D=\mathbb{Q}\times\mathbb{Q}\subseteq\mathbb{R}^2\). This set is countable: enumerate the rationals, then list pairs of enumeration indices in order of increasing sum; every pair appears after finitely many earlier pairs. We show that \(D\) is dense.

Take any point \((u,v)\in\mathbb{R}^2\) and any radius \(r>0\). By rational density in \(\mathbb{R}\), choose \(p,q\in\mathbb{Q}\) with $$ |p-u|<\frac{r}{2\sqrt{2}} \qquad\text{and}\qquad |q-v|<\frac{r}{2\sqrt{2}}. $$ Then $$ \|(p,q)-(u,v)\| =\sqrt{(p-u)^2+(q-v)^2} <\sqrt{\frac{r^2}{8}+\frac{r^2}{8}} =\frac{r}{2}<r. $$ Thus the open ball \(B((u,v),r)\) contains the point \((p,q)\in D\). Since this holds for every center and every positive radius, every open ball meets \(D\), so \(D\) is dense.

Check with specific values: take the ball centered at \((\sqrt{2},\sqrt{3})\) with radius \(1/10\), and choose \((141/100,173/100)\in D\). The inequalities \(1.41^2=1.9881<2<2.0164=1.42^2\) and \(1.73^2=2.9929<3<3.0276=1.74^2\) show that each coordinate error is less than \(1/100\). Therefore the distance is less than \(\sqrt{(1/100)^2+(1/100)^2}=\sqrt{2}/100<2/100=1/50<1/10\). The chosen point lies in the ball.

What the Countability Hypothesis Contributes

Second-countability is a sufficient condition for having a countable dense subset, not a statement that every space has one. For example, give an uncountable set \(X\) the discrete topology, in which every subset is open. If \(D\subsetneq X\), choose \(x\in X\setminus D\). The singleton \(\{x\}\) is a nonempty open set disjoint from \(D\), so \(D\) is not dense. Thus any dense subset must equal \(X\), and no countable subset is dense. This example shows why the countable-basis hypothesis matters for the general construction.

Common pitfall. Choosing one point from each basis element proves countability only when the basis itself is countable. In the uncountable discrete example, the singleton basis \(\{\{x\}:x\in X\}\) has one element for each point of \(X\), so this selection gives all of \(X\), not a countable dense subset. The valid conclusion is that a countable basis permits the construction; it is not valid to apply the construction to an arbitrary basis and then infer countability.

Check Your Understanding

Use the open-set test for density when checking your answers.

  1. Why does finding a rational in every interval \((a,b)\) prove that \(\mathbb{Q}\) is dense in the standard topology on \(\mathbb{R}\)?
  2. In the irrational-number construction, why must \(q+\sqrt{2}/n\) be irrational when \(q\) is rational and \(n\in\mathbb{N}\)?
  3. Explain why choosing one point from each nonempty member of a countable basis produces a countable set.
  4. Give the distance estimate that shows \(\mathbb{Q}\times\mathbb{Q}\) is dense in \(\mathbb{R}^2\).
  5. Why does an uncountable discrete space have no countable dense subset?