Absolute and Relative Error
Imagine students is checking a map app during a road trip 🚗. The app says the next gas station is $12.0\ \text{km}$ away, but the true distance is $12.4\ \text{km}$. Is that a big mistake? The answer depends on whether we measure the mistake in kilometers or as a fraction of the true value. That is the heart of absolute error and relative error in Numerical Analysis.
In this lesson, students will learn how to:
- explain the meaning of absolute and relative error,
- calculate both errors from a measured or approximate value,
- interpret when each error measure is more useful,
- connect these ideas to numerical computation and floating-point numbers,
- use examples to judge the quality of an approximation.
These ideas matter because computers rarely store exact real numbers. Every numerical answer is usually an approximation, so we need tools to judge how accurate it is. 📊
What Is Error in Numerical Computation?
In Numerical Analysis, an error is the difference between a true value and an approximate value. If the exact value is $x$ and the approximation is $\tilde{x}$, then the error is related to the difference between them.
A numerical method may produce a value that is close to the true answer, but not exact. This happens because of rounding, truncation, limited memory, and the way numbers are represented in a computer. For example, the decimal number $\frac{1}{3}$ cannot be written exactly with finitely many decimal places, so computers must store something like $0.333333\dots$ up to some limit.
Error analysis helps students answer questions like:
- How far is the approximation from the truth?
- Is the error small enough for the task?
- Is a small absolute difference actually small in context?
To answer those questions, we use absolute and relative error.
Absolute Error: How Far Off?
The absolute error is the size of the difference between the true value and the approximate value. If the true value is $x$ and the approximation is $\tilde{x}$, then the absolute error is
$$|x-\tilde{x}|$$
This gives the actual distance between the two numbers on the number line. It is always nonnegative.
Example 1: A measurement in science 🔬
Suppose the true mass of an object is $50.0\ \text{g}$ and a scale shows $49.6\ \text{g}$. The absolute error is
$$|50.0-49.6|=0.4\ \text{g}$$
So the measurement is off by $0.4\ \text{g}$.
Example 2: A road distance 🚗
If the exact distance is $120\ \text{km}$ and the estimated distance is $123\ \text{km}$, then the absolute error is
$$|120-123|=3\ \text{km}$$
This tells students the estimate is $3\ \text{km}$ away from the truth.
Why absolute error matters
Absolute error is useful when the units matter. If students is measuring length, time, mass, or money, then the error in the same unit is easy to understand. For instance, an error of $0.01\ \text{m}$ is very different from an error of $0.01\ \text{s}$.
However, absolute error alone does not always tell the full story. An error of $3\ \text{km}$ might be huge for a short trip but tiny for a cross-country drive. That is where relative error helps.
Relative Error: How Big Is the Error Compared to the True Value?
The relative error compares the absolute error to the size of the true value. If the true value is $x$ and the approximate value is $\tilde{x}$, then the relative error is
$$\frac{|x-\tilde{x}|}{|x|}$$
as long as $x\neq 0$.
Relative error is often written as a fraction or a percentage. To convert it to a percentage, multiply by $100\%$.
Example 3: Same absolute error, different importance 📉
Suppose the absolute error is $2$.
- If the true value is $x=200$, then the relative error is
$$\frac{2}{200}=0.01=1\%$$
- If the true value is $x=4$, then the relative error is
$$\frac{2}{4}=0.5=50\%$$
The same absolute error can be small in one situation and large in another. That is why relative error is often more informative.
Example 4: A price estimate 💵
If the true price of a phone is $800$ and an estimate is $820$, then the absolute error is
$$|800-820|=20$$
The relative error is
$$\frac{20}{800}=0.025=2.5\%$$
A $20$ dollar error may seem large, but compared with $800$, it is only $2.5\%$.
Comparing Absolute and Relative Error
Absolute error tells students the actual amount of difference. Relative error tells students how large that difference is compared with the true value.
A simple way to remember the difference is:
- absolute error answers “How many units off?”
- relative error answers “How large is the error compared with the correct value?”
When each one is useful
- Use absolute error when the physical size of the mistake matters, such as in engineering tolerances, measurement tools, or deadlines.
- Use relative error when comparing errors across quantities of different sizes, such as financial estimates, scientific values, or algorithm output.
Example 5: Temperature readings 🌡️
If the true temperature is $20^\circ\text{C}$ and a thermometer reads $21^\circ\text{C}$, then:
$$|20-21|=1^\circ\text{C}$$
and the relative error is
$$\frac{1}{20}=0.05=5\%$$
If the true temperature were $200^\circ\text{C}$ with the same $1^\circ\text{C}$ error, the relative error would be
$$\frac{1}{200}=0.5\%$$
So the same absolute error can be much more serious for a smaller true value.
Approximations, Floating-Point Numbers, and Error
Computers store numbers using a fixed number of bits, so many values must be rounded. This storage format is called floating-point representation. Because of this, a computer may not represent the exact value of a number like $0.1$.
For example, if a computer stores a rounded value $\tilde{x}$ instead of the true value $x$, then the difference $|x-\tilde{x}|$ is the absolute error caused by rounding.
This matters in arithmetic too. Suppose students computes
$$0.1+0.2$$
On paper, the result is exactly $0.3$. On a computer, the stored result may be slightly different because $0.1$ and $0.2$ are not represented exactly in binary floating-point form. The error is usually tiny, but it is still important in long calculations.
Why small errors can add up
If a calculation repeats many times, tiny rounding errors may accumulate. For example, in a long simulation of weather or finance, a very small relative error in one step can affect later steps. Numerical Analysis studies how errors grow and how to reduce that growth.
Error Bound and Estimated Error
In practice, students often does not know the true value $x$. That means the exact error $|x-\tilde{x}|$ cannot always be calculated directly. Instead, numerical methods often provide an error bound, which is a guarantee that the error is no larger than some amount.
For example, if a result is reported as
$$\tilde{x}=3.14\pm 0.01$$
then the absolute error is at most
$$0.01$$
This means the true value is expected to lie between
$$3.13\text{ and }3.15$$
If the approximate value is $\tilde{x}=3.14$ and the true value is known to be near $\pi\approx 3.14159$, then the absolute error is
$$|\pi-3.14|\approx 0.00159$$
The relative error is approximately
$$\frac{|\pi-3.14|}{\pi}\approx \frac{0.00159}{3.14159}\approx 0.000506$$
which is about $0.0506\%$.
A Practical Way to Solve Error Problems
When students sees an error question, use this checklist:
- Identify the true value $x$ and the approximate value $\tilde{x}$.
- Compute the absolute error using
$$|x-\tilde{x}|$$
- Compute the relative error using
$$\frac{|x-\tilde{x}|}{|x|}$$
- Convert to a percentage if needed by multiplying by $100\%$.
- Interpret the result in context.
Example 6: Checking a calculator answer 🧮
Suppose the exact value is $x=7.5$ and a calculator gives $\tilde{x}=7.47$.
Absolute error:
$$|7.5-7.47|=0.03$$
Relative error:
$$\frac{0.03}{7.5}=0.004$$
Percentage relative error:
$$0.004\times 100\%=0.4\%$$
So the answer is off by $0.03$, which is only $0.4\%$ of the true value.
Conclusion
Absolute and relative error are basic but powerful tools in Numerical Analysis. Absolute error tells students how far an approximation is from the true value in actual units. Relative error tells how large that mistake is compared with the size of the true value. Both are needed because a small difference may be unimportant in one setting but serious in another.
These ideas are part of the wider study of Numerical Error and Computation, especially when working with floating-point numbers and repeated calculations. If students understands absolute and relative error, then students is ready to judge the quality of numerical answers more carefully and understand how computers handle approximate values. ✅
Study Notes
- Absolute error measures the size of the difference between the true value $x$ and the approximation $\tilde{x}$.
- The formula for absolute error is $|x-\tilde{x}|$.
- Relative error compares the absolute error to the size of the true value and is given by $\frac{|x-\tilde{x}|}{|x|}$ when $x\neq 0$.
- Relative error is often written as a percentage by multiplying by $100\%$.
- Absolute error is best for measuring the actual amount off in units like dollars, meters, or seconds.
- Relative error is best for comparing accuracy across different-sized quantities.
- The same absolute error can be small for a large true value and huge for a small true value.
- Floating-point numbers can introduce small rounding errors because computers store only finite precision.
- In long computations, small errors can accumulate and affect the final result.
- Error bounds are useful when the true value is unknown but the possible size of the error is known.
