### 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 [latex]B[/latex] is our estimate of some quantity having an actual value of [latex]A[/latex], then the absolute error is given by [latex]|A-B|[/latex]. The relative error is the error as a percentage of the absolute value and is given by [latex]|\frac{A-B}{A}|=|\frac{A-B}{A}|\cdot 100\text{%}[/latex].

### Example: Calculating Error in the Midpoint Rule

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

.

### Example: Calculating Error in the Trapezoidal Rule

Calculate the absolute and relative error in the estimate of [latex]{\displaystyle\int }_{0}^{1}{x}^{2}dx[/latex] 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

### try it

In an earlier checkpoint, we estimated [latex]{\displaystyle\int }_{1}^{2}\frac{1}{x}dx[/latex] to be [latex]\frac{24}{35}[/latex] using [latex]{T}_{2}[/latex]. The actual value of this integral is [latex]\text{ln}2[/latex]. Using [latex]\frac{24}{35}\approx 0.6857[/latex] and [latex]\text{ln}2\approx 0.6931[/latex], 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 [latex]f\left(x\right)[/latex] be a continuous function over [latex]\left[a,b\right][/latex], having a second derivative [latex]f\text{''}\left(x\right)[/latex] over this interval. If [latex]M[/latex] is the maximum value of [latex]|f\text{''}\left(x\right)|[/latex] over [latex]\left[a,b\right][/latex], then the upper bounds for the error in using [latex]{M}_{n}[/latex] and [latex]{T}_{n}[/latex] to estimate [latex]{\displaystyle\int }_{a}^{b}f\left(x\right)dx[/latex] are

and

We can use these bounds to determine the value of [latex]n[/latex] 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.

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

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

What value of [latex]n[/latex] should be used to guarantee that an estimate of [latex]{\displaystyle\int }_{0}^{1}{e}^{{x}^{2}}dx[/latex] 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

### try it

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