Skip to content

← Grade 11 Mathematics

Numerical Integration

Unit 21 · Computational Methods (one option)

Hide the stories, facts, photos, activities and interactives, for revising before an exam
What this builds on from class
In this unit 3 sections
  1. 21.1 Trapezoidal rule
  2. 21.2 Simpson’s rule
  3. Exercise

Area 7 of the course is Computational Methods or Mechanics: each school teaches one. This unit and Unit 20 are Computational Methods; Units 22–23 are Mechanics.

How much water does a river carry past you each second? Hydrologists answer it by going across the river, measuring the depth every few meters, and the water’s speed. The depths give the area of the river’s cross-section, the slice you would see if the river were cut across, and area times speed is the flow. But the riverbed has no equation: there is nothing to integrate, only a list of depths. This unit turns such a list into an area, and the river’s answer comes at the end of 21.2. (The river’s depths below are made up; the way the flow is measured is the US Geological Survey’s.)

21.1 Trapezoidal rule

Unit 19 found the area under a curve as the limit of sums of thin rectangles, and then, far more easily, as F(b) − F(a). But the second way needs an anti-derivative, and often there is none to use:

  • the curve is only measured, at a few points: a river’s depths, a field’s width, a car’s speed read every second;
  • or its anti-derivative is not one of the functions we know. ∫e−x2 dx \int e^{-x^2}\,dx , the area under the bell curve of statistics, is the famous case: no combination of powers, roots, exponentials, logarithms and trigonometric functions has e−x2 e^{-x^2} as its derivative.

So we go back to strips, and make each strip fit the curve better than a rectangle does. That is numerical integration.

Cut [a, b] into n strips of equal width h=b−an h = \frac{b - a}{n} . The heights of the curve at the cuts, y₀ = f(a), y₁ = f(a + h), …, yn=f(b) y_n = f(b) , are the ordinates: n strips have n + 1 of them.

The rule. Join the tops of neighboring ordinates by straight lines (chords): each strip becomes a trapezium.

  1. A trapezium’s area is half the sum of its parallel sides times the distance between them. The first strip’s parallel sides are y₀ and y₁, h apart, so its area is h2(y0+y1) \frac{h}{2}(y_0 + y_1) .
  2. In the same way the strips have areas h2(y1+y2) \frac{h}{2}(y_1 + y_2) , h2(y2+y3) \frac{h}{2}(y_2 + y_3) , …, h2(yn−1+yn) \frac{h}{2}(y_{n-1} + y_n) .
  3. Add them. y₀ and yn y_n are each the side of one strip only; every ordinate in between is shared by two strips, so it is counted twice:

∫aby dx≈h2[(y0+yn)+2(y1+y2+⋯+yn−1)] \begin{aligned} \int_a^b y\,dx \approx \frac{h}{2}\big[ &(y_0 + y_n) \\ &+ 2(y_1 + y_2 + \dots + y_{n-1}) \big] \end{aligned}

In words: half the width times (the first and last, plus twice all the rest). It is the average of Unit 19’s left-height and right-height rectangle sums.

The trapezoidal rule with only one strip, n = 1, gives ∫abf(x) dx≈ \int_a^b f(x)\,dx \approx :

Pick an answer to see why.

21.2 Simpson’s rule

A chord is a straight line, and a curve isn’t. Through any three points (not in a line) passes exactly one parabola y=Ax2+Bx+C y = Ax^2 + Bx + C with a vertical axis, and a parabola can bend as the curve bends. So take the strips in pairs, and over each pair put the parabola through its three ordinates.

The area under one parabola. Move the Y-axis to the middle ordinate, so the three points are (−h, y₀), (0, y₁), (h, y₂). Moving the axis doesn’t change the area.

  1. The parabola y=Ax2+Bx+C y = Ax^2 + Bx + C passes through them: y0=Ah2−Bh+C y_0 = Ah^2 - Bh + C , y₁ = C, y2=Ah2+Bh+C y_2 = Ah^2 + Bh + C .
  2. Its area over [ −h, h] is ∫−hh(Ax2+Bx+C) dx=[Ax33+Bx22+Cx]−hh=2Ah33+2Ch=h3(2Ah2+6C) \int_{-h}^{h} (Ax^2 + Bx + C)\,dx = \left[ \frac{Ax^3}{3} + \frac{Bx^2}{2} + Cx \right]_{-h}^{h} = \frac{2Ah^3}{3} + 2Ch = \frac{h}{3}(2Ah^2 + 6C) (the Bx part cancels: it is odd).
  3. From step 1, y0+y2=2Ah2+2C y_0 + y_2 = 2Ah^2 + 2C , so 2Ah2+6C=(y0+y2)+4C=y0+4y1+y2 2Ah^2 + 6C = (y_0 + y_2) + 4C = y_0 + 4y_1 + y_2 .
  4. So the area under the parabola is h3(y0+4y1+y2) \frac{h}{3}(y_0 + 4y_1 + y_2) : the middle ordinate counts four times.

The rule. With n strips, n even, the pairs give h3(y0+4y1+y2)+h3(y2+4y3+y4)+⋯+h3(yn−2+4yn−1+yn) \frac{h}{3}(y_0 + 4y_1 + y_2) + \frac{h}{3}(y_2 + 4y_3 + y_4) + \dots + \frac{h}{3}(y_{n-2} + 4y_{n-1} + y_n) . Each odd ordinate is the middle of a pair (×4); each even one inside is the end of two pairs (×2):

∫aby dx≈h3[(y0+yn)+4(y1+y3+⋯+yn−1)+2(y2+y4+⋯+yn−2)] \begin{aligned} \int_a^b y\,dx \approx \frac{h}{3}\big[ &(y_0 + y_n) \\ &+ 4(y_1 + y_3 + \dots + y_{n-1}) \\ &+ 2(y_2 + y_4 + \dots + y_{n-2}) \big] \end{aligned}

The weights run 1, 4, 2, 4, 2, …, 4, 1. It is often called Simpson’s one-third rule, for the h3 \frac{h}{3} . Since it takes strips in pairs, n must be even, an odd number of ordinates (5, 7, 9…); with 6 ordinates, use the trapezoidal rule, or Simpson’s on four strips and a trapezium for the fifth.

Try it

Trapezia or parabolas

The same ordinates, joined by chords or by parabolic arcs. Pick a curve and a rule, then slide the strips up and watch the error.

0π/2π0.51

y = sin x from 0 to π

Curve:
Rule:
Trapezoidal
1.570796
Exact
2
Error
0.4292

The answer is too small: the chords run under the curve more than over it.

How good is each rule?

∫0πsin⁡x dx=[−cos⁡x]0π=2 \int_0^\pi \sin x\,dx = \Big[ -\cos x \Big]_0^\pi = 2 exactly. Here are the two rules, and their errors, as the strips double:

Strips n 2 4 8 16
Trapezoidal 1.570796 1.896119 1.974232 1.993570
its error 0.429204 0.103881 0.025768 0.006430
Simpson’s 2.094395 2.004560 2.000269 2.000017
its error −0.094395 −0.004560 −0.000269 −0.000017

Halving h divides the trapezoidal error by about 4 (it goes as h2 h^2 ), and Simpson’s by about 16 (as h4 h^4 ). That is why Simpson’s rule is the one to choose when n is even. Simpson’s rule is even exact for every cubic: the exercise asks why.

In Simpson’s rule with n = 4 on [0, 2], the ordinate at x = 1 is multiplied by:

Pick an answer to see why.

Back to the river

Exercise

Choose the correct option

The trapezoidal rule with n strips of width h is ∫aby dx≈ \int_a^b y\,dx \approx :

Pick an answer to see why.

On each strip, the trapezoidal rule replaces the curve by:

Pick an answer to see why.

∫14f(x) dx \int_1^4 f(x)\,dx by the trapezoidal rule with h = 0.5 uses how many ordinates?

Pick an answer to see why.

The trapezoidal rule is used on ∫02ex dx \int_0^2 e^x\,dx . Its answer is:

Pick an answer to see why.

Simpson’s rule, as it stands, can’t be used with:

Pick an answer to see why.

The trapezoidal rule gives 0.7828 for ∫01dx1+x2=π4=0.7854 \int_0^1 \frac{dx}{1 + x^2} = \frac{\pi}{4} = 0.7854 . Its relative error is about:

Pick an answer to see why.

A trapezoidal answer has an error of 0.04. With the strips halved in width, the error will be about:

Pick an answer to see why.

The trapezoidal rule with n = 2 gives ∫02x2 dx≈ \int_0^2 x^2\,dx \approx :

Pick an answer to see why.

Simpson’s rule with n = 2 gives ∫13dxx≈ \int_1^3 \frac{dx}{x} \approx :

Pick an answer to see why.

Simpson’s rule with n = 2 gives the exact value of which integral?

Pick an answer to see why.

T₂ and T₄ are trapezoidal answers for the same integral with 2 and 4 strips. Then 4T4−T23 \frac{4T_4 - T_2}{3} is:

Pick an answer to see why.

Short questions

1.

Evaluate ∫12dxx \int_1^2 \dfrac{dx}{x} with n = 4 by a. the trapezoidal rule [2], b. Simpson’s rule [2], and c. compare each with the exact value [1]. Give answers to four decimal places.

Hint
Answer
2.

The sunlight on a flat roof in Bhaktapur on an average April day, averaged by PVGIS at the middle of each hour from 6:15 am to 6:15 pm Grade 11: Unit 19, is 66, 254, 465, 654, 788, 856, 837, 758, 637, 489, 325, 156 and 16 W/m². Find by Simpson’s rule the energy that falls on each square meter between those times, in kWh. (5 marks)

Hint
Answer
3.

A plot of land lies between a straight boundary 60 m long and a stream. The distances (offsets) from the boundary to the stream, every 10 m along it, are 12, 15, 18, 17, 20, 16 and 14 m. Find the plot’s area by Simpson’s rule, in square meters and in ropani (1 ropani = 5476 square feet = 508.74 m² = 16 aana). (5 marks)

Hint
Answer

Project work

Where these facts come from
  • How river flow is measured: “discharge = area × velocity”; the cross-section divided into vertical subsections, the width and depth of each measured, the speed by current meter, at 25 to 30 regularly spaced places, the subsections’ flows summed (the opening, Example 3): USGS Water Science School, “How Streamflow is Measured”, read November 2026.
  • Kepler’s second marriage while working in Linz (1613), the merchant’s rod pushed through the bung hole to the edges of the ends, Nova stereometria doliorum vinariorum (1615) and the barrel rule h6(q(0)+4q(h2)+q(h)) \frac{h}{6}(q(0) + 4q(\frac{h}{2}) + q(h)) : Wikipedia (German), “Keplersche Fassregel”; Simpson’s dates and the rule named after him: Wikipedia, “Simpson’s rule”; that he learned the method from Newton, as he acknowledged: MacTutor, “Thomas Simpson”, all read November 2026 (21.2).
  • That e−x2 e^{-x^2} has no elementary anti-derivative (Liouville’s theorem): Wikipedia, “Nonelementary integral”, read November 2026 (21.1).
  • 1 ropani = 5476 square feet (74 feet square, so 508.74 m²) = 16 aana: Wikipedia, “Nepalese units of measurement”, read November 2026 (Question 3). The plot’s offsets are made up.
  • Bhaktapur’s sunlight (Question 2): PVGIS, as in Unit 19’s sources.
  • The unit’s items and project work: CDC, Secondary Education Curriculum 2078, Mathematics, Grades 11–12, 7.2 and sample project 17; the marks and the model question: CDC, Specification Grid 2078, Mathematics, Grade 11, and its model paper, question 19.

Found a mistake? Please tell us.