Tutorials › Real Analysis › The Density Strategy

Proof Strategy · Tutorial 952 of 1000

The Density Strategy

Use dense subsets as a bridge: establish a claim where it is easier to check, then use continuity to extend it to the whole domain.

Advanced 9 min read

What You'll Learn

  • Define density relative to a subset of a metric space
  • Characterize density by sequences approaching every point
  • Extend equalities and inequalities from a dense set using continuity
  • Compute the supremum of a continuous function using a dense subset
  • Recognize why density alone cannot transfer claims without continuity

Prove a Claim Where It Is Easier to Check

The Approximation Strategy controls the distance between an object and a simpler one. The Density Strategy uses a related idea about points in a space: if a subset comes arbitrarily close to every point, then it may be enough to establish a claim on that subset and use continuity to carry the claim elsewhere.

This is especially effective when the subset has a simple description. Rational numbers, for example, are often easier to use in algebraic calculations than arbitrary real numbers. Density alone does not guarantee that a claim transfers, however. Continuity supplies the missing link: values at points close to a given point must be close to the value at that point. We will make that link precise, then apply it to equalities, inequalities, and suprema.

Dense Subsets and Approximating Sequences

Definition (Dense Subset): Let \((X,d)\) be a metric space, let \(E\subseteq X\), and let \(D\subseteq E\). The set \(D\) is dense in \(E\) if, for every \(x\in E\) and every \(\varepsilon>0\), there is a point \(d_0\in D\) such that \(d(x,d_0)<\varepsilon\). Equivalently, every open ball about each point of \(E\) meets \(D\).

Density is relative to the set \(E\). It says that points of \(D\) can approximate every point of \(E\), not that \(D\) contains every point of \(E\). A useful way to work with this definition is to choose a sequence of points in \(D\) that approaches a specified point.

Theorem (Sequential Characterization of Density): Let \((X,d)\) be a metric space, \(E\subseteq X\), and \(D\subseteq E\). Then \(D\) is dense in \(E\) if and only if, for every \(x\in E\), there is a sequence \((d_n)\) in \(D\) such that \(d_n\to x\).

Proof. Suppose first that \(D\) is dense in \(E\), and fix \(x\in E\). For each positive integer \(n\), apply density with \(\varepsilon=1/n\). This gives \(d_n\in D\) such that \(d(x,d_n)<1/n\). Given any \(\varepsilon>0\), choose \(N>1/\varepsilon\). If \(n\geq N\), then

$$ d(d_n,x)=d(x,d_n)<\frac{1}{n}\leq\frac{1}{N}<\varepsilon. $$

Therefore \(d_n\to x\).

Conversely, suppose every \(x\in E\) is the limit of a sequence \((d_n)\) in \(D\). Fix \(x\in E\) and \(\varepsilon>0\). By convergence, there is an integer \(N\) such that \(n\geq N\) implies \(d(d_n,x)<\varepsilon\). In particular, \(d_N\in D\) lies within distance \(\varepsilon\) of \(x\). Since \(x\) and \(\varepsilon\) were arbitrary, \(D\) is dense in \(E\). \(\square\)

The sequential characterization converts an “arbitrarily close” condition into a tool for limit arguments. Whenever \(D\) is dense, a point \(x\in E\) can be approached by a sequence entirely inside \(D\). Continuity then relates function values along that sequence to the value at \(x\).

Worked Example: Approximating a Real Number by Rationals

The Density of the Rational Numbers in the Real Numbers says that \(\mathbb{Q}\) is dense in \(\mathbb{R}\). Thus, for any real \(x\), there is a sequence of rationals \(q_n\) with \(q_n\to x\). For a concrete illustration, take \(x=\sqrt{2}\) and define

$$ q_n=\frac{\lfloor 10^n\sqrt{2}\rfloor}{10^n}. $$

Here \(\lfloor t\rfloor\) is the greatest integer less than or equal to \(t\). It follows that \(\lfloor 10^n\sqrt{2}\rfloor\leq 10^n\sqrt{2}<\lfloor 10^n\sqrt{2}\rfloor+1\). Dividing by \(10^n>0\) gives

$$ q_n\leq\sqrt{2}<q_n+\frac{1}{10^n}, \qquad 0\leq\sqrt{2}-q_n<\frac{1}{10^n}. $$

Each \(q_n\) is rational, and \(1/10^n\to0\), so \(q_n\to\sqrt{2}\). For the first terms, \(q_1=1.4\), \(q_2=1.41\), and \(q_3=1.414\). The sequence illustrates how a dense subset supplies a sequence approaching a point that does not belong to the subset.

Continuity Transfers Equalities from a Dense Set

Theorem (Equality on a Dense Set Determines Continuous Functions): Let \(E\) be a subset of a metric space, and let \(D\subseteq E\) be dense in \(E\). Suppose \(f,g:E\to\mathbb{R}\) are continuous at every point of \(E\) and \(f(d)=g(d)\) for every \(d\in D\). Then \(f(x)=g(x)\) for every \(x\in E\).

Proof. Fix \(x\in E\). By the sequential characterization of density, choose a sequence \((d_n)\) in \(D\) with \(d_n\to x\). Continuity of \(f\) and \(g\) at \(x\) gives \(f(d_n)\to f(x)\) and \(g(d_n)\to g(x)\). Since \(d_n\in D\), the hypothesis gives \(f(d_n)=g(d_n)\) for every \(n\). The common sequence therefore has both \(f(x)\) and \(g(x)\) as limits. By the Uniqueness of Sequence Limits, \(f(x)=g(x)\). Since \(x\) was arbitrary, the functions agree on all of \(E\). \(\square\)

The proof has a reusable form: choose points from the dense set converging to an arbitrary target point, apply continuity to pass to the limit, and use the claim already known on the dense set. The density hypothesis chooses the sequence; continuity makes its function values converge to the desired values.

Worked Example: Identifying a Continuous Function from Rational Values

Suppose \(f:\mathbb{R}\to\mathbb{R}\) is continuous and satisfies \(f(q)=q^2+1\) for every rational \(q\). Define \(g(x)=x^2+1\), which is continuous on \(\mathbb{R}\). The functions \(f\) and \(g\) agree on \(\mathbb{Q}\), a dense subset of \(\mathbb{R}\). The theorem gives

$$ f(x)=g(x)=x^2+1\qquad\text{for every }x\in\mathbb{R}. $$

In particular, no separate calculation is needed at an irrational input such as \(x=\sqrt{2}\). The density of the rationals provides rational sequences approaching that input, and continuity forces the function value there to be the limit of the rational-input values.

Continuity Also Transfers Inequalities

An equality is not the only kind of information that can pass from a dense subset to the whole domain. An inequality can pass as well, provided both functions are continuous. The order is preserved under limits, as established earlier in the course.

Theorem (Inequalities Extend from a Dense Set): Let \(E\) be a subset of a metric space, and let \(D\subseteq E\) be dense in \(E\). Suppose \(f,g:E\to\mathbb{R}\) are continuous at every point of \(E\), and \(f(d)\leq g(d)\) for every \(d\in D\). Then \(f(x)\leq g(x)\) for every \(x\in E\).

Proof. Fix \(x\in E\), and choose a sequence \((d_n)\) in \(D\) with \(d_n\to x\). By continuity, \(f(d_n)\to f(x)\) and \(g(d_n)\to g(x)\). The hypothesis gives \(f(d_n)\leq g(d_n)\) for every \(n\). Applying Order Is Preserved Under Limits to these two convergent real sequences yields \(f(x)\leq g(x)\). This holds for every \(x\in E\). \(\square\)

Worked Example: Extending a Rational-Input Inequality

Suppose \(f,g:[0,1]\to\mathbb{R}\) are continuous and \(f(q)\leq g(q)\) for every rational \(q\in[0,1]\). The rationals in \([0,1]\) are dense in \([0,1]\), so the inequality theorem gives \(f(x)\leq g(x)\) throughout the interval. For instance, it applies at \(x=\sqrt{2}/2\), which lies in \([0,1]\) and is irrational.

To see the limit step at this particular point, choose rationals \(q_n\in[0,1]\) with \(q_n\to\sqrt{2}/2\). Continuity gives \(f(q_n)\to f(\sqrt{2}/2)\) and \(g(q_n)\to g(\sqrt{2}/2)\). Since \(f(q_n)\leq g(q_n)\) for every \(n\), Order Is Preserved Under Limits gives \(f(\sqrt{2}/2)\leq g(\sqrt{2}/2)\). The same reasoning works at each point of the interval.

Finding a Supremum by Looking on a Dense Subset

Density can also simplify a supremum calculation. For a continuous function, its values on a dense subset come arbitrarily close to its value at any point of the full domain. Consequently, when the function is bounded above, restricting to a dense subset does not change its supremum.

Theorem (Supremum on a Dense Subset): Let \(E\) be a nonempty subset of a metric space, let \(D\subseteq E\) be dense in \(E\), and let \(f:E\to\mathbb{R}\) be continuous. If \(f(E)\) is bounded above, then \(f(D)\) is nonempty and bounded above, and \(\sup f(D)=\sup f(E)\).

Proof. Since \(D\) is dense in the nonempty set \(E\), it is nonempty. Also \(f(D)\subseteq f(E)\), so any upper bound for \(f(E)\) is an upper bound for \(f(D)\). Thus \(s=\sup f(D)\) exists. Fix \(x\in E\), and choose \(d_n\in D\) with \(d_n\to x\). Continuity gives \(f(d_n)\to f(x)\). For every \(n\), \(f(d_n)\leq s\), because \(s\) is an upper bound for \(f(D)\). By Order Is Preserved Under Limits, \(f(x)\leq s\). Since this holds for every \(x\in E\), \(s\) is an upper bound for \(f(E)\), and hence \(\sup f(E)\leq s\). On the other hand, \(f(D)\subseteq f(E)\) implies \(\sup f(D)\leq\sup f(E)\). Combining the two inequalities proves \(\sup f(D)=\sup f(E)\). \(\square\)

Worked Example: Computing a Supremum over Rational Inputs

Let \(E=[0,1]\), let \(D=\mathbb{Q}\cap[0,1]\), and define \(f(x)=x(1-x)\). The function is continuous, \(D\) is dense in \(E\), and \(f(E)\) is bounded above. For each \(x\in[0,1]\),

$$ f(x)=x(1-x)=\frac{1}{4}-\left(x-\frac{1}{2}\right)^2\leq\frac{1}{4}. $$

Equality holds at \(x=1/2\), which is rational and belongs to \(D\). Thus \(f(1/2)=1/4\), while the displayed identity shows \(f(x)\leq1/4\) for every \(x\in[0,1]\). Therefore \(\sup f(D)=1/4\). The dense-subset theorem also guarantees that this is the supremum over the entire interval. The method would still identify the same supremum if the point where the maximum occurs were irrational: rational inputs could approach it, and continuity would make their function values approach its value.

Why Density Alone Is Not Enough

A common pitfall is to assume that a claim true on a dense set must be true everywhere. Density concerns which points can be approximated; it says nothing by itself about how function values behave under that approximation. The continuity hypotheses in the transfer theorems are essential.

Worked Example: A Claim That Fails Without Continuity

Define \(h:\mathbb{R}\to\mathbb{R}\) by \(h(x)=0\) when \(x\) is rational and \(h(x)=1\) when \(x\) is irrational. Then \(h(q)=0\) for every rational \(q\), so the equality \(h(q)=0\) holds on the dense set \(\mathbb{Q}\). But \(h(\sqrt{2})=1\), so \(h\) is not identically zero. The equality-on-a-dense-set theorem cannot be applied because \(h\) is not continuous. This example distinguishes the two roles in the strategy: density supplies approximating points, while continuity controls what happens to the corresponding values.

When using the Density Strategy, check the domain and the hypotheses carefully. The subset must be dense in the domain under discussion, and the functions must have the required continuity at points where the conclusion is sought. For a supremum argument, boundedness above is also needed to ensure that the suprema exist as real numbers.

1
Choose a convenient subset.
Identify a dense set on which the claim is easier to verify, such as rational inputs in a real interval.
2
Approximate an arbitrary point.
For the target point, choose a sequence from the dense subset that converges to it.
3
Pass to function values.
Use continuity to show that the values along the sequence converge to the values at the target point.
4
Transfer the claim.
Use uniqueness of limits for equalities, order preservation under limits for inequalities, or the definition of supremum for bounds.

The strategy is most powerful when the dense subset makes verification simple and the desired conclusion is stable under limits. It does not replace checking hypotheses: without continuity, nearby inputs need not have nearby function values. With the right hypotheses in place, however, a proof on a dense set can determine behavior across an entire domain.

Check Your Understanding

Use the definitions and transfer arguments in this tutorial to answer these questions.

  1. How does the sequential characterization of density produce a sequence approaching an arbitrary point of the domain?
  2. Where does continuity enter the proof that two functions agreeing on a dense subset agree everywhere?
  3. Which earlier result justifies passing an inequality between function values to the limit?
  4. Why does a continuous function bounded above have the same supremum on a dense subset as on its full domain?
  5. What hypothesis fails in the example of the function that is zero on rationals and one on irrationals?