Density of the Rationals

See that every interval, however narrow, hides a rational. Bigger denominators make the ticks denser.

Between any two numbers sits a fraction. Narrower gaps need bigger denominators. Chop the scale finely enough and some tick lands in every gap. The same trick works around irrationals.

For example, keep cutting a 🍰 cake in half, again and again. The pieces shrink without end. Pick any thin gap, and a thinner piece exists. That piece is the fraction landing inside.

n=⌊1yβˆ’xβŒ‹+1,m=⌊nxβŒ‹+1n = \left\lfloor\frac{1}{y-x}\right\rfloor + 1,\quad m = \lfloor nx \rfloor + 1
x<mn<yx < \frac{m}{n} < y
z=r+(sβˆ’r)22Β isΒ irrationalz = r + (s-r)\frac{\sqrt{2}}{2}\ \text{is irrational}

Examples & Exercises

Prove completely, from the Archimedean property, that for every real xx there is an integer nn with n≀x<n+1n \le x < n+1 (Tao, Proposition 4.4.1).

βˆ€β€‰x∈RΒ βˆƒβ€‰n∈Z:Β n≀x<n+1\forall\, x \in \mathbb{R}\ \exists\, n \in \mathbb{Z}:\ n \le x < n+1
Interval (1,2)(1, 2): n=⌊1/(2βˆ’1)βŒ‹+1=2n = \lfloor 1/(2-1) \rfloor + 1 = 2, m=⌊2β‹…1βŒ‹+1=3m = \lfloor 2 \cdot 1 \rfloor + 1 = 3, so q=3/2=1.5q = 3/2 = 1.5 lands inside. The proof below shows this recipe always works.
Show proof
  1. Let S={k∈Z:k≀x}S = \{k \in \mathbb{Z} : k \le x\}. By the Archimedean property there is a natural number K>βˆ’xK > -x; then βˆ’K<x-K < x, so βˆ’K∈S-K \in S β€” SS is nonempty and bounded above by xx.

  2. A nonempty set of integers bounded above has a maximum: pick an integer M>xM > x (Archimedean); then Sβ€²β€²={Mβˆ’s:s∈S}S'' = \{M - s : s \in S\} is a nonempty set of nonnegative integers, so by well-ordering it has a least element Mβˆ’nM - n with n∈Sn \in S. Every s∈Ss \in S satisfies Mβˆ’sβ‰₯Mβˆ’nM - s \ge M - n, i.e. s≀ns \le n, so n=max⁑Sn = \max S.

  3. Since n∈Sn \in S, n≀xn \le x.

    Also n+1>xn + 1 > x: otherwise n+1≀xn + 1 \le x would put n+1∈Sn + 1 \in S, contradicting the maximality of nn.

    Hence n≀x<n+1n \le x < n+1 β€” every real sits exactly between two consecutive integer marks.

Prove completely that for reals x<yx < y there is a rational qq with x<q<yx < q < y β€” the rationals are dense in the reals (Tao, Proposition 4.4.3).

x<yβ‡’βˆƒβ€‰q∈Q:Β x<q<yx < y \Rightarrow \exists\, q \in \mathbb{Q}:\ x < q < y
n=⌊1yβˆ’xβŒ‹+1,m=⌊nxβŒ‹+1,q=mnn = \left\lfloor\frac{1}{y-x}\right\rfloor + 1,\quad m = \lfloor nx \rfloor + 1,\quad q = \frac{m}{n}
Interval (1,2)(1, 2): taking n=2n = 2 with 1/n<yβˆ’x1/n < y - x, one of the 1/21/2-spaced marks …,1,3/2,2,…\dots, 1, 3/2, 2, \dots β€” namely 3/23/2 β€” falls inside the interval: the proof's recipe executed live.
Show proof
  1. Since yβˆ’x>0y - x > 0, the Archimedean property gives a natural number nn larger than 1yβˆ’x\frac{1}{y-x} β€” i.e. 1n<yβˆ’x\frac{1}{n} < y - x. The model computes such an nn directly as n=⌊1yβˆ’xβŒ‹+1n = \left\lfloor\frac{1}{y-x}\right\rfloor + 1.

  2. Applying problem 1 to nxnx gives an integer mm with mβˆ’1≀nx<mm - 1 \le nx < m (the model computes m=⌊nxβŒ‹+1m = \lfloor nx \rfloor + 1). Put q=m/nq = m/n; from m>nxm > nx we get mn>nxn=x\frac{m}{n} > \frac{nx}{n} = x.

  3. Also m<nx+1m < nx + 1, and 1n<yβˆ’x\frac{1}{n} < y - x is equivalent to 1<n(yβˆ’x)1 < n(y - x), so nx+1<nx+n(yβˆ’x)=nynx + 1 < nx + n(y - x) = ny.

    Hence m<nym < ny, i.e. mn<y\frac{m}{n} < y.

    Together: x<mn<yx < \frac{m}{n} < y β€” the desired rational q=m/nq = m/n is found.

  4. The key idea: once the marks are spaced finer than the interval (1n<yβˆ’x\frac{1}{n} < y - x), no mark can jump clean over it. However narrow the interval (try the (0,0.1)(0, 0.1) and (βˆ’3.5,βˆ’3.4)(-3.5, -3.4) presets), finer marks always work β€” there are no exceptions.

Prove the irrationals are dense too: if x<yx < y there is an irrational zz with x<z<yx < z < y (hint: pick rationals r<sr < s inside (x,y)(x, y) and use z=r+(sβˆ’r)22z = r + (s-r)\frac{\sqrt{2}}{2}).

z=r+(sβˆ’r)22∈(x,y),zβˆ‰Qz = r + (s-r)\frac{\sqrt{2}}{2} \in (x, y),\qquad z \notin \mathbb{Q}
Interval (1,2)(1, 2): with rationals r=3/2r = 3/2, s=7/4s = 7/4, z=32+14β‹…22β‰ˆ1.677z = \frac{3}{2} + \frac{1}{4}\cdot\frac{\sqrt{2}}{2} \approx 1.677 is an irrational inside (1,2)(1, 2) β€” an irrational always squeezes between rational marks.
Show proof
  1. Problem 2 alone gives only one rational, so apply it twice: with the midpoint m=(x+y)/2m = (x + y)/2, applying problem 2 in (x,m)(x, m) gives a rational rr with x<r<mx < r < m, and applying it in (m,y)(m, y) gives a rational ss with m<s<ym < s < y; since r<m<sr < m < s, there are rationals r<sr < s inside (x,y)(x, y).

    Put z=r+(sβˆ’r)22z = r + (s - r)\frac{\sqrt{2}}{2}.

    Since 1<2<41 < 2 < 4 and squaring is strictly increasing on [0,∞)[0, \infty) (problem 1 of the sqrt2-irrational scene, plus the n-th root scene), 1<2<21 < \sqrt{2} < 2 β€” hence 0<22<10 < \frac{\sqrt{2}}{2} < 1.

  2. Since sβˆ’r>0s - r > 0, 0<(sβˆ’r)22<sβˆ’r0 < (s-r)\frac{\sqrt{2}}{2} < s - r; adding rr gives r<z<sr < z < s. With x<rx < r and s<ys < y, x<z<yx < z < y β€” zz lies in the interval.

  3. Now zz is irrational: if it were rational, 2=2(zβˆ’r)sβˆ’r\sqrt{2} = \frac{2(z - r)}{s - r} would be rational too (the right side is arithmetic on rationals with nonzero denominator) β€” contradicting Proposition 4.4.4 that 2\sqrt{2} is irrational (problem 1 of the sqrt2-irrational scene). Hence zz is irrational with x<z<yx < z < y.

  4. Corollary: every open interval of the real line contains both rationals and irrationals. Density of the rationals does not mean "almost all" reals are rational β€” quite the opposite is true (the countability scene).

2. Number Systems