Pick two numbers on the number line, close together. Say 0.314 and 0.315. Is there a fraction in between them?

Obviously yes — 0.3145 is 6290/20000, a perfectly good fraction. Now pick two even closer numbers, like 0.31415 and 0.31416. A fraction between? Still yes. Try 0.31415926 and 0.31415927. Fraction between? Still yes.

No matter how close you pick, you can always fit a fraction in the gap. That is the core content of density of the rationals on the real line. This article is about seeing density: what happens visually as you zoom into the number line over and over.

The key move: zooming doesn't help

Start with the interval [0, 1] and mark all fractions with denominator up to, say, 20. There are dozens of them, and they look like a thick sprinkling on the line.

All fractions p over q with q up to twenty on the interval from zero to one A horizontal line from zero to one with many red tick marks placed at the positions of every fraction p over q where q is between one and twenty. The ticks are dense, close together, and crowd the centre of the interval. A few are labelled — zero, one half, and one — but most of the marks are just dots so you can see how many there are. 0 1 1/2 every red dot is a fraction p/q with q ≤ 20
A thick sprinkling of fractions between $0$ and $1$ — only the ones with denominators up to $20$. If you allowed every denominator, the dots would overlap everywhere.

Now zoom in on any tiny sub-interval — say, [0.3, 0.31]. A naïve guess: the fractions were packed at the [0, 1] scale, so they should thin out when you zoom in, right? You zoomed 100\times, so the fractions should be 100\times more sparse?

Wrong. When you zoom in on any sub-interval, the fractions that fit inside it are the same kind of dense sprinkling. Allow larger denominators and you get as many fractions in [0.3, 0.31] as you had in [0, 1]. Zoom again into [0.314, 0.315] — same story.

The visual signature of density is this: no matter how narrow the window, there are still infinitely many fractions inside, and they continue to look thickly packed.

Drag the zoom slider below to see this happen live. The viewing window is centred on \pi = 3.14159\dots. At each zoom level, black tick marks show rational numbers at the current precision.

A live zoomable number line centred on pi An interactive number line centred on pi. The reader can click a plus button to zoom in by a factor of five, or a minus button to zoom out. As they zoom in, the rational tick marks become labelled with more decimal places, but the centre marker for pi never lands exactly on a tick — it always sits in the gap between two rational ticks, no matter how far in you zoom.
A live number line centred on $\pi$. Each click of $+$ zooms in by $5\times$. After ten clicks the rational ticks are $\sim 10^{-7}$ apart and the labels show seven decimal places. Notice: the red $\pi$ marker is always in the *gap* between two black ticks. It never lands on one.

The zoom reveals two things at once:

  1. The rationals stay thick. No matter how far in you zoom, there are always rational ticks visible. The density never dies.
  2. But \pi is never a tick. The rationals crowd around \pi but never land on it.

Those two observations together are what density without completeness looks like. Density means "rationals everywhere." Completeness (which only the full reals have) means "no gaps left." The rationals are dense but not complete — they crowd around irrationals without ever filling the hole at them.

Why density is a theorem, not an observation

Take any two rationals a < b, however close. Their average

m = \dfrac{a + b}{2}

is strictly between them (a < m < b) and is itself rational (the average of two fractions is a fraction). Why m is rational: if a = p/q and b = r/s, then m = (ps + rq)/(2qs), which is a quotient of two integers and therefore rational.

So between any two rationals there is a third rational. Between those two, there is a fourth. Between those two, a fifth. The construction never terminates. That is the proof of density.

More strongly: between any two real numbers a < b (not just rationals), there is a rational number. To find one, expand a in decimal as a = 0.a_1 a_2 a_3 \dots and b = 0.b_1 b_2 b_3 \dots and look for the first decimal place where they differ. Round off at that precision and adjust — you will land on a fraction strictly between them. Density applies to every gap on the real line, not just the gaps between rationals.

Density is not "most numbers are rational"

Here is the part that trips everyone. The rationals are dense. You can zoom anywhere and always find rationals. So it feels like the rationals are most of the number line. They are not.

In a precise sense that you can think of as "measuring the total length," the rationals take up zero length on the real line. The irrationals take up all of it. That is compatible with density: you can have infinitely many rational points in any interval and still have the rationals contribute zero length, because each rational is an infinitely thin point and their total "thickness" never adds up to anything.

Analogy. Imagine a ruler with a red dot painted on every rational position. The red dots are dense — you can never find a stretch of ruler without some. But if you melted all the red dots together, you would not get a visible splash of paint. You would get nothing, because each dot has zero thickness.

Dense does not mean "most" — rationals are everywhere but take up no length Two stacked horizontal bars representing the interval from zero to one. The top bar is labelled "the rationals" and has many red dots sprinkled densely along it, but the bar itself is empty behind the dots. The bottom bar is labelled "the irrationals" and is filled solid grey to represent the full length of the interval. the rationals dense — everywhere — but zero total length the irrationals also dense, AND take up all of the length
Both the rationals and the irrationals are dense on the unit interval. But measure-theoretically, the rationals take up zero length and the irrationals take up the full length of $1$. Density is a topological property; length is a measure-theoretic one. They are different.

That is why zooming into the rationals never stops revealing more rationals — density — but also why, if you had to pick a real number uniformly at random in [0, 1], you would land on an irrational with probability 1. The rationals take up none of the room, even though they are everywhere.

Find a rational strictly between $\pi$ and $\pi + 10^{-6}$

You need a fraction p/q with

\pi < \tfrac{p}{q} < \pi + 10^{-6}.

Strategy. Choose any decimal approximation of \pi that fits. \pi \approx 3.141\,592\,653\,5. Add a tiny rational bump, small enough that \pi + 10^{-6} hasn't been overshot. For instance,

\tfrac{p}{q} = 3.141\,593 = \tfrac{3\,141\,593}{1\,000\,000}.

Check.

  • Lower bound: 3.141593 > 3.141592653\dots, so p/q > \pi. ✓
  • Upper bound: \pi + 10^{-6} = 3.141\,593\,653\dots > 3.141\,593. ✓

So 3141593/1000000 is rational and sits strictly in that tiny window. The construction works for any window around any real — which is exactly what density says.

The zoom never ends, the rationals stay thick, and the irrationals still fill all the room. That is the picture of density.

This satellite sits inside Number Systems.