Treat the integral as accumulated area, approximate it with Riemann sums and connect it to derivatives.
Why this matters
The derivative answers "how fast?". The integral answers "how much in total?". If you know a pump's flow rate over time, the integral gives the total volume pumped. If you know the force along a spring, the integral gives the work done. In probability, the area under a density curve is a probability, and in pharmacology the area under a concentration curve (AUC) measures total drug exposure.
Area as accumulation
When a rate is constant, total = rate × time: 3 litres per minute for 10 minutes is 30 litres, the area of a 3-by-10 rectangle. When the rate changes, the total is still the area under the rate curve. The integral is the tool for computing that area.
The definite integral of f from a to b is written:
∫ from a to b of f(x) dx
The long S stands for "sum", f(x) is the height, and dx is a tiny width. You are adding up many thin rectangles.
Riemann sums
To approximate the area, chop [a, b] into n strips of width Δx = (b − a) / n, build a rectangle on each one, and add up their areas. The height can come from the left edge, the right edge or the midpoint of each strip:
left sum = Δx · [f(x₀) + f(x₁) + … + f(xₙ₋₁)]
midpoint sum = Δx · Σ f(a + (i + 0.5)·Δx), i = 0 … n − 1
Worked example: f(x) = x² on [0, 3] with n = 3 strips (Δx = 1).
| strip | midpoint | height | area |
|---|---|---|---|
| [0, 1] | 0.5 | 0.25 | 0.25 |
| [1, 2] | 1.5 | 2.25 | 2.25 |
| [2, 3] | 2.5 | 6.25 | 6.25 |
The midpoint sum is 8.75. With more strips it approaches the exact value, 9. That limit, as the strips get infinitely thin, is the definite integral.
The fundamental theorem of calculus
Adding up rectangles works, but there is a shortcut that links integrals back to derivatives. If F is any function whose derivative is f (an antiderivative), then:
∫ from a to b of f(x) dx = F(b) − F(a)
For f(x) = x², an antiderivative is F(x) = x³/3, so the area on [0, 3] is 27/3 − 0 = 9. This is the fundamental theorem of calculus: accumulation and rate of change are inverse operations. Reversing the power rule gives the most common antiderivative:
∫ xⁿ dx = xⁿ⁺¹ / (n + 1) + C (n ≠ −1)
The + C appears in an indefinite integral (no limits) because any constant disappears when differentiated. It cancels in a definite integral.
Numerical integration in practice
Lab instruments and simulations produce data points, not formulas, so numerical integration is routine. The trapezoidal rule joins neighbouring points with straight lines; NumPy has it built in as numpy.trapezoid (numpy.trapz in older versions), and SciPy offers scipy.integrate.quad for formulas. A plain Python midpoint rule takes a few lines:
def midpoint_integral(f, a, b, n):
dx = (b - a) / n
return dx * sum(f(a + (i + 0.5) * dx) for i in range(n))
print(midpoint_integral(lambda x: x ** 2, 0, 3, 1000)) # about 8.99999775
Signed area
Area below the x-axis counts as negative. The integral of sin x from 0 to 2π is 0: the positive hump and the negative hump cancel. If you want total distance rather than net displacement, integrate the absolute value of the speed.
Common mistakes
- Too few strips. Accuracy improves as n grows. Compare n and 2n; if the answers differ noticeably, use more.
- Mixing up Δx. The strip width is (b − a) / n, not 1 / n.
- Forgetting units. The integral of a flow rate in L/min over minutes is litres: multiply the units, just as with rectangles.
- Dropping + C on an indefinite integral, or keeping it in a definite one.
Quick recap
- A definite integral is the limit of a sum of thin rectangles: area or total accumulation.
- Riemann sums (left, right, midpoint) approximate it; more strips means a better answer.
- The fundamental theorem: ∫ from a to b of f dx = F(b) − F(a), where F′ = f.
- Area below the axis counts as negative.
Try it
In the Do tab, write the midpoint Riemann sum and watch it converge to the exact area.