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.

Articles by others on the same topic (2)

A fraction is a mathematical expression that represents the division of one quantity by another. It is composed of two parts: the numerator and the denominator. The numerator is the number above the line (or before the slash), which indicates how many parts we have. The denominator is the number below the line (or after the slash), representing the total number of equal parts that make up a whole.