Irrational numbers are real numbers that cannot be written as simple fractions and are key in both mathematics and computing for representing precise, continuous quantities.
What are irrational numbers?
Irrational numbers are real numbers that cannot be expressed as the quotient of two integers, meaning they cannot be written in the form a divided by b, where both a and b are integers and b is not zero. In contrast to rational numbers, which have decimal expansions that either terminate (come to an end) or repeat (have a recurring pattern), irrational numbers have decimal representations that go on forever and never repeat.
Formal definition
An irrational number is any number that cannot be written as a ratio of two integers. This means:
There do not exist integers a and b (with b not equal to zero) such that a / b = x, where x is the irrational number.
Irrational numbers belong to the set of real numbers but not to the set of rational numbers.
Key characteristics
Non-terminating: The decimal representation continues forever.
Non-repeating: No pattern of digits repeats in the decimal expansion.
Cannot be expressed exactly in fractional or decimal form.
This makes irrational numbers fundamentally different from integers, natural numbers, and rational numbers.
Examples of irrational numbers
Practice Questions
FAQ
Computers operate using binary, which represents numbers using a finite number of bits. Irrational numbers have infinite, non-repeating decimal expansions, meaning their exact value cannot be captured using any finite combination of bits. Even with vast amounts of memory, a computer can only store a limited number of digits, which means it must round or truncate the number at some point. For example, π goes on forever without repeating, and no matter how many digits are stored, it’s always an approximation. This is not just a limitation of memory size but a fundamental constraint of digital number representation. Floating-point formats such as IEEE 754 double precision can store about 15–17 decimal digits accurately, which is sufficient for many applications but still not exact. These limitations can lead to tiny inaccuracies in calculations, which are usually negligible but can cause cumulative errors in some scientific or iterative computations if not managed carefully.
No, not all square roots are irrational. A square root is only irrational if the number under the root (called the radicand) is not a perfect square. For instance, √4 = 2 and √9 = 3, which are both rational numbers because they result in whole numbers. However, √2, √3, √5, and similar values are irrational because their decimal expansions are non-terminating and non-repeating, and they cannot be simplified into a ratio of integers. In computer science, identifying whether a square root is rational or irrational is important, especially when choosing data types. For example, if a program is calculating a square root and expects an exact value (e.g., √16), it may use integer arithmetic. But if the value is irrational (like √7), then floating-point approximation is needed, with all the implications of rounding error and storage limits. So, only square roots of non-square natural numbers are irrational.
If you attempt to represent an irrational number using a rational fraction in a program, the result will always be an approximation and not the true irrational value. Some programming environments allow you to define a number as a rational fraction explicitly, like 22/7 for π, but this is just a rough estimate. These approximations are used for simplicity or performance reasons, particularly when perfect precision is not required. However, using a rational fraction to represent an irrational value can introduce error margins, especially in cumulative calculations or simulations. For example, using 22/7 instead of a higher-precision constant for π may lead to noticeable differences in calculations involving circular motion or area. While this might be acceptable in educational contexts or basic animations, it is inadequate for scientific work, where precise approximations such as π to 15 decimal places might be needed. Always use language-specific mathematical constants or high-precision libraries where possible.
Irrational numbers can impact both the performance and design of algorithms, especially those involving floating-point calculations, geometry, or trigonometry. Since irrational numbers cannot be represented exactly, operations involving them are based on approximations, which can accumulate small floating-point errors. These errors may lead to unexpected results, such as two values appearing unequal due to minor discrepancies. This is crucial in algorithms that rely on exact comparisons or thresholds, such as collision detection in games or precision modelling in simulations. Designers must also take into account that operations involving irrational numbers (like repeated use of √2 or π) may be computationally expensive, as they involve floating-point arithmetic and rounding. To improve performance, programmers often store and reuse approximated values rather than recomputing them. In critical systems, the tolerance for error must be considered when deciding how irrational values are handled. Therefore, irrational numbers necessitate careful algorithm design to maintain accuracy and efficiency.
Within a program, irrational numbers are always treated as approximated values because programming languages use finite-precision floating-point numbers to represent real numbers. It is not possible for a computer to store or verify the true irrational nature of a number through numeric computation alone. For example, if you input √2 or π into a program, it will store an approximation like 1.414213562… or 3.1415926535…, without any indication that the value is irrational. However, symbolic mathematics libraries (like SymPy in Python or Mathematica) can preserve the symbolic form of irrational constants (e.g., √2, π) and perform exact algebraic manipulations without converting to decimals. These systems can identify irrational expressions and perform transformations based on mathematical rules rather than numerical approximations. But in general-purpose programming, unless symbolic tools are used, all irrational numbers are processed as finite, floating-point approximations, and their irrational nature is not inherently recognised by the program.
