A rational number is a quotient of integers with . The numerator can be negative or zero; the denominator can be chosen positive by transferring its sign to . For example, and .
Different fractions describe the same rational number exactly when cross multiplication gives . Dividing the entries by their greatest common divisor produces the unique reduced fraction with positive denominator, including for zero.
The rational numbers form a field: addition, subtraction, multiplication and division by a nonzero rational number remain rational. They are dense in the real line, by density of the rational numbers, although they do not fill it: the square root of two is an irrational number.
A binary tree enumerating every positive reduced fraction exactly once. Begin with boundary fractions and ; between neighboring fractions , insert their mediant and recurse into the two new intervals. The determinant relation is preserved, and the new denominator is .
A fraction represents the quotient of its numerator by its nonzero denominator . For integers this is a rational number. Different fractions can represent the same number: . Dividing both entries by their greatest common divisor gives a reduced fraction, with the sign convention that the denominator is positive.
A nonnegative fraction with positive denominator and numerator smaller than its denominator, so its value lies in . The zero value has the reduced fraction representation . The term is sometimes extended to negative fractions by comparing absolute values; the nonnegative convention is the one used here.
A unit fraction is for a positive integer . Its numerator is one, so it is already a reduced fraction; the denominator determines its value uniquely. For example, and are unit fractions, while is not.
Every unit fraction lies in , including . A rational number can have several expressions as a sum of unit fractions: , for example. An Egyptian fraction requires such a finite representation, usually with distinct denominators.
An Egyptian fraction expresses a nonnegative rational number as a finite sum of positive unit fractions. A computational representation may permit repeated denominators, while the classical distinct-denominator convention adds a further requirement. The empty sum represents zero. For example, ; each denominator is a positive integer. A representation that permits repetition also has the simple expansion for nonnegative integers and positive .
For a positive proper residual fraction , with , choose , append the unit fraction , and replace the residual by in lowest terms. This is a greedy algorithm: the chosen unit fraction is the largest one not exceeding the residual.
The inequalities imply . Thus the numerator of the reduced residual strictly decreases while positive, proving algorithm termination by a nonnegative-integer loop variant. The loop invariant is that the accumulated sum plus the residual is the original rational number. Since and , the new residual is less than . If it remains positive, its next chosen denominator is therefore strictly greater than ; this expansion also satisfies the distinct-denominator convention. The proof does not bound the denominators by the input's fixed-width range. Arbitrary-precision arithmetic, checked conversion, or a different representable expansion can therefore be necessary in code.
Exact arithmetic on rational numbers represented by integer numerators and nonzero integer denominators. Common factors can be removed with the greatest common divisor. Exact rational arithmetic avoids rounding error when deciding equality or integrality.
For nonzero denominators, exactly when . For positive denominators, exactly when . This compares fractions with exact integer arithmetic, avoiding rounding from floating-point arithmetic.
The numerator is the upper entry in a fraction . For an integer fraction, it records how many signed units of size are being taken when the denominator is positive: takes three fifths, while reverses the sign.
A numerator belongs to a chosen representation, rather than being determined by the rational number alone. The equal fractions and have different numerators. The reduced fraction convention makes the numerator and positive denominator unique; zero then has numerator zero and denominator one.
The denominator is the nonzero lower entry in a fraction . It specifies the division being performed; with , the unit fraction is the size of one part. Thus and have the same numerator but different values.
An integer fraction can always be written with positive denominator. Dividing both entries by their greatest common divisor gives a reduced fraction, so and represent the same rational number despite different denominators.
A zero denominator is excluded from ordinary rational numbers. The symbol used at the boundary of the Stern-Brocot tree is a formal boundary symbol, not an additional rational number produced by division by zero.
For a positive integer , the Farey sequence is the increasing list of reduced fractions in with denominators at most , including and . For example,Each denominator contributes exactly new interior fractions, because the allowable numerators are precisely those coprime to . Therefore the number of terms is , using the summatory totient function.
For two distinct fractions in the list, their difference is , since the integer is positive. This arithmetic separation, rather than arbitrary real spacing, makes Farey fractions useful in rational approximation. The Stern-Brocot tree organizes the same positive reduced fractions by mediant insertion instead of a denominator cutoff.
A member of a Farey sequence. Two distinct level- fractions have ordinary distance at least . On the quotient circle identify zero and one before forming a set; the shorter wrapped distance of two remaining distinct fractions obeys the same bound.
A reduced fraction has coprime integers and positive denominator . Distinct reduced fractions with denominators at most differ by at least , since their difference has a nonzero integer numerator over a denominator at most .
Between any two real numbers lies a rational number. By the Archimedean property, choose a positive integer with , and set using the floor function. ThenThis works for negative as well as positive endpoints, because the floor always rounds downward. It proves that the rational numbers are dense in the real line.
There are actually infinitely many rational numbers in each nonempty open interval: after finding one, apply the same argument between that point and the right endpoint, repeatedly. Density concerns the existence of nearby points; it does not say that every real number is rational. In particular, the countable set of rational numbers is dense in an uncountable set.
A repeating decimal has a decimal representation whose digits eventually repeat a finite block. An initial decimal preperiod may occur before the repeated tail: , whereas begins repeating immediately. Terminating expansions fit the same convention by repeating zeros, as in .
A real number is rational exactly when its decimal expansion is eventually periodic. For a rational number, long division has finitely many possible remainders, so it either reaches zero or repeats a previous remainder. Conversely, a repeating tail sums as a geometric series, giving a rational number. The same argument holds in every integer positional base at least two, as in eventually periodic positional expansion of a rational number.
Decimal representations need not be unique: . Both are eventually periodic, so this endpoint ambiguity does not affect the rationality criterion.
The shortest prefix before the repeating tail of a decimal representation. For a reduced fraction with denominator , where is coprime to ten, its length is ; the tail length is given by decimal period from multiplicative order.
A positional expansion in an integer base represents a rational number exactly when its digit sequence is eventually periodic. Long division proves the forward implication because only finitely many remainders occur; summing a periodic tail as a geometric series proves the converse.
Articles by others on the same topic
A rational number is any number that can be expressed as the quotient or fraction \( \frac{a}{b} \), where \( a \) and \( b \) are integers, and \( b \) is not equal to zero. In other words, rational numbers include integers, finite decimals, and repeating decimals. For example: - The number \( \frac{1}{2} \) is a rational number.