A rational number is any real number which may be represented by the quotient $ \tfrac{p}{q} $ such that $ p,q $ are integers and $ q\ne0 $ . When represented as a decimal, a rational number has a repeating decimal representation (as opposed to irrational numbers, which have a nonrepeating nonterminating decimal representation) (for example, $ \tfrac13=0.\bar{3} $ and $ \tfrac16=0.1\bar{6} $ , where the overbar indicates the portion of the decimal which repeats) which may include a repeating 0 (e.g., $ \tfrac12=0.5\bar{0} $) that results in a terminating decimal (e.g., 0.5). Thus, a terminating decimal is in fact a repeating decimal in which the repeating portion is 0.
Every rational number of the form $ \tfrac{p}{q} $ has an equivalent repeating decimal representation as described above. This is due to the finite number of wholenumber remainders possible for any divisor $ q $ . The divisor $ q $ has a set of exactly $ q $ possible remainders, $ \left\{0,\ldots,q1\right\} $ . When computing a decimal using long division, a given remainder multiplied by 10 real and divided by $ q $ will result in the same or another remainder of $ q $ . As there are only a finite number of remainders, the process of long division is guaranteed to come back to a previously used remainder, which causes the sequence of remainders to cycle from that remainder.
Definition 

Set of all real numbers
The set of all rational numbers, $ \Q $ , is defined as:

The set of rational numbers (represented as $ \Q $) is closed for the four fundamental arithmetic operations: addition, subtraction, multiplication and division. Because the set of integers is closed for addition, subtraction, and multiplication, operations involving rational numbers may be represented as the quotient of two sets of closed integer operations. For example, given two rational numbers $ a,b $ with quotient forms $ a=\tfrac{p}{q} $ and $ b=\tfrac{r}{s} $ ,
 Addition: $ a+b=\frac{ps+rq}{qs} $
 Subtraction: $ ab=\frac{psrq}{qs} $
 Multiplication: $ a\cdot b=\frac{p\cdot r}{q\cdot s} $
 Division: $ a\div b=\frac{p\cdot s}{q\cdot r} $
Real numbers which are not rational are defined to be irrational numbers
Advanced
 Constructing the rational numbers from integers, also known as a field of fractions