## Absolute and Relative Error

### Learning Outcomes

• Determine the absolute and relative error in using a numerical integration technique
• Estimate the absolute and relative error using an error-bound formula
• Recognize when the midpoint and trapezoidal rules over- or underestimate the true value of an integral

An important aspect of using these numerical approximation rules consists of calculating the error in using them for estimating the value of a definite integral. We first need to define absolute error and relative error.

### Definition

If $B$ is our estimate of some quantity having an actual value of $A$, then the absolute error is given by $|A-B|$. The relative error is the error as a percentage of the absolute value and is given by $|\frac{A-B}{A}|=|\frac{A-B}{A}|\cdot 100\text{%}$.

### Example: Calculating Error in the Midpoint Rule

Calculate the absolute and relative error in the estimate of ${\displaystyle\int }_{0}^{1}{x}^{2}dx$ using the midpoint rule, found in the example: Using the Midpoint Rule with ${M}_{4}$.

.

### Example: Calculating Error in the Trapezoidal Rule

Calculate the absolute and relative error in the estimate of ${\displaystyle\int }_{0}^{1}{x}^{2}dx$ using the trapezoidal rule, found in the example: Using the trapezoidal rule.

Watch the following video to see the worked solutions to Example:  Calculating Error in the Midpoint Rule and Example: Calculating Error in the Trapezoidal Rule

You can view the transcript for “3.6.2” here (opens in new window).

### try it

In an earlier checkpoint, we estimated ${\displaystyle\int }_{1}^{2}\frac{1}{x}dx$ to be $\frac{24}{35}$ using ${T}_{2}$. The actual value of this integral is $\text{ln}2$. Using $\frac{24}{35}\approx 0.6857$ and $\text{ln}2\approx 0.6931$, calculate the absolute error and the relative error.

In the two previous examples, we were able to compare our estimate of an integral with the actual value of the integral; however, we do not typically have this luxury. In general, if we are approximating an integral, we are doing so because we cannot compute the exact value of the integral itself easily. Therefore, it is often helpful to be able to determine an upper bound for the error in an approximation of an integral. The following theorem provides error bounds for the midpoint and trapezoidal rules. The theorem is stated without proof.

### Error Bounds for the Midpoint and Trapezoidal Rules

Let $f\left(x\right)$ be a continuous function over $\left[a,b\right]$, having a second derivative $f\text{''}\left(x\right)$ over this interval. If $M$ is the maximum value of $|f\text{''}\left(x\right)|$ over $\left[a,b\right]$, then the upper bounds for the error in using ${M}_{n}$ and ${T}_{n}$ to estimate ${\displaystyle\int }_{a}^{b}f\left(x\right)dx$ are

$\text{Error in }{M}_{n}\le \frac{M{\left(b-a\right)}^{3}}{24{n}^{2}}$

and

$\text{Error in }{T}_{n}\le \frac{M{\left(b-a\right)}^{3}}{12{n}^{2}}$.

We can use these bounds to determine the value of $n$ necessary to guarantee that the error in an estimate is less than a specified value. Before exploring an example, let’s review some basic rules for solving inequalities.

### Recall: Rules for Solving Inequalities

The process of solving an inequality is similar to solving an equation by isolating the variable. There are several rules to keep in mind when solving these inequalities.

1. Adding or subtracting the same number to both sides of an inequality yields an equivalent statement.
2. Multiplying or dividing the same positive number to both sides of an inequality yields an equivalent statement.
3. Multiplying or dividing a negative number to both sides of an inequality reverses the direction of the inequality.
4. If $x^n \le a \: \text{and}\:x\ge0$  then $x \le \sqrt[n] {a}$

### Example: Determining the Number of Intervals to Use

What value of $n$ should be used to guarantee that an estimate of ${\displaystyle\int }_{0}^{1}{e}^{{x}^{2}}dx$ is accurate to within 0.01 if we use the midpoint rule?

Watch the following video to see the worked solution to Example: Determining the Number of Intervals to Use

You can view the transcript for “3.6.3” here (opens in new window).

### try it

Use the previous theorem to find an upper bound for the error in using ${M}_{4}$ to estimate ${\displaystyle\int }_{0}^{1}{x}^{2}dx$.