Slice the region under a curve into thin rectangles, add them up, then shrink the slices to nothing. That limit is the integral — and it turns out to be the exact reverse of the derivative you met in Chapter 4.
Chapter 4 asked how fast something changes at an instant — the derivative, a rate. This chapter asks the mirror question: given the rate, how much piled up in total? That accumulated total is the integral, and the two ideas are so tightly bound that a single theorem — the Fundamental Theorem of Calculus — says each one undoes the other.
Two everyday pictures carry the whole chapter:
We'll build the integral the honest way — by slicing, approximating, and taking a limit — then cash it in for the theorem that makes it computable. Everything leans on Chapter 1's completeness (the limit has somewhere to land) and Chapter 2's limits (the machinery of "shrink to zero").
Suppose your car's speed is plotted against time. At any instant the graph tells you how fast you're going — but you want the total distance. If the speed were a flat 60 km/h for 2 hours, that's easy: distance is 60 × 2 = 120, which is exactly the area of the rectangle under the flat line. Speed times time is an area.
Now let the speed wobble — speeding up, slowing down, a curve instead of a flat line. The trick is the same: the total distance is still the area of the region trapped between the speed curve and the time axis. Wherever the curve is high you're covering ground fast, so that stretch contributes a tall slice of area; where it dips, a short one.
This is the one idea to internalize: an integral accumulates a quantity by measuring the area under the graph of its rate. Swap the labels and the same picture pays out everywhere — total charge is the area under a current-vs-time curve; total rainfall is the area under a rainfall-rate curve; the work done is the area under a force-vs-distance curve. The formal name for "the signed area under f from a to b" is the definite integral, written ∫ab f(x) dx.
"Signed" is a small but real caveat: area below the axis counts as negative. If the speed graph were a velocity that went negative (driving in reverse), that stretch would subtract from the total displacement. For now picture curves that stay above the axis, where the integral is plain positive area.
A curved region has no area formula — but a rectangle does: width times height. So we cheat in the most productive way in all of mathematics: approximate the awkward shape with a pile of easy ones.
Chop the interval [a, b] into n equal slices, each of width dx = (b − a)/n. Over each slice, pretend the curve is flat by picking one height — say the value of f somewhere in that slice — and stand a rectangle there. Its area is f(xi) · dx. Add up all n of them and you get an estimate of the total area:
Sn = f(x1)·dx + f(x2)·dx + ⋯ + f(xn)·dx
That sum has a name: a Riemann sum. It's just a map over the slices — compute each rectangle's area — followed by a sum. Any programmer has written this loop a hundred times without knowing it was the foundation of integral calculus. Drag the slider below to add more rectangles and watch the staircase creep toward the true curve.
Even at a handful of rectangles the estimate is in the right ballpark; push n higher and the jagged staircase hugs the curve, the leftover slivers of over- and under-shoot shrink, and the error readout marches toward zero. That convergence is the entire plot of this chapter — hold onto it.
There's one wrinkle in "pick a height for the slice": which point in the slice do you sample? The curve isn't flat, so the left edge, the right edge, and the middle all give slightly different heights — and slightly different rectangles.
Toggle the three buttons in the widget above at a small n — say 4 or 6 — and you'll see left and right disagree noticeably while midpoint threads between them. Now crank n up. The disagreement melts away. All three rules are chasing the same target, and as the slices get thin the choice of sample point stops mattering. That's the tell that there's a single well-defined number underneath all this approximating — which is exactly what the next section pins down.
Every Riemann sum is an approximation. So how do we get the exact area? The same way Chapter 2 turned "closer and closer" into an actual value: take the limit. Let the number of slices n run off to infinity so the slice width dx shrinks to zero, and ask what number the sums close in on.
If the sums converge to a single value no matter where you sampled each slice — left, right, midpoint, anywhere — then f is called integrable on [a, b], and that shared limit is the definite integral:
∫ab f(x) dx = limn→∞ Sn
Notice what this quietly assumes: that the limit exists — that there's a genuine number sitting there for the sums to land on. That guarantee is Chapter 1's completeness axiom doing its job. On the rationals the sums might huddle around a value that isn't there; on the reals, a bounded, non-oscillating sequence of sums always has a real limit. Continuous functions (Chapter 3) are the safe, friendly case: every continuous f on a closed interval [a, b] is integrable, full stop.
map(f(x) * dx).sum with the slices taken infinitely thin. The symbol is the algorithm.Here's the punchline the whole subject was built around. Computing that limit of Riemann sums by hand is miserable. The Fundamental Theorem of Calculus hands you a shortcut so powerful it feels like cheating: integration and differentiation are inverse operations. Whatever the derivative does, the integral undoes — and vice versa.
Make it concrete with the accumulator. Define the area-so-far function A(x) = the area under f from the start a up to the moving point x. As you nudge x a little to the right, how fast does that accumulated area grow? By exactly one thin sliver — width dx, height f(x). So the rate at which area accumulates is the current height of the curve:
A(x) = ∫ax f(t) dt ⟹ A′(x) = f(x)
That's the first half of the theorem: differentiating an integral gives you back the function you integrated. The area function's rate of change is just the height — the derivative from Chapter 4 and the integral from this chapter are two ends of the same stick.
The second half is the one you'll actually compute with. If you can find any function F whose derivative is f (an antiderivative), then the definite integral is just the change in F across the interval — no limits, no rectangles:
∫ab f(x) dx = F(b) − F(a) where F′ = f
This is the bridge between Chapter 4 and Chapter 5. The hard object — a limit of infinitely many rectangles — collapses into a subtraction, provided you can run differentiation backwards. Which raises the obvious next question.
The FTC quietly rewrote the whole problem. "Find the area under f" — a geometric, limit-of-sums question — has become "find a function whose derivative is f." That reverse function is an antiderivative, and hunting for one is the game the rest of introductory calculus plays.
You already know the forward direction from Chapter 4, so you can often just read it backwards. The derivative of x² is 2x, so an antiderivative of 2x is x². The derivative of x³/3 is x², so ∫ x² dx = x³/3. The power rule in reverse: bump the exponent up by one and divide by the new exponent.
One subtlety: antiderivatives come in families. Since the derivative of a constant is zero, x² and x² + 7 have the same derivative — so both are antiderivatives of 2x. We write the whole family with a + C. But for a definite integral the constant cancels in the subtraction F(b) − F(a), so it never affects the area. Worth knowing that some perfectly innocent functions — like e−x², the bell curve — have no antiderivative expressible in elementary functions at all. When symbolic reversal fails, you fall back on adding up rectangles numerically. Which is where a programmer comes in.
When there's no tidy antiderivative — or when f is just an array of sensor readings with no formula at all — you compute the integral the way the widget does: add up slices. But you don't have to settle for flat-topped rectangles. One cheap upgrade buys a lot of accuracy.
A rectangle caps each slice with a horizontal line, ignoring that the curve is tilted across the slice. The trapezoid rule instead connects the curve's value at the left edge to its value at the right edge with a straight, slanted line — capping each slice with a trapezoid that actually leans the way the curve does. Its area is width times the average of the two edge heights: dx · (f(xi) + f(xi+1))/2. Same loop, better lid.
The payoff: for a smooth curve the plain rectangle rule's error shrinks like 1/n, while the trapezoid rule's error shrinks like 1/n² — double the slices and you roughly quarter the error instead of halving it. For a few extra additions it's almost always worth it. Here's the midpoint Riemann sum — the widget's engine — in both languages; the trapezoid version is the same shape with a two-point average in place of the single midpoint height.
integrate never returns the true area — it returns the area of n rectangles, which is near it. Just like Chapter 1's bisection reaching within eps of √2, the exact integral is the limit these sums huddle toward as n → ∞. Completeness is what guarantees that limit is a real number waiting to be approximated.