Calculus3Introduction to Integration4 of 6
Introduction to Integration · 4

Riemann Sums

1

Estimating with left and right sums

To find ∫abf(x) dx\int_a^b f(x)\,dx, we usually look for an antiderivative FF and evaluate F(b)−F(a)F(b) - F(a). But what if we can't write down an antiderivative, like for ∫e−x2 dx\int e^{-x^2}\,dx, or we only have a table of measured values? Then we have to estimate the integral.

Let's practise on an integral we can already find, ∫04(2+5x−x2) dx=803\int_0^4 (2 + 5x - x^2)\,dx = \frac{80}{3}, or about 26.6726.67, so we can see how close an estimate gets. Suppose we only know f(x)=2+5x−x2f(x) = 2 + 5x - x^2 at five points.

x01234f(x)26886\displaystyle \begin{array}{c|ccccc} x & 0 & 1 & 2 & 3 & 4 \\ \hline f(x) & 2 & 6 & 8 & 8 & 6 \end{array}

We split [0,4][0, 4] into 44 equal pieces, which tests call subintervals, and build a rectangle on each one. But the curve's height changes across each piece, so which height should a rectangle use?

Estimate ∫04(2+5x−x2) dx\int_0^4 (2 + 5x - x^2)\,dx from five values with left and right sums
00
11
22
33
44
xx
yy
22
66
88
88
66
Text solution
The width of each pieceThe interval has length 4−0=44 - 0 = 4, shared by 44 pieces.
width\displaystyle \text{width} =4−04\displaystyle = \frac{4 - 0}{4} =1\displaystyle = 1
Only the ends differThe values f(1),f(2)f(1), f(2) and f(3)f(3) are in both sums, because 1,21, 2 and 33 are the right end of one piece and the left end of the next. Subtracting cancels them.
28−24\displaystyle \rgt{28} - \lft{24} =f(4)−f(0)\displaystyle = \rgt{f(4)} - \lft{f(0)} =4\displaystyle = 4

A left sum takes each height at the left end of its piece, and a right sum takes it at the right end. Any sum like these, where we cut an interval into pieces and add up width⋅height\text{width} \cdot \text{height} for each piece, is called a Riemann sum.

00
11
22
33
44
xx
yy
2\htmlClass{lc-pink}{2}
6\htmlClass{lc-pink}{6}
8\htmlClass{lc-pink}{8}
8\htmlClass{lc-pink}{8}
y=f(x)y = f(x)
00
11
22
33
44
xx
6\htmlClass{lc-blue}{6}
8\htmlClass{lc-blue}{8}
8\htmlClass{lc-blue}{8}
6\htmlClass{lc-blue}{6}
Left sum
=1⋅f(0)+1⋅f(1)+1⋅f(2)+1⋅f(3)+1⋅f(4)=24\displaystyle {= 1\cdot\lft{f(0)} + 1\cdot\lft{f(1)} + 1\cdot\lft{f(2)} + 1\cdot\lft{f(3)} \phantom{{} + 1\cdot f(4)} = \lft{24}}
Right sum
=1⋅f(0)+1⋅f(1)+1⋅f(2)+1⋅f(3)+1⋅f(4)=28\displaystyle {= \phantom{1\cdot f(0) + {}} 1\cdot\rgt{f(1)} + 1\cdot\rgt{f(2)} + 1\cdot\rgt{f(3)} + 1\cdot\rgt{f(4)} = \rgt{28}}
left sumright sum+  1⋅f(0)+  1⋅f(1)+  1⋅f(1)+  1⋅f(2)+  1⋅f(2)+  1⋅f(3)+  1⋅f(3)+  1⋅f(4)=  24=  28\displaystyle {\begin{array}{lll} \lft{\text{left sum}} & \qquad & \rgt{\text{right sum}}\\[4pt] \phantom{+}\;1\cdot\lft{f(0)} & & \\ +\;1\cdot\lft{f(1)} & & \phantom{+}\;1\cdot\rgt{f(1)}\\ +\;1\cdot\lft{f(2)} & & +\;1\cdot\rgt{f(2)}\\ +\;1\cdot\lft{f(3)} & & +\;1\cdot\rgt{f(3)}\\ & & +\;1\cdot\rgt{f(4)}\\[4pt] =\;\lft{24} & & =\;\rgt{28} \end{array}}

The exact area lies between the two estimates, with the left sum below it and the right sum above it.

2020
3232
803\dfrac{80}{3}
24\htmlClass{lc-pink}{24}
28\htmlClass{lc-blue}{28}
24<803<28\displaystyle {\lft{24} < \frac{80}{3} < \rgt{28}}
2

Overestimates, underestimates, and inscribed rectangles

Our left sum of 24\lft{24} came out less than 803\frac{80}{3}, while the right sum of 28\rgt{28} came out greater. Does a left sum always underestimate the integral? Look at the fourth left rectangle, on [3,4][3, 4].

00
11
22
33
44
2.52.5
xx
yy
8.258.25
2\htmlClass{lc-pink}{2}
6\htmlClass{lc-pink}{6}
8\htmlClass{lc-pink}{8}
8\htmlClass{lc-pink}{8}
22
Compare left, inscribed, and circumscribed sums for y=2+5x−x2y = 2 + 5x - x^2 on [0,4][0, 4]
00
11
22
33
44
xx
yy
2\htmlClass{lc-pink}{2}
6\htmlClass{lc-pink}{6}
8\htmlClass{lc-pink}{8}
8\htmlClass{lc-pink}{8}
2020
3232
803\dfrac{80}{3}
24\htmlClass{lc-pink}{24}
Text solution
The fourth pieceOn [0,3][0, 3], each left end gives the smallest value on its piece, even on [2,3][2, 3], where the curve peaks at 8.258.25 between two 88s. On [3,4][3, 4], ff falls from 88 to 66, so the left height is the largest value there, and that rectangle sits above the curve by as much as 22. The left sum is still under 803\frac{80}{3} only because the first three rectangles miss more area than the fourth one adds.
Left sum and inscribed sumOn [3,4][3, 4], the inscribed height is the smallest value, f(4)=6\fit{f(4) = 6}, not the left height 8\lft{8}. That one piece is the whole difference.
24−22\displaystyle \lft{24} - \fit{22} =8−6\displaystyle = \lft{8} - \fit{6}
Below the axisFor g(x)=−(2+5x−x2)g(x) = -(2 + 5x - x^2), each inscribed height is the value nearest 00 on its piece, so the inscribed sum is closer to 00 than the integral.
−803<−22<0\displaystyle -\frac{80}{3} < \fit{-22} < 0

A left sum is guaranteed to be an underestimate when ff increases across the whole interval [a,b][a, b]. Then the left end of every piece has the smallest value and the right end the largest. If ff decreases across the whole interval, those roles swap.

When f increases
left sum<∫abf(x) dx<right sum\displaystyle {\lft{\text{left sum}} < \int_a^b f(x)\,dx < \rgt{\text{right sum}}}
When f decreases
right sum<∫abf(x) dx<left sum\displaystyle {\rgt{\text{right sum}} < \int_a^b f(x)\,dx < \lft{\text{left sum}}}

When ff increases and then decreases, we choose the height on each piece separately instead. Inscribed rectangles fit inside the region, so each one uses the smallest value of ff on its piece. Circumscribed rectangles cover the region, so each one uses the largest. That value can be inside the piece, like the local maximum f(2.5)=8.25\fit{f(2.5) = 8.25} on [2,3][2, 3].

00
11
22
33
44
2.52.5
xx
yy
2\htmlClass{lc-orange}{2}
6\htmlClass{lc-orange}{6}
8\htmlClass{lc-orange}{8}
6\htmlClass{lc-orange}{6}
6\htmlClass{lc-orange}{6}
8\htmlClass{lc-orange}{8}
8.25\htmlClass{lc-orange}{8.25}
8\htmlClass{lc-orange}{8}
Inscribed sum
=2+6+8+6=22\displaystyle {= \fit{2} + \fit{6} + \fit{8} + \fit{6} = \fit{22}}
Circumscribed sum
=6+8+8.25+8=30.25\displaystyle {= \fit{6} + \fit{8} + \fit{8.25} + \fit{8} = \fit{30.25}}
22<803<30.25\displaystyle {\fit{22} < \frac{80}{3} < \fit{30.25}}

When the curve is below the x-axis, like g(x)=−(2+5x−x2)g(x) = -(2 + 5x - x^2), the heights are negative, and an inscribed rectangle reaches down only to the value nearest 00 on its piece.

00
11
22
33
44
xx
−2\htmlClass{lc-orange}{−2}
−6\htmlClass{lc-orange}{−6}
−8\htmlClass{lc-orange}{−8}
−6\htmlClass{lc-orange}{−6}
y=−(2+5x−x2)y = -(2 + 5x - x^2)
inscribed\displaystyle \fit{\text{inscribed}} =−2−6−8−6\displaystyle = {\fit{-2}\fit{{} - 6}\fit{{} - 8}\fit{{} - 6}} =−22\displaystyle = \fit{-22}
∫04−(2+5x−x2) dx\displaystyle {\int_0^4 -(2 + 5x - x^2)\,dx} =−803\displaystyle = -\frac{80}{3}

Is a left sum always an underestimate?

Change where the function increases
3

Midpoint and trapezoid sums

The left and right sums took the height at an end of each piece, and they gave 24\lft{24} and 28\rgt{28} around the exact 803≈26.67\frac{80}{3} \approx 26.67. Here are two ways to get closer.

Instead of an end, we can take the height at the middle of each piece. That's the midpoint sum.

00
11
22
33
44
xx
yy
4.25\htmlClass{lc-green}{4.25}
7.25\htmlClass{lc-green}{7.25}
8.25\htmlClass{lc-green}{8.25}
7.25\htmlClass{lc-green}{7.25}
midpoint sum=1⋅f(0.5)+1⋅f(1.5)+1⋅f(2.5)+1⋅f(3.5)=4.25+7.25+8.25+7.25=27\displaystyle \begin{aligned}\mdp{\text{midpoint sum}} &= 1\cdot\mdp{f(0.5)} + 1\cdot\mdp{f(1.5)} + 1\cdot\mdp{f(2.5)} + 1\cdot\mdp{f(3.5)}\\ &= 4.25 + 7.25 + 8.25 + 7.25 = \mdp{27}\end{aligned}
midpoint sum=1⋅f(0.5)+1⋅f(1.5)+1⋅f(2.5)+1⋅f(3.5)=4.25+7.25+8.25+7.25=27\displaystyle \begin{aligned}&\mdp{\text{midpoint sum}}\\ &= 1\cdot\mdp{f(0.5)} + 1\cdot\mdp{f(1.5)}\\ &\quad + 1\cdot\mdp{f(2.5)} + 1\cdot\mdp{f(3.5)}\\ &= 4.25 + 7.25 + 8.25 + 7.25\\ &= \mdp{27}\end{aligned}

Or we can connect the points on the curve at the two ends of each piece with a straight segment. That gives a trapezoid on each piece, and adding their areas gives the trapezoid sum. On [0,1][0, 1], the trapezoid's area is the average of the left and right rectangles' areas.

00
11
2\htmlClass{lc-pink}{2}
6\htmlClass{lc-blue}{6}
1⋅2+62=4=1⋅2+1⋅62\displaystyle \begin{aligned}1\cdot\frac{\lft{2} + \rgt{6}}{2} &= \trp{4}\\[4pt] &= \frac{1\cdot \lft{2} + 1\cdot \rgt{6}}{2}\end{aligned}

That happens on every piece, so the same is true of the whole sums:

trapezoid sum\displaystyle \trp{\text{trapezoid sum}} =left sum+right sum2\displaystyle = \frac{\lft{\text{left sum}} + \rgt{\text{right sum}}}{2}

Which of the two is too big, and which is too small? That depends on concavity.

Find the midpoint and trapezoid sums for ∫04(2+5x−x2) dx\int_0^4 (2 + 5x - x^2)\,dx and compare them using concavity
00
11
22
33
44
xx
yy
2020
3232
803\dfrac{80}{3}
24\htmlClass{lc-pink}{24}
28\htmlClass{lc-blue}{28}
Text solution
The four trapezoids
2+62+6+82+8+82+8+62=4+7+8+7=26=24+282\displaystyle \begin{aligned}&\trp{\frac{2 + 6}{2}} + \trp{\frac{6 + 8}{2}} + \trp{\frac{8 + 8}{2}} + \trp{\frac{8 + 6}{2}}\\ &= 4 + 7 + 8 + 7 = \trp{26} = \frac{\lft{24} + \rgt{28}}{2}\end{aligned}
Concave down, so the trapezoids fall shortThe second derivative is −2-2, so ff is concave down, and the curve lies above the segment joining any two of its points. Every trapezoid top is under the curve.
26<803\displaystyle \trp{26} < \frac{80}{3}
Turn the midpoint top onto the tangentTurning the top about its midpoint removes one triangle and adds an equal one, so the area stays 4.25\mdp{4.25}. The tangent lies above a concave-down curve, so each midpoint rectangle has more area than the curve on its piece.
27>803\displaystyle \mdp{27} > \frac{80}{3}

Here's that turn on [0,1][0, 1], onto the tangent line at x=0.5x = 0.5.

00
11
4.25\htmlClass{lc-green}{4.25}
2.252.25
6.256.25
f′(x)=5−2x,f′(0.5)=4\displaystyle \begin{aligned}f'(x) = 5 - 2x, \qquad f'(0.5) = 4\end{aligned}
tangent at 0.5:y=4.25+4(x−0.5)x=0→2.25,x=1→6.25\displaystyle \begin{aligned}&\text{tangent at } 0.5{:} \quad y = \mdp{4.25} + 4(x - 0.5)\\ &x = 0 \to 2.25, \quad x = 1 \to 6.25\end{aligned}
tangent at 0.5:y=4.25+4(x−0.5)x=0→2.25,x=1→6.25\displaystyle \begin{aligned}&\text{tangent at } 0.5{:}\\ &y = \mdp{4.25} + 4(x - 0.5)\\ &x = 0 \to 2.25, \quad x = 1 \to 6.25\end{aligned}
1⋅2.25+6.252\displaystyle {1\cdot\frac{2.25 + 6.25}{2}} =4.25\displaystyle = \mdp{4.25} =1⋅f(0.5)\displaystyle = 1\cdot\mdp{f(0.5)}

If a function is concave up instead, both arguments reverse. The curve lies below its chords and above its tangent lines, so the trapezoid sum is an overestimate and the midpoint sum is an underestimate.

Notice that ff is increasing on [0,1][0, 1], but the trapezoid there has area 4\trp{4}, less than the exact ∫01(2+5x−x2) dx=256≈4.17\int_0^1 (2 + 5x - x^2)\,dx = \frac{25}{6} \approx 4.17. For trapezoid and midpoint sums, what decides over or under is concavity, not whether ff is increasing or decreasing.

2020
3232
803\dfrac{80}{3}
24\htmlClass{lc-pink}{24}
26\htmlClass{lc-violet}{26}
27\htmlClass{lc-green}{27}
28\htmlClass{lc-blue}{28}
26<803<27\displaystyle {\trp{26} < \frac{80}{3} < \mdp{27}}

If a function is increasing, does its trapezoid sum have to be an overestimate?

Change concavity, keep the endpoints
4

Simpson's rule

For 2+5x−x22 + 5x - x^2, the trapezoid sum on 44 pieces was 26\trp{26}, under the exact area of 803\frac{80}{3}, and the midpoint sum was 27\mdp{27}, over it. Can we combine them so their errors cancel out?

That's what Simpson's rule does. It groups the 44 pieces into 22 pairs of width 22, [0,2][0, 2] and [2,4][2, 4], which is why it needs an even number of pieces.

00
11
22
33
44
xx
yy
6\htmlClass{lc-green}{6}
8\htmlClass{lc-green}{8}
2\htmlClass{lc-violet}{2}
8\htmlClass{lc-violet}{8}
6\htmlClass{lc-violet}{6}
Use Simpson's rule with n=4n = 4 to estimate ∫04(2+5x−x2) dx\int_0^4 (2 + 5x - x^2)\,dx
00
11
22
33
44
xx
yy
2020
3232
803\dfrac{80}{3}
26\htmlClass{lc-violet}{26}
27\htmlClass{lc-green}{27}
Text solution
Both sums on the pairsThe middles are 1\mdp{1} and 3\mdp{3}, and the ends are 00, 22 and 44. The trapezoid sum misses by twice as much as the midpoint sum.
2⋅f(1)+2⋅f(3)\displaystyle 2\cdot\mdp{f(1)} + 2\cdot\mdp{f(3)} =28\displaystyle = \mdp{28}
10+14\displaystyle 10 + 14 =24\displaystyle = \trp{24}
28−803\displaystyle \mdp{28} - \frac{80}{3} =43\displaystyle = \mdp{\frac43}
803−24\displaystyle \frac{80}{3} - \trp{24} =83\displaystyle = \trp{\frac83}
Why it's 2 to 1On y=x2y = x^2 over [−1,1][-1, 1], the exact area is 23\frac23, the trapezoid gives 2\trp{2} and the midpoint gives 0\mdp{0}. Both sums are exact for any line, and every parabola is an x2x^2 term plus a line, so the ratio holds on every parabola.
2−23\displaystyle \trp{2} - \frac23 =43\displaystyle = \trp{\frac43}
23−0\displaystyle \frac23 - \mdp{0} =23\displaystyle = \mdp{\frac23}
Weight the midpoint sum twice
23⋅28+13⋅24\displaystyle {\frac23\cdot \mdp{28} + \frac13\cdot \trp{24}} =563+243\displaystyle = {\frac{56}{3} + \frac{24}{3}} =803\displaystyle = \frac{80}{3}

So Simpson's rule gives the midpoint sum twice the weight of the trapezoid sum, both taken on the pairs of pieces.

Simpson's rule
=23 (midpoint sum)+13 (trapezoid sum)\displaystyle {= \frac23\,(\mdp{\text{midpoint sum}}) + \frac13\,(\trp{\text{trapezoid sum}})}
=23 (midpoint sum)+13 (trapezoid sum)\displaystyle \begin{aligned}&= \frac23\,(\mdp{\text{midpoint sum}})\\ &\quad + \frac13\,(\trp{\text{trapezoid sum}})\end{aligned}

On any parabola, Simpson's rule gives the exact integral. Other curves aren't parabolas, but over a small pair a smooth curve is close to one, so the two errors almost cancel, and the estimate is usually far closer than the trapezoid or midpoint sum alone.

5

Sums from a table

When we have a formula, we can chop the interval into equal pieces. But when the values come from a table, the inputs aren't always evenly spaced.

t023710r(t)47853\displaystyle \begin{array}{c|ccccc} t & 0 & 2 & 3 & 7 & 10 \\ \hline r(t) & 4 & 7 & 8 & 5 & 3 \end{array}

Here the gaps between the times are 22, 11, 44, and 33. We don't know r(t)r(t) between these times, so an estimate is the best we can do.

00
22
33
77
1010
tt
rr
44
77
88
55
33
22
11
44
33
Estimate ∫010r(t) dt\int_0^{10} r(t)\,dt from an unevenly spaced table
tt
r(t)r(t)
00
44
22
77
33
88
77
55
1010
33
00
22
33
77
1010
tt
rr
Text solution
Each piece has its own widthEach piece runs from one time in the table to the next.
2−0=2,3−2=17−3=4,10−7=3\displaystyle \begin{aligned}2 - 0 &= 2, & 3 - 2 &= 1\\ 7 - 3 &= 4, & 10 - 7 &= 3\end{aligned}
Multiply each height by its own widthAn average width of 104=2.5\frac{10}{4} = 2.5 for every piece would give 6060, which is wrong: the height 88 stands on a piece of width 44. The trapezoid sum is still the average of the left and right sums.
2⋅4+1⋅7+4⋅8+3⋅5\displaystyle 2\cdot \lft{4} + 1\cdot \lft{7} + 4\cdot \lft{8} + 3\cdot \lft{5} =62\displaystyle = \lft{62}
2⋅7+1⋅8+4⋅5+3⋅3\displaystyle 2\cdot \rgt{7} + 1\cdot \rgt{8} + 4\cdot \rgt{5} + 3\cdot \rgt{3} =51\displaystyle = \rgt{51}
56.5\displaystyle \trp{56.5} =62+512\displaystyle = \frac{\lft{62} + \rgt{51}}{2}

We also can't tell whether these sums are overestimates or underestimates without knowing whether r(t)r(t) is increasing, decreasing, or concave up or down between the points.

When a table value is negative, a trapezoid's average height can be negative too. With heights 11 and −2-2 on a piece of width 22, part of the trapezoid is above the axis, but its net area is negative.

tt
−12\htmlClass{lc-violet}{-\dfrac12}
11
−2-2
22
2⋅1+(−2)2=2⋅(−12)=−1\displaystyle \begin{aligned}2\cdot\trp{\frac{1 + (-2)}{2}} &= 2\cdot\Big(\trp{{-}\frac12}\Big)\\[4pt] &= \trp{-1}\end{aligned}

For a midpoint sum from a table, the middle of each piece has to be an input that's listed. In the table for 2+5x−x22 + 5x - x^2, pieces of width 11 would need 0.50.5, 1.51.5, 2.52.5, and 3.53.5, which aren't there. So we take two pieces of width 22, with middles 1\mdp{1} and 3\mdp{3}. That's the same midpoint sum of 28\mdp{28} we used in Simpson's rule.

x01234f(x)26886\displaystyle \begin{array}{c|ccccc} x & 0 & \mdp{1} & 2 & \mdp{3} & 4 \\ \hline f(x) & 2 & \mdp{6} & 8 & \mdp{8} & 6 \end{array}
[0,2], [2,4],middles 1, 3\displaystyle \begin{aligned}[0, 2],\ [2, 4], \qquad \text{middles } \mdp{1},\ \mdp{3}\end{aligned}
Midpoint sum
=2⋅f(1)+2⋅f(3)=12+16=28\displaystyle \begin{aligned}&= 2\cdot \mdp{f(1)} + 2\cdot \mdp{f(3)}\\ &= 12 + 16 = \mdp{28}\end{aligned}
6

The limit of Riemann sums

With 44 pieces, the inscribed rectangles gave 22\fit{22} and the circumscribed ones gave 30.25\fit{30.25}, with 803\frac{80}{3} between them. With 88 thinner pieces, the two sums close in on it.

00
11
22
33
44
xx
4 pieces4 \text{ pieces}
00
11
22
33
44
xx
8 pieces8 \text{ pieces}
4 pieces
22<803<30.25\displaystyle {\fit{22} < \frac{80}{3} < \fit{30.25}}
30.25−22\displaystyle {\fit{30.25} - \fit{22}} =8.25\displaystyle = 8.25
8 pieces
24.375<803<28.625\displaystyle {\fit{24.375} < \frac{80}{3} < \fit{28.625}}
28.625−24.375\displaystyle {\fit{28.625} - \fit{24.375}} =4.25\displaystyle = 4.25

As the pieces get thinner, that gap goes to 00, and both sums approach the exact area. The definite integral ∫04f(x) dx\int_0^4 f(x)\,dx is that value. To write a sum for any number of pieces nn, we use sigma notation, and then we'll read a limit of sums back as an integral.

Find the integral for lim⁡n→∞∑i=1n1+4in⋅4n\lim_{n\to\infty} \sum_{i=1}^{n} \sqrt{1 + \frac{4i}{n}}\cdot\frac4n
00
11
22
33
44
xx
4 pieces4 \text{ pieces}
2020
3232
803\dfrac{80}{3}
22\htmlClass{lc-orange}{22}
30.25\htmlClass{lc-orange}{30.25}
Text solution
Sigma notation∑i=14\sum_{i=1}^{4} means we evaluate the term at i=1,2,3,4i = 1, 2, 3, 4 and add them up, like the right sum with 44 pieces.
∑i=14f(i)⋅1\displaystyle \sum_{i=1}^{4} \rgt{f(i)}\cdot 1 =28\displaystyle = \rgt{28}
The right sum with nn piecesEach width is 4n\frac4n, and rectangle ii ends ii widths from 00, at 4in\rgt{\frac{4i}{n}}. At i=ni = n, that's 4\rgt{4}.
lim⁡n→∞∑i=1nf(4in)⋅4n\displaystyle \lim_{n\to\infty} \sum_{i=1}^{n} \rgt{f\Big(\frac{4i}{n}\Big)}\cdot\frac4n =∫04f(x) dx\displaystyle = \int_0^4 f(x)\,dx
Read the limit backThe 4n\frac4n multiplying the height is the width, so the length is n⋅4n=4n\cdot\frac4n = 4. Treating the right end 1+4in\rgt{1 + \frac{4i}{n}} as xx, the height is x\sqrt{x}, the right bound is 5\rgt{5}, and the left bound is 5−4=15 - 4 = 1.
∫15x dx\displaystyle \int_1^{\rgt{5}} \sqrt{x}\,dx =23(55−1)\displaystyle = \frac23\big(5\sqrt5 - 1\big)

With left ends instead, the heights are at 4(i−1)n\lft{\frac{4(i - 1)}{n}}, one width earlier. The right sum minus the left sum is just (f(4)−f(0))⋅4n=16n(\rgt{f(4)} - \lft{f(0)})\cdot\frac4n = \frac{16}{n}, which goes to 00, so both sums have the same limit.

Reading a limit of sums as an integral comes down to naming each part of the sum:

∑i=1n1+4in⏟right end of rectangle i⋅4n⏟width\displaystyle {\sum_{i=1}^{n} \sqrt{\underbrace{\rgt{1 + \frac{4i}{n}}}_{\text{right end of rectangle } i}}\cdot\underbrace{\frac4n}_{\text{width}}}
n⋅4n=4i=n→1+4=55−4=1\displaystyle \begin{aligned}n\cdot\frac4n &= 4\\ i = n \to \rgt{1 + 4} &= \rgt{5}\\ 5 - 4 &= 1\end{aligned}

We could also treat 4in\rgt{\frac{4i}{n}} as xx. Then the bounds are 00 and 4\rgt{4}, and the height is 1+x\sqrt{1 + x}. That curve is y=xy = \sqrt{x} on [1,5][1, 5] shifted 11 unit to the left, with the same rectangles and the same area, so either integral is a correct answer.

00
11
2\htmlClass{lc-blue}{2}
3\htmlClass{lc-blue}{3}
4\htmlClass{lc-blue}{4}
5\htmlClass{lc-blue}{5}
xx
2\htmlClass{lc-blue}{\sqrt2}
3\htmlClass{lc-blue}{\sqrt3}
2\htmlClass{lc-blue}{2}
5\htmlClass{lc-blue}{\sqrt5}
y=xy = \sqrt{x}
00
1\htmlClass{lc-blue}{1}
2\htmlClass{lc-blue}{2}
3\htmlClass{lc-blue}{3}
4\htmlClass{lc-blue}{4}
xx
2\htmlClass{lc-blue}{\sqrt2}
3\htmlClass{lc-blue}{\sqrt3}
2\htmlClass{lc-blue}{2}
5\htmlClass{lc-blue}{\sqrt5}
y=1+xy = \sqrt{1 + x}
∫15x dx=∫041+x dx\displaystyle \begin{aligned}&\int_1^{\rgt{5}} \sqrt{x}\,dx\\ &= \int_0^{\rgt{4}} \sqrt{1 + x}\,dx\end{aligned}

Why do the inscribed and circumscribed sums approach the same area?

Narrower rectangles

Which integral does this limit of sums represent?

Read the rectangles

Summary

What a Riemann sum adds up
Riemann sum=width⋅height+width⋅height+⋯\displaystyle \begin{aligned}&\text{Riemann sum}\\ &= \text{width}\cdot\text{height}\\ &\quad + \text{width}\cdot\text{height} + \cdots\end{aligned}

Split the interval into pieces, and build a rectangle on each piece. A left sum uses the height at the left end, a right sum uses the right end, and a midpoint sum uses the middle.

When values come from a table, each piece's width is the difference between neighbouring inputs. For a midpoint sum, if the inputs are evenly spaced, combine every two steps into one piece so the middle of each piece is an input from the table.

Overestimates and underestimates from increasing or decreasing

When ff increases across the whole interval, the left end gives the smallest value on each piece and the right end gives the largest. So the left sum is an underestimate and the right sum is an overestimate.

When ff decreases across the whole interval, the left sum is an overestimate and the right sum is an underestimate. If ff increases and then decreases, neither sum is guaranteed to be an overestimate or an underestimate.

Inscribed and circumscribed rectangles
00
11
22
33
44
xx
yy
2\htmlClass{lc-orange}{2}
6\htmlClass{lc-orange}{6}
8\htmlClass{lc-orange}{8}
6\htmlClass{lc-orange}{6}
6\htmlClass{lc-orange}{6}
8\htmlClass{lc-orange}{8}
8.25\htmlClass{lc-orange}{8.25}
8\htmlClass{lc-orange}{8}
inscribed=22circumscribed=30.25\displaystyle \begin{aligned}\fit{\text{inscribed}} &= \fit{22}\\ \fit{\text{circumscribed}} &= \fit{30.25}\end{aligned}
22<803<30.25\displaystyle {\fit{22} < \frac{80}{3} < \fit{30.25}}

An inscribed rectangle stays inside the region on its piece, so its height is the value of ff nearest the axis on that piece. A circumscribed rectangle covers the region on its piece, so its height is the value farthest from the axis.

When ff changes between increasing and decreasing inside a piece, check its local maximum or minimum. On [2,3][2, 3], the local maximum f(2.5)=8.25\fit{f(2.5) = 8.25} is greater than the values at either endpoint, so the circumscribed rectangle uses height 8.25\fit{8.25}.

Trapezoid and midpoint sums
trapezoid sum=left sum+right sum2\displaystyle \begin{aligned}&\trp{\text{trapezoid sum}}\\ &= \frac{\lft{\text{left sum}} + \rgt{\text{right sum}}}{2}\end{aligned}

Connecting the points on the curve at the ends of each piece gives us a trapezoid on that piece. The trapezoid sum is always the average of the left sum and the right sum.

When ff is concave down across the whole interval, chords lie below the curve and tangent lines lie above it, so the trapezoid sum is an underestimate and the midpoint sum is an overestimate. When ff is concave up across the whole interval, the trapezoid sum is an overestimate and the midpoint sum is an underestimate.

Simpson's rule
Simpson’s rule=23 (midpoint sum)+13 (trapezoid sum)on the pairs of pieces\displaystyle \begin{aligned}&\text{Simpson's rule}\\ &= \frac23\,(\mdp{\text{midpoint sum}})\\ &\quad + \frac13\,(\trp{\text{trapezoid sum}})\\ &\text{on the pairs of pieces}\end{aligned}

Simpson's rule groups the pieces into pairs, so we need an even number of pieces nn.

Because the trapezoid error on any parabola is twice the midpoint error on the opposite side, the errors cancel out completely, and Simpson's rule gives the exact integral. On a smooth curve, using small pairs usually gives a much closer estimate than either sum alone.

Turning a limit of sums into an integral
lim⁡n→∞∑i=1n1+4in⏟right end ofrectangle i⋅4n⏟width\displaystyle {\lim_{n\to\infty} \sum_{i=1}^{n} \sqrt{\underbrace{\rgt{1 + \frac{4i}{n}}}_{\substack{\text{right end of} \\ \text{rectangle } i}}}\cdot\underbrace{\frac4n}_{\text{width}}} =∫15x dx\displaystyle = {\int_1^{\rgt{5}} \sqrt{x}\,dx} =∫041+x dx\displaystyle = {\int_0^{\rgt{4}} \sqrt{1 + x}\,dx}

The factor 4n\frac4n multiplying the height is the width of each rectangle. Multiplying that width by nn gives the total interval length, n⋅4n=4n\cdot\frac4n = 4.

The input 1+4in\rgt{1 + \frac{4i}{n}} is the right end of rectangle ii, and the height is the square root of that right end. Setting i=ni = n gives the right bound, 1+4=5\rgt{1 + 4 = 5}. Subtracting the length 44 gives the left bound, 5−4=15 - 4 = 1, so the limit is ∫15x dx\int_1^{\rgt{5}} \sqrt{x}\,dx.

If we treat 4in\rgt{\frac{4i}{n}} as xx instead, the interval goes from 00 to 44 with height 1+x\sqrt{1 + x}, and we get ∫041+x dx\int_0^{\rgt{4}} \sqrt{1 + x}\,dx. It's the same area, shifted 1 unit to the left.

7

Practice

Enter exact values unless a problem asks for an approximation.

1
Let f(x)=x2+1f(x) = x^2 + 1. (a) Find the left Riemann sum for ∫03f(x) dx\displaystyle\int_0^3 f(x)\,dx with 3 subintervals of equal width. (b) Is it an overestimate or an underestimate of the integral? Explain.

The interval [0,3][0, 3] is split into 33 equal pieces. What are the left endpoints of those pieces?

If you got overestimate Check whether ff is increasing or decreasing on [0,3][0, 3]. Concavity decides trapezoid and midpoint sums, not left sums.

(b)\text{(b)}

Is ff increasing or decreasing on [0,3][0, 3]? That tells you whether the smallest value on each piece is at its left end or its right end.

Find the left Riemann sumThe interval [0,3][0, 3] has length 3, so 3 equal pieces have width 1, and we evaluate ff at the left end of each piece.
width\displaystyle \text{width} =3−03\displaystyle = \frac{3 - 0}{3} =1,[0,1], [1,2], [2,3]\displaystyle = 1, \qquad [0, 1],\ [1, 2],\ [2, 3]
1⋅f(0)+1⋅f(1)+1⋅f(2)\displaystyle 1\cdot \lft{f(0)} + 1\cdot \lft{f(1)} + 1\cdot \lft{f(2)} =1+2+5\displaystyle = 1 + 2 + 5 =8\displaystyle = 8
Check whether ff is increasing or decreasingThe derivative is positive for x>0x > 0, so ff is increasing on [0,3][0, 3].
f′(x)\displaystyle f'(x) =2x>0 for 0<x\displaystyle = 2x > 0 \text{ for } 0 < x ≤3\displaystyle \le 3
Because ff is increasing, the smallest value on each piece is at its left endpoint, so every left rectangle lies below the curve, and the left sum is an underestimate.
∫03(x2+1) dx\displaystyle \int_0^3 (x^2 + 1)\,dx =9+3\displaystyle = 9 + 3 =12>8\displaystyle = 12 > 8
2
The table gives values of v(t)v(t). Use a left Riemann sum with the four subintervals given by the table to estimate ∫06v(t) dt\displaystyle\int_0^6 v(t)\,dt.
t01346v(t)2−1−304\displaystyle \begin{array}{c|ccccc} t & 0 & 1 & 3 & 4 & 6 \\ \hline v(t) & 2 & -1 & -3 & 0 & 4 \end{array}

What is the width of [1,3][1, 3], and what is the height v(1)v(1) at its left end?

The tt-values are not evenly spaced, so we find the width of each subinterval separately.
1−0\displaystyle 1 - 0 =1,3−1\displaystyle = 1, \qquad 3 - 1 =2,4−3\displaystyle = 2, \qquad 4 - 3 =1,6−4\displaystyle = 1, \qquad 6 - 4 =2\displaystyle = 2
On each subinterval we multiply its width by the value of vv at its left end, keeping the negative signs.
1⋅2+2⋅(−1)+1⋅(−3)+2⋅0\displaystyle 1\cdot \lft{2} + 2\cdot\lft{(-1)} + 1\cdot\lft{(-3)} + 2\cdot \lft{0} =2−2−3+0\displaystyle = 2 - 2 - 3 + 0 =−3\displaystyle = -3
3
Let f(x)=x2−3x+4f(x) = x^2 - 3x + 4. Find the sum of the areas of the inscribed rectangles for the region under y=f(x)y = f(x) on [0,4][0, 4], using 4 subintervals of equal width.

On [1,2][1, 2], the endpoints give f(1)=2f(1) = 2 and f(2)=2f(2) = 2. Is 22 the smallest value of ff on that piece?

Four equal subintervals on [0,4][0, 4] have width 1, so let's evaluate f(x)f(x) at each endpoint.
f(0)\displaystyle f(0) =4,f(1)\displaystyle = 4, \quad f(1) =2,f(2)\displaystyle = 2, \quad f(2) =2,f(3)\displaystyle = 2, \quad f(3) =4,f(4)\displaystyle = 4, \quad f(4) =8\displaystyle = 8
Check for a minimum inside a pieceSetting f′(x)=0f'(x) = 0 gives the vertex at x=1.5x = 1.5 inside [1,2][1, 2], where the value of ff is less than at either endpoint.
f′(x)\displaystyle f'(x) =2x−3\displaystyle = 2x - 3 =0→x\displaystyle = 0 \to x =1.5,f(1.5)\displaystyle = 1.5, \qquad f(1.5) =2.25−4.5+4\displaystyle = 2.25 - 4.5 + 4 =1.75\displaystyle = 1.75
For inscribed rectangles, take the smallest value of ff on each piece, so we use 1.75\fit{1.75} on [1,2][1, 2] and the smaller endpoint value on the other three pieces.
[0,1]:2,[1,2]:1.75,[2,3]:2,[3,4]:4\displaystyle \begin{aligned}[0, 1]: \fit{2}, \qquad [1, 2]: \fit{1.75}, \qquad [2, 3]: \fit{2}, \qquad [3, 4]: \fit{4}\end{aligned}
1⋅2+1⋅1.75+1⋅2+1⋅4\displaystyle 1\cdot \fit{2} + 1\cdot \fit{1.75} + 1\cdot \fit{2} + 1\cdot \fit{4} =9.75\displaystyle = 9.75
4
(a) Use a trapezoid sum with 2 subintervals of equal width to estimate ∫04x dx\displaystyle\int_0^4 \sqrt{x}\,dx. (b) Is it an overestimate or an underestimate? Explain.

The interval [0,4][0, 4] is split into 2 equal pieces. What are the heights at x=0,2,4x = 0, 2, 4?

If you got overestimate Check the concavity of x\sqrt{x}. Whether a function increases or decreases decides left and right sums, but concavity decides trapezoid sums.

(b)\text{(b)}

Is the second derivative of x\sqrt{x} positive or negative on (0,4)(0, 4)?

Each of the 2 subintervals has width 2, and the area of each trapezoid is its width times the average of its two heights.
width\displaystyle \text{width} =2:2⋅0+22+2⋅2+42\displaystyle = 2: \qquad 2\cdot\trp{\frac{\sqrt0 + \sqrt2}{2}} + 2\cdot\trp{\frac{\sqrt2 + \sqrt4}{2}} =2+2+2\displaystyle = \sqrt2 + \sqrt2 + 2 =2+22\displaystyle = 2 + 2\sqrt2
Check concavityThe second derivative is negative for all x>0x > 0, so x\sqrt{x} is concave down.
(x)′′\displaystyle \big(\sqrt x\big)'' =−14x−32<0 for x>0\displaystyle = -\frac14 x^{-\frac32} < 0 \text{ for } x > 0
Because the curve is concave down, the straight line connecting the ends of each piece lies below the curve, so the trapezoid sum is an underestimate.
∫04x dx\displaystyle \int_0^4 \sqrt x\,dx =163≈5.33>2+22≈4.83\displaystyle = \frac{16}{3} \approx 5.33 > 2 + 2\sqrt2 \approx 4.83
5
The table gives values of f(x)f(x). Use a midpoint sum with 3 subintervals of equal width to estimate ∫012f(x) dx\displaystyle\int_0^{12} f(x)\,dx.
x024681012f(x)3589742\displaystyle \begin{array}{c|ccccccc} x & 0 & 2 & 4 & 6 & 8 & 10 & 12 \\ \hline f(x) & 3 & 5 & 8 & 9 & 7 & 4 & 2 \end{array}
x0246f(x)3589\displaystyle \begin{array}{c|cccc} x & 0 & 2 & 4 & 6 \\ \hline f(x) & 3 & 5 & 8 & 9 \end{array}
x81012f(x)742\displaystyle \begin{array}{c|ccc} x & 8 & 10 & 12 \\ \hline f(x) & 7 & 4 & 2 \end{array}

The three subintervals are [0,4][0, 4], [4,8][4, 8], and [8,12][8, 12]. What are their midpoints?

Find the subintervals and midpointsDividing the interval of length 12 into 3 equal pieces gives width 4, and the midpoint of each piece is in the table.
width\displaystyle \text{width} =12−03\displaystyle = \frac{12 - 0}{3} =4:[0,4], [4,8], [8,12],middles 2, 6, 10\displaystyle = 4: \qquad [0, 4],\ [4, 8],\ [8, 12], \qquad \text{middles } \mdp{2},\ \mdp{6},\ \mdp{10}
We read the values of ff at the three midpoints from the table and multiply their sum by the width 44.
4⋅f(2)+4⋅f(6)+4⋅f(10)\displaystyle 4\cdot \mdp{f(2)} + 4\cdot \mdp{f(6)} + 4\cdot \mdp{f(10)} =4⋅(5+9+4)\displaystyle = 4\cdot(5 + 9 + 4) =72\displaystyle = 72
6
Use Simpson's rule with n=4n = 4 to estimate ∫131x dx\displaystyle\int_1^3 \frac1x\,dx.

Simpson's rule groups the 44 pieces into pairs. How many pairs are there?

On the pairs [1,2][1, 2] and [2,3][2, 3], what are the midpoints?

Group the subintervals into pairsWith n=4n = 4, the 44 subintervals group into 22 pairs, [1,2][1, 2] and [2,3][2, 3], each of width 11.
n\displaystyle n =4:1, 1.5, 2, 2.5, 3,pairs [1,2], [2,3]\displaystyle = 4: \quad 1,\ 1.5,\ 2,\ 2.5,\ 3, \qquad \text{pairs } [1, 2],\ [2, 3]
On these two pairs, we find the midpoint sum using midpoints 1.5\mdp{1.5} and 2.5\mdp{2.5}, and the trapezoid sum using the endpoints 11, 22, and 33.
midpoint sum\displaystyle \mdp{\text{midpoint sum}} =1⋅11.5+1⋅12.5\displaystyle = 1\cdot\mdp{\frac{1}{1.5}} + 1\cdot\mdp{\frac{1}{2.5}} =23+25\displaystyle = \frac23 + \frac25 =1615\displaystyle = \mdp{\frac{16}{15}}
trapezoid sum\displaystyle \trp{\text{trapezoid sum}} =1⋅1+122+1⋅12+132\displaystyle = 1\cdot\trp{\frac{1 + \frac12}{2}} + 1\cdot\trp{\frac{\frac12 + \frac13}{2}} =34+512\displaystyle = \frac34 + \frac{5}{12} =76\displaystyle = \trp{\frac76}
Simpson's rule takes 23\frac23 of the midpoint sum plus 13\frac13 of the trapezoid sum.
23⋅1615+13⋅76\displaystyle \frac23\cdot\mdp{\frac{16}{15}} + \frac13\cdot\trp{\frac76} =3245+718\displaystyle = \frac{32}{45} + \frac{7}{18} =6490+3590\displaystyle = \frac{64}{90} + \frac{35}{90} =9990\displaystyle = \frac{99}{90} =1110\displaystyle = \frac{11}{10}
The exact integral is ln⁡3≈1.0986\ln 3 \approx 1.0986, which is close to our estimate of 1.11.1 but not equal to it.
∫131x dx\displaystyle \int_1^3 \frac1x\,dx =ln⁡3≈1.0986\displaystyle = \ln 3 \approx 1.0986
7
Evaluate lim⁡n→∞∑i=1n(1+2in)3⋅2n\displaystyle\lim_{n\to\infty} \sum_{i=1}^{n} \Big(1 + \frac{2i}{n}\Big)^3 \cdot \frac2n.

The factor 2n\frac2n is the width of each rectangle. What is the total length of the nn rectangles?

When i=ni = n, what value does 1+2in1 + \frac{2i}{n} reach?

Find the bounds of the integralThe width of each rectangle is 2n\frac2n, so nn rectangles span a total length of 22. At i=ni = n, the right endpoint reaches 3\rgt{3}, so the left bound is 3−2=13 - 2 = 1.
width 2n→n⋅2n\displaystyle \text{width } \frac2n \to n\cdot\frac2n =2,i\displaystyle = 2, \qquad i =n→1+2=3,3−2\displaystyle = n \to \rgt{1 + 2 = 3}, \qquad 3 - 2 =1\displaystyle = 1
The term 1+2in\rgt{1 + \frac{2i}{n}} is the right end of rectangle ii, and the height is that value cubed, so the limit is the integral of x3x^3 from 1 to 3.
lim⁡n→∞∑i=1n(1+2in)3⋅2n\displaystyle \lim_{n\to\infty} \sum_{i=1}^{n} \Big(\rgt{1 + \frac{2i}{n}}\Big)^3 \cdot \frac2n =∫13x3 dx\displaystyle = \int_1^{\rgt{3}} x^3\,dx =[x44]13\displaystyle = \Big[\frac{x^4}{4}\Big]_1^3 =814−14\displaystyle = \frac{81}{4} - \frac14 =20\displaystyle = 20
8
Which of the following equals ∫13ln⁡x dx\displaystyle\int_1^3 \ln x\,dx?

On [1,3][1, 3], what is the width of each of the nn rectangles, and what is the right end of rectangle ii?

If you got lim⁡n→∞∑i=1nln⁡(2in)⋅2n\displaystyle\lim_{n\to\infty} \sum_{i=1}^{n} \ln\Big(\frac{2i}{n}\Big)\cdot\frac2n The sample points 2in\frac{2i}{n} go from 0 to 2, so that limit gives the integral of ln⁡x\ln x from 0 to 2.

If you got lim⁡n→∞∑i=1nln⁡(1+2in)⋅1n\displaystyle\lim_{n\to\infty} \sum_{i=1}^{n} \ln\Big(1 + \frac{2i}{n}\Big)\cdot\frac1n The factor 1n\frac1n doesn't match the subinterval width 2n\frac2n, so that limit gives 12∫13ln⁡x dx\frac12 \int_1^3 \ln x\,dx.

If you got lim⁡n→∞∑i=1nln⁡(1+in)⋅2n\displaystyle\lim_{n\to\infty} \sum_{i=1}^{n} \ln\Big(1 + \frac{i}{n}\Big)\cdot\frac2n The sample points 1+in1 + \frac{i}{n} only go from 11 to 22, not from 11 to 33.

Dividing the interval [1,3][1, 3] of length 22 into nn equal pieces gives rectangles of width 2n\frac2n.
[1,3]:width\displaystyle [1, 3]: \quad \text{width} =3−1n\displaystyle = \frac{3 - 1}{n} =2n\displaystyle = \frac2n
Starting from x=1x = 1, each step moves right by 2n\frac2n, so rectangle ii has right end 1+2in\rgt{1 + \frac{2i}{n}} and height ln⁡(1+2in)\ln\big(\rgt{1 + \frac{2i}{n}}\big).
right end of rectangle i\displaystyle \text{right end of rectangle } i =1+2in:i\displaystyle = \rgt{1 + \frac{2i}{n}}: \quad i =n→3\displaystyle = n \to \rgt{3}
∫13ln⁡x dx\displaystyle \int_1^3 \ln x\,dx =lim⁡n→∞∑i=1nln⁡(1+2in)⋅2n\displaystyle = \lim_{n\to\infty} \sum_{i=1}^{n} \ln\Big(1 + \frac{2i}{n}\Big)\cdot\frac2n
9
The table gives values of f′(x)f'(x), and f(0)=5f(0) = 5. Use a trapezoid sum with the four subintervals given by the table to estimate f(10)f(10). (Challenge)
x026710f′(x)134−21\displaystyle \begin{array}{c|ccccc} x & 0 & 2 & 6 & 7 & 10 \\ \hline f'(x) & 1 & 3 & 4 & -2 & 1 \end{array}

By the Fundamental Theorem of Calculus, what does ∫010f′(x) dx\int_0^{10} f'(x)\,dx equal in terms of f(10)f(10) and f(0)f(0)?

What are the widths of the subintervals between neighbouring xx-values in the table?

Relate f(10)f(10) to the integral of f′f'The integral of f′f' gives the net change f(10)−f(0)f(10) - f(0), so f(10)f(10) is f(0)f(0) plus the integral of f′f'.
∫010f′(x) dx\displaystyle \int_0^{10} f'(x)\,dx =f(10)−f(0)  →  f(10)\displaystyle = f(10) - f(0) \;\to\; f(10) =f(0)+∫010f′(x) dx\displaystyle = f(0) + \int_0^{10} f'(x)\,dx
We find each subinterval's width from the xx-values and compute the trapezoid sum for the integral of f′(x)f'(x), keeping the negative value at x=7x = 7.
2−0\displaystyle 2 - 0 =2,6−2\displaystyle = 2, \qquad 6 - 2 =4,7−6\displaystyle = 4, \qquad 7 - 6 =1,10−7\displaystyle = 1, \qquad 10 - 7 =3\displaystyle = 3
2⋅1+32+4⋅3+42+1⋅4+(−2)2+3⋅−2+12\displaystyle 2\cdot\trp{\frac{1 + 3}{2}} + 4\cdot\trp{\frac{3 + 4}{2}} + 1\cdot\trp{\frac{4 + (-2)}{2}} + 3\cdot\trp{\frac{-2 + 1}{2}} =4+14+1−1.5\displaystyle = 4 + 14 + 1 - 1.5 =17.5\displaystyle = 17.5
Adding that estimated net change to f(0)=5f(0) = 5 gives our estimate for f(10)f(10).
f(10)≈5+17.5\displaystyle f(10) \approx 5 + 17.5 =22.5\displaystyle = 22.5