# Rational number

In mathematics, a rational number (or informally fraction) is a ratio or quotient of two integers, usually written as the vulgar fraction a/b, where b is not zero.

Each rational number can be written in infinitely many forms, for example $3/6=2/4=1/2$. The simplest form is when $a$ and $b$ have no common divisors, and every non-zero rational number has exactly one simplest form of this type with positive denominator.

The decimal expansion of a rational number is eventually periodic (in the case of a finite expansion the zeroes which implicitly follow it form the periodic part). The same is true for any other integral base above 1. Conversely, if the expansion of a number for one base is periodic, it is periodic for all bases and the number is rational.

A real number that is not rational is called an irrational number.

In mathematics, the term "rational something" means that the underlying field considered is the field ${\mathbb {Q}}$ of rational numbers. For example, rational polynomials or rational prime ideals.

The set of all rational numbers is denoted by Q, or in blackboard bold ${\mathbb {Q}}$. Using the set-builder notation ${\mathbb {Q}}$ is defined as such:

${\mathbb {Q}}=\left\{{\frac {m}{n}}:m\in {\mathbb {Z}},n\in {\mathbb {Z}},n\neq 0\right\}$

## Arithmetic

${\frac {a}{b}}+{\frac {c}{d}}={\frac {ad+bc}{bd}}$

${\frac {a}{b}}\cdot {\frac {c}{d}}={\frac {ac}{bd}}$

Two rational numbers ${\frac {a}{b}}$ and ${\frac {c}{d}}$ are equal if and only if $ad=bc$

Additive and multiplicative inverses exist in the rational numbers.

$-\left({\frac {a}{b}}\right)={\frac {-a}{b}}$

$\left({\frac {a}{b}}\right)^{{-1}}={\frac {b}{a}}{\mbox{ if }}a\neq 0$

## History

### Egyptian fractions

Any positive rational number can be expressed as a sum of distinct reciprocals of positive integers.

For instance, ${\frac {5}{7}}={\frac {1}{2}}+{\frac {1}{6}}+{\frac {1}{21}}$

For any positive rational number, there are infinitely many different such representations. These representations are called Egyptian fractions, because the ancient Egyptians used them. The Egyptians also had a different notation for dyadic fractions. See also Egyptian numerals.

## Formal construction

Mathematically we may define them as an ordered pair of integers $\left(a,b\right)$, with $b$ not equal to zero. We can define addition and multiplication of these pairs with the following rules:

$\left(a,b\right)+\left(c,d\right)=\left(ad+bc,bd\right)$
$\left(a,b\right)\times \left(c,d\right)=\left(ac,bd\right)$

To conform to our expectation that $2/4=1/2$, we define an equivalence relation $\sim$ upon these pairs with the following rule:

$\left(a,b\right)\sim \left(c,d\right){\mbox{ iff }}ad=bc$

This equivalence relation is compatible with the addition and multiplication defined above, and we may define Q to be the quotient set of ~, i.e. we identify two pairs (a, b) and (c, d) if they are equivalent in the above sense. (This construction can be carried out in any integral domain, see quotient field.)

We can also define a total order on Q by writing

$\left(a,b\right)\leq \left(c,d\right){\mbox{ iff }}(bd>0{\mbox{ and }}ad\leq bc){\mbox{ or }}(bd<0{\mbox{ and }}ad\geq bc)$

## Properties

The set ${\mathbb {Q}}$, together with the addition and multiplication operations shown above, forms a field, the quotient field of the integers ${\mathbb {Z}}$.

The rationals are the smallest field with characteristic 0: every other field of characteristic 0 contains a copy of ${\mathbb {Q}}$.

The algebraic closure of ${\mathbb {Q}}$, i.e. the field of roots of rational polynomials, is the algebraic numbers.

The set of all rational numbers is countable. Since the set of all real numbers is uncountable, we say that almost all real numbers are irrational, in the sense of Lebesgue measure, i.e. the set of rational numbers is a null set.

The rationals are a densely ordered set: between any two rationals, there sits another one, in fact infinitely many other ones.

## Real numbers

The rationals are a dense subset of the real numbers: every real number has rational numbers arbitrarily close to it. A related property is that rational numbers are the only numbers with finite expressions of continued fraction.

By virtue of their order, the rationals carry an order topology. The rational numbers also carry a subspace topology. The rational numbers form a metric space by using the metric $d\left(x,y\right)=|x-y|$, and this yields a third topology on ${\mathbb {Q}}$. All three topologies coincide and turn the rationals into a topological field. The rational numbers are an important example of a space which is not locally compact. The rationals are characterized topologically as the unique countable metric space without isolated points. The space is also totally disconnected. The rational numbers do not form a complete metric space; the real numbers are the completion of ${\mathbb {Q}}$.

In addition to the absolute value metric mentioned above, there are other metrics which turn ${\mathbb {Q}}$ into a topological field:
let $p$ be a prime number and for any non-zero integer $a$ let $|a|_{p}=p^{{-n}}$, where $p^{n}$ is the highest power of $p$ dividing $a$;
in addition write $|0|_{p}=0$. For any rational number ${\frac {a}{b}}$, we set $\left|{\frac {a}{b}}\right|_{p}={\frac {|a|_{p}}{|b|_{p}}}$.
Then $d_{p}\left(x,y\right)=|x-y|_{p}$ defines a metric on ${\mathbb {Q}}$.
The metric space $\left({\mathbb {Q}},d_{p}\right)$ is not complete, and its completion is the p-adic number field ${\mathbb {Q}}_{p}$.bg:Рационално число bn:মূলদ সংখ্যা ca:Nombre racional cs:Racionální číslo da:Rationale tal de:Rationale Zahl et:Ratsionaalarvud es:Número racional eo:Racionala nombro eu:Zenbaki arrazional fr:Nombre rationnel ko:유리수 hr:Racionalni brojevi is:Ræðar tölur it:Numero razionale he:מספר רציונלי lt:Racionalieji skaičiai jbo:fi'urna'u nl:Rationaal getal ja:有理数 no:Rasjonalt tall pl:Liczby wymierne pt:Número racional ro:Număr raţional ru:Рациональное число scn:Nummuru razziunali simple:Rational number sl:Racionalno število sr:Рационалан број fi:Rationaaliluku sv:Rationella tal th:จำนวนตรรกยะ tr:Rasyonel sayılar uk:Раціональні числа zh:有理数