The Central Idea

Numerical integration approximates

\[ \int_a^b f(x)\,dx \]

using a finite collection of function values.

The general strategy is:

  1. divide the interval into subintervals;
  2. approximate the function on each subinterval;
  3. compute the corresponding local area or accumulation;
  4. add the local contributions.

Different numerical methods use different local approximations.

Why Numerical Integration Is Needed

Numerical integration is useful when:

Equal Subintervals

Divide

\[ [a,b] \]

into \(n\) equal subintervals.

The width is

\[ \boxed{\Delta x=\frac{b-a}{n}}. \]

The partition points are

\[ x_i=a+i\Delta x. \]

Left Endpoint Rule

The left endpoint rule uses the left endpoint of each subinterval:

\[ \boxed{ L_n= \Delta x \left[ f(x_0)+f(x_1)+\cdots+f(x_{n-1}) \right] }. \]

This is the same left Riemann sum introduced earlier.

Right Endpoint Rule

The right endpoint rule uses the right endpoint of each subinterval:

\[ \boxed{ R_n= \Delta x \left[ f(x_1)+f(x_2)+\cdots+f(x_n) \right] }. \]

Midpoint Rule

The midpoint rule evaluates the function at the center of each subinterval.

If

\[ m_i=\frac{x_{i-1}+x_i}{2}, \]

then

\[ \boxed{ M_n= \Delta x \sum_{i=1}^{n}f(m_i) }. \]

Midpoint estimates are often much more accurate than left or right sums using the same number of subintervals.

The Trapezoidal Rule

Instead of approximating the graph by horizontal rectangles, the trapezoidal rule connects neighboring data points with straight line segments.

Each subinterval contributes the area of a trapezoid.

\[ \boxed{ \text{trapezoid area} = \frac12 (\text{left height}+\text{right height}) (\text{width}) }. \]

Composite Trapezoidal Rule

For \(n\) equal subintervals,

\[ \boxed{ T_n= \frac{\Delta x}{2} \left[ f(x_0) +2f(x_1) +2f(x_2) +\cdots +2f(x_{n-1}) +f(x_n) \right] }. \]

The endpoint values appear once, while interior values appear twice.

The Trapezoidal Rule as an Average

For equal subintervals,

\[ \boxed{ T_n=\frac{L_n+R_n}{2} }. \]

This provides a useful connection between rectangle approximations and trapezoidal approximation.

Simpson’s Rule

Simpson’s Rule improves the local approximation further by fitting quadratic curves rather than horizontal or straight-line pieces.

It is usually substantially more accurate for smooth functions.

The standard composite Simpson’s Rule requires an even number of subintervals.

Composite Simpson’s Rule

If \(n\) is even and

\[ \Delta x=\frac{b-a}{n}, \]

then

\[ \boxed{ S_n= \frac{\Delta x}{3} \left[ f(x_0) +4f(x_1) +2f(x_2) +4f(x_3) +\cdots +2f(x_{n-2}) +4f(x_{n-1}) +f(x_n) \right] }. \]

The interior weights alternate:

\[ \boxed{4,2,4,2,\ldots,4}. \]

Remembering the Simpson Pattern

For \(n\) even, the coefficient pattern is

\[ \boxed{ 1,\ 4,\ 2,\ 4,\ 2,\ \ldots,\ 4,\ 1 }. \]

Then multiply the weighted sum by

\[ \boxed{\frac{\Delta x}{3}}. \]

Example: Approximate \(\int_0^2 x^2\,dx\)

Use \(n=4\) equal subintervals.

The width is

\[ \Delta x=\frac{2-0}{4}=\frac12. \]

The partition points are

\[ 0,\quad\frac12,\quad1,\quad\frac32,\quad2. \]

Left Endpoint Approximation

\[ L_4= \frac12 \left[ 0^2+ \left(\frac12\right)^2+ 1^2+ \left(\frac32\right)^2 \right]. \]

Therefore,

\[ L_4= \frac12 \left[ 0+\frac14+1+\frac94 \right]. \] \[ \boxed{L_4=\frac74=1.75}. \]

Right Endpoint Approximation

\[ R_4= \frac12 \left[ \left(\frac12\right)^2+ 1^2+ \left(\frac32\right)^2+ 2^2 \right]. \]

Thus,

\[ \boxed{R_4=\frac{15}{4}=3.75}. \]

Midpoint Approximation

The midpoints are

\[ \frac14,\quad\frac34,\quad\frac54,\quad\frac74. \]

Therefore,

\[ M_4= \frac12 \left[ \left(\frac14\right)^2+ \left(\frac34\right)^2+ \left(\frac54\right)^2+ \left(\frac74\right)^2 \right]. \]

Hence,

\[ \boxed{M_4=\frac{21}{8}=2.625}. \]

Trapezoidal Approximation

Since

\[ T_4=\frac{L_4+R_4}{2}, \]

we have

\[ T_4= \frac{1.75+3.75}{2}. \]

Therefore,

\[ \boxed{T_4=2.75}. \]

Simpson Approximation

Use

\[ S_4= \frac{\Delta x}{3} \left[ f(x_0)+4f(x_1)+2f(x_2)+4f(x_3)+f(x_4) \right]. \]

Thus,

\[ S_4= \frac{1/2}{3} \left[ 0+ 4\left(\frac14\right)+ 2(1)+ 4\left(\frac94\right)+ 4 \right]. \]

The weighted sum is

\[ 0+1+2+9+4=16. \]

Hence,

\[ \boxed{ S_4=\frac16(16)=\frac83 }. \]

In this case Simpson’s Rule is exact because \(x^2\) is quadratic.

Comparing the Estimates

The exact value is

\[ \int_0^2x^2\,dx=\frac83\approx2.667. \]

Our estimates were

\[ L_4=1.75, \] \[ M_4=2.625, \] \[ T_4=2.75, \]

and

\[ S_4=\frac83. \]

This illustrates how different approximation rules can have very different accuracy.

Numerical Integration from a Table

Numerical methods are especially important when the function is known only through measurements.

\(x\) \(f(x)\)
02
13
25
34
46

Since the spacing is \(1\), these values can be used directly in left, right, trapezoidal, and Simpson approximations.

Example: Trapezoidal Rule from Tabular Data

Using the table above,

\[ T_4= \frac12 \left[ 2+2(3)+2(5)+2(4)+6 \right]. \]

Therefore,

\[ T_4= \frac12(32). \]

Hence,

\[ \boxed{T_4=16}. \]

Example: Simpson’s Rule from the Same Table

Since \(n=4\) is even,

\[ S_4= \frac13 \left[ 2+4(3)+2(5)+4(4)+6 \right]. \]

Thus,

\[ S_4= \frac13(46). \]

Therefore,

\[ \boxed{S_4=\frac{46}{3}\approx15.333}. \]

Unequal Subintervals

The simple composite formulas above assume equal spacing.

With unequal spacing, the trapezoidal rule can still be applied interval-by-interval:

\[ \boxed{ T = \sum_{i=1}^{n} \frac{f(x_{i-1})+f(x_i)}{2} (x_i-x_{i-1}) }. \]

Each trapezoid uses its own width.

Approximation Error

Numerical integration replaces a curved function with a simpler local model.

The difference between the approximation and the true integral is the numerical integration error.

In general, error becomes smaller as the partition is refined.

Monotonicity and Endpoint Errors

If \(f\) is increasing and positive:

If \(f\) is decreasing and positive, the pattern reverses.

Concavity and the Trapezoidal Rule

If \(f\) is concave up, secant lines tend to lie above the graph.

Therefore the trapezoidal rule tends to overestimate.

If \(f\) is concave down, secant lines tend to lie below the graph, so the trapezoidal rule tends to underestimate.

Concavity and the Midpoint Rule

For smooth functions, midpoint behavior typically goes in the opposite direction from trapezoidal behavior.

Trapezoidal Error Bound

If

\[ |f''(x)|\leq K \]

on \([a,b]\), then

\[ \boxed{ |E_T| \leq \frac{K(b-a)^3}{12n^2} }. \]

This shows that trapezoidal error decreases on the order of \(1/n^2\).

Midpoint Error Bound

If

\[ |f''(x)|\leq K, \]

then

\[ \boxed{ |E_M| \leq \frac{K(b-a)^3}{24n^2} }. \]

The midpoint bound has half the constant of the trapezoidal bound.

Simpson Error Bound

If \(n\) is even and

\[ |f^{(4)}(x)|\leq K \]

on \([a,b]\), then

\[ \boxed{ |E_S| \leq \frac{K(b-a)^5}{180n^4} }. \]

Simpson error decreases on the order of \(1/n^4\), which explains its strong performance for smooth functions.

Exactness for Certain Functions

Numerical methods are approximations in general, but some are exact for particular classes of functions.

Choosing a Numerical Method

A practical hierarchy is:

Data Quality Matters

Numerical integration cannot recover information that was never measured.

Sparse, noisy, or irregularly spaced data can limit the reliability of an integral estimate.

A mathematically precise quadrature formula does not eliminate uncertainty in the underlying measurements.

Units in Numerical Integration

Each numerical term has the same units as

\[ f(x)\Delta x. \]

For example, if \(v(t)\) is in meters per second and \(\Delta t\) is in seconds, then each contribution is in meters.

The numerical integral therefore approximates displacement.

Example: Velocity Data

\(t\) (s) \(v(t)\) (m/s)
04
27
49
68

Using the trapezoidal rule with width \(2\),

\[ T_3= \frac{2}{2} \left[ 4+2(7)+2(9)+8 \right]. \]

Thus,

\[ \boxed{T_3=44\text{ meters}}. \]

Refining the Partition

If the number of equal subintervals is doubled, the width is halved:

\[ \Delta x=\frac{b-a}{n}. \]

Smaller widths usually improve the local representation of the function.

Comparing estimates for \(n\), \(2n\), and \(4n\) is a practical way to assess numerical stability.

Common Error: Confusing Data Points with Subintervals

If a table contains \(n+1\) equally spaced data points, then there are \(n\) subintervals.

For example, five data points create four subintervals.

Common Error: Using Simpson’s Rule with Odd \(n\)

The standard composite Simpson’s Rule requires

\[ \boxed{n\text{ even}}. \]

If \(n\) is odd, adjust the partition or use another method.

Common Error: Losing the Simpson Weights

The pattern must be

\[ \boxed{1,4,2,4,2,\ldots,4,1}. \]

The two endpoints receive coefficient \(1\), odd-indexed interior values receive \(4\), and even-indexed interior values receive \(2\).

Common Error: Forgetting the Width Factor

Every numerical integration rule contains the subinterval width.

A weighted sum of function values alone does not yet have the correct accumulated scale or units.

Common Error: Applying Equal-Spacing Formulas to Unequal Data

Before using a composite formula, verify that the \(x\)-values are equally spaced.

For irregular spacing, compute contributions interval by interval unless a method specifically designed for nonuniform spacing is being used.

A Reliable Numerical Integration Procedure

  1. Identify the interval and available data.
  2. Determine the number of subintervals.
  3. Check whether the spacing is uniform.
  4. Choose an appropriate rule.
  5. Write the formula before substituting numbers.
  6. Apply the correct weights.
  7. Multiply by the width factor.
  8. Carry units through the calculation.
  9. Estimate whether the result should be high or low when possible.
  10. Refine the partition if greater accuracy is needed.

Practice 1: Width

Divide \([0,8]\) into \(4\) equal subintervals. Find \(\Delta x\).

Practice 2: Left Rule

Approximate

\[ \int_0^4(x+1)\,dx \]

using \(4\) left-endpoint rectangles.

Practice 3: Right Rule

Approximate the same integral using \(4\) right-endpoint rectangles.

Practice 4: Midpoint Rule

Approximate

\[ \int_0^2x^2\,dx \]

using \(2\) midpoint subintervals.

Practice 5: Trapezoidal Rule

Use \(n=2\) to approximate

\[ \int_0^2x^2\,dx \]

with the trapezoidal rule.

Practice 6: Simpson’s Rule

Use \(n=2\) to approximate

\[ \int_0^2x^2\,dx \]

with Simpson’s Rule.

Practice 7: Table and Trapezoids

\(x\)\(f(x)\)
01
12
25
34

Use the trapezoidal rule on \([0,3]\).

Practice 8: Simpson Weights

Write the coefficient pattern for Simpson’s Rule when \(n=6\).

Practice 9: Over or Under?

If \(f\) is positive, increasing, and concave up, classify the likely direction of error for:

  1. left endpoint rule;
  2. right endpoint rule;
  3. trapezoidal rule;
  4. midpoint rule.

Practice 10: Simpson Eligibility

Can standard composite Simpson’s Rule be used directly with \(n=5\)?

Practice 11: Units

A rate is measured in gallons per hour and integrated numerically with respect to hours. What are the units of the resulting estimate?

Practice 12: Irregular Spacing

Data are recorded at

\[ x=0,\ 1,\ 3,\ 6. \]

Can the standard equal-spacing composite trapezoidal formula be used directly?

Practice Answers

Practice 1

\[ \Delta x=\frac{8-0}{4}=\boxed{2}. \]

Practice 2

Here \(\Delta x=1\), and the left endpoints are \(0,1,2,3\).

\[ L_4=(1+2+3+4)(1)=\boxed{10}. \]

Practice 3

The right endpoints are \(1,2,3,4\).

\[ R_4=(2+3+4+5)(1)=\boxed{14}. \]

Practice 4

The width is \(1\), and the midpoints are \(1/2\) and \(3/2\).

\[ M_2= \left[ \left(\frac12\right)^2+ \left(\frac32\right)^2 \right](1) = \boxed{\frac52}. \]

Practice 5

\[ T_2= \frac12 \left[ 0^2+2(1^2)+2^2 \right] = \boxed{3}. \]

Practice 6

\[ S_2= \frac13 \left[ 0^2+4(1^2)+2^2 \right] = \frac13(8). \]

Therefore,

\[ \boxed{\frac83}. \]

Practice 7

\[ T_3= \frac12 [1+2(2)+2(5)+4]. \] \[ =\frac12(19). \]

Hence,

\[ \boxed{9.5}. \]

Practice 8

\[ \boxed{1,\ 4,\ 2,\ 4,\ 2,\ 4,\ 1}. \]

Practice 9

Practice 10

No. Standard composite Simpson’s Rule requires an even number of subintervals.

Practice 11

The units are

\[ \frac{\text{gallons}}{\text{hour}} \cdot \text{hours} = \boxed{\text{gallons}}. \]

Practice 12

No. The spacing is not uniform.

Use interval-by-interval trapezoids or another method suitable for nonuniform spacing.

What to Remember

Numerical integration estimates

\[ \boxed{\int_a^b f(x)\,dx} \]

using finitely many function values.

For equal subintervals,

\[ \boxed{\Delta x=\frac{b-a}{n}}. \]

The main rules are:

\[ \boxed{ L_n,\quad R_n,\quad M_n,\quad T_n,\quad S_n }. \]

The trapezoidal rule uses straight-line approximations, while Simpson’s Rule uses quadratic approximations.

As a practical principle:

use the simplest method that matches the available data and the accuracy you need, then refine the partition when greater precision is required.

Where We Go Next

Numerical integration gives practical approximations to accumulated quantities. The next applications of integration use those accumulated quantities to compute area, volume, arc length, and work.