AQA 7517, section 4.5.1.4
An irrational number is a number that cannot be written as a fraction of two integers.
The best-known examples are:
Decimal form
The decimal expansion of an irrational number never ends and never repeats. That is the difference from a rational number, whose decimal either stops or repeats.
| Number | Decimal | Type |
|---|---|---|
| 0.25 (stops) | Rational | |
| 0.3333... (repeats) | Rational | |
| 1.41421356... (no pattern, never stops) | Irrational |
Irrational numbers in computing
A computer has only a finite number of bits for each number, but an irrational number needs an infinite number of digits to be written exactly. So a computer can only store an approximation.
import math
print(math.pi) # 3.141592653589793
print(math.sqrt(2)) # 1.4142135623730951
print(math.sqrt(2) ** 2) # 2.0000000000000004: not exactly 2
The answer to math.sqrt(2) ** 2 shows a small rounding error, because the stored value of isn't exact. This is covered in 4.5.4.5.
Irrational numbers appear in many programs: for circles, in geometry, and in growth and compound interest.
Worked example
Task: classify each number as rational or irrational: 0.5, , , , .
- 0.5: rational ().
- : rational, because the answer is a whole number.
- : irrational.
- : irrational.
- : rational ().
Not every square root is irrational. and are whole numbers, but , and are irrational.
Exam tip: give as the example, because the specification uses it. Say it can't be written as a fraction, and explain that a computer can only store an approximation.
Check yourself
What is an irrational number?
A number that cannot be written as a fraction of two integers.
Give two examples of irrational numbers
Any two of: , , , .
Why can't a computer store an irrational number exactly?
Its decimal (and binary) expansion never ends, but a computer has only a finite number of bits, so it can only store an approximation.