Approximating integrals

Adding up rectangles

What is the area under y=x^2 between x=0 and x=2? No formula from geometry covers a curved edge. But you can find the area of rectangles. How close can rectangles get?

Cut the interval into n strips and stand a rectangle on each one. Change how the heights are chosen, then add more strips and watch the total close in on a single number.

Ochre rectangles count as positive area. Indigo rectangles, below the axis, count as negative.

Height of each rectangle
Integral
Δx
Sum of areas
Exact value
Error

The same method with more strips
nSumError

Left, right and midpoint sums

Split [a,b] into n strips of equal width \Delta x=\frac{b-a}{n}. The strip edges are x_i=a+i\,\Delta x for i=0,1,\dots,n. Each rule picks a different height for each rectangle:

RuleHeight of rectangle iSum
Leftthe left edge, f(x_{i-1})L_n=\Delta x\,[f(x_0)+\dots+f(x_{n-1})]
Rightthe right edge, f(x_i)R_n=\Delta x\,[f(x_1)+\dots+f(x_n)]
Midpointthe middle, f\!\left(\frac{x_{i-1}+x_i}{2}\right)M_n=\Delta x\,[f(\bar x_1)+\dots+f(\bar x_n)]

When f is increasing, left sums underestimate and right sums overestimate. Why? Midpoint sums are usually far more accurate than either, as the error column shows. Where f is negative, the rectangles count as negative area. Try x^3-2x.

Every rule gets closer to the same number as n grows. What happens when n grows without bound is the subject of the next lesson.

Solve it step by step

Compute each approximation by hand. Decimals are fine. The score counts steps you answer correctly on the first try.

Problems solved0
First-try steps0 of 0

    Common mistakes

    Using n + 1 sample points

    There are n rectangles, so a left sum uses x_0 to x_{n-1} and a right sum uses x_1 to x_n.

    Forgetting to multiply by Δx

    Each term is a height times a width. Adding the heights alone gives the wrong answer unless \Delta x=1.

    Counting every rectangle as positive

    Where f(x)<0, a rectangle has negative height, so it subtracts from the sum.