How Do You Compute Irrational Numbers?
At a glance
- 1. Choose a precision
Decide how many decimal places or significant digits the calculation needs.
- 2. Use an approximation algorithm
Apply a method that produces rational approximations, such as Newton's method for square roots.
- 3. Control the error
Use a proven error bound or an enclosing interval to confirm the approximation is accurate enough.
- 4. Increase precision if needed
Repeat with more digits or iterations; an irrational number generally has no finite exact decimal form.
An irrational number cannot be written exactly as a ratio of integers, and its decimal expansion neither terminates nor repeats. That does not prevent you from calculating it: in practice, you compute a rational approximation to a chosen precision, such as 10 decimal places.
The key is to pair an approximation method with a way to judge its accuracy. Here is how that works for , followed by guidance on other irrational numbers and what “computing” can mean.
What does it mean to compute an irrational number?
A calculator cannot display an infinite, non-repeating decimal expansion. Instead, it displays a finite approximation. For example,
The displayed decimal is rational: it is a fraction with a power of 10 as its denominator. It is not exactly , but it can be made as close as needed by calculating more digits.
There are two common ways to describe a computed value:
- An approximation: a decimal or fraction believed to be close to the answer.
- An approximation with an error bound: a statement that the answer lies within a specified distance or interval.
The second is stronger. If you know that lies between 1.4142 and 1.4143, you have a certified range for even if you do not know its exact decimal expansion.
Worked example: computing
Newton’s method can find a number satisfying . Starting with a positive estimate, repeatedly apply
For a positive starting value, this iteration approaches . Start with :
The value after three updates agrees with to many decimal places. In exact rational arithmetic, the iterates here are , , , and . Each iterate is rational, even though their limit is irrational.
If you need a verified answer, do not rely only on the number of iterations. Check an error bound or enclose the root. For instance, since and , and squaring preserves order for positive numbers, you can conclude that
Choosing a method
The right algorithm depends on how the number is defined.
- For a square root, use Newton’s method or bisection.
- For constants such as , use a series or a specialized algorithm that produces digits with a known error bound.
- For a number defined as the solution of an equation, use a root-finding method and verify the result with an interval or residual bound.
- For expressions involving several quantities, use enough working precision to account for rounding during the intermediate calculations.
A computer typically represents numbers using a finite number of bits. Ordinary floating-point arithmetic is convenient, but it rounds values, so the last displayed digits may not be exact. For guaranteed accuracy, use interval arithmetic or arbitrary-precision arithmetic with suitable error control.
Can every irrational number be computed?
No. Many familiar irrationals, including , , and , are computable: there is an algorithm that produces approximations to any requested accuracy. But there are also noncomputable real numbers for which no algorithm can generate arbitrarily accurate approximations in general.
So “irrational” and “computable” describe different properties. Irrationality says a number is not a ratio of integers. Computability asks whether a finite procedure can approximate it to any specified precision. For ordinary mathematical constants, the practical question is usually which algorithm gives the needed accuracy efficiently.
Common mistakes
- Treating a decimal approximation as exact. A finite display such as 1.41421356 is rational, not exactly .
- Assuming more displayed digits mean more correct digits. Rounding and numerical instability can make some digits wrong. Check the method’s error bound.
- Confusing irrational with impossible to calculate. Most standard irrationals encountered in school and science are computable to arbitrary precision.
- Ignoring precision in later calculations. Subtracting two close approximations can magnify relative error; retain extra working digits and check the final error.
For a reliable numerical result, specify the desired precision, use a suitable algorithm, and verify how far the computed value can be from the true one.
References
- Computable Analysis: An Introduction — Klaus Weihrauch
- Modern Computer Arithmetic — Richard P. Brent and Paul Zimmermann
Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.