Video 1, chapter 20

Can Every Fraction Be Counted?

How the rational numbers, a dense set on the number line, still form a countable set, through a diagonal enumeration of a fraction grid that keeps each fraction only in lowest terms.

  • Video 1, chapter 20
  • When infinity changes the rules

Video 1, chapter 20

Between any two different fractions there is always another fraction, so on the number line no fraction is followed by a next one. That seems to make it impossible to number all the fractions first, second, third and so on. This page shows that a numbered list does not have to follow the order of size, builds a list that contains every rational number exactly once, and explains why being dense and being countable are different properties.

Key terms

Diagonal enumeration

Definition The diagonal enumeration is a way to list the positive rational numbers. Lay out a grid in which the cell in column pp and row qq, for positive integers pp and qq, holds the fraction p/qp/q, so the numerators grow to the right and the denominators grow downward. Visit the cells diagonal by diagonal, where a diagonal is the set of cells with the same sum p+qp + q. The sums are taken in the order 2,3,4,…2, 3, 4, \dots, and within a diagonal pp increases. A diagonal with sum dd has only d−1d - 1 cells, so each one is finished after finitely many steps. Keep a cell when its fraction is in lowest terms and skip it otherwise, because the same number was already kept on an earlier diagonal. The kept fractions, in the order visited, form a list r1,r2,r3,…r_1, r_2, r_3, \dots that begins

1,  12,  2,  13,  3,14,  23,  32,  4,  …\begin{gathered} 1, \; \tfrac12, \; 2, \; \tfrac13, \; 3, \\[0.4em] \tfrac14, \; \tfrac23, \; \tfrac32, \; 4, \; \dots \end{gathered}

Every positive rational number appears in this list exactly once. It appears, because it can be written in lowest terms as p/qp/q, and that cell lies on the diagonal with sum p+qp + q, which is reached after finitely many cells, and it is kept. It appears only once, because only one cell holds it in lowest terms. The full list

0,  r1,  −r1,  r2,  −r2,  …0, \; r_1, \; -r_1, \; r_2, \; -r_2, \; \dots

then contains every rational number exactly once, with zero placed first and each negative number right after its positive partner. So the rational numbers form a countable set. This answers the question in the title. The rational numbers are dense, so they cannot be listed in order of size, but a list does not have to follow the order of size. This one jumps back and forth along the number line, and the entry after rkr_k is simply the next entry of the list, not a next larger rational number, which does not exist.

In plain words You cannot count the fractions from smallest to largest, but you can count them in a different order, by sweeping along short diagonals across a grid that contains them all and skipping the repeats.

Example Take 7/117/11. It is in lowest terms, since 77 and 1111 have no common factor larger than 11, and it lies on the diagonal with sum 1818. The diagonals with sums 22 to 1717 contain 1+2+⋯+16=1361 + 2 + \dots + 16 = 136 cells, and on its own diagonal the six cells 1/17,2/16,…,6/121/17, 2/16, \dots, 6/12 come before it, so 7/117/11 is the 143143rd cell visited. Only some of the 142142 earlier cells are kept, and counting them shows that 7/117/11 is entry r98r_{98} of the list. Any other positive fraction gets a definite finite position in the same way.

Rational numbers

Definition A rational number is a number that can be written as a fraction p/qp/q, where pp is an integer and qq is a nonzero integer. Two fractions p/qp/q and p′/q′p'/q' name the same rational number exactly when pq′=p′qpq' = p'q, so each rational number is named by many fractions. Every rational number is zero, positive or negative, and every positive rational number can be written as p/qp/q with both pp and qq positive integers. The set of all rational numbers is written Q\mathbb{Q}.

In plain words The rational numbers are the fractions, positive and negative, together with zero and the integers, which are fractions with denominator 11. Their decimal expansions are exactly the ones that stop or end in a block of digits repeating forever.

Example The numbers 3/43/4, −5/2-5/2, 7=7/17 = 7/1 and 0=0/10 = 0/1 are rational, and so are 0.75=3/40.75 = 3/4 and 0.333…=1/30.333\ldots = 1/3. The fractions 1/21/2, 2/42/4 and 3/63/6 all name one rational number, since 1⋅4=2⋅21 \cdot 4 = 2 \cdot 2 and 1⋅6=3⋅21 \cdot 6 = 3 \cdot 2. The square root of 22 is a real number that is not rational.

Lowest terms

Definition A fraction p/qp/q with an integer pp and a positive integer qq is in lowest terms when the only positive integer that divides both pp and qq is 11. This is written gcd⁡(p,q)=1\gcd(p, q) = 1, where gcd⁡\gcd stands for the greatest common divisor. Dividing the numerator and the denominator by their greatest common divisor gives a fraction in lowest terms with the same value. Every rational number has exactly one fraction in lowest terms with a positive denominator, and for zero it is 0/10/1. In the grid, where numerators and denominators are positive, each positive rational number therefore has exactly one cell in lowest terms, and that is the cell the diagonal enumeration keeps. Every other cell with the same value is (gp)/(gq)(gp)/(gq) for some integer g≥2g \ge 2, so the cell in lowest terms has the smallest sum and lies on the earliest diagonal.

In plain words A fraction is in lowest terms when it cannot be simplified any further. Each number has just one such simplest fraction, so keeping only the simplest fractions counts each number once.

Example The fraction 18/2418/24 is not in lowest terms, since 66 divides both 1818 and 2424, and dividing both by 66 gives 3/43/4. The cells 2/42/4, 3/63/6 and 50/10050/100 all reduce to 1/21/2. On the diagonal with sum 44 the cells are 1/31/3, 2/22/2 and 3/13/1, and the enumeration skips 2/22/2, because it equals 11, which was kept as 1/11/1 on the first diagonal.

Countable set

Definition A set is countable when it is finite or countably infinite, that is, when its elements can be arranged in a list, finite or endless, in which every element appears at some finite position. Here the positions are numbered 1,2,31, 2, 3 and so on. Starting at 00 instead, as some books do when they number the natural numbers, changes nothing. A list that contains every element at least once is enough, even with repeats, because deleting each repeat after its first appearance leaves a list in which every element appears exactly once. Some books use the word countable only for countably infinite sets.

In plain words A set is countable when its elements can be called out one at a time so that each of them is called at some point, after only finitely many others.

Example The integers are countable, listed as 0,1,−1,2,−20, 1, -1, 2, -2 and so on, and so are the pairs of positive integers, listed along diagonals as in Hilbert’s Hotel. Taking entries from two lists in turn shows that the union of two countable sets is countable, and that is how the full list of rational numbers comes from the positive ones. In the list 0,r1,−r1,r2,−r2,…0, r_1, -r_1, r_2, -r_2, \dots the number 00 has position 11, each rkr_k has position 2k2k and each −rk-r_k has position 2k+12k + 1. For example 2/3=r72/3 = r_7 has position 1414 and −2/3-2/3 has position 1515.

Dense set

Definition A set DD of real numbers is dense in the real line when every interval (a,b)(a, b) with a<ba < b contains at least one element of DD. The rational numbers are dense. Given a<ba < b, choose a positive integer nn with n(b−a)>1n(b - a) > 1. Neighboring numbers of the form m/nm/n, with mm an integer, are then less than b−ab - a apart, so the first of them to the right of aa lies strictly between aa and bb. In particular, between two different rational numbers there is always a third, so no rational number has a next larger rational number. Being dense is a property of positions on the number line, while being countable is a property of matching with the positive integers, and a set can have both. Cantor’s Diagonal Argument shows that the real numbers between 00 and 11 are not countable.

In plain words However far you zoom in on the number line, every stretch of it with positive length still contains rational numbers, in fact infinitely many. Dense means that no stretch of the line is free of them, not that there are too many of them to count.

Example The average of two rational numbers a<ba < b is rational and lies strictly between them,

a<a+b2<b.a < \frac{a + b}{2} < b.

So 3/43/4 lies between 1/21/2 and 11, and 5/85/8 lies between 1/21/2 and 3/43/4, and the halving never stops. For the same reason there is no smallest positive rational number, since r/2r/2 is a positive rational smaller than rr. A list of all positive rational numbers therefore cannot start with the smallest one and go up in order, and the diagonal enumeration instead starts at 11 and jumps to 1/21/2, then 22, then 1/31/3. The integers show the other combination. They are countable but not dense, since the interval (1/4,3/4)(1/4, 3/4) contains no integer.

Check yourself

  1. Continue the diagonal enumeration through the diagonal with sum 77. Which cells are skipped, what are the entries r10r_{10} to r17r_{17}, and at which position does −3/4-3/4 appear in the full list 0,r1,−r1,r2,−r2,…0, r_1, -r_1, r_2, -r_2, \dots?
Show the answer

The diagonal with sum 66 holds 1/51/5, 2/42/4, 3/33/3, 4/24/2 and 5/15/1. Three of them are skipped, 2/4=1/22/4 = 1/2, 3/3=13/3 = 1 and 4/2=24/2 = 2, so the new entries are r10=1/5r_{10} = 1/5 and r11=5r_{11} = 5. The diagonal with sum 77 holds 1/61/6, 2/52/5, 3/43/4, 4/34/3, 5/25/2 and 6/16/1, all in lowest terms, so

r12,…,r17=16,  25,  34,  43,  52,  6.\begin{gathered} r_{12}, \dots, r_{17} = \\[0.4em] \tfrac16, \; \tfrac25, \; \tfrac34, \; \tfrac43, \; \tfrac52, \; 6. \end{gathered}

So 3/4=r143/4 = r_{14}, and in the full list its negative −r14=−3/4-r_{14} = -3/4 has position 2⋅14+1=292 \cdot 14 + 1 = 29.

  1. A friend lists the positive fractions one row at a time, first all fractions with denominator 11, then all with denominator 22, and so on, keeping only fractions in lowest terms. Where does 1/21/2 appear? And would the diagonal route still prove that the positive rational numbers are countable if it kept every cell, repeats included?
Show the answer

The fraction 1/21/2 never appears. The first row 1/1,2/1,3/1,…1/1, 2/1, 3/1, \dots never ends, and its entries already take every position 1,2,3,…1, 2, 3, \dots, so no fraction with a denominator larger than 11 gets a finite position. The lowest terms rule does not help, because every fraction in the first row is in lowest terms. The trouble is the endless row, not the repeats.

The diagonal route without the rule gives 1,1/2,2,1/3,1,3,…1, 1/2, 2, 1/3, 1, 3, \dots, a list in which every positive rational number appears, but infinitely often. For instance 1=1/1=2/2=3/31 = 1/1 = 2/2 = 3/3 and so on. That list still proves countability, because deleting every repeat after its first appearance leaves a list with each number exactly once. The first appearance of each number is its cell in lowest terms, so deleting the repeats gives exactly the list made with the lowest terms rule.

  1. How many cells does the diagonal with sum 1212 keep, and which ones? Then explain why a diagonal whose sum is a prime number keeps every cell.
Show the answer

The cells are p/(12−p)p/(12 - p) for p=1,2,…,11p = 1, 2, \dots, 11. A positive integer that divides pp and 12−p12 - p also divides their sum 1212, and one that divides pp and 1212 also divides 12−p12 - p. So a cell is in lowest terms exactly when pp and 1212 have no common factor larger than 11, which means that pp is divisible by neither 22 nor 33. That leaves p=1,5,7,11p = 1, 5, 7, 11, so the diagonal keeps four of its eleven cells,

111,  57,  75,  11.\tfrac{1}{11}, \; \tfrac57, \; \tfrac75, \; 11.

The same reasoning works for any sum dd, so a cell p/(d−p)p/(d - p) is kept exactly when pp and dd have no common factor larger than 11. If dd is prime, its only positive divisors are 11 and dd, and dd does not divide any pp from 11 to d−1d - 1, so every one of the d−1d - 1 cells is kept. The diagonal with sum 77 in the first question is an example.

How this lesson connects