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 .

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.

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.^{[1]} The customary divisions of the gallon into half-gallons, quarts, pints, and cups are also dyadic.^{[2]} The ancient Egyptians used dyadic rationals in measurement, with denominators up to 64.^{[3]} 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".^{[4]}

Dyadic rationals are central to computer science as a type of fractional number that many computers can manipulate directly.^{[5]} 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.^{[6]} The same is true for fixed-point datatypes, which also use powers of two implicitly in the majority of cases.^{[7]} Because of the simplicity of computing with dyadic rationals, they are also used for exact real computing using interval arithmetic,^{[8]} and are central to some theoretical models of computable numbers.^{[9]}^{[10]}^{[11]}

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.^{[12]}

Time signatures in Western musical notation traditionally are written in a form resembling fractions (for example: ^{2}_{2}, ^{4}_{4}, or ^{6}_{8}),^{[13]} 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,^{[14]} although non-dyadic time signatures have also been used.^{[15]} 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.^{[13]}^{[14]}

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.^{[16]} This stage of development of the concept of fractions has been called "algorithmic halving".^{[17]} 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.^{[18]}

The dyadic numbers are the rational numbers that result from dividing an integer by a power of two.^{[9]} A rational number in simplest terms is a dyadic rational when is a power of two.^{[19]} Another equivalent way of defining the dyadic rationals is that they are the real numbers that have a terminating binary representation.^{[9]}

Addition, subtraction, and multiplication of any two dyadic rationals produces another dyadic rational, according to the following formulas:^{[20]}

However, the result of dividing one dyadic rational by another is not necessarily a dyadic rational.^{[21]} For instance, 1 and 3 are both dyadic rational numbers, but 1/3 is not.

Every integer, and every half-integer, is a dyadic rational.^{[22]} 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 , consider the dyadic rationals of the form , where can be any integer and denotes the floor function that rounds its argument down to an integer. These numbers approximate from below to within an error of , which can be made arbitrarily small by choosing 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 with error smaller than a constant times .^{[23]}^{[24]} The existence of accurate dyadic approximations can be expressed by saying that the set of all dyadic rationals is dense in the real line.^{[22]} More strongly, this set is uniformly dense, in the sense that the dyadic rationals with denominator are uniformly spaced on the real line.^{[9]}

The dyadic rationals are precisely those numbers possessing finite binary expansions.^{[9]} 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.11_{2} = 0.10111..._{2}, giving two different representations for 3/4.^{[9]}^{[25]} The dyadic rationals are the only numbers whose binary expansions are not unique.^{[9]}

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

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,^{[30]} 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.^{[31]}

Addition of dyadic rationals modulo 1 (the quotient group of the dyadic rationals by the integers) forms the Prüfer 2-group.^{[32]}

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.^{[30]} It is an example of a protorus, a solenoid, and an indecomposable continuum.^{[33]}

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,^{[34]} 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.^{[35]}

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.^{[26]} Similarly, the dyadic rationals parameterize the discontinuities in the boundary between stable and unstable points in the parameter space of the Hénon map.^{[36]}

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.^{[37]} The same group can also be represented by an action on rooted binary trees,^{[38]} or by an action on the dyadic rationals within the unit interval.^{[32]}

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 is a dyadic rational with denominator 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).^{[39]}

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.^{[40]} 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.^{[41]}^{[42]}^{[19]}

The fusible numbers are a subset of the dyadic rationals, the closure of the set under the operation , restricted to pairs with . They are well-ordered, with order type equal to the epsilon number . For each integer the smallest fusible number that is greater than has the form . The existence of for each cannot be proven in Peano arithmetic,^{[43]} and grows so rapidly as a function of that for it is (in Knuth's up-arrow notation for large numbers) already larger than .^{[44]}

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