JOVANA
Library Glossary Getting Started Three Levels Fields How it works Mission
Join the mission
All guides

The Definite Integral: Adding Up Infinitely Many Slices

How do you measure the area under a **curve**, where there is no neat rectangle to point at? The trick is older than calculus: chop the region into thin strips, pretend each is a rectangle, and add. The strips never fit perfectly — so you make them thinner, and thinner, and chase what the total **approaches**. That chase has a destination, a single number, and that number is the **[[definite-integral|definite integral]]**. This guide builds it from scratch, and shows why it is far more than 'just area'.

The old problem: area under a curve

You can find the area of a rectangle in your sleep: width times height. A triangle, a circle, a trapezoid — geometry hands you a formula for each. But now draw a wavy curve, like y = x^2, and ask for the area trapped between that curve, the x-axis, and two vertical lines at x = a and x = b. There is no formula in the back of the book. The top edge bends, so no single width-times-height will do. This is the area problem, and people wrestled with it for two thousand years before calculus tamed it.

The breakthrough idea is humble: if you cannot measure the curvy region all at once, cover it with shapes you *can* measure. Slice the interval from a to b into a row of thin vertical strips. Each strip has a curved top, but if it is narrow enough, that top is almost flat — so pretend the strip is a plain rectangle. Add up all the rectangle areas, and you get an estimate of the whole. It will be a little off, but only a little, and that error is something we can squeeze.

The Riemann sum: chop, measure, add

Let's make the plan precise. Take the interval from a to b and split it into n equal pieces. Each piece has width dx = (b - a) / n. In strip number i, pick one sample point x_i, measure the curve's height there as f(x_i), and call that strip a rectangle of height f(x_i) and width dx. Its area is f(x_i) * dx. Add up all n of them and you have a [[riemann-sum|Riemann sum]]:

Riemann sum  =  f(x_1)*dx + f(x_2)*dx + ... + f(x_n)*dx

             =  sum from i = 1 to n  of  f(x_i) * dx

   where      dx = (b - a) / n
n rectangles, each of width dx and height f(x_i). The sum is an estimate of the area under f from a to b — not the answer yet, just a stepping stone.

Where inside each strip should you read the height? You have a choice, and it gives the sum a name. Read the height at each strip's left edge and you get a left Riemann sum; read it at the right edge, a right Riemann sum; read it at the middle for a midpoint sum, which usually hugs the true value most tightly. For a smooth curve these all disagree slightly when n is small — but as the strips get thinner, their disagreement shrinks toward nothing.

  1. Decide how many strips n you want, and compute the width dx = (b - a) / n.
  2. In each strip, choose a sample point (left, right, or middle) and measure the height f(x_i) there.
  3. Form each rectangle's area as f(x_i) * dx, and add all n of them into one running total.
  4. Now increase n — double it, then double again — and watch whether the total settles toward a fixed number.

The limit that turns a sum into a number

Here is the heart of it. The Riemann sum is only an estimate, and any finite n leaves it a little wrong. But push n upward — more strips, each thinner, dx shrinking toward 0 — and a well-behaved curve makes the sum march in on one fixed value. The [[definite-integral|definite integral]] of f from a to b is *defined* as the [[limit|limit]] of these sums as n -> infinity (equivalently, as dx -> 0). It is not the sum itself; it is the number the sums approach. We write it like this:

integral from a to b of f(x) dx  =  lim (n -> infinity)  sum from i = 1 to n  f(x_i) * dx

The elongated S (the integral sign) is a stretched 'sum'.
The dx is the leftover width of each slice, shrunk to nothing.
The definite integral is the limit of Riemann sums. The sign comes from a long S for 'sum'; dx is what dx = (b - a)/n becomes as the slices vanish.

And the result is a single number, not a function. The definite integral from a to b of f swallows the whole interval and reports one value — total distance from a velocity curve, total charge from a current, total profit from a rate of earnings. That is what 'definite' means: the bounds a and b are pinned down, so the answer is settled and numeric. (Leave the bounds off and you get something different — an [[antiderivative|antiderivative]], a whole family of functions — which the next rungs will connect back to this one.)

Watch it converge in a few lines of code

Talk is cheap; let's run the limit. We'll approximate the integral of f(x) = x^2 from 0 to 1 with a left Riemann sum, then crank n up and watch the total close in. The exact answer, which the next rung will let you compute by hand, is 1/3.

def f(x):
    return x * x

a, b = 0.0, 1.0
for n in [4, 10, 100, 1000, 100000]:
    dx = (b - a) / n
    total = 0.0
    for i in range(n):
        x_i = a + i * dx        # left edge of strip i
        total += f(x_i) * dx
    print(n, total)

# n         Riemann sum
# 4         0.21875
# 10        0.285
# 100       0.32835
# 1000      0.3328335
# 100000    0.33333283...   ->  heading for 1/3
As n grows and dx shrinks, the left Riemann sum climbs toward 1/3 = 0.3333... It never lands exactly on a finite n, but the limit it approaches IS the definite integral.

Watching that column of numbers crawl toward 0.3333... is the whole concept in miniature. We never finish adding infinitely many slices — no computer could — but we do not need to. We only need to see *where the totals are headed*, and a smooth function leaves no doubt. That destination is the definite integral.