The integral of f from a to b is the area between the curve and the x-axis over that interval. It answers questions like "how far did the car go, given its speed at every moment?"
Thin rectangles
Cut the interval into n strips of width w = (b − a) ÷ n. In each strip, draw a rectangle as tall as the curve at the strip's midpoint, and add the areas. This is a Riemann sum.
def f(x):
return x * x
a, b = 0, 3
for n in [2, 4, 8, 16]:
width = (b - a) / n
total = 0
for i in range(n):
total += f(a + (i + 0.5) * width) * width
print(n, "strips:", round(total, 5))
print("exact: 3³/3 =", 3 ** 3 / 3)For f(x) = x² from 0 to 3, the sums approach 9. Doubling the number of strips makes the midpoint error about four times smaller.
The fundamental theorem of calculus
Integration undoes differentiation. If F′ = f (F is an antiderivative of f), then:
the integral of f from a to b = F(b) − F(a)
For f(x) = x², F(x) = x³ ÷ 3, so the area is 27/3 − 0 = 9 exactly, with no rectangles at all.
Where it is used
Distance from speed, probability from a density curve (the normal curve's areas in the Probability course), work from force, and the total of any quantity that changes continuously.
Common mistakes
- Area below the x-axis counts as negative. The integral of sin x from 0 to 2π is 0, though the curve is not flat.
- Forgetting that an antiderivative is only defined up to a constant: x³/3 + 7 works too, and the 7 cancels in F(b) − F(a).
Quick check
Practice problems for this lesson
My notes
Write down what you want to remember from this lesson. Notes are saved on this device as you type, and appear on your dashboard.