Textbook
A rational number has the form $p/q$, where $p,q\in\mathbb Z$ and $q\ne0$. Their set is denoted $\mathbb Q$. A fraction means division of the numerator by the denominator; a zero denominator is forbidden.
Different fractions can represent the same number: $1/2=2/4$. A rational number therefore is not a unique spelling of a fraction. Every integer $n=n/1$ is rational, but a rational need not be an integer: $1/2\notin\mathbb Z$. All rational numbers are real, but the converse fails: $\sqrt2$ cannot be expressed as a ratio of integers.
With nonzero denominators, $p/q=r/s$ is equivalent to $ps=rq$. Fractions can therefore be compared without rounded decimal values. Multiplying numerator and denominator by the same nonzero integer preserves the number because the common factor cancels. The denominator can be chosen positive by moving its sign to the numerator. Zero is rational as well: $0/q=0$ for every admissible $q$, including $0=0/1$.
Definitions and further reading: Mathematics for Computer Science.
In plain language
A rational number describes a share: one pie for two people and two pies for four people give the same half each. Different numerators and denominators can represent the same number. A zero denominator does not create an infinitely generous serving; division by zero is undefined. Pie explains positive shares, while minus one half can describe a debt: arithmetic extends beyond the kitchen without requiring negative guests.
Example
The example compares the illustrative expressions $1/2$, $2/4$, and $1/0$. The first two give equal shares; the last violates the required denominator restriction.
Rational Numbers: Ratios of Integers
One half
Division of one by two is valid because the denominator is nonzero.
Step 1 of 3: One half
Read all steps
One half
Division of one by two is valid because the denominator is nonzero.
- State
- p: 1currentq: 2current1/2current
The same share
Two out of four gives the same number.
- State
- 2/4current1/2current
Forbidden denominator
Zero violates the denominator requirement.
- State
- p: 1q: 0excludedundefinedexcluded
For the first two fractions, cross multiplication checks equality: $1\cdot4=2\cdot2$. Equal values do not require equal numerators and denominators. The final expression must first pass the admissibility check; ordinary fraction arithmetic cannot be applied to it. In particular, trying to “cancel the zero” in a denominator is invalid. Cancellation uses a nonzero common factor and cannot repair an expression that was undefined from the start.
Related concepts: Integers, Real numbers.