Tutorials › Real Analysis › Density of the Rational Numbers

Number Systems · Tutorial 119 of 1000

Density of the Rational Numbers

Learn how the integer part and Archimedean Property give a rational number between any two distinct real numbers, and how this yields rational approximations to any real number.

Beginner 9 min read

What You'll Learn

  • State the density property for rational numbers on the real line
  • Use the Archimedean Property to choose a suitable denominator
  • Construct a rational number between two given real numbers using the floor
  • Verify candidate rational numbers by clearing positive denominators
  • Deduce rational approximations within any prescribed positive error

Finding a Rational Number Between Two Real Numbers

The integer part gives a way to locate a real number between consecutive integers. We can use that fact to answer a different question: given real numbers \(a<b\), can we find a rational number strictly between them? The answer is always yes, even when \(a\) and \(b\) are very close together, or when either endpoint is irrational.

The key is to scale the interval until its length is greater than one. The Archimedean Property lets us choose a positive integer large enough to do this. After scaling, the integer part identifies an integer inside the enlarged interval; scaling back then produces the rational number we need.

The Density Theorem

Definition (Dense Subset of the Real Numbers). A set \(D\subseteq\mathbb{R}\) is dense in \(\mathbb{R}\) if, for every pair of real numbers \(a<b\), there is some \(d\in D\) such that \(a<d<b\).

To prove that \(\mathbb{Q}\) is dense in \(\mathbb{R}\), we use the Archimedean Property from earlier in this course and the integer part theorem from the previous tutorial. In particular, for every real \(x\), the integer \(\lfloor x\rfloor\) satisfies \(\lfloor x\rfloor\leq x<\lfloor x\rfloor+1\).

Theorem (Density of the Rational Numbers). For any real numbers \(a<b\), there is a rational number \(q\) such that $$ a<q<b. $$ Therefore, \(\mathbb{Q}\) is dense in \(\mathbb{R}\).

Proof. Let \(a,b\in\mathbb{R}\) with \(a<b\). Then \(b-a>0\), so \(1/(b-a)>0\). By the Archimedean Property, choose a positive integer \(n\) such that $$ n>\frac{1}{b-a}. $$ Multiplying by the positive number \(b-a\) gives \(n(b-a)>1\), or equivalently \(na+1<nb\).

Let \(m=\lfloor na\rfloor+1\). The defining inequalities for the integer part give $$ \lfloor na\rfloor\leq na<\lfloor na\rfloor+1=m. $$ They also give \(m\leq na+1\). Combining these bounds with \(na+1<nb\), we obtain $$ na<m\leq na+1<nb. $$ Since \(n\) is positive, division by \(n\) preserves the inequalities: $$ a<\frac{m}{n}<b. $$ Here \(m\) is an integer and \(n\) is a positive integer, so \(m/n\in\mathbb{Q}\). Taking \(q=m/n\) proves the claim. \(\square\)

The construction handles negative numbers and integer endpoints without needing a separate case. The floor theorem applies to every real number \(na\). Also, choosing \(m=\lfloor na\rfloor+1\) ensures that \(m\) is strictly greater than \(na\), including when \(na\) is already an integer.

Worked Applications of the Construction

Worked Example: A Rational Number Between One-Third and One-Half

We seek a rational number strictly between \(a=1/3\) and \(b=1/2\). Their difference is $$ b-a=\frac{1}{2}-\frac{1}{3}=\frac{1}{6}. $$ Choose \(n=7\). Then \(n(b-a)=7/6>1\), as required by the construction. Also, $$ na=\frac{7}{3}, \qquad \left\lfloor\frac{7}{3}\right\rfloor=2. $$ Thus \(m=\lfloor na\rfloor+1=3\), and the construction gives \(q=m/n=3/7\). To verify both strict inequalities, use positive denominators: $$ \frac{1}{3}<\frac{3}{7} \quad\text{because}\quad 7<9, \qquad \frac{3}{7}<\frac{1}{2} \quad\text{because}\quad 6<7. $$ Therefore \(1/3<3/7<1/2\).

Worked Example: A Rational Number Between Negative Numbers

Let \(a=-7/3\) and \(b=-2\). Their difference is $$ b-a=-2-\left(-\frac{7}{3}\right)=\frac{1}{3}. $$ Take \(n=4\), so \(n(b-a)=4/3>1\). Now \(na=-28/3\), and $$ -10\leq-\frac{28}{3}<-9, $$ because \(-30/3\leq-28/3<-27/3\). Hence \(\lfloor na\rfloor=-10\), \(m=-9\), and \(q=m/n=-9/4\). Direct verification gives $$ -\frac{7}{3}<-\frac{9}{4} \quad\text{because}\quad -28<-27, \qquad -\frac{9}{4}<-2 \quad\text{because}\quad -9<-8. $$ In the first comparison we used the common positive denominator \(12\); in the second we used the common positive denominator \(4\). Thus \(-7/3<-9/4<-2\). The construction works for negative endpoints because division is by the positive integer \(n\).

Worked Example: A Rational Number Between an Irrational and a Rational

There is a rational number strictly between \(\sqrt{2}\) and \(3/2\). Consider \(q=10/7\). First, both \(\sqrt{2}\) and \(10/7\) are positive, and $$ 2<\frac{100}{49} $$ because \(98<100\). Comparing positive squares therefore gives \(\sqrt{2}<10/7\). For the other comparison, positive denominators give $$ \frac{10}{7}<\frac{3}{2} \quad\text{because}\quad 20<21. $$ Consequently, $$ \sqrt{2}<\frac{10}{7}<\frac{3}{2}. $$ This example verifies a particular rational number directly. The Density Theorem also guarantees such a number without requiring us to guess one.

Rational Approximations to Any Real Number

Density can also be expressed as an approximation result. Given a real number \(x\) and a positive error tolerance \(\varepsilon\), we can find a rational number whose distance from \(x\) is less than \(\varepsilon\). The strict error bound is important: the approximation can be made as accurate as any specified positive tolerance.

Theorem (Rational Approximation). For every \(x\in\mathbb{R}\) and every \(\varepsilon>0\), there is a rational number \(q\in\mathbb{Q}\) such that $$ |x-q|<\varepsilon. $$

Proof. Since \(\varepsilon>0\), we have \(x-\varepsilon<x+\varepsilon\). Apply the Density Theorem to this pair of real numbers. It gives a rational \(q\) satisfying $$ x-\varepsilon<q<x+\varepsilon. $$ Subtracting \(x\) throughout gives \(-\varepsilon<q-x<\varepsilon\). By the strict absolute-value bound criterion, this is equivalent to \(|q-x|<\varepsilon\). Since \(|x-q|=|q-x|\), the required inequality follows. \(\square\)

Worked Example: Approximating the Square Root of Two

Take \(x=\sqrt{2}\), \(q=7/5\), and \(\varepsilon=1/5\). Both numbers used in comparing squares are positive, and $$ \left(\frac{7}{5}\right)^2=\frac{49}{25}<\frac{50}{25}=2< \frac{64}{25}=\left(\frac{8}{5}\right)^2. $$ Thus \(7/5<\sqrt{2}<8/5\). Subtracting \(7/5\) gives $$ 0<\sqrt{2}-\frac{7}{5}<\frac{1}{5}. $$ Therefore \(\left|\sqrt{2}-7/5\right|<1/5\), as claimed. The rational approximation theorem guarantees that some rational approximation exists for every positive tolerance; this example checks one particular choice of rational and tolerance.

Why Density Matters—and a Common Pitfall

The density theorem says that no open interval between distinct real numbers is too small to contain a rational. In particular, the rationals have no gaps on the real line in the sense of the definition above. The rational approximation theorem gives the same idea from a different viewpoint: around every real number, however small a positive error is specified, some rational lies within that distance.

Density does not mean that every real number is rational, nor does it say that the rational number between two endpoints is unique. For example, the Density Theorem can be applied to smaller subintervals as well as to the original interval, so its conclusion is existence, not a formula selecting a single possible answer. It also does not say that a rational endpoint lies strictly between the endpoints; the inequalities in the theorem are strict, and the rational must be inside the interval.

A common mistake in the construction is to choose a denominator \(n\) without ensuring that \(n(b-a)>1\). Without that condition, the integer \(m=\lfloor na\rfloor+1\) is guaranteed to be greater than \(na\), but it need not be less than \(nb\). Choosing \(n>1/(b-a)\) supplies exactly the needed room. A second detail is that \(n\) must be positive: division by a negative number would reverse the inequalities, and division by zero would not be defined.

Key takeaway. To find a rational between \(a<b\), choose a positive integer \(n\) with \(n(b-a)>1\), set \(m=\lfloor na\rfloor+1\), and take \(q=m/n\). Then \(a<q<b\). As a consequence, every real number can be approximated by rationals within any prescribed positive error.

Check Your Understanding

Use the construction, the defining property of the floor, and the approximation result to answer these questions.

  1. Why can the Archimedean Property be used to choose \(n\) with \(n(b-a)>1\) when \(a<b\)?
  2. In the density proof, why does \(m=\lfloor na\rfloor+1\) satisfy \(na<m\leq na+1\)?
  3. Find a rational number between \(1/4\) and \(1/3\) by choosing a suitable positive integer denominator and applying the floor construction.
  4. How does the Density Theorem imply that for every \(x\in\mathbb{R}\) and \(\varepsilon>0\), some rational \(q\) satisfies \(|x-q|<\varepsilon\)?
  5. Why is it necessary that the denominator \(n\) in the construction be positive?