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 and row , for positive integers and , holds the fraction , 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 . The sums are taken in the order , and within a diagonal increases. A diagonal with sum has only 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 that begins
Every positive rational number appears in this list exactly once. It appears, because it can be written in lowest terms as , and that cell lies on the diagonal with sum , 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
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 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 . It is in lowest terms, since and have no common factor larger than , and it lies on the diagonal with sum . The diagonals with sums to contain cells, and on its own diagonal the six cells come before it, so is the rd cell visited. Only some of the earlier cells are kept, and counting them shows that is entry 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 , where is an integer and is a nonzero integer. Two fractions and name the same rational number exactly when , 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 with both and positive integers. The set of all rational numbers is written .
In plain words The rational numbers are the fractions, positive and negative, together with zero and the integers, which are fractions with denominator . Their decimal expansions are exactly the ones that stop or end in a block of digits repeating forever.
Example The numbers , , and are rational, and so are and . The fractions , and all name one rational number, since and . The square root of is a real number that is not rational.
Lowest terms
Definition A fraction with an integer and a positive integer is in lowest terms when the only positive integer that divides both and is . This is written , where 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 . 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 for some integer , 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 is not in lowest terms, since divides both and , and dividing both by gives . The cells , and all reduce to . On the diagonal with sum the cells are , and , and the enumeration skips , because it equals , which was kept as 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 and so on. Starting at 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 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 the number has position , each has position and each has position . For example has position and has position .
Dense set
Definition A set of real numbers is dense in the real line when every interval with contains at least one element of . The rational numbers are dense. Given , choose a positive integer with . Neighboring numbers of the form , with an integer, are then less than apart, so the first of them to the right of lies strictly between and . 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 and 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 is rational and lies strictly between them,
So lies between and , and lies between and , and the halving never stops. For the same reason there is no smallest positive rational number, since is a positive rational smaller than . 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 and jumps to , then , then . The integers show the other combination. They are countable but not dense, since the interval contains no integer.
Check yourself
- Continue the diagonal enumeration through the diagonal with sum . Which cells are skipped, what are the entries to , and at which position does appear in the full list ?
Show the answer
The diagonal with sum holds , , , and . Three of them are skipped, , and , so the new entries are and . The diagonal with sum holds , , , , and , all in lowest terms, so
So , and in the full list its negative has position .
- A friend lists the positive fractions one row at a time, first all fractions with denominator , then all with denominator , and so on, keeping only fractions in lowest terms. Where does 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 never appears. The first row never ends, and its entries already take every position , so no fraction with a denominator larger than 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 , a list in which every positive rational number appears, but infinitely often. For instance 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.
- How many cells does the diagonal with sum keep, and which ones? Then explain why a diagonal whose sum is a prime number keeps every cell.
Show the answer
The cells are for . A positive integer that divides and also divides their sum , and one that divides and also divides . So a cell is in lowest terms exactly when and have no common factor larger than , which means that is divisible by neither nor . That leaves , so the diagonal keeps four of its eleven cells,
The same reasoning works for any sum , so a cell is kept exactly when and have no common factor larger than . If is prime, its only positive divisors are and , and does not divide any from to , so every one of the cells is kept. The diagonal with sum in the first question is an example.