# Rational number

${\ displaystyle \ mathbb {Q}}$

A rational number is a real number that can be represented as a ratio ( Latin ratio ) of two whole numbers . To denote the set of all rational numbers, the formula symbol ( Unicode U + 211A: ℚ) is used (from " quotient ", see letter with double line ). It covers all numbers that when fraction (Engl. Fraction ) can be displayed, which contains both the numerator and the denominator whole numbers. The exact mathematical definition is based on equivalence classes of pairs of integers. ${\ displaystyle \ mathbb {Q}}$

The rational numbers are also called fractions , especially in school math. By introducing the fractional numbers, division becomes feasible even if the dividend is smaller than the divisor , e.g. B. 3: 4 =? Which cannot be executed with natural or whole numbers.

The fraction ¾, for example, represents: 1. the division 3: 4 (3 divided into 4, 3 divided into 4, 3 divided into 4's, 3 divided into 4 (equal) parts, 3 divided by 4), 2. the result of the Division as your own (fraction) number ¾ (three quarters), 3. The order: "Divide into 4 parts, take 3" (three of four (parts)).

The terms ordinary fraction , stem fraction , real fraction , I, improper fraction , I, shortened fraction , extended fraction , decimal fraction , binary fraction  ... are used for special spellings or forms of rational numbers.

## definition

The set of rational numbers consists of the set of negative rational numbers, the number zero and the set of positive rational numbers. The definition of rational numbers is based on the representation of rational numbers using fractions , i.e. pairs of whole numbers. It is structured in such a way that the calculation with rational numbers can be carried out as usual with the help of their fractions, but at the same time it abstracts the rational number from its fractions. The rational numbers are not postulated as completely new things, but are reduced to the whole numbers.

The definition begins with the set of all ordered pairs of integers with . Important: These pairs are not the rational numbers. ${\ displaystyle (a, b)}$${\ displaystyle b \ not = 0}$

One defines addition and multiplication on this set as follows:

${\ displaystyle (a, b) + (c, d): = (a \ cdot d + b \ cdot c, \, b \ cdot d)}$
${\ displaystyle (a, b) \ cdot (c, d): = (a \ cdot c, \, b \ cdot d)}$

These are the well-known rules of fractions . The pairs of numbers can be understood as fractions.

One goal of defining rational numbers is that, for example, the fractions and denote the same "number". So we consider fractions that are equivalent to one another (of the same value). This is expressed by an equivalence relation , which is defined as follows: ${\ displaystyle 2/3}$${\ displaystyle 4/6}$

${\ displaystyle (a, b) \ sim (c, d) \;: \! \ iff a \ cdot d = b \ cdot c}$.

It is important that this relation is actually an equivalence relation, i.e. the total amount is broken down into subsets (here called equivalence classes) of mutually equivalent elements; this can be proven.

For the equivalence classes, one again defines calculation rules that are based on fractions and ensure that what is understood by a rational number is abstracted from the concrete fraction representation. The addition of the equivalence classes and is defined as follows: ${\ displaystyle q + r =: s}$${\ displaystyle q}$${\ displaystyle r}$

From To Choose any item, so an ordered pair of integers (ie choosing a single member of rather than two). You also choose the element . ${\ displaystyle q}$${\ displaystyle (a, b)}$${\ displaystyle q}$${\ displaystyle r}$${\ displaystyle (c, d)}$

${\ displaystyle (a, b)}$and if you add up according to the fractions, you get a pair . This is an element of an equivalence class , which is the result of the addition. ${\ displaystyle (c, d)}$${\ displaystyle (e, f)}$${\ displaystyle s}$

It is important that regardless of the specific choice of and always an element of one and the same equivalence class comes out; this property of addition, its well-definedness , must and can be proven. ${\ displaystyle (a, b) \ in q}$${\ displaystyle (c, d) \ in r}$${\ displaystyle s \ ni (e, f)}$

The multiplication is defined in the same way. ${\ displaystyle q \ cdot r = t}$

The equivalence classes are understood as elements of a new set and are called rational numbers . So a single rational number is an infinite set of ordered pairs . This set is very often written as a fraction that denotes the equivalence class ${\ displaystyle q, r, s, t}$${\ displaystyle \ mathbb {Q}}$${\ displaystyle q \ in \ mathbb {Q}}$${\ displaystyle (a, b)}$ ${\ displaystyle (a, b) =: {\ tfrac {a} {b}} =: a / b}$

${\ displaystyle {\ frac {a} {b}}: = {\ bigl \ {} (c, d) \; {\ big |} \; c \ in \ mathbb {Z} \; \ wedge \; d \ in \ mathbb {Z} \ setminus \ {0 \} \; \ wedge \; (c, d) \ sim (a, b) {\ bigr \}}}$

of all pairs to be equivalent. The horizontal or (from top right to bottom left) diagonal dividing line between the two whole numbers is called a fraction line . The first integer is the numerator , the second the denominator of the fraction. The denominator is always different and can be chosen because of positive. The preferred representation of the rational number is the (maximally) reduced fraction${\ displaystyle (a, b)}$${\ displaystyle 0}$${\ displaystyle (a, b) \ sim (-a, -b)}$${\ displaystyle {\ tfrac {a} {b}}}$

${\ displaystyle {\ frac {c} {d}} \;: = \; {\ frac {a \ div e} {b \ div e}}}$

With

${\ displaystyle e: = \ operatorname {sgn} (b) \ cdot \ operatorname {abs} {\ bigl (} \ operatorname {ggT} (a, b) {\ bigr)}}$,

where stands for the greatest common factor of and . Thus the equivalence class consists exactly of the pairs of integers ${\ displaystyle \ operatorname {ggT} (a, b)}$${\ displaystyle a}$${\ displaystyle b}$${\ displaystyle {\ tfrac {a} {b}}}$

${\ displaystyle {\ bigl \ {} (c \ cdot f, d \ cdot f) \; {\ big |} f \ in \ mathbb {Z} \ setminus \ {0 \} {\ bigr \}}}$.

If you identify the whole number with the rational number , then you have an extension of the number range of the whole numbers , which is also referred to as the formation of the quotient field . If and are two whole numbers and , their sum and product, then the calculation rules for fractions are designed in such a way that and hold. Moreover, by virtue of this identification, a fraction is in fact the quotient of the numerator and denominator. In this sense, the fraction bar is also used as an ordinary division symbol instead of . ${\ displaystyle n \ in \ mathbb {Z}}$${\ displaystyle {\ tfrac {n} {1}} \ in \ mathbb {Q}}$${\ displaystyle n}$${\ displaystyle m}$${\ displaystyle s = n + m}$${\ displaystyle p = n \ cdot m}$${\ displaystyle {\ tfrac {n} {1}} + {\ tfrac {m} {1}} = {\ tfrac {s} {1}}}$${\ displaystyle {\ tfrac {n} {1}} \ cdot {\ tfrac {m} {1}} = {\ tfrac {p} {1}}}$${\ displaystyle \ div}$

## Order relation

One defines

${\ displaystyle {\ frac {a} {b}} <{\ frac {c} {d}} \ qquad: \ Longleftrightarrow \ qquad a \ operatorname {sgn} (b) \ operatorname {abs} (d) <\ operatorname {abs} (b) c \ operatorname {sgn} (d)}$

with the well-known comparison symbols and functions based on the arrangement of the whole numbers and This definition is independent of the abbreviation or expansion of the fractions, as these always have the same effect on both sides of the right-hand symbol . With it immediately follows that in is compatible with in , so that the same character can be used. ${\ displaystyle <}$${\ displaystyle \ operatorname {sgn}}$${\ displaystyle \ operatorname {abs}.}$${\ displaystyle <}$${\ displaystyle b = \ operatorname {sgn} (b) = \ operatorname {abs} (b) = d = \ operatorname {sgn} (d) = \ operatorname {abs} (d) = 1}$${\ displaystyle <}$${\ displaystyle \ mathbb {Z}}$${\ displaystyle <}$${\ displaystyle \ mathbb {Q}}$

If two pairs are equivalent, then neither is

${\ displaystyle {\ frac {a} {b}} <{\ frac {c} {d}}}$     yet     ${\ displaystyle {\ frac {c} {d}} <{\ frac {a} {b}}.}$

The trichotomy of order states:

Exactly one of the following relationships applies:
• ${\ displaystyle {\ frac {a} {b}} <{\ frac {c} {d}}}$
• ${\ displaystyle {\ frac {a} {b}} \ sim {\ frac {c} {d}}}$
• ${\ displaystyle {\ frac {c} {d}} <{\ frac {a} {b}}.}$

So the rational numbers are a totally ordered set . ${\ displaystyle (\ mathbb {Q}, <)}$

→ The construction of the real numbers by means of Dedekind cuts is based on this order relation .

## properties

The rational numbers contain a subset that is isomorphic to the whole numbers (choose the fraction representation ). This is often expressed in a simplistic way that the whole numbers are contained in the rational numbers . ${\ displaystyle \ mathbb {Z}}$ ${\ displaystyle z \ in \ mathbb {Z}}$${\ displaystyle {\ tfrac {z} {1}}}$

The body is the smallest body that contains the natural numbers . is namely the quotient field of the ring of whole numbers , which is the smallest containing ring. This means that the smallest part of every upper part of the body , including the field of real numbers, is its prime field . And as a prime field is rigid , that is, its only automorphism is the trivial one (the identity). ${\ displaystyle \ mathbb {Q}}$ ${\ displaystyle \ mathbb {N}}$${\ displaystyle \ mathbb {Q}}$ ${\ displaystyle \ mathbb {Z}}$${\ displaystyle \ mathbb {N}}$${\ displaystyle \ mathbb {Q}}$${\ displaystyle \ mathbb {R}}$${\ displaystyle \ mathbb {Q}}$

A real number is rational if and only if it is algebraic of the first degree . Thus the rational numbers themselves are a subset of the algebraic numbers . ${\ displaystyle \ mathbb {A}}$

Between (in the sense of the order relation defined above ) two rational numbers and there is always another rational number, for example the arithmetic mean${\ displaystyle {\ tfrac {a} {b}}}$${\ displaystyle {\ tfrac {c} {d}}}$

${\ displaystyle {\ frac {ad + bc} {2bd}}}$

of these two numbers, and thus any number.

The rational numbers lie close to the number line , that is: Every real number (clearly: every point on the number line) can be approximated as precisely as desired using rational numbers.

Despite the tightness of in , there can be no function that is only continuous on the rational numbers (and discontinuous on all irrational numbers ) - it works the other way round (for both statements see the article Thoma's function ). ${\ displaystyle \ mathbb {Q}}$${\ displaystyle \ mathbb {R}}$ ${\ displaystyle \ mathbb {R} \! \ setminus \! \ mathbb {Q}}$

The set of rational numbers is equal to the set of natural numbers, so it is countable . In other words: there is a bijective mapping between and that assigns a natural number to every rational number and vice versa. Cantor's first diagonal argument and the Stern-Brocot tree provide such bijective images. (The existence of true subsets of equal power is synonymous with infinite power.) ${\ displaystyle \ mathbb {Q}}$${\ displaystyle \ mathbb {N}}$${\ displaystyle q}$${\ displaystyle n}$

→ A Lebesgue null set is a countable set . ${\ displaystyle \ mathbb {Q}}$

## Division algorithms

A rational number in the form of the ordered pair numerator / denominator represents a division that has not been carried out. The rational number is indeed described exactly and without loss of accuracy and in pure mathematics one is often satisfied with it. But even comparing two rational numbers is much easier if the division is at least partially implemented as a division with the remainder , which may lead to a mixed number .

A division is considered to be fully executed when the rational number in a place value system has been developed to a certain basis. A wide variety of algorithms have been designed for this, which can be roughly divided into three groups:

• Written division as an algorithm for manual calculation
• Algorithms for use in computers
• Fixed (and small) length integer algorithms
• Algorithms for integers of any length

Examples of the latter are

The latter two methods first form a kind of reciprocal value of the denominator, which is then multiplied by the numerator. All processes are also suitable for short divisions and are also used there. The SRT division, for example, was initially implemented incorrectly in the division unit of the Pentium processor from Intel .

## Decimal fraction expansion

Every rational number can be assigned a decimal fraction expansion. Rational numbers have a periodic decimal fraction development, irrational ones, on the other hand, a non-periodic one (which also applies to the -adic fractions to other (from different) number bases (basic numbers) ). A finite (that is, terminating) decimal fraction expansion is only a special case of periodic decimal fraction expansion in that the decimal digit 0 or periodically repeats itself after the finite digit sequence . The period (the repetitive part) is marked (in many countries, but not internationally uniform) with an overline . ${\ displaystyle g}$${\ displaystyle 10}$${\ displaystyle g \ in \ mathbb {Z} \ setminus \ {- 1,0,1 \}}$${\ displaystyle g-1}$

Examples are:

 ${\ displaystyle {\ tfrac {1} {3}}}$ ${\ displaystyle = 0 {,} {\ overline {3}}}$ ${\ displaystyle = 0 {,} 33333 \ dotso}$ ${\ displaystyle = \ left [0 {,} {\ overline {01}} \ right] _ {2}}$ ${\ displaystyle {\ tfrac {9} {7}}}$ ${\ displaystyle = 1 {,} {\ overline {285714}}}$ ${\ displaystyle = 1 {,} 285714 \ 285714 \ dotso}$ ${\ displaystyle = \ left [1 {,} {\ overline {010}} \ right] _ {2}}$ ${\ displaystyle {\ tfrac {1} {5}}}$ ${\ displaystyle = 0 {,} 2 {\ overline {0}} = 0 {,} 1 {\ overline {9}}}$ ${\ displaystyle = 0 {,} 20000 \ dotso = 0 {,} 19999 \ dotso}$ ${\ displaystyle = \ left [0 {,} {\ overline {0011}} \ right] _ {2}}$ ${\ displaystyle {\ tfrac {1} {2}}}$ ${\ displaystyle = 0 {,} 5 {\ overline {0}} = 0 {,} 4 {\ overline {9}}}$ ${\ displaystyle = 0 {,} 50000 \ dotso = 0 {,} 49999 \ dotso}$ ${\ displaystyle = \ left [0 {,} 1 {\ overline {0}} \ right] _ {2} = \ left [0 {,} 0 {\ overline {1}} \ right] _ {2}}$ ${\ displaystyle 1 = {\ tfrac {1} {1}}}$ ${\ displaystyle = 1 {,} {\ overline {0}} = 0 {,} {\ overline {9}}}$ ${\ displaystyle = 1 {,} 00000 \ dotso = 0 {,} 99999 \ dotso}$ ${\ displaystyle = \ left [1 {,} {\ overline {0}} \ right] _ {2} = \ left [0 {,} {\ overline {1}} \ right] _ {2}}$

The corresponding developments in the binary system (base ) are indicated in square brackets . ${\ displaystyle g = 2}$

The finite decimal resp. Binary fraction expansions are precisely those that have at least two essentially different expansions (see also the § Representation of Rational Numbers ). They are among the quarries whose shortened denominator in a power rises the base so that the to prime divider to be obtained. To distinguish it from the following cases with (and non-terminating development), the period length of such a terminating development is assigned. ${\ displaystyle d}$${\ displaystyle g ^ {r}}$${\ displaystyle g}$${\ displaystyle n | d}$${\ displaystyle 1}$${\ displaystyle n> 1}$${\ displaystyle 0}$

According to Euler's theorem, we have a denominator and a base that is coprime to it${\ displaystyle n \ in \ mathbb {N} _ {> 1}}$${\ displaystyle g \ in \ mathbb {N}}$

${\ displaystyle g ^ {\ varphi (n)} \ equiv 1 {\ pmod {n}}}$

with Euler's phi function . The period length of is the order of the remainder class in the unit group of the remainder class ring modulo . According to Lagrange's theorem, is a factor of the group order and therefore not greater than it. The Carmichael function is defined as the maximum element order in and is therefore also a divisor of , and it applies to all${\ displaystyle \ varphi}$${\ displaystyle 1 / n}$ ${\ displaystyle l: = \ operatorname {ord} _ {n} (g)}$ ${\ displaystyle \ left [g \ right]}$ ${\ displaystyle (\ mathbb {Z} / n \ mathbb {Z}) ^ {\ times}}$ ${\ displaystyle \ mathbb {Z} / n \ mathbb {Z}}$${\ displaystyle n}$${\ displaystyle l}$ ${\ displaystyle \ varphi (n)}$ ${\ displaystyle \ lambda (n)}$${\ displaystyle (\ mathbb {Z} / n \ mathbb {Z}) ^ {\ times}}$${\ displaystyle \ varphi (n)}$${\ displaystyle g, n}$

${\ displaystyle \ operatorname {ord} _ {n} (g) \; | \; \ lambda (n) \; | \; \ varphi (n)}$.

The number

${\ displaystyle x: = (g ^ {l} -1) / n}$

is whole, positive and , and the digits developed from the base are constantly repeated in the -adic representation of , thus: ${\ displaystyle ${\ displaystyle l}$ ${\ displaystyle g}$${\ displaystyle g}$${\ displaystyle 1 / n}$

${\ displaystyle x \ cdot \ sum _ {i = 1} ^ {\ infty} \ left (g ^ {l} \ right) ^ {- i} = {\ frac {x} {g ^ {l} -1 }} = {\ frac {1} {n}}}$

The above example 1/3 has in the base of the period length and the sequence of digits , as well as at the base , the period length and the number sequence . ${\ displaystyle g = 10}$${\ displaystyle \ operatorname {ord} _ {3} (10) = 1}$${\ displaystyle x = {\ overline {3}}}$${\ displaystyle g = 2}$${\ displaystyle \ operatorname {ord} _ {3} (2) = 2}$${\ displaystyle x = {\ overline {01}}}$

For a given denominator , the period length occurs precisely when the base is a primitive root modulo . There are primitive roots only if the prime residue class group is cyclic, i.e. if Else is and the period length is a real divisor of${\ displaystyle n> 1}$${\ displaystyle l: = \ operatorname {ord} _ {n} (g) = \ lambda (n) = \ varphi (n)}$${\ displaystyle g}$${\ displaystyle n}$${\ displaystyle (\ mathbb {Z} / n \ mathbb {Z}) ^ {\ times}}$${\ displaystyle n \ in \ {2,4, p ^ {r}, 2p ^ {r} \; \; | \; \; 2 ${\ displaystyle \ lambda (n)}$${\ displaystyle l}$${\ displaystyle \ varphi (n).}$

The table below uses the example of the bases and gives an impression of the denominators for which the period length (with a suitable numerator) is maximum (in bold). E.g. the decimal fractions of the reciprocal values ​​of the prime numbers have the period length . In the case of composite numbers , the maximum is ; they have the values ​​for and in italics. The worst case period length is in , while the length of the number in the -adic number system (also given in the table for comparison) is in. The reciprocal value 1/802787 of the prime number 802787 requires at least 802786 bits in the dual system and at least 401393 digits in the decimal system - too many to display here. ${\ displaystyle g = 2,3,5}$${\ displaystyle 10}$${\ displaystyle n}$${\ displaystyle n = 7,17,19,23,29}$${\ displaystyle \ lambda (n) = \ varphi (n) = n-1 = 6,16,18,22,28}$${\ displaystyle n = 12.15,21,33,35}$${\ displaystyle \ operatorname {ord} _ {n} (g) \ leq \ varphi (n) / 2}$${\ displaystyle \ varphi (n)}$${\ displaystyle \ lambda (n)}$${\ displaystyle {\ mathcal {O}} (n)}$${\ displaystyle \ scriptstyle \ operatorname {len} _ {g} (n)}$${\ displaystyle n}$${\ displaystyle g}$${\ displaystyle {\ mathcal {O}} (\ log n)}$

 ${\ displaystyle \ textstyle n}$ 3 5 7th 9 11 12 13 15th 17th 19th 21st 23 25th 27 29 31 33 35 37 802787 ${\ displaystyle \ textstyle \ varphi (n)}$ 2 4th 6th 6th 10 4th 12 8th 16 18th 12 22nd 20th 18th 28 30th 20th 24 36 802786 ${\ displaystyle \ textstyle \ lambda (n)}$ 2 4th 6th 6th 10 2 12 4th 16 18th 6th 22nd 20th 18th 28 30th 10 12 36 802786 ${\ displaystyle \ textstyle \ operatorname {ord} _ {n} (2)}$ 2 4th 3 6th 10 - 12 4th 8th 18th 6th 11 20th 18th 28 5 10 12 36 802786 ${\ displaystyle \ scriptstyle \ operatorname {len} _ {2} (n)}$ 2 3 3 4th 4th - 4th 4th 5 5 5 5 5 5 5 5 6th 6th 6th 20th ${\ displaystyle \ textstyle \ operatorname {ord} _ {n} (3)}$ - 4th 6th - 5 - 3 - 16 18th - 11 20th - 28 30th - 12 18th 401393 ${\ displaystyle \ scriptstyle \ operatorname {len} _ {3} (n)}$ - 2 2 - 3 - 3 - 3 3 - 3 3 - 4th 4th - 4th 4th 13 ${\ displaystyle \ textstyle \ operatorname {ord} _ {n} (5)}$ 2 - 6th 6th 5 2 4th - 16 9 6th 22nd - 18th 14th 3 10 - 36 802786 ${\ displaystyle \ scriptstyle \ operatorname {len} _ {5} (n)}$ 1 - 2 2 2 2 2 - 2 2 2 2 - 3 3 3 3 - 3 9 ${\ displaystyle \ textstyle \ operatorname {ord} _ {n} (10)}$ 1 - 6th 1 2 - 6th - 16 18th 6th 22nd - 3 28 15th 2 - 3 401393 ${\ displaystyle \ scriptstyle \ operatorname {len} _ {10} (n)}$ 1 - 1 1 2 - 2 - 2 2 2 2 - 2 2 2 2 - 2 6th

S. a. the algorithm for the -adic expansion of a rational number for an arbitrary basis${\ displaystyle g}$${\ displaystyle g \ in \ mathbb {N} _ {> 1}.}$