Instant PDF download, name-and-email checkout. Complete bundle: every Economics, Statistics and Mathematics book
Mathematics guide, Unit 6, step 20 of 33Previous stepNext step

Step 20: Riemann Sums and the Definite Integral

SyllabusAP 6.1–6.6 · 9709 P2 2.5 (trapezium) · IB SL 5.5
In 30 seconds
  • The area under a rate graph is the total change in the quantity. Rate times time gives an amount, so the units of the area are (units of \( y \)) \( \times \) (units of \( x \)). Area below the axis counts as negative.
  • When the graph is curved, estimate the area with strips: left, right or midpoint rectangles, or trapezia. The trapezoidal sum is the average of the left and right sums.
  • The definite integral \( \int_a^b f(x)\,dx \) is the exact value these sums approach as the strips become infinitely thin: \( \displaystyle\lim_{n \to \infty} \sum_{i=1}^{n} f(x_i)\,\Delta x \).
  • Exam point: AP tables often have unequal gaps. Work strip by strip (width \( \times \) height, or width \( \times \) average height), show every product, and finish with units and a sentence of meaning.
Video lesson coming soonA short animated lesson for this step will appear here.

The area under a rate graph is total change

Everything in Units 2 to 5 started from a quantity and asked how fast it was changing. Integration runs the other way. You know the rate, such as the speed of a car, the flow of water into a tank or the revenue a shop earns per hour, and you want the total amount that has built up.

Start with a steady rate. Rain fills a tank at 6 litres per minute for 10 minutes, so 60 litres go in. On a graph of rate against time, that product is the area of a rectangle 10 wide and 6 high. The units agree: litres per minute times minutes gives litres. When the rate varies, the rectangle becomes a region under a curve, but the idea survives. Over a very short time the rate hardly changes, so each thin sliver of area is still rate \( \times \) time, and the slivers add up to the total.

Key termSigned area: the area between a graph and the \( x \)-axis, counted as positive where the graph is above the axis and negative where it is below. The definite integral of a rate measures signed area, so it gives the net change in the quantity.

A negative rate means the quantity is falling: a velocity of \( -3 \) m/s means moving backwards. So area below the axis subtracts from the total. This is the difference between displacement (where you end up, relative to the start) and distance (every metre travelled, in either direction).

Worked example

A particle moves along a line. Its velocity \( v \) m/s for \( 0 \le t \le 8 \) seconds is made of straight pieces joining \( (0, 0) \), \( (1, 4) \), \( (4, 4) \), \( (6, 0) \) and \( (8, -4) \), as in Figure 1. Find its displacement and the total distance it travels.

Step 1Above the axis, from \( t = 0 \) to \( t = 6 \), the region is a triangle, a rectangle and another triangle: \( \tfrac12(1)(4) + 3 \times 4 + \tfrac12(2)(4) = 2 + 12 + 4 = 18 \).
Step 2Below the axis, from \( t = 6 \) to \( t = 8 \), there is one triangle of area \( \tfrac12(2)(4) = 4 \).
Step 3Displacement \( = \int_0^8 v(t)\,dt = 18-4 = 14 \) m. Distance \( = \int_0^8 |v(t)|\,dt = 18 + 4 = 22 \) m.

The particle finishes 14 m ahead of where it started, but it has covered 22 m, because it went 4 m backwards at the end.

Velocity of a particle, 0 ≤ t ≤ 8
v(t)
12345678−4−22460t (s)v (m/s)area 18 (forwards)area 4
Figure 1. Area above the axis (18) is distance moved forwards; area below (4) is distance moved backwards. Displacement = 18 − 4 = 14 m, distance = 18 + 4 = 22 m.

Rectangles and trapezia: four Riemann sums

Curved graphs have no simple shape to measure, so you approximate the region with shapes you can measure. Cut the interval \( [a, b] \) into \( n \) strips of equal width \( \Delta x = \dfrac{b-a}{n} \), with dividing points \( x_0 = a, x_1, \ldots, x_n = b \). Each strip then needs a height.

MethodHeight of each stripFormula
Left sum \( L_n \)value at the left end\( \Delta x\,[f(x_0) + f(x_1) + \cdots + f(x_{n-1})] \)
Right sum \( R_n \)value at the right end\( \Delta x\,[f(x_1) + f(x_2) + \cdots + f(x_n)] \)
Midpoint sum \( M_n \)value at the middle of the strip\( \Delta x\,[f(m_1) + \cdots + f(m_n)] \)
Trapezoidal sum \( T_n \)average of the two ends\( \tfrac12\Delta x\,[f(x_0) + 2f(x_1) + \cdots + 2f(x_{n-1}) + f(x_n)] \)

In the trapezoidal sum every inside height belongs to two neighbouring trapezia, so it is counted twice, while the two end heights are counted once. Each trapezium is the average of the left and right rectangles on its strip, so \( T_n = \tfrac12(L_n + R_n) \).

Key termRiemann sum: a sum \( \sum f(x_i^*)\,\Delta x_i \), where the interval is cut into strips of width \( \Delta x_i \) and \( x_i^* \) is a point in the \( i \)th strip. Left, right and midpoint sums are Riemann sums; the trapezoidal sum is the average of two of them.
Worked example

Estimate \( \int_0^3 (9-x^2)\,dx \) with three strips of width 1, using (a) a left sum, (b) a right sum, (c) a midpoint sum and (d) the trapezoidal rule.

Step 1Heights: \( f(0) = 9 \), \( f(1) = 8 \), \( f(2) = 5 \), \( f(3) = 0 \), and \( \Delta x = 1 \).
Step 2(a) \( L_3 = 9 + 8 + 5 = 22 \). (b) \( R_3 = 8 + 5 + 0 = 13 \).
Step 3(c) Midpoints \( 0.5, 1.5, 2.5 \): \( M_3 = 8.75 + 6.75 + 2.75 = 18.25 \).
Step 4(d) \( T_3 = \tfrac12(1)[9 + 2(8 + 5) + 0] = 17.5 \), which is also \( \tfrac12(22 + 13) \).

The exact value, found in the next step, is 18. The left and midpoint sums are too big; the right and trapezoidal sums are too small. The next table explains why, without needing the exact answer.

Left sum L₃ = 22 for y = 9 − x² on [0, 3]
y = 9 − x²
1232468100xy985
Figure 2. The function falls, so each left height is the highest point of its strip: every rectangle pokes above the curve and L₃ = 9 + 8 + 5 = 22 overestimates the true area, 18.

You can usually tell which way an estimate is wrong just from the shape of the graph.

If \( f \) on \( [a, b] \) isOverestimateUnderestimate
increasingright sumleft sum
decreasingleft sumright sum
concave uptrapezoidal summidpoint sum
concave downmidpoint sumtrapezoidal sum

The reasons are pictures. If \( f \) is decreasing, the left end of each strip is its highest point, so left rectangles stick out above the curve (Figure 2). The top of a trapezium is a chord, and a concave down curve bulges above its chords, so trapezia miss a sliver of area. The midpoint rectangle has the same area as the trapezium under the tangent at the midpoint, and a concave down curve lies below its tangents, so the midpoint sum is slightly too big. For \( 9-x^2 \), which is decreasing and concave down on \( [0, 3] \), all four predictions match the numbers above.

Common mistakeUsing the average of the two end heights as the midpoint height. The midpoint sum needs \( f \) evaluated at the midpoint: for the strip \( [0, 1] \) above, that is \( f(0.5) = 8.75 \), not \( \tfrac12(9 + 8) = 8.5 \). The average of the end heights is what the trapezoidal rule uses. Also count carefully: \( n \) strips need \( n + 1 \) dividing points.

An economics example: revenue from a sales log. Data rarely arrive at equal intervals. A café records the rate \( R(t) \) at which it takes money, in dollars per hour, \( t \) hours after opening.

\( t \) (hours)01347
\( R(t) \) ($ per hour)3048666042

Total revenue over the seven hours is \( \int_0^7 R(t)\,dt \) dollars. The strip widths are 1, 2, 1 and 3, so no single formula applies; take each strip on its own. A trapezoidal sum gives

\[ \begin{aligned} &1 \cdot \tfrac{30 + 48}{2} + 2 \cdot \tfrac{48 + 66}{2} + 1 \cdot \tfrac{66 + 60}{2} + 3 \cdot \tfrac{60 + 42}{2} \\ &= 39 + 114 + 63 + 153 = 369. \end{aligned} \]

So the café takes about $369 in its first seven hours. The left sum is \( 1(30) + 2(48) + 1(66) + 3(60) = 372 \) and the right sum is \( 1(48) + 2(66) + 1(60) + 3(42) = 366 \); their average is again 369. Because the rate rises and then falls, neither is guaranteed to be too big or too small.

Exam tipCambridge 9709 (Paper 2 topic 2.5, also on Paper 3) calls this the trapezium rule and writes it as \( \tfrac12 h\,[y_0 + 2(y_1 + \cdots + y_{n-1}) + y_n] \), with \( h \) for the strip width. You are usually asked to say whether your answer is an over- or underestimate, and the expected reason is the concavity of the curve, ideally backed up by the sign of the second derivative. AP free-response questions (topics 6.1 to 6.2) prefer tables with unequal widths and always want units.

The definite integral as a limit of sums

More strips give better estimates. The exact area is the value the estimates close in on as the strips become infinitely thin. To say this precisely you need sigma notation: \( \sum_{i=1}^{n} a_i \) means “add up \( a_i \) for \( i = 1 \) to \( n \)”, so for example \( \sum_{i=1}^{4} 3i = 3 + 6 + 9 + 12 = 30 \).

Key termDefinite integral: for \( f \) continuous on \( [a, b] \), with \( \Delta x = \dfrac{b-a}{n} \) and \( x_i = a + i\,\Delta x \), \[ \int_a^b f(x)\,dx = \lim_{n \to \infty} \sum_{i=1}^{n} f(x_i)\,\Delta x. \] The same limit is reached with left endpoints, midpoints or any point in each strip. The sign \( \int \) is a stretched S, for “sum”, and \( f(x)\,dx \) recalls a strip of height \( f(x) \) and tiny width.

For simple functions you can actually take this limit. For \( \int_0^3 (9-x^2)\,dx \), the right sum uses \( \Delta x = \tfrac3n \) and \( x_i = \tfrac{3i}{n} \). With the standard result \( \sum_{i=1}^{n} i^2 = \tfrac16 n(n+1)(2n+1) \),

\[ \begin{aligned} R_n &= \sum_{i=1}^{n} \left(9-\frac{9i^2}{n^2}\right)\frac{3}{n} = 27-\frac{27}{n^3}\cdot\frac{n(n+1)(2n+1)}{6} \\ &= 27-\frac92\left(1 + \frac1n\right)\left(2 + \frac1n\right). \end{aligned} \]

Check: \( n = 3 \) gives \( 27-\tfrac92 \cdot \tfrac43 \cdot \tfrac73 = 13 \), the right sum found earlier. With \( n = 12 \) it is about 16.84 and with \( n = 100 \) about 17.86. As \( n \to \infty \) both brackets tend to 1 and 2, so \( R_n \to 27-9 = 18 \). The exact area is 18.

Right sum R₁₂ ≈ 16.84 for y = 9 − x² on [0, 3]
y = 9 − x²
1232468100xy
Figure 3. With 12 right rectangles the gaps under the curve are much smaller. R₃ = 13, R₁₂ ≈ 16.84, R₁₀₀ ≈ 17.86: the sums close in on the exact area, 18.

AP multiple-choice questions (topic 6.3) usually run this backwards: you are given the limit of a sum and asked which integral it is. Read off three things: the width \( \Delta x \), which gives \( b-a \); the expression for \( x_i \), which gives the starting point \( a \); and what the function does to \( x_i \).

Worked example

Write \( \displaystyle\lim_{n \to \infty} \sum_{i=1}^{n} \sqrt{2 + \frac{5i}{n}}\cdot\frac{5}{n} \) as a definite integral.

Step 1The width is \( \Delta x = \tfrac5n \), so the interval has length \( b-a = 5 \).
Step 2The points are \( x_i = 2 + \tfrac{5i}{n} \). At \( i = 0 \) this is 2, and at \( i = n \) it is 7, so \( a = 2 \) and \( b = 7 \).
Step 3The function takes the square root of \( x_i \), so \( f(x) = \sqrt{x} \).

The limit is \( \displaystyle\int_2^7 \sqrt{x}\,dx \). Reading the points as \( x_i = \tfrac{5i}{n} \) and the function as \( \sqrt{2 + x} \) gives the equally correct \( \int_0^5 \sqrt{2 + x}\,dx \): the same area slid 2 units to the left.

Properties of definite integrals

A definite integral is a signed area, so a handful of rules follow straight from pictures. They are tested constantly, often with no formula for \( f \) at all.

PropertyRule
Zero width\( \int_a^a f(x)\,dx = 0 \)
Reversing the limits\( \int_b^a f(x)\,dx = -\int_a^b f(x)\,dx \)
Joining intervals\( \int_a^c f(x)\,dx + \int_c^b f(x)\,dx = \int_a^b f(x)\,dx \)
Linearity\( \int_a^b [k f(x) \pm g(x)]\,dx = k\int_a^b f(x)\,dx \pm \int_a^b g(x)\,dx \)
Constant\( \int_a^b c\,dx = c(b-a) \), a rectangle

Reversing the limits makes every \( \Delta x \) negative, so every term of the Riemann sum changes sign. Linearity holds for every Riemann sum, so it holds for their limit.

Worked example

Given \( \int_0^5 f(x)\,dx = 8 \), \( \int_3^5 f(x)\,dx = -2 \) and \( \int_0^3 g(x)\,dx = 4 \), find (a) \( \int_0^3 f(x)\,dx \), (b) \( \int_5^3 f(x)\,dx \) and (c) \( \int_0^3 [3f(x)-2g(x) + 1]\,dx \).

Step 1(a) Join intervals: \( \int_0^3 f + \int_3^5 f = \int_0^5 f \), so \( \int_0^3 f(x)\,dx = 8-(-2) = 10 \).
Step 2(b) Reverse the limits: \( \int_5^3 f(x)\,dx = -(-2) = 2 \).
Step 3(c) Linearity, with the constant 1 giving a rectangle of width 3: \( 3(10)-2(4) + 1(3) = 25 \).

Part (c) is where marks are lost: the \( +1 \) contributes \( 1 \times 3 = 3 \), not 1.

Geometry evaluates some integrals with no calculus at all. The graph of \( y = \sqrt{9-x^2} \) is the top half of the circle \( x^2 + y^2 = 9 \), so \( \int_{-3}^{3} \sqrt{9-x^2}\,dx = \tfrac12\pi(3)^2 = \tfrac{9\pi}{2} \). The graph of \( y = |x-2| \) on \( [0, 6] \) is two triangles, so \( \int_0^6 |x-2|\,dx = 2 + 8 = 10 \). And for an odd function such as \( x^5 \), the areas either side of 0 cancel exactly: \( \int_{-2}^{2} x^5\,dx = 0 \).

The same thinking gives a first look at consumer surplus. If demand is \( P = 60-2Q \) and the price is $20, then 20 units are bought, and buyers gain the gap between what they would have paid and what they did pay. That gain is the area between the demand line and the price line, \( \int_0^{20} (40-2Q)\,dQ \), a triangle of area \( \tfrac12(20)(40) = \$400 \). Step 22 handles curved demand curves.

Common mistakeTreating “the integral” and “the area” as the same thing when part of the graph is below the axis. \( \int_0^{2\pi} \sin x\,dx = 0 \), but the region between the curve and the axis certainly has area. For area, or for total distance, integrate \( |f| \) or split the interval where \( f \) changes sign and add the sizes.

Practise: 6 questions

Try each one on paper first, then check the worked answer.

EasyQ1. A tap fills a bath at 8 litres per minute for 3 minutes, then at 5 litres per minute for 4 minutes. Sketch the rate graph and find the total volume of water. Show worked answer
The rate graph is two rectangles: height 8 over \( 0 \le t \le 3 \) and height 5 over \( 3 \le t \le 7 \).
Areas: \( 8 \times 3 = 24 \) and \( 5 \times 4 = 20 \).
Total volume \( = 24 + 20 = 44 \) litres (litres per minute \( \times \) minutes).
EasyQ2. For \( \int_0^2 (x^2 + 1)\,dx \) with two strips of width 1, find the left sum, the right sum and the trapezoidal sum. Show worked answer
Heights: \( f(0) = 1 \), \( f(1) = 2 \), \( f(2) = 5 \).
Left sum: \( 1(1) + 1(2) = 3 \).
Right sum: \( 1(2) + 1(5) = 7 \).
Trapezoidal sum: \( \tfrac12(1)[1 + 2(2) + 5] = 5 \), the average of 3 and 7.
(The exact value is \( \tfrac{14}{3} \approx 4.67 \): the curve is increasing and concave up, so left is under and right and trapezoidal are over.)
MediumQ3. Use the trapezium rule with 4 intervals to estimate \( \int_0^4 2^x\,dx \). State, with a reason, whether your answer is an overestimate or an underestimate. Show worked answer
\( h = 1 \); heights at \( x = 0, 1, 2, 3, 4 \) are \( 1, 2, 4, 8, 16 \).
Estimate \( = \tfrac12(1)[1 + 16 + 2(2 + 4 + 8)] = \tfrac12(45) = 22.5 \).
\( y = 2^x \) has second derivative \( (\ln 2)^2\,2^x > 0 \), so the curve is concave up and lies below every chord.
So 22.5 is an overestimate. (The exact value is \( \tfrac{15}{\ln 2} \approx 21.64 \).)
MediumQ4. Write \( \displaystyle\lim_{n \to \infty} \sum_{i=1}^{n} \left(1 + \frac{3i}{n}\right)^3 \frac{3}{n} \) as a definite integral with lower limit 1. Show worked answer
Width \( \Delta x = \tfrac3n \), so \( b-a = 3 \).
Points \( x_i = 1 + \tfrac{3i}{n} \) run from 1 (at \( i = 0 \)) to 4 (at \( i = n \)).
The function cubes \( x_i \).
So the limit is \( \displaystyle\int_1^4 x^3\,dx \). (Equivalently \( \int_0^3 (1 + x)^3\,dx \).)
MediumQ5. Given \( \int_{-2}^{4} f(x)\,dx = 10 \) and \( \int_{-2}^{1} f(x)\,dx = 3 \), find (a) \( \int_4^1 f(x)\,dx \) and (b) \( \int_1^4 [2f(x) + 3]\,dx \). Show worked answer
First \( \int_1^4 f(x)\,dx = 10-3 = 7 \) (joining intervals).
(a) Reverse the limits: \( \int_4^1 f(x)\,dx = -7 \).
(b) \( 2(7) + 3 \times (4-1) = 14 + 9 = 23 \).
ExamQ6. Water flows into a reservoir at a rate \( R(t) \) cubic metres per hour, where \( R \) is differentiable. Selected values are shown.
\( t \) (hours): 0, 2, 5, 6, 10
\( R(t) \) (m³/h): 12, 18, 22, 20, 14
(a) Use a trapezoidal sum with the four subintervals in the table to approximate \( \int_0^{10} R(t)\,dt \). [2] (b) Interpret the meaning of \( \int_0^{10} R(t)\,dt \) in context, with units. [1] (c) Use a left Riemann sum with the two subintervals in the table to approximate \( \int_0^5 R(t)\,dt \). Given that \( R \) is increasing on \( 0 \le t \le 5 \), is this an overestimate or an underestimate? Give a reason. [3] Show worked answer
(a) \( 2 \cdot \tfrac{12 + 18}{2} + 3 \cdot \tfrac{18 + 22}{2} + 1 \cdot \tfrac{22 + 20}{2} + 4 \cdot \tfrac{20 + 14}{2} \) [M1]
\( = 30 + 60 + 21 + 68 = 179 \) m³. [A1]
(b) \( \int_0^{10} R(t)\,dt \) is the total volume of water, in cubic metres, that flows into the reservoir over the 10 hours from \( t = 0 \) to \( t = 10 \). [B1]
(c) \( 2(12) + 3(18) = 24 + 54 = 78 \) m³. [M1 A1]
Underestimate: \( R \) is increasing on \( [0, 5] \), so on each subinterval the left endpoint gives the smallest value of \( R \), and each rectangle lies below the graph. [B1]
Total: 6 marks.

Check yourself

1. \( f \) is increasing and concave down on \( [a, b] \). Which of these must overestimate \( \int_a^b f(x)\,dx \)?

For an increasing function the right end of each strip is its highest point, so right rectangles poke above the curve. The left sum and (for concave down) the trapezoidal sum are underestimates.

2. If \( \int_1^5 f(x)\,dx = 6 \) and \( \int_1^3 f(x)\,dx = 10 \), what is \( \int_3^5 f(x)\,dx \)?

Joining intervals: \( \int_1^3 f + \int_3^5 f = \int_1^5 f \), so \( \int_3^5 f = 6-10 = -4 \). A negative answer just means more of the graph is below the axis on \( [3, 5] \).

3. Which integral equals \( \displaystyle\lim_{n \to \infty} \sum_{i=1}^{n} \left(3 + \frac{2i}{n}\right)^2 \frac{2}{n} \)?

\( \Delta x = \tfrac2n \) gives length 2, and \( x_i = 3 + \tfrac{2i}{n} \) runs from 3 to 5, with the function squaring \( x_i \). The third option shifts twice; the second forgets the start at 3.

Your score: 0 out of 3

The short version

  • The area under a rate graph is the total (net) change; area below the axis counts as negative. Displacement is \( \int v\,dt \); distance is \( \int |v|\,dt \).
  • Left, right and midpoint sums use rectangles; the trapezoidal sum is \( \tfrac12(L_n + R_n) \). Increasing: left under, right over. Concave up: trapezoidal over, midpoint under (reverse both for decreasing or concave down).
  • With unequal widths, work strip by strip and give units.
  • \( \int_a^b f(x)\,dx = \lim_{n \to \infty} \sum f(x_i)\,\Delta x \). To read a limit of a sum as an integral, find \( \Delta x \), the starting point and the function.
  • Reversing the limits changes the sign; integrals over joining intervals add; constants and sums come out of the integral.
  • The full chapter in Mathematics Made Simple has many more worked examples and a full set of practice questions with a complete answer key.
Want more questions like these, with worked answers?
The practice book has hundreds more, graded from easy to exam level.
Next: step 21 of 33The Fundamental Theorem of Calculus