Dyadic rational

In mathematics, a dyadic rational or binary rational is a number that can be expressed as a fraction whose denominator is a power of two. For example, 1/2, 3/2, and 3/8 are dyadic rationals, but 1/3 is not. These numbers are important in computer science because they are the only ones with finite binary representations. Dyadic rationals also have applications in weights and measures, musical time signatures, and early mathematics education. They can accurately approximate any real number.

The sum, difference, or product of any two dyadic rational numbers is another dyadic rational number, given by a simple formula. However, division of one dyadic rational number by another does not always produce a dyadic rational result. Mathematically, this means that the dyadic rational numbers form a ring, lying between the ring of integers and the field of rational numbers. This ring may be denoted $$\Z[\tfrac12]$$.

In advanced mathematics, the dyadic rational numbers are central to the constructions of the dyadic solenoid, Minkowski's question-mark function, Daubechies wavelets, Thompson's group, Prüfer 2-group, surreal numbers, and fusible numbers. These numbers are order-isomorphic to the rational numbers; they form a subsystem of the 2-adic numbers as well as of the reals, and can represent the fractional parts of 2-adic numbers. Functions from natural numbers to dyadic rationals have been used to formalize mathematical analysis in reverse mathematics.

In measurement
Many traditional systems of weights and measures are based on the idea of repeated halving, which produces dyadic rationals when measuring fractional amounts of units. The inch is customarily subdivided in dyadic rationals rather than using a decimal subdivision. The customary divisions of the gallon into half-gallons, quarts, pints, and cups are also dyadic. The ancient Egyptians used dyadic rationals in measurement, with denominators up to 64. Similarly, systems of weights from the Indus Valley civilisation are for the most part based on repeated halving; anthropologist Heather M.-L. Miller writes that "halving is a relatively simple operation with beam balances, which is likely why so many weight systems of this time period used binary systems".

In computing
Dyadic rationals are central to computer science as a type of fractional number that many computers can manipulate directly. In particular, as a data type used by computers, floating-point numbers are often defined as integers multiplied by positive or negative powers of two. The numbers that can be represented precisely in a floating-point format, such as the IEEE floating-point datatypes, are called its representable numbers. For most floating-point representations, the representable numbers are a subset of the dyadic rationals. The same is true for fixed-point datatypes, which also use powers of two implicitly in the majority of cases. Because of the simplicity of computing with dyadic rationals, they are also used for exact real computing using interval arithmetic, and are central to some theoretical models of computable numbers.

Generating a random variable from random bits, in a fixed amount of time, is possible only when the variable has finitely many outcomes whose probabilities are all dyadic rational numbers. For random variables whose probabilities are not dyadic, it is necessary either to approximate their probabilities by dyadic rationals, or to use a random generation process whose time is itself random and unbounded.

In music
Time signatures in Western musical notation traditionally are written in a form resembling fractions (for example:, , or ), although the horizontal line of the musical staff that separates the top and bottom number is usually omitted when writing the signature separately from its staff. As fractions they are generally dyadic, although non-dyadic time signatures have also been used. The numeric value of the signature, interpreted as a fraction, describes the length of a measure as a fraction of a whole note. Its numerator describes the number of beats per measure, and the denominator describes the length of each beat.

In mathematics education
In theories of childhood development of the concept of a fraction based on the work of Jean Piaget, fractional numbers arising from halving and repeated halving are among the earliest forms of fractions to develop. This stage of development of the concept of fractions has been called "algorithmic halving". Addition and subtraction of these numbers can be performed in steps that only involve doubling, halving, adding, and subtracting integers. In contrast, addition and subtraction of more general fractions involves integer multiplication and factorization to reach a common denominator. Therefore, dyadic fractions can be easier for students to calculate with than more general fractions.

Definitions and arithmetic
The dyadic numbers are the rational numbers that result from dividing an integer by a power of two. A rational number $$p/q$$ in simplest terms is a dyadic rational when $$q$$ is a power of two. Another equivalent way of defining the dyadic rationals is that they are the real numbers that have a terminating binary representation.

Addition, subtraction, and multiplication of any two dyadic rationals produces another dyadic rational, according to the following formulas:
 * $$\begin{align}

\frac{a}{2^b}+\frac{c}{2^d}&=\frac{2^{d - \min(b,d)}a + 2^{b - \min(b,d)}c} {2^{\max(b,d)} } \\[6px] \frac{a}{2^b}-\frac{c}{2^d}&=\frac{2^{d - \min(b,d)}a - 2^{b - \min(b,d)}c} {2^{\max(b,d)} } \\[6px] \frac{a}{2^b}\cdot \frac{c}{2^d} &= \frac{ a c}{2^{b+d}} \end{align}$$ However, the result of dividing one dyadic rational by another is not necessarily a dyadic rational. For instance, 1 and 3 are both dyadic rational numbers, but 1/3 is not.

Additional properties
Every integer, and every half-integer, is a dyadic rational. They both meet the definition of being an integer divided by a power of two: every integer is an integer divided by one (the zeroth power of two), and every half-integer is an integer divided by two.

Every real number can be arbitrarily closely approximated by dyadic rationals. In particular, for a real number $$x$$, consider the dyadic rationals of the form $\lfloor 2^i x \rfloor / 2^i$, where $$i$$ can be any integer and $$\lfloor\dots\rfloor$$ denotes the floor function that rounds its argument down to an integer. These numbers approximate $$x$$ from below to within an error of $$1/2^i$$, which can be made arbitrarily small by choosing $$i$$ to be arbitrarily large. For a fractal subset of the real numbers, this error bound is within a constant factor of optimal: for these numbers, there is no approximation $$n/2^i$$ with error smaller than a constant times $$1/2^i$$. The existence of accurate dyadic approximations can be expressed by saying that the set of all dyadic rationals is dense in the real line. More strongly, this set is uniformly dense, in the sense that the dyadic rationals with denominator $$2^i$$ are uniformly spaced on the real line.

The dyadic rationals are precisely those numbers possessing finite binary expansions. Their binary expansions are not unique; there is one finite and one infinite representation of each dyadic rational other than 0 (ignoring terminal 0s). For example, 0.112 = 0.10111...2, giving two different representations for 3/4. The dyadic rationals are the only numbers whose binary expansions are not unique.

Algebraic structure
Because they are closed under addition, subtraction, and multiplication, but not division, the dyadic rationals are a ring but not a field. The ring of dyadic rationals may be denoted $$\Z[\tfrac12]$$, meaning that it can be generated by evaluating polynomials with integer coefficients, at the argument 1/2. As a ring, the dyadic rationals are a subring of the rational numbers, and an overring of the integers. Algebraically, this ring is the localization of the integers with respect to the set of powers of two.

As well as forming a subring of the real numbers, the dyadic rational numbers form a subring of the 2-adic numbers, a system of numbers that can be defined from binary representations that are finite to the right of the binary point but may extend infinitely far to the left. The 2-adic numbers include all rational numbers, not just the dyadic rationals. Embedding the dyadic rationals into the 2-adic numbers does not change the arithmetic of the dyadic rationals, but it gives them a different topological structure than they have as a subring of the real numbers. As they do in the reals, the dyadic rationals form a dense subset of the 2-adic numbers, and are the set of 2-adic numbers with finite binary expansions. Every 2-adic number can be decomposed into the sum of a 2-adic integer and a dyadic rational; in this sense, the dyadic rationals can represent the fractional parts of 2-adic numbers, but this decomposition is not unique.

Addition of dyadic rationals modulo 1 (the quotient group $$\Z[\tfrac12]/\Z$$ of the dyadic rationals by the integers) forms the Prüfer 2-group.

Dyadic solenoid
Considering only the addition and subtraction operations of the dyadic rationals gives them the structure of an additive abelian group. Pontryagin duality is a method for understanding abelian groups by constructing dual groups, whose elements are characters of the original group, group homomorphisms to the multiplicative group of the complex numbers, with pointwise multiplication as the dual group operation. The dual group of the additive dyadic rationals, constructed in this way, can also be viewed as a topological group. It is called the dyadic solenoid, and is isomorphic to the topological product of the real numbers and 2-adic numbers, quotiented by the diagonal embedding of the dyadic rationals into this product. It is an example of a protorus, a solenoid, and an indecomposable continuum.

Functions with dyadic rationals as distinguished points
Because they are a dense subset of the real numbers, the dyadic rationals, with their numeric ordering, form a dense order. As with any two unbounded countable dense linear orders, by Cantor's isomorphism theorem, the dyadic rationals are order-isomorphic to the rational numbers. In this case, Minkowski's question-mark function provides an order-preserving bijection between the set of all rational numbers and the set of dyadic rationals.

The dyadic rationals play a key role in the analysis of Daubechies wavelets, as the set of points where the scaling function of these wavelets is non-smooth. Similarly, the dyadic rationals parameterize the discontinuities in the boundary between stable and unstable points in the parameter space of the Hénon map.

The set of piecewise linear homeomorphisms from the unit interval to itself that have power-of-2 slopes and dyadic-rational breakpoints forms a group under the operation of function composition. This is Thompson's group, the first known example of an infinite but finitely presented simple group. The same group can also be represented by an action on rooted binary trees, or by an action on the dyadic rationals within the unit interval.

Other related constructions
In reverse mathematics, one way of constructing the real numbers is to represent them as functions from unary numbers to dyadic rationals, where the value of one of these functions for the argument $$i$$ is a dyadic rational with denominator $$2^i$$ that approximates the given real number. Defining real numbers in this way allows many of the basic results of mathematical analysis to be proven within a restricted theory of second-order arithmetic called "feasible analysis" (BTFA).

The surreal numbers are generated by an iterated construction principle which starts by generating all finite dyadic rationals, and then goes on to create new and strange kinds of infinite, infinitesimal and other numbers. This number system is foundational to combinatorial game theory, and dyadic rationals arise naturally in this theory as the set of values of certain combinatorial games.

The fusible numbers are a subset of the dyadic rationals, the closure of the set $$\{0\}$$ under the operation $$x,y\mapsto(x+y+1)/2$$, restricted to pairs $$x,y$$ with $$|x-y|<1$$. They are well-ordered, with order type equal to the epsilon number $$\varepsilon_0$$. For each integer $$n$$ the smallest fusible number that is greater than $$n$$ has the form $$n+1/2^k$$. The existence of $$k$$ for each $$n$$ cannot be proven in Peano arithmetic, and $$k$$ grows so rapidly as a function of $$n$$ that for $$n=3$$ it is (in Knuth's up-arrow notation for large numbers) already larger than $$2\uparrow^9 16$$.

The usual proof of Urysohn's lemma utilizes the dyadic fractions for constructing the separating function from the lemma.