In last week’s post, we defined an extension of parity from the integers to the rational numbers. Three parity classes were found — even, odd and *none*. This week, we show that, with an appropriate ordering or enumeration of the rationals, the three classes are not only equinumerate (having the same cardinality) but of equal density in . This article is a condensation of part of a paper [Lynch & Mackey, 2022] recently posted on arXiv.

A simple way of separating the rational numbers — ratios of whole numbers — into three subsets is given in schematic form:

The term *none* is an initialism for *neither odd nor even*. Corresponding to this three-way partition, we defined three subsets of the rationals:

The rational numbers are **countable:** they can be put into one-to-one correspondence with the natural numbers. This is also true for the sets , and . Numerical evidence indicates that, for a large cutoff of the denominator size, all three classes have about the same number of elements. We will show rigourously, using set density, that this is true.

** The Density of subsets of .**

In pure set-theoretic terms, the set of even positive numbers is “the same size” as the set of all natural numbers; both are infinite countable sets. However, **cardinality is a blunt instrument:** with the usual ordering, every second natural number is even and, intuitively, we feel that there are half as many even numbers as natural numbers. The concept of *density* provides a means of expressing the relative sizes of sets that is more discriminating than cardinality.

Density — also called natural or asymptotic density — is defined for many interesting subsets of , although not for all subsets. Assume a subset of is enumerated as . We define the density of in as the limit, if it exists,

Thus, if the fraction of elements of among the first natural numbers converges to a limit as tends to infinity, then has density . More generally, if is a subset of a countable set enumerated as , we define the density of in — if it exists — as

For , we usually write as . For or , we have , as might be expected. This is consistent with our intuitive notion that of the natural numbers are even and are odd.

Let us now rearrange the natural numbers into a set such that there are *twice as many even as odd numbers in *. We reorder so that each odd number is followed by two even ones:

It is easy to see that and .

Proceeding further, we can construct a set in which the -th odd number is followed by even numbers. We find that , so that “almost all the elements of are even”. These examples make it clear that **density depends strongly on the ordering of the set.** We will show that, for the rational numbers with the Calkin-Wilf and Stern-Brocot orderings defined below,

** The Calkin-Wilf Ordering **

There are many exhaustive sequences of rationals, one attractive option being the Calkin-Wilf tree [Calkin & Wilf, 1999]. The Calkin-Wilf tree is complete: it includes all positive rational numbers and each such number occurs precisely once. The tree starts with the root value , and everything springs from this root (see Figure) Each rational in the tree has two “children”: for the entry , the children are and . The “left child” is always smaller that while the “right child” is always greater that **(mnemonic: the children are “top over sum” and “sum over bottom”).** The pattern of parity from one row of the Calkin-Wilf diagram to the next is simple. Denoting odd parity, even parity and no parity by , and respectively, the parity transfer rules are as follows:We can show that the elements of the Calkin-Wilf tree are remarkably regular, with the pattern repeating interminably (see Figure at head of this post). Thus, the parity of any specific term in the tree can easily be deduced. This implies that, with the ordering of corresponding to the Calkin-Wilf tree, the three parity classes all have the same density.

**Theorem 1.** Let be ordered with the Calkin-Wilf tree. Then may be partitioned into three parity classes, , and , each having asymptotic density .

**Proof.** The proof follows by using the transfer rules and an inductive argument. Full details are in the arXiv preprint (Lynch and Mackey, 2022).

The Calkin-Wilf tree enumerates the positive rationals . This enumeration, which we write , can be extended in a natural way to the full set of rationals: we enumerate by . With this ordering, the rational numbers split into three parts, each of asymptotic density :

** The Stern-Brocot Ordering **

The Stern-Brocot tree [Graham, Knuth and Patashnik, 1994, pg.116] is another ordering of very similar to the Calkin-Wilf tree. The numbers at each level are formed from the mediants of adjacent pairs of numbers above (see Figure) The mediant of two (reduced) rationals, and is defined as . We note that the parity of the mediants of two numbers of different parity is the third parity:

We now show that, with the ordering of the Stern-Brocot tree, the split into three sets of equal density holds true.

**Theorem 2.** For the order of induced by the Stern-Brocot process, the asymptotic density of each parity class, , and , is .

**Proof.** The proof follows by using the transfer rules and an inductive argument. Full details are in the arXiv preprint (Lynch and Mackey, 2022).

** Summary. **

We have extended parity from the integers to the rational numbers. Three parity classes — even, odd and *none* — were found. The Calkin-Wilf tree was found to have a remarkably simple parity pattern, with the sequence `odd/none/even’ repeating indefinitely. Using the natural density, which provides a means of distinguishing the sizes of countably infinite sets, the three parity classes are equally dense in the rationals. The same conclusion holds for the Stern-Brocot tree.

**Sources**

Calkin, Neil and Wilf, Herbert S., 1999: Recounting the rationals. *American Mathematical Monthly*, **107**, (4), 360–363. PDF

Graham, Ronald L., Knuth, Donald E. and Patashnik, Oren, 1994: *Concrete Mathematics*, Second Edn., Addison-Wesley Publ.~Co., ISBN: 978-0-2015-5802-9.

Lynch, Peter & Michael Mackey, 2022: Parity and Partition of the Rational Numbers. Preprint on arXiv.

Lynch, Peter, 2018: That’s Maths: Listing the Rational Numbers II: The Stern-Brocot Tree. Post.

Lynch, Peter, 2018: That’s Maths: Listing the Rational Numbers III: The Calkin-Wilf Tree. Post.