Trapezoidal Rule

Estimating the area under a curve by adding the areas of trapezia.

Learning goal Use the trapezoidal rule to estimate area from function values or a table, and understand how the formula is built.
Key idea Replace the curved top of a region with straight-line segments, creating trapezia whose areas can be added.
Syllabus connection. This page supports IB Mathematics work on numerical integration and area under a curve. It links naturally with definite integrals, area interpretation, graphing technology, tabulated data, approximation and percentage error. Students should practise writing the correct trapezoidal-rule expression before calculating the estimate.

On this page

  1. Integration pathway
  2. The whole idea
  3. Area of one trapezium
  4. Step-by-step method
  5. The trapezoidal rule formula
  6. Worked example: function values
  7. Improving accuracy
  8. IB-style data example
  9. Overestimate and underestimate
  10. Practice

Integration pathway

This page belongs to the integration mini-chapter. It is best studied after definite integrals and area under a curve.

1The whole idea

The trapezoidal rule is used when we want to estimate an area but cannot, or do not need to, find an exact antiderivative. Instead of following the curve exactly, we join neighbouring points on the curve with straight line segments. These line segments create trapezia.

The handwritten notes introduce the method by approximating the area enclosed by a curve, the x-axis, and two vertical lines using four trapezia. The clean diagram below follows that same structure.

x y O y = f(x) a=x₀ x₁ x₂ x₃ b=x₄ h The whole idea Replace the curved top by straight line segments. Then add the areas of the trapezia. Here n = 4 4 trapezia 5 heights: y₀, y₁, y₂, y₃, y₄ In general: n trapezia need n+1 heights.

Key idea: the curved top of the region is replaced by straight-line segments, making the region easier to calculate.

Important: if there are \(n\) trapezia, there are \(n+1\) x-values and therefore \(n+1\) heights. For example, 4 trapezia require 5 heights.

2Reminder: area of one trapezium

A trapezium has two parallel sides. In this context, the parallel sides are the two vertical heights, and the distance between them is the strip width \(h\).

\[A=\frac{h}{2}(y_1+y_2)\]

The trapezoidal rule is simply this formula used repeatedly: calculate the area of each trapezium, then add them.

h y₁ y₂ Reminder: area of a trapezium A = h/2 × (sum of parallel heights)

3Step-by-step method

1Choose the width

Either choose the number of trapezia \(n\), or use the interval width \(h\) given in the question.

\[h=\frac{b-a}{n}\]

If \(h\) is already given, use it directly.

2Find the x-values

Start at \(a\), then keep adding \(h\) until you reach \(b\).

\[\begin{aligned}x_0&=a\\x_1&=a+h\\x_2&=a+2h\\&\vdots\\x_n&=b\end{aligned}\]

3Find the heights

Substitute each x-value into the function, or read each height from a table.

\[\begin{aligned}y_0&=f(x_0)\\y_1&=f(x_1)\\y_2&=f(x_2)\\&\vdots\\y_n&=f(x_n)\end{aligned}\]

4Use the formula

The first and last heights are used once. All middle heights are used twice.

\[A\approx\frac{h}{2}\left[y_0+y_n+2(y_1+\cdots+y_{n-1})\right]\]

Reminder: this same pattern appears in every worked example.

4The trapezoidal rule formula

For a function \(y=f(x)\), divided into \(n\) equal-width trapezia from \(x=a\) to \(x=b\), the trapezoidal rule is:

\[\int_a^b f(x)\,dx\approx\frac{h}{2}\left[y_0+y_n+2(y_1+y_2+\cdots+y_{n-1})\right]\]

where \(h=\frac{b-a}{n}\), \(x_i=a+ih\), and \(y_i=f(x_i)\).

Why the middle heights are counted twice Each trapezium uses two neighbouring heights. y₀ y₁ y₂ y₃ y₄ A₁ A₂ A₃ A₄ A₁ uses y₀ and y₁ A₂ uses y₁ and y₂ A₃ uses y₂ and y₃ A₄ uses y₃ and y₄ So y₁, y₂ and y₃ appear twice.

For four trapezia, \(y_1\), \(y_2\) and \(y_3\) are each shared by two neighbouring trapezia, so they are counted twice.

For \(n=4\), the four trapezia have areas:

\[A_1=\frac{h}{2}(y_0+y_1),\quad A_2=\frac{h}{2}(y_1+y_2),\quad A_3=\frac{h}{2}(y_2+y_3),\quad A_4=\frac{h}{2}(y_3+y_4)\]

Now add them carefully, step by step:

\[A\approx A_1+A_2+A_3+A_4\]
\[A\approx\frac{h}{2}(y_0+y_1)+\frac{h}{2}(y_1+y_2)+\frac{h}{2}(y_2+y_3)+\frac{h}{2}(y_3+y_4)\]
\[A\approx\frac{h}{2}\left[(y_0+y_1)+(y_1+y_2)+(y_2+y_3)+(y_3+y_4)\right]\]
\[A\approx\frac{h}{2}\left[y_0+y_1+y_1+y_2+y_2+y_3+y_3+y_4\right]\]
\[A\approx\frac{h}{2}\left[y_0+2y_1+2y_2+2y_3+y_4\right]\]
\[A\approx\frac{h}{2}\left[y_0+y_4+2(y_1+y_2+y_3)\right]\]

Always remember: the first height \(y_0\) and the last height \(y_n\) appear only once. Every middle height appears twice because each one belongs to two neighbouring trapezia.

5Worked example 1: using function values

Using a step size \(h=0.5\), estimate the area enclosed by \(y=f(x)\) and the x-axis for \(0\leq x\leq 2\), where

\[f(x)=x^2-4x+6.\]

The exact area would be \(\int_0^2 f(x)\,dx\), but here we are asked to estimate it using trapezia.

Reminder before using the formula: the first and last heights are used once, while all middle heights are doubled.

Since \(h=0.5\), the x-values are:

\[0,\quad 0.5,\quad 1,\quad 1.5,\quad 2\]

There are 5 x-values, so there are 4 trapezia.

i01234
\(x_i\)00.511.52
\(y_i=f(x_i)\)64.2532.252
\[\begin{aligned}A&\approx\frac{0.5}{2}\left[6+2+2(4.25+3+2.25)\right]\\&=0.25(27)\\&=6.75\end{aligned}\]

So the trapezoidal rule estimate is \(6.75\) square units.

00.511.52246 y0y1y2y3y4 y = x² − 4x + 6 Example 1: four trapezia h = 0.5, n = 4 x y

The four trapezia are built from the five heights \(y_0\) to \(y_4\).

The exact value is \(\int_0^2 (x^2-4x+6)\,dx=\frac{20}{3}\approx 6.67\). The estimate \(6.75\) is close, but not exact.

6How to increase accuracy

The approximation usually improves when the trapezia are narrower. That means using more trapezia, or equivalently using a smaller step size \(h\).

For the previous example, changing from \(h=0.5\) to \(h=0.25\) gives 8 trapezia instead of 4.

\[n=\frac{2-0}{0.25}=8\]

The estimate becomes:

\[A\approx 6.69\]

This is closer to the exact value \(6.67\) than the earlier estimate \(6.75\).

00.511.52246 y = x² − 4x + 6 More strips: eight trapezia h = 0.25, n = 8 x y

More, thinner trapezia give a better approximation for this example.

7Worked example 2: IB-style data question

Engineers measure the power output \(P\), in MW, of a wind farm over a period of 3 hours. The total electrical energy produced, in MWh, is represented by the area under the power-time graph.

\(t\) hours00.51.01.52.02.53.0
\(P\) MW40556560504555

Use the trapezoidal rule with interval width \(0.5\) hours to estimate the total energy produced.

Here \(h=0.5\), and there are 6 trapezia.

Reminder: use the first and last values once, and double every middle value from the table.

\[\begin{aligned}E&\approx\frac{0.5}{2}\left[40+55+2(55+65+60+50+45)\right]\\&=0.25\left[95+2(275)\right]\\&=161.25\end{aligned}\]

So the estimated total energy produced is \(161.25\) MWh, or \(161\) MWh to 3 significant figures.

204060 00.511.522.53 Power output data Area under the graph estimates total energy produced. P (MW) t (hours)

For data questions, the trapezia are built from the table values rather than from an explicit formula.

If the real amount of energy was \(158\) MWh, the percentage error is:

\[\begin{aligned}\%\;\mathrm{error}&=\left|\frac{161.25-158}{158}\right|\times 100\\&\approx 2.06\%\end{aligned}\]

If the estimate is first rounded to \(161\) MWh, then the percentage error is approximately \(1.90\%\). In an exam, use unrounded values unless the question tells you otherwise.

8Overestimate and underestimate

The trapezoidal rule replaces a curve by straight chords. Whether this gives an overestimate or underestimate depends on the shape of the curve.

Concave down: usually an underestimate straight chords lie below the curve Concave up: usually an overestimate straight chords lie above the curve

This is a useful visual check, but in exams you should still follow the requested method carefully.

Common warning: overestimate and underestimate statements are safest when the curve keeps the same concavity on the whole interval.

9Common mistakes checklist

Mixing up n and n+1

There are \(n\) trapezia but \(n+1\) heights.

Forgetting to double the middle heights

Only \(y_0\) and \(y_n\) are used once.

Using the wrong h

If the interval width is given, use it. Otherwise calculate \(h=\frac{b-a}{n}\).

Dropping the units

For example, MW multiplied by hours gives MWh.

10Practice with solutions

  1. Use the trapezoidal rule with \(h=0.5\) to estimate \(\int_0^2 (x^2+1)\,dx\).
    Show solution

    The x-values are \(0,0.5,1,1.5,2\). The y-values are \(1,1.25,2,3.25,5\).

    \[A\approx\frac{0.5}{2}\left[1+5+2(1.25+2+3.25)\right]=4.75\]
  2. A curve is divided into 6 trapezia from \(x=1\) to \(x=4\). Find \(h\).
    Show solution
    \[h=\frac{4-1}{6}=0.5\]
  3. For \(h=2\), the heights are \(3,5,8,6\). Estimate the area.
    Show solution

    There are 4 heights, so there are 3 trapezia.

    \[A\approx\frac{2}{2}\left[3+6+2(5+8)\right]=35\]
  4. The velocity of a particle is measured as follows. Estimate the distance travelled from \(t=0\) to \(t=4\).
    \(t\)01234
    \(v\)25764
    Show solution

    Here \(h=1\).

    \[D\approx\frac{1}{2}\left[2+4+2(5+7+6)\right]=21\]

    The estimated distance is 21 units.

  5. Explain why using more trapezia generally improves the approximation.
    Show solution

    Using more trapezia makes the width \(h\) smaller. The straight-line segments then follow the curve more closely, so the total trapezium area is usually closer to the true area.