Single-Variable-Calculus · Unit 20 · Video 3 · Interactive Practice

Numerical Integration: Riemann Sums and the Trapezoidal Rule

IKey Formulas

FormulaNameWeights on y0,y1,…,yny_0, y_1, \dots, y_n
Δx=b−an,yi=f(xi)\Delta x = \dfrac{b - a}{n}, \quad y_i = f(x_i)Setup: nn equal steps, n+1n + 1 heights—
L=Δx (y0+y1+⋯+yn−1)L = \Delta x\,(y_0 + y_1 + \dots + y_{n-1})
R=Δx (y1+y2+⋯+yn)R = \Delta x\,(y_1 + y_2 + \dots + y_n)
Left and right Riemann sums1,1,…,1,01, 1, \dots, 1, 0 and 0,1,…,1,10, 1, \dots, 1, 1
T=Δx(y02+y1+⋯+yn−1+yn2)T = \Delta x\left(\dfrac{y_0}{2} + y_1 + \dots + y_{n-1} + \dfrac{y_n}{2}\right)Trapezoidal rule12,1,…,1,12\tfrac12, 1, \dots, 1, \tfrac12
T=L+R2T = \dfrac{L + R}{2}Average of the two Riemann sums—

Key Insight: One trapezoid has area yi−1+yi2 Δx\dfrac{y_{i-1} + y_i}{2}\,\Delta x; every middle height borders two trapezoids and collects 12+12=1\tfrac12 + \tfrac12 = 1, while each end height borders only one and keeps 12\tfrac12.

IIVisualization 1 — One Trapezoid, Two Ways

A trapezoid of width Δx\Delta x has area y3+y42 Δx\frac{y_3 + y_4}{2}\,\Delta x: width times the average of its two sides.

IIIVisualization 2 — The Trapezoidal Rule Is the Average of L and R

For any heights y0,…,y6y_0, \dots, y_6, the trapezoids' total equals L+R2\frac{L + R}{2}, with end weights 12\tfrac12.

IVVisualization 3 — How Close Do They Get?

∫01e−x2 dx≈0.746824\int_0^1 e^{-x^2}\,dx \approx 0.746824 has no formula; compare how fast each method's error shrinks as nn grows.

💡 The trapezoidal rule is far better than either Riemann sum, yet its slanted tops still miss the curve wherever it bends — Simpson's rule, next, fits parabolas instead.

VQuiz Questions

Problem 1 · Apply the Trapezoidal Rule

Given: Δx=0.5\Delta x = 0.5 and the heights y0=2y_0 = 2, y1=3y_1 = 3, y2=5y_2 = 5, y3=6y_3 = 6, y4=4y_4 = 4 — find the trapezoidal approximation TT.

✅ Correct! The end heights get weight 12\tfrac12, the middle ones weight 11: 0.5 (1+3+5+6+2)=8.50.5\,(1 + 3 + 5 + 6 + 2) = 8.5.
❌ Not quite. 0.5 (2+3+5+6+4)=100.5\,(2 + 3 + 5 + 6 + 4) = 10 gives every height weight 11. The two end heights each border only one trapezoid, so they count 12\tfrac12.
❌ Not quite. 0.5 (2+3+5+6)=80.5\,(2 + 3 + 5 + 6) = 8 is the left Riemann sum — it drops y4y_4 entirely instead of giving it weight 12\tfrac12.
❌ Close, but… 22+3+5+6+42=17\tfrac{2}{2} + 3 + 5 + 6 + \tfrac{4}{2} = 17 is the weighted sum of heights; it still has to be multiplied by the width Δx=0.5\Delta x = 0.5.
❌ Not quite. Use T=Δx(y02+y1+y2+y3+y42)T = \Delta x\left(\frac{y_0}{2} + y_1 + y_2 + y_3 + \frac{y_4}{2}\right).
Show solution

With n=4n = 4 steps the weights are 12,1,1,1,12\tfrac12, 1, 1, 1, \tfrac12:

T=0.5(22+3+5+6+42)=0.5 (1+3+5+6+2)=0.5⋅17=8.5T = 0.5\left(\frac{2}{2} + 3 + 5 + 6 + \frac{4}{2}\right) = 0.5\,(1 + 3 + 5 + 6 + 2) = 0.5 \cdot 17 = 8.5

Check with the Riemann sums: L=0.5 (2+3+5+6)=8L = 0.5\,(2 + 3 + 5 + 6) = 8 and R=0.5 (3+5+6+4)=9R = 0.5\,(3 + 5 + 6 + 4) = 9, so L+R2=8.5\frac{L + R}{2} = 8.5.

Problem 2 · Recover the Missing Sum

Given: for the same integral and the same nn, the left Riemann sum is L=3.2L = 3.2 and the trapezoidal rule gives T=3.5T = 3.5 — find the right Riemann sum RR.

✅ Correct! TT sits exactly halfway between LL and RR, so R=2T−L=7−3.2=3.8R = 2T - L = 7 - 3.2 = 3.8.
❌ Not quite. 3.353.35 is the average of LL and TT. It is TT that is the average of LL and RR: T=L+R2T = \frac{L + R}{2}.
❌ Not quite. L+T=6.7L + T = 6.7 has no meaning here. Solve 3.5=3.2+R23.5 = \frac{3.2 + R}{2} for RR.
❌ Close, but… 2L−T=2.92L - T = 2.9 would put LL in the middle. The trapezoidal value is the midpoint, so RR lies 0.30.3 above TT, not below LL.
❌ Not quite. Use T=L+R2T = \frac{L + R}{2}.
Show solution

The trapezoidal rule is the average of the two Riemann sums:

T=L+R2⟹R=2T−L=2(3.5)−3.2=3.8T = \frac{L + R}{2} \quad\Longrightarrow\quad R = 2T - L = 2(3.5) - 3.2 = 3.8

T=3.5T = 3.5 is 0.30.3 above L=3.2L = 3.2, so RR is another 0.30.3 above TT.

Problem 3 · From the Integral to the Number

Given: ∫131x dx\displaystyle\int_1^3 \frac{1}{x}\,dx with n=4n = 4 steps — find Δx\Delta x and the trapezoidal approximation TT.

What is Δx?

What is T?

✅ Correct! T=6760≈1.117T = \frac{67}{60} \approx 1.117, close to the exact value ln⁡3≈1.0986\ln 3 \approx 1.0986.
❌ Not quite. 25\frac{2}{5} divides by the number of points, n+1=5n + 1 = 5. The interval is cut into n=4n = 4 steps: Δx=b−an\Delta x = \frac{b - a}{n}.
❌ Not quite. 14\frac{1}{4} divides 11, not the interval's length 3−1=23 - 1 = 2, by nn.
❌ Not quite. 22 is the whole length b−ab - a; it still has to be split into n=4n = 4 steps.
❌ Check Δx. Δx=b−an\Delta x = \frac{b - a}{n}.
❌ Not quite. 7760\frac{77}{60} is the left Riemann sum LL, which leaves out y4=13y_4 = \tfrac13 and counts y0=1y_0 = 1 fully.
❌ Not quite. 1920\frac{19}{20} is the right Riemann sum RR, which leaves out y0=1y_0 = 1. The trapezoidal rule averages LL and RR.
❌ Close, but… 6730\frac{67}{30} is the weighted sum of heights; multiply it by Δx=12\Delta x = \tfrac12.
❌ Check T. Weights 12,1,1,1,12\tfrac12, 1, 1, 1, \tfrac12 on the heights, then multiply by Δx\Delta x.
Show solution

Step 1: Δx and the cut points. Δx=3−14=12\Delta x = \frac{3 - 1}{4} = \frac12, so xi=1,1.5,2,2.5,3x_i = 1, 1.5, 2, 2.5, 3.

Step 2: heights. yi=1xiy_i = \frac{1}{x_i}: y0=1y_0 = 1, y1=23y_1 = \tfrac23, y2=12y_2 = \tfrac12, y3=25y_3 = \tfrac25, y4=13y_4 = \tfrac13.

Step 3: weights 12,1,1,1,12\tfrac12, 1, 1, 1, \tfrac12.

T=12(12+23+12+25+16)=12⋅6730=6760≈1.117T = \frac12\left(\frac12 + \frac23 + \frac12 + \frac25 + \frac16\right) = \frac12 \cdot \frac{67}{30} = \frac{67}{60} \approx 1.117

Check: L=12(1+23+12+25)=7760L = \frac12\left(1 + \frac23 + \frac12 + \frac25\right) = \frac{77}{60} and R=12(23+12+25+13)=5760R = \frac12\left(\frac23 + \frac12 + \frac25 + \frac13\right) = \frac{57}{60}, so L+R2=134120=6760\frac{L + R}{2} = \frac{134}{120} = \frac{67}{60}. The exact value is ln⁡3≈1.0986\ln 3 \approx 1.0986.

Problem 4 · A Hundred Steps without the Hundred Terms

Given: ∫02x2 dx\displaystyle\int_0^2 x^2\,dx with n=100n = 100 steps — find how much larger the trapezoidal value TT is than the left Riemann sum LL, without adding up the terms.

✅ Correct! Only the two end weights differ: T−L=Δx(yn2−y02)=0.02⋅4−02=0.04T - L = \Delta x\left(\frac{y_n}{2} - \frac{y_0}{2}\right) = 0.02 \cdot \frac{4 - 0}{2} = 0.04.
❌ Close, but… 0.08=Δx (yn−y0)0.08 = \Delta x\,(y_n - y_0) is R−LR - L. The trapezoidal value is only halfway from LL to RR.
❌ Not quite. yn−y0=4y_n - y_0 = 4 is a difference of heights, not of areas — it still needs the factor Δx\Delta x (and the 12\tfrac12).
❌ Not quite. yn−y02=2\frac{y_n - y_0}{2} = 2 has the right weights but is missing the width Δx=0.02\Delta x = 0.02.
❌ Not quite. Compare the weights of TT and LL height by height.
Show solution

Here Δx=2−0100=0.02\Delta x = \frac{2 - 0}{100} = 0.02, y0=02=0y_0 = 0^2 = 0 and y100=22=4y_{100} = 2^2 = 4. Line up the weights:

L: 1,1,…,1,0T: 12,1,…,1,12L:\ 1, 1, \dots, 1, 0 \qquad T:\ \tfrac12, 1, \dots, 1, \tfrac12

The middle heights cancel, leaving

T−L=Δx(y1002−y02)=0.02⋅4−02=0.04T - L = \Delta x\left(\frac{y_{100}}{2} - \frac{y_0}{2}\right) = 0.02 \cdot \frac{4 - 0}{2} = 0.04

Equivalently R−L=Δx (y100−y0)=0.08R - L = \Delta x\,(y_{100} - y_0) = 0.08 and T=L+R2T = \frac{L + R}{2} sits halfway, 0.040.04 above LL. (Numerically L=2.6268L = 2.6268 and T=2.6668T = 2.6668.)

Solved: 0 / 4