Parity and Partition of the Rational Numbers

We define an extension of parity from the integers to the rational numbers. Three parity classes are found -- even, odd and `none'. Using the 2-adic valuation, we partition the rationals into subgroups with a rich algebraic structure. The natural density provides a means of distinguishing the sizes of countably infinite sets. The Calkin-Wilf tree has a remarkably simple parity pattern, with the sequence `odd/none/even' repeating indefinitely. This pattern means that the three parity classes have equal natural density in the rationals. A similar result holds for the Stern-Brocot tree.


+
even odd even even odd odd odd even × even odd even even even odd even odd 1 Parity.
The distinction between odd and even numbers is called parity.The even/odd concept is defined only for the integers.The distinction does not apply to fractions or irrational numbers, but one may wonder if there is a natural way to extend the concept of parity to larger sets of numbers.
What characteristics might one require of such an extension?The definition would have to agree with the traditional definition for the integers, so 5 would continue to be odd and 10 even.In addition, the usual 'rules of parity' might be required: 1.The sum of two even numbers is even; the product is even.
2. The sum of two odd numbers is even; the product is odd.
3. The sum of an even and an odd number is odd; the product is even.
4. An odd number plus 1 is even; an even number plus 1 is odd.
Table 1 shows the effects of addition and multiplication on the ring of integers.
If the concept of parity is extended to larger sets of numbers, some of the properties indicated above may have to be sacrificed.For rational numbers, we might define a number q = m/n to be even if the numerator m is even and odd if m is odd.But then 1 4 + 1 4 = 1 2 , meaning that two odd rationals would add to yield another odd one.
We will distinguish between 'odd' and 'uneven' rationals: assuming m and n to be relatively prime integers, (m, n) = 1, we will adopt the following definition: For any rational number q = m n , q is even if m is even, q is uneven if m is odd .
A three-way split.
There is a simple way of separating the rational numbers into three subsets: For any rational q = m n , q has parity even if m is even and n is odd, q has parity odd if m is odd and n is odd, q has parity none if m is odd and n is even. ( The term none is an initialism for 'neither odd nor even'.Corresponding to this three-way partition, we define three subsets of the rationals: 2n for some m, n ∈ Z} .
These three sets are mutually disjoint and confirming that the definition of parity for the rationals is an extension of the usual meaning for the integers.We see that the even and odd rationals respect the four 'rules of parity' listed above.
1.1 "Twice as many uneven as even fractions".
The rational numbers are countable: they can be put into one-to-one correspondence with the natural numbers.We can list all rationals in (0, 1) in a sequence where, for each n in turn, all (new) numbers m/n with m < n are listed in order.For n max = 8 we have Rearrangement in increasing order of magnitude gives the Farey sequence F 8 .
A Mathematica program was written to count the proportion of rationals in each parity class in the interval (0, 1), with denominators less than or equal to n, for a range of cut-off values n ≤ n max .The ratios are plotted in Fig. 1.As n increases, the ratios of numbers with parity even, odd and none all tend to the limit 1 3 .Colloquially, there are an equal number of rationals with parity even, odd and none, and "twice as many uneven as even rationals".
2 The Density of subsets of N.
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 N, although not for all subsets.Assume a subset A of N is enumerated as {a 1 , a 2 , . . .}.We define the density of A in N as the limit, if it exists, Thus, if the fraction of elements of A among the first n natural numbers converges to a limit ρ N (A) as n tends to infinity, then A has density ρ N (A) [7].More generally, if A = {a 1 , a 2 , a 3 , . . .} is a subset of a countable set X enumerated as {x 1 , x 2 , x 3 , . . .}, we define the density of A in X -if it exists -as For X = N, we usually write ρ N (A) as ρ(A).For A = N E or A = N O , we have ρ(A) = 1 2 , as might be expected.This is consistent with our intuitive notion that 50% of the natural numbers are even and 50% are odd.
It is easy to see that ρ F (N E ) = 2 3 and ρ F (N O ) = 1 3 .Proceeding further, we can construct a set H in which the n-th odd number is followed by n even numbers.We find that ρ H (N E ) = 1, so that "almost all the elements of H are even".These examples make it clear that density depends strongly on the ordering of the reference set.Our intuition is guided by the usual (natural) ordering of the natural numbers and the alternation between odd and even numbers leads us to the conclusion that, somehow, they are equal in number, each comprising "half" of the set of natural numbers.Density relative to N is consistent with this intuition.
With the ordering {0, +1, −1, +2, −2, . ..} of the integers, the densities defined by (5) are We will prove that, for the rational numbers with the Calkin-Wilf and Stern-Brocot orderings defined below, 3 Partitioning the rationals.In Table 2 we show the results of adding and multiplying numbers from the three parity classes.The most important thing to notice is that, if we confine attention to only the even and odd rationals, the tables are identical to the addition and multiplication tables for Z (Table 1).The entry "any" in the tables indicates a number that is a ratio of two even numbers and that may, after reduction, be in any of the three parity classes.Examining the left panel of Table 2, we see that (Q E , +) is an additive (normal) subgroup of (Q, +).
In Table 2 (right panel) we show the results of multiplying numbers from the three parity classes.Restricting attention to the even and odd rationals only -omitting those with no parity -we define This is the set of all rationals whose denominators are odd numbers in Z.It is closed under addition and multiplication and forms a commutative subring of the field Q.Moreover, since there are no divisors of zero, Q P is an integral domain [4].Although Q P is not an ideal of Q (fields do not have proper ideals), it is a (normal) subgroup of (Q, +).So, we may enquire about its index [Q : Q P ] and its quotient group Q/Q P .
Somewhat out of context, we mention the easily-proved observation that all three parity classes, Q E , Q O and Q N , are (topologically) dense in the rationals.
2-Adic valuation and the "degree of evenness".
All multiples of 2 are even, but some are more even than others.
The p-adic valuation -or p-adic order [6] -of an integer n is the function This is extended to the rational numbers m/n: It is easily proved that, for any rationals q 1 and q 2 , ν p (q 1 + q 2 ) ≥ min{ν p (q 1 ), ν p (q 2 )} , with equality holding if ν p (q 1 ) = ν p (q 2 ).
We shall be concerned exclusively with the case p = 2.We note that The "degree of evenness" of a number can be expressed in terms of the 2-adic valuation.For an integer n, the 2-adic valuation is the largest natural number k such that 2 k divides n.It is normally written ν 2 (n) or ord 2 (n).For even integers, ν 2 (n) > 0; for odd integers, ν 2 (n) = 0.By convention, ν 2 (0) = ∞ (since zero is divisible by every power of 2).
The 2-adic order clearly identifies the parity classes of the rationals, and it provides a means of partitioning them into finer-grain parity classes.The resulting partition reveals a wealth of algebraic structure.For all k ∈ Z, we define the set of all rational numbers with 2-adic valuation k: The union of all the Q-sets comprises the entire set of rationals We illustrate the subsets Q k in Fig. 2. The vertical axis is the 2-adic valuation ν 2 .Each subset Q k is represented by a horizontal dotted line.We remark that all odd rationals are in Q 0 and all even rationals are in k>0 Q k .For all K ∈ Z, we define and observe that Q K is a subgroup of Q.We write this as There is an infinite chain of subgroups, starting with Q ∞ = { 0 } and extending through all the Q K groups to the full group of rationals:

Dyadic rational numbers.
A dyadic rational is a number that can be expressed as a fraction whose denominator is a power of two.The usual definition of the dyadic rational numbers [1, pg.122] is Note that the integers are included in the set of dyadic rationals.A convenient alternative definition is since all the numbers of the form 2 k (2 − 1) are in Q k .Moreover, the expression of each number in this form is unique.We also define the sets The dyadics correspond to all real numbers with finite binary expansions, and also to the set of surreal numbers born on finite days [3].The dyadic rational numbers form a ring between the ring of integers and the field of rational numbers: The sets D k are indicated in Fig. 2 by the marked points in Q k .The vertical axis is the 2-adic valuation ν 2 .For each k, D k ⊂ Q k .The (black) dots at level k = 0 are the odd integers.The (blue) dots at positive k-levels are the even integers.The (red) dots at each By analogy with the definition (9) of the Q K -sets, we construct a countable infinity of subgroups of D: Particular cases of the D-sets include There is an infinite chain of subgroups starting with D ∞ and extending through all the D K groups to the full group of dyadic rationals: Readers familiar with the theory of p-adic numbers may wish to show that Q P is the ring of rational-valued 2-adic integers, Q ∩ Z 2 , and the dyadic rational numbers may be expressed as 4 Cosets of Q P in Q.
In the following section we show that any two rationals q 1 and q 2 with distinct, negative 2-adic orders are representatives of distinct cosets: q 1 + Q P = q 2 + Q P .Thus, if q 1 + Q P = q 2 + Q P then ν 2 (q 1 ) = ν 2 (q 2 ).Consequently, there is at least one coset for each k < 0 and therefore an infinite number of cosets.However, it is clear that ν 2 (q 1 ) = ν 2 (q 2 ) does not imply equality of cosets; consider, for example, q 1 = 1 4 and q 2 = 3 4 , since (q 2 − q 1 ) = 1 2 ∈ Q P .We now investigate the cosets q + Q P in Q/Q P .First, we note that if q ∈ Q −k then q + Q P ⊂ Q −k , but there is no guarantee that q + Q P is equal to Q −k .Suppose q 1 and q 2 are in Q −k for some k > 0. If they represent the same coset then q 1 − q 2 ∈ Q P .However, it is easily seen that ν 2 (q 1 − q 2 ) may assume any value greater than −k: Thus, q 1 − q 2 may be in any of the following sets: Clearly, q 1 − q 2 ∈ Q P if and only if ≥ k, whence For each k > 0, we define a set of values We note that these are the first 2 k−1 positive values in D −k .We show in the following section that these are representatives of 2 k−1 cosets, which are all distinct and which provide a disjoint partition of Q −k .This analysis provides explicit expressions for each of the infinite set of cosets of Q P in Q: Scale invariance of the structure.
We notice that the diagram in Fig. 2 has a scaling invariance: if the horizontal axis is stretched by a factor of 2 and the diagram translated one unit in the vertical, the dyadic rationals occupy the same set of points.We have chosen to analyse the quotient group Q/Q P .However, a similar analysis could be done for any subgroup Q K , with directly analogous results.
Density of Q k : a heuristic discussion.
The set It can be visualized as a copy of Q P shifted by a distance 1  2 .We argue heuristically that Q −1 is "as dense as Q P ".More generally, for any k, there is a natural correspondence between elements of Q k and elements of Q k−1 : Thus, Q k−1 may be visualized as a compressed version of Q k .Since Q k−1 is "twice as dense as Q k ", we may argue that we should have twice as many cosets in Q k−1 as there are in Q k .This is consistent with what is proved rigorously below.
5 Formal proof of the coset structure for Q P .
In this section, we give rigorous proofs of some of the results considered heuristically in the discussion above.Lemmas 1 and 2 give conditions for cosets to be equal.Proposition 1 gives explicit representatives q k for each of the distinct cosets.In the following, we abbreviate the 2-adic valuation ν 2 to ν.
Proof.For the cosets to be equal, we must have q 1 − q 2 ∈ Q P .Suppose that ν(q 1 ) = −k and ν(q 2 ) = − with k = ∈ N. Without loss of generality, we may assume that = k + d with d > 0.Then, using (8), Thus, q 1 − q 2 ∈ Q − , so that q 1 + Q P = q 2 + Q P .Consequently, a necessary condition for equality of the cosets is that q 1 and q 2 have the same 2-adic valuation, ν(q 1 ) = ν(q 2 ).
The next lemma strengthens this to a necessary and sufficient condition.
Lemma 2. Let q 1 and q 2 be in Q N .Then q 1 +Q P = q 2 +Q P if, and only if, ν(q 1 ) = ν(q 2 ) = −k for some k ∈ N and ν(a Proof.Let q 1 and q 2 be in Q N .Suppose that q 1 + Q P = q 2 + Q P .Lemma 1 tells us that ν(q 1 ) = ν(q 2 ) = −k for some k ∈ N. We may thus write where a i , b i are odd, and so By hypothesis, this is an element of For the converse, if ν(q 1 ) = ν(q 2 ) = −k, then (12), and hence (13), holds.The condition ν(a 1 b 2 − a 2 b 1 ) ≥ k then implies ν(q 1 − q 2 ) ≥ 0 and so If two of these numbers, q k and q k say, generate the same coset, then q k −q k ∈ Q P and so, by Lemma 2, 2 k divides 2 −1−(2 −1) = 2( − ) and hence 2 k−1 divides − .As 1 ≤ , ≤ 2 k−1 , the only way this can occur is if = .This shows that all 2 k−1 cosets generated by q k are distinct.
Next, we show that these exhaust all possible cosets by elements of Q −k .For this, given q ∈ Q −k we need to show that q +Q P = q k +Q P for some ∈ {1, 2, . . .
for m and n odd, by Lemma 2, this amounts to showing ν In particular, by the pigeonhole principle, all 2 k−1 possible 2 k−1remainders, including 0, are contributed by s − m, = 1, . . ., 2 k−1 .So 2 k−1 divides s − m for some and, for this we have q ∈ q k + Q P , as stated.6 Densities of the parity classes.
There are many exhaustive sequences of rationals other than (3), one attractive option being the Calkin-Wilf tree [2].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 1/1, and everything springs from this root (see Fig. We will now show that the elements of the Calkin-Wilf tree are remarkably regular, with the pattern (o, n, e) repeating interminably.Thus, the parity of any specific term in the tree can easily be deduced.We also prove that, with the ordering of Q corresponding to the Calkin-Wilf tree, the three parity classes all have the same density.
Theorem 1.Let Q + be ordered with the Calkin-Wilf tree.Then Q + may be partitioned into three parity classes, Q + E , Q + O and Q + N , each having asymptotic density 1 3 .
Proof.The parity classes for the first few rows of the Calkin-Wilf tree are shown in Fig. 5.
Odd rows follow a pattern (one) k o for some k ≥ 0 and even rows follow a pattern ne(one) k .This is clearly true for the first few rows.Using the transfer rules (14), and arguing inductively, it is clear that a row with pattern (one) k o is followed by a row with pattern ne(one) 2k .This, in turn, is followed by a row with pattern (one) 4k+1 o.We conclude that, if the entire tree is written row by row as a sequence, the parity follows an unvarying pattern, with odd followed by none followed by even.The parity of an element at any position N is immediately deduced from m = N (mod 3).The pattern also implies that the three parity classes have equal densities.
The Calkin-Wilf tree enumerates the positive rationals Q + .This enumeration, which we write {q n : n ∈ N}, can be extended in a natural way to the full set of rationals: we enumerate Q by {0, q 1 , −q 1 , q 2 , −q 2 , . . .}.With this ordering, the rational numbers split into three parts, each of asymptotic density 1 3 .To summarise, the parity classes of elements of the Calkin-Wilf tree follow a simple pattern if arranged in a single sequence: the pattern {o, n, e} repeats indefinitely (see Fig. 5).As a result, the densities of the parity classes in Q are all equal for this ordering: The Stern-Brocot tree [5, pg. 116] is another ordering of Q very similar to the Calkin-Wilf tree.The numbers at each level are formed from the mediants of adjacent pairs of numbers above (Fig. 4, right panel).The mediant of two (reduced) rationals, m 1 /n 1 and m 2 /n 2 is defined as M (m 1 /n 1 , m 2 /n 2 ) := (m 1 +m 2 )/(n 1 +n 2 ).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, (15) holds true.
Theorem 2. For the order of Q induced by the Stern-Brocot process, the asymptotic density of each parity class, Proof.The Stern-Brocot tree is generated starting from level 0 with the boundary elements Using the transfer rules (16), an odd row with parity (eon) K is followed by even row with parity e(noe) 2K−1 n.This in turn is followed by an odd row with parity (eon) 4K−1 .By an inductive argument, it follows that the parity pattern for an odd row k is (eon) K , where K = (2 k + 1)/3 and, for an even row k, is e(noe) K n where K = (2 − 1)/3.This implies that the asymptotic densities are equal for all three parity classes.
The Stern-Brocot tree enumerates the positive rationals Q + .This enumeration, is easily extended to the full set of rationals, as was done above for the Calkin-Wilf tree.Then the rational numbers split into three parts, each of asymptotic density 1  3 .
The determination of the densities of parity classes for the ordering corresponding to the Farey sequences is left as a challenge for readers.

Conclusion.
We have extended parity from the integers to the rational numbers.Three parity classeseven, odd and 'none' -were found.The even and odd rationals Q E and Q O follow the usual rules of parity.The union of these forms an additive subgroup Q P of Q.
Using the 2-adic valuation, we partitioned Q into subsets and found a chain of subgroups, each having a quotient group of cosets.We constructed a complete set of representatives for the cosets of Q P .
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, we showed that, with the Calkin-Wilf ordering, the three parity classes are equally dense in the rationals.The same conclusion holds for the Stern-Brocot tree.
Finally, we remark that, while this study used only 2-adic numbers, there is potential for broad extensions and generalizations using more general p-adic numbers.

Figure 1 :
Figure 1: Parity ratio r for rationals m/n of parity even (solid line, blue online), odd (dashed line, red online) and none (dotted line, black online) for n ≤ n max = 20.

Figure 2 :
Figure 2: Partition of the rational numbers.The vertical axis is the 2-adic valuation ν 2 .Each (dense) subset Q k is represented by a horizontal dotted line.The sets D k are indicated by the marked points in Q k .The totality of these comprises the dyadic rationals D.

Figure 3 :
Figure 3: Partition of the rational numbers.The vertical axis is µ 2 = 2 ν 2 .Each subset Q k is represented by a horizontal dotted line.The sets D k are indicated by the marked points in Q k .The dyadic numbers in D all appear on a pencil of lines emanating from the origin.
4, left panel).Each rational in the tree has two "children": for the entry m/n, the children are m/(m + n) and (m + n)/n.The "left child" m/(m + n) is always smaller that 1 while the "right child" (m + n)/n is always greater that 1 (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 o, e and n respectively, the parity transfer rules are as follows:

Figure 5 :
Figure 5: Parity classes of terms in the Calkin-Wilf tree.

0 1 and 1 0
, representing 0 and ∞ and with parities [e] and [n].To get each subsequent level we add, between each pair of adjacent numbers, the mediant of that pair, retaining all numbers already generated.The results, for the first few levels, are shown in Fig. 4 (right panel).The parity pattern for the first few levels is [e]o[n] [e]noe[n] [e]oneoneo[n] [e]noenoenoenoenoe[n] .

Table 1 :
Addition table (left) and multiplication table (right) for Z.

Table 2 :
Addition table (left) and multiplication table (right) for Q.The entry 'any' indicates that the result may be in any of the three parity classes.