Absolute and Relative Error

Absolute error is the size of the gap between a true value p and an approximation p^*: |p - p^*|. Relative error divides that gap by the size of the true value, \frac{|p - p^*|}{|p|}, so it measures the error as a fraction of the answer and lets you compare approximations of very different sizes.

Before this lesson: Absolute Value, Scientific Notation and Taylor Polynomials

Why measure error two ways

Suppose a measurement is off by 1 millimeter. For a 2-millimeter screw, that is a terrible measurement. For a 100-meter bridge, it is excellent. The gap is the same, but the quality is not.

Absolute error reports the raw gap in the original units. Relative error compares the gap with the size of the quantity, so it has no units and tells you how many digits of the approximation you can trust. Numerical methods use both: absolute error when the size of the answer is known in advance, and relative error when answers can be huge or tiny.

Diagram of a number line, not to scale. A long bar runs from 0 to the true value p and is labeled size of the true value, |p|. Near its right end, the approximation p star sits a short distance from p, and a brace over the short gap between them is labeled absolute error, |p minus p star|. Below, the relative error is written as the short gap divided by the long bar: |p minus p star| divided by |p|.
Absolute error is the short gap between p and p*. Relative error compares that gap with the whole length |p|.

Absolute and relative error formulas

Let p be the true value and p^* an approximation of it.

\text{absolute error} = |p - p^*| \qquad \text{relative error} = \frac{|p - p^*|}{|p|}, \quad p \ne 0
  • Absolute error has the same units as p. Relative error has no units.
  • Percent error is the relative error times 100%.
  • Relative error is undefined when p = 0. Use absolute error near zero.
  • Some books define the error as p - p^* or p^* - p with a sign. The absolute value removes the sign, so the size of the error is the same either way.

Significant digits. A common test says that p^* approximates p to t significant digits when t is the largest whole number with

\frac{|p - p^*|}{|p|} \le 5 \times 10^{-t}

For example, a relative error of 7 \times 10^{-5} passes the test for t = 4 but fails it for t = 5, so the approximation has about 4 significant digits.

When the true value is unknown. In practice you rarely know p exactly. Instead you know an error bound \delta with |p - p^*| \le \delta, which traps p in the interval [p^* - \delta,\, p^* + \delta]. The relative error is then estimated with |p^*| in the denominator.

How to find absolute and relative error

  1. Subtract the approximation from the true value.
  2. Take the absolute value. This is the absolute error.
  3. Divide by the absolute value of the true value. This is the relative error.
  4. Multiply by 100% if you want the percent error.
  5. To count significant digits, find the largest t with relative error at most 5 \times 10^{-t}.

Absolute and relative error examples

Example 1: Approximating π by 3.14

Find the absolute and relative error when p = \pi is approximated by p^* = 3.14. How many significant digits does 3.14 have?

|p - p^*| = |3.1415927 - 3.14|

Substitute, using \pi \approx 3.1415927.

= 0.0015927

Subtract.

\frac{|p - p^*|}{|p|} = \frac{0.0015927}{3.1415927}

Divide by the true value.

\approx 5.07 \times 10^{-4}

Divide and write in scientific notation.

5.07 \times 10^{-4} \le 5 \times 10^{-3}

The test passes for t = 3.

5.07 \times 10^{-4} \gt 5 \times 10^{-4}

The test fails for t = 4.

Answer: The absolute error is about 0.0016 and the relative error is about 5.07 \times 10^{-4}, or 0.0507%. So 3.14 approximates \pi to 3 significant digits.

Example 2: Same absolute error, different accuracy

Compare two approximations: p_1 = 0.0025 approximated by p_1^* = 0.0024, and p_2 = 2500 approximated by p_2^* = 2499.

|p_1 - p_1^*| = |0.0025 - 0.0024| = 0.0001

Absolute error of the first pair.

\frac{0.0001}{0.0025} = 0.04

Relative error of the first pair.

|p_2 - p_2^*| = |2500 - 2499| = 1

Absolute error of the second pair.

\frac{1}{2500} = 0.0004

Relative error of the second pair.

Answer: The second approximation has an absolute error 10,000 times larger, but its relative error is 100 times smaller (0.04% against 4%). Relative error shows that 2499 is the far better approximation.

Example 3: Approximating e by 2.718

Find the relative error and the number of significant digits when p = e is approximated by p^* = 2.718.

|e - 2.718| = |2.7182818 - 2.718|

Substitute, using e \approx 2.7182818.

= 0.0002818

Subtract.

\frac{0.0002818}{2.7182818} \approx 1.04 \times 10^{-4}

Divide by the true value.

1.04 \times 10^{-4} \le 5 \times 10^{-4}

The test passes for t = 4.

1.04 \times 10^{-4} \gt 5 \times 10^{-5}

The test fails for t = 5.

Answer: The relative error is about 1.04 \times 10^{-4}, so 2.718 approximates e to 4 significant digits.

Example 4: Which measurement is better? (word problem)

A machinist measures a part whose true length is 12.50 mm and gets 12.47 mm. A surveyor measures a road whose true length is 1,250.0 m and gets 1,249.2 m. Which measurement is more accurate?

|12.50 - 12.47| = 0.03

The machinist’s absolute error, in millimeters.

\frac{0.03}{12.50} = 0.0024

The machinist’s relative error.

|1250.0 - 1249.2| = 0.8

The surveyor’s absolute error, in meters.

\frac{0.8}{1250.0} = 0.00064

The surveyor’s relative error.

0.00064 \lt 0.0024

Compare the relative errors.

Answer: The surveyor’s absolute error (0.8 m) is far larger, but the absolute errors are in different units and on different scales. The relative errors are 0.24% for the machinist and 0.064% for the surveyor, so the surveyor’s measurement is more accurate.

Example 5: Error in a Taylor polynomial

Approximate e^{0.5} with the degree-2 Taylor polynomial 1 + x + \frac{x^2}{2}. Find the absolute and relative error, and compare the absolute error with the Lagrange error bound.

p^* = 1 + 0.5 + \frac{0.5^2}{2}

Substitute x = 0.5.

= 1 + 0.5 + 0.125

Square 0.5 and divide by 2.

= 1.625

Add.

p = e^{0.5} \approx 1.6487213

Evaluate the true value with a calculator.

|p - p^*| = 1.6487213 - 1.625

Set up the absolute error.

= 0.0237213

Subtract.

\frac{0.0237213}{1.6487213} \approx 0.0144

Divide by the true value.

|R_2(0.5)| \le \frac{M(0.5)^3}{3!}

Use the Lagrange error bound, where M bounds f'''(x) = e^x on [0, 0.5].

\le \frac{2(0.125)}{6}

Use M = 2, since e^{0.5} \lt 2.

= \frac{1}{24} \approx 0.0417

Simplify.

Answer: The absolute error is about 0.0237 and the relative error is about 0.0144, or 1.44%. The error is well under the Lagrange bound of 0.0417, as it must be. This kind of error, from cutting off an infinite series, is called truncation error.

Common mistakes

MistakeExample of the errorFix
Dividing by the approximation when the true value is knownComputing \frac{0.0015927}{3.14} in Example 1Divide by |p|, the true value. Use |p^*| only when p is unknown.
Leaving off the absolute valueReporting an error of -0.03 mmError size is never negative: |12.50 - 12.47| = 0.03.
Comparing absolute errors across scalesSaying the machinist in Example 4 is more accurate because 0.03 is less than 0.8Compare relative errors, which have no units.
Mixing up a decimal and a percentWriting a relative error of 0.0024 as 0.0024%Multiply by 100%: 0.0024 is 0.24%.
Using relative error when the true value is 0Dividing by p = 0Relative error is undefined. Report the absolute error.
Judging digits by how they lookSaying 3.15 has only 2 significant digits of \pi because its last digit is wrongUse the test: \frac{|\pi - 3.15|}{\pi} \approx 0.0027 \le 5 \times 10^{-3}, so 3.15 has 3 significant digits.

Related ideas

For a linear system, the condition number of a matrix measures how much a small relative error in the data can grow in the solution.

Sources of error. Truncation error comes from stopping an infinite process, such as the Taylor series in Example 5 or a finite number of iterations. Round-off error comes from storing numbers with a fixed number of digits, which is the topic of the next lesson, Floating-Point Arithmetic.

Stopping rules. Iterative methods stop when successive approximations are close. A relative test such as \frac{|p_n - p_{n-1}|}{|p_n|} \lt 10^{-6} works for answers of any size, which is why most software uses it.

Percent change. The relative error formula has the same shape as percent change, with the true value in place of the original value.

Practice problems

  1. Find the absolute and relative error when \sqrt{2} is approximated by 1.414.
  2. Find the absolute and relative error when p = 50 is approximated by p^* = 49.9. Give the percent error.
  3. Find the absolute and relative error when p = 0.004 is approximated by p^* = 0.0041.
  4. The fraction \frac{355}{113} \approx 3.1415929 is a famous approximation of \pi. Find its relative error and its number of significant digits.
  5. A student measures the acceleration due to gravity as 9.6 m/s². The accepted value is 9.81 m/s². Find the percent error.
  6. A length is recorded as p^* = 7.32 cm with |p - p^*| \le 0.005. Find the interval that contains p, and bound the relative error.
  7. Which is the better approximation in relative terms: 0.333 for \frac{1}{3}, or 0.667 for \frac{2}{3}?
  8. Approximate \sin(0.3) by x - \frac{x^3}{6} and find the absolute and relative error.
  9. A part must be within a relative error of 0.002 of its target length of 250 mm. What interval must the measured length lie in?
  10. A sensor reads 10^{-6} when the true value is 0. Find the absolute error. Why is the relative error not useful here?
Show answers

1.

|\sqrt{2} - 1.414| = |1.4142136 - 1.414|

Substitute, using \sqrt{2} \approx 1.4142136.

= 0.0002136

Subtract.

\frac{0.0002136}{1.4142136} \approx 1.51 \times 10^{-4}

Divide by the true value.

Answer: absolute error about 2.14 \times 10^{-4}, relative error about 1.51 \times 10^{-4}

2.

|50 - 49.9| = 0.1

Absolute error.

\frac{0.1}{50} = 0.002

Relative error.

0.002 \times 100\% = 0.2\%

Percent error.

Answer: 0.1, 0.002 and 0.2%

3.

|0.004 - 0.0041| = 0.0001

Absolute error.

\frac{0.0001}{0.004} = 0.025

Relative error.

Answer: absolute error 0.0001 is tiny, but the relative error is 2.5%.

4.

|3.1415926536 - 3.1415929204| \approx 2.67 \times 10^{-7}

Subtract, using 10 decimal places of each number.

\frac{2.67 \times 10^{-7}}{3.1415927} \approx 8.49 \times 10^{-8}

Divide by \pi.

8.49 \times 10^{-8} \le 5 \times 10^{-7}

The test passes for t = 7.

8.49 \times 10^{-8} \gt 5 \times 10^{-8}

The test fails for t = 8.

Answer: relative error about 8.49 \times 10^{-8}, so \frac{355}{113} gives 7 significant digits.

5.

|9.81 - 9.6| = 0.21

Absolute error, in m/s².

\frac{0.21}{9.81} \approx 0.0214

Relative error.

0.0214 \times 100\% = 2.14\%

Percent error.

Answer: about 2.14%

6.

7.32 - 0.005 = 7.315

Lower end of the interval.

7.32 + 0.005 = 7.325

Upper end of the interval.

\frac{0.005}{7.315} \approx 6.84 \times 10^{-4}

Largest relative error: biggest gap over smallest possible |p|.

Answer: p is in [7.315, 7.325], and the relative error is at most about 6.84 \times 10^{-4}.

7.

\left|\frac{1}{3} - 0.333\right| = \frac{1}{3000}

Write 0.333 as \frac{999}{3000} and \frac{1}{3} as \frac{1000}{3000}.

\frac{1/3000}{1/3} = \frac{1}{1000} = 0.001

Relative error of the first.

\left|\frac{2}{3} - 0.667\right| = \frac{1}{3000}

Write 0.667 as \frac{2001}{3000} and \frac{2}{3} as \frac{2000}{3000}.

\frac{1/3000}{2/3} = \frac{1}{2000} = 0.0005

Relative error of the second.

Answer: both absolute errors are \frac{1}{3000}, but 0.667 has half the relative error, so it is better.

8.

p^* = 0.3 - \frac{0.3^3}{6}

Substitute x = 0.3.

= 0.3 - \frac{0.027}{6}

Cube 0.3.

= 0.3 - 0.0045

Divide.

= 0.2955

Subtract.

p = \sin(0.3) \approx 0.2955202

Evaluate in radians with a calculator.

|p - p^*| \approx 0.0000202

Subtract.

\frac{0.0000202}{0.2955202} \approx 6.84 \times 10^{-5}

Divide by the true value.

Answer: absolute error about 2.02 \times 10^{-5}, relative error about 6.84 \times 10^{-5}

9.

|p - p^*| \le 0.002(250)

Multiply the relative error by the true value.

|p - p^*| \le 0.5

Multiply.

250 - 0.5 \le p^* \le 250 + 0.5

Undo the absolute value.

249.5 \le p^* \le 250.5

Simplify.

Answer: between 249.5 mm and 250.5 mm

10.

|0 - 10^{-6}| = 10^{-6}

Absolute error.

Answer: the absolute error is 10^{-6}, which is tiny. The relative error would divide by |p| = 0, so it is undefined; near zero, use absolute error.

FAQ

What is the difference between absolute error and relative error?

Absolute error is the size of the gap |p - p^*|, in the same units as the quantity. Relative error divides that gap by |p|, so it is a unitless fraction that can compare approximations of different sizes.

How do you calculate percent error?

Find the relative error \frac{|p - p^*|}{|p|} and multiply by 100%. For example, measuring 9.6 when the true value is 9.81 gives a percent error of about 2.14%.

Which is better, absolute or relative error?

Neither is always better. Relative error is usually more meaningful because it accounts for the size of the answer, but absolute error is the right choice when the true value is zero or very close to it.

Can relative error be greater than 1?

Yes. If p = 2 and p^* = 5, the relative error is \frac{3}{2} = 1.5, or 150%. A relative error near or above 1 means the approximation has no correct significant digits.

Summary

  • Absolute error is |p - p^*|, in the units of p.
  • Relative error is \frac{|p - p^*|}{|p|}, a unitless fraction; percent error is that fraction times 100%.
  • Use relative error to compare approximations of different sizes, and absolute error near zero.
  • p^* has t significant digits when t is the largest whole number with relative error at most 5 \times 10^{-t}.
  • Truncation error comes from cutting off an infinite process; round-off error comes from storing a limited number of digits.

Previous lesson: Cobb-Douglas Production Function (the last lesson of Finite Math and Business Calculus)

Next lesson: Floating-Point Arithmetic

Back to the Numerical Methods Index