27 min read

For seven chapters you learned to take things apart. The derivative is a local measurement: zoom in on a single point, watch a difference quotient shrink, and read off the slope of the tangent line. Differentiation is the mathematics of the instant.

Prerequisites

  • Chapter 12: Antiderivatives
  • Chapter 4: Continuity
  • Chapter 3: The Limit

Learning Objectives

  • Set up the area problem and approximate area with left, right, and midpoint Riemann sums.
  • Define the definite integral as the limit of Riemann sums using sigma notation.
  • Interpret the definite integral as signed area and evaluate simple integrals by geometry.
  • State and apply the properties of definite integrals (linearity, additivity over intervals, comparison).
  • State the Mean Value Theorem for Integrals and compute the average value of a function.
  • Approximate integrals numerically in Python (Riemann sums and the trapezoidal rule), including the area under the normal curve.

Chapter 13 — The Definite Integral

13.1 A New Kind of Problem

For seven chapters you learned to take things apart. The derivative is a local measurement: zoom in on a single point, watch a difference quotient shrink, and read off the slope of the tangent line. Differentiation is the mathematics of the instant.

This chapter opens Part III, where we run the machinery in reverse. Instead of zooming in, we will zoom out — chopping an interval into many pieces, measuring each, and adding everything up. The motivating question is two thousand years old.

The area problem. Given a function $f$ that is positive on $[a,b]$, how much area lies between its graph and the $x$-axis?

For a rectangle the answer is base times height; for a triangle it is half of that; for a circle the Greeks worked out $\pi r^2$ by heroic effort. But what is the area under $y = x^2$ from $0$ to $1$? The top edge is curved, so no formula from geometry applies. We need a genuinely new idea, and that idea — the definite integral — turns out to be one of the two pillars the whole subject stands on.

The Key Insight. The definite integral is a limit of sums. Geometrically it is the area under a curve; physically it is a total accumulated from a varying rate; computationally it is a single number. The same three-step move — slice the interval, sum the pieces, take the limit — produces all of them. Master that pattern and you have understood integration.

This chapter builds the definite integral from the ground up using only limits and geometry. We will not use the shortcut that makes integrals easy to evaluate — the Fundamental Theorem of Calculus — because that theorem is the subject of Chapter 14, and proving it honestly requires that we first build the integral it is about. Everything here is computed the hard way, by sums and limits, so that the shortcut feels like the miracle it is.

13.2 Approximating Area by Rectangles

Take $f(x) = x^2$ on $[0,1]$ and approximate the area beneath it with rectangles.

Cut $[0,1]$ into $n$ strips of equal width $\Delta x = 1/n$. Over each strip, replace the curve by a flat top — a rectangle. We get to choose the height of each rectangle by sampling $f$ somewhere in the strip. The simplest choice is the right endpoint of each strip. With $n = 4$ the strips are $[0,\tfrac14],[\tfrac14,\tfrac12],[\tfrac12,\tfrac34],[\tfrac34,1]$, their right endpoints are $\tfrac14,\tfrac12,\tfrac34,1$, and the rectangle heights are the squares of those numbers:

$$R_4 = \Delta x\Big[f(\tfrac14)+f(\tfrac12)+f(\tfrac34)+f(1)\Big] = \tfrac14\Big[\tfrac{1}{16}+\tfrac{4}{16}+\tfrac{9}{16}+\tfrac{16}{16}\Big] = \tfrac14\cdot\tfrac{30}{16} = \tfrac{30}{64} \approx 0.469.$$

Because $x^2$ is increasing on $[0,1]$, the right endpoint is the highest point of each strip, so each rectangle pokes above the curve and $R_4$ overestimates the true area. If instead we sample the left endpoint of each strip ($0,\tfrac14,\tfrac12,\tfrac34$), every rectangle sits below the curve and we underestimate:

$$L_4 = \tfrac14\Big[f(0)+f(\tfrac14)+f(\tfrac12)+f(\tfrac34)\Big] = \tfrac14\Big[0+\tfrac{1}{16}+\tfrac{4}{16}+\tfrac{9}{16}\Big] = \tfrac14\cdot\tfrac{14}{16} = \tfrac{14}{64} \approx 0.219.$$

So the true area is trapped: $0.219 < \text{Area} < 0.469$. That is a crude bracket, but notice what we have done — we have bounded a curved-region area using nothing but rectangles. Refining the strips will tighten the bracket.

Geometric Intuition. Picture the curve with the rectangles drawn under it. With right endpoints on an increasing function, each rectangle's top-right corner touches the curve and the rest of its top floats above — the little triangular slivers of overshoot are the error. As you double the number of strips, each sliver is cut roughly in half and there are twice as many of them, so the total overshoot shrinks. In the limit, the slivers vanish and the rectangles fill the region exactly. That vanishing is the whole idea of the integral.

Refining the estimate. Repeat with more strips. The left and right sums for $f(x)=x^2$ on $[0,1]$ close in on a common value:

$n$ $L_n$ (left, under) $R_n$ (right, over) gap $R_n - L_n$
4 0.21875 0.46875 0.25000
10 0.28500 0.38500 0.10000
100 0.32835 0.33835 0.01000
1000 0.33283 0.33383 0.00100

The gap is exactly $R_n - L_n = \big(f(1)-f(0)\big)\Delta x = 1\cdot\tfrac1n = \tfrac1n$, which marches to zero. Both sums are squeezing toward $\tfrac13 = 0.3333\ldots$. We will prove that value in §13.5 with no rectangles at all — just algebra and a limit.

13.3 Riemann Sums in Sigma Notation

Let us make "slice, sum" precise for a general function $f$ on $[a,b]$.

A partition of $[a,b]$ is a choice of points $a = x_0 < x_1 < x_2 < \cdots < x_n = b$ that cut the interval into $n$ subintervals $[x_{i-1}, x_i]$. We will almost always use a regular partition, where every subinterval has the same width

$$\Delta x = \frac{b-a}{n}, \qquad x_i = a + i\,\Delta x.$$

In each subinterval pick a sample point $x_i^* \in [x_{i-1}, x_i]$ and build a rectangle of height $f(x_i^*)$ and width $\Delta x$. The total rectangle area is the Riemann sum

$$S_n = \sum_{i=1}^{n} f(x_i^*)\,\Delta x.$$

The standard choices of sample point have names:

  • Left endpoint: $x_i^* = x_{i-1} = a + (i-1)\Delta x$.
  • Right endpoint: $x_i^* = x_i = a + i\,\Delta x$.
  • Midpoint: $x_i^* = \overline{x}_i = \tfrac12(x_{i-1} + x_i) = a + (i - \tfrac12)\Delta x$.

Two more choices matter for theory. The lower sum uses, in each subinterval, the point where $f$ is smallest; the upper sum uses where $f$ is largest. By construction every Riemann sum is trapped between the lower and upper sums for the same partition. This squeeze is exactly what we exploited numerically in §13.2, and it is the engine of the existence proof in §13.12.

Common Pitfall. Students often write the right-endpoint sum as $\sum_{i=1}^n f(a + i\,\Delta x)\,\Delta x$ but then also start the index at $i = 0$, double-counting the left edge. For the right-endpoint regular partition, the sample points are $a+\Delta x,\ a+2\Delta x,\ \ldots,\ a+n\Delta x = b$, so the sum runs $i = 1$ to $n$. For the left-endpoint sum the points are $a,\ a+\Delta x,\ \ldots,\ a+(n-1)\Delta x$, so it runs $i = 0$ to $n-1$ — or equivalently $i=1$ to $n$ with $f(a+(i-1)\Delta x)$. Pick a convention and keep the endpoints straight; an off-by-one here corrupts every digit.

Check Your Understanding. Write the right-endpoint Riemann sum for $\int_1^3 \frac{1}{x}\,dx$ with $n$ subintervals, in sigma notation.

AnswerHere $a=1$, $b=3$, so $\Delta x = \frac{3-1}{n} = \frac{2}{n}$ and $x_i = 1 + \frac{2i}{n}$. The right-endpoint sum is $$S_n = \sum_{i=1}^{n} f(x_i)\,\Delta x = \sum_{i=1}^{n} \frac{1}{\,1 + \tfrac{2i}{n}\,}\cdot\frac{2}{n}.$$ Its limit as $n\to\infty$ is $\int_1^3 \frac{dx}{x}$, a number we will recognize in Chapter 14 as $\ln 3$.

13.4 The Definite Integral

Now take the limit. As the number of subintervals grows, $\Delta x \to 0$, the rectangles get thin, and — for a well-behaved $f$ — the Riemann sums converge to a single number that does not depend on which sample points we chose.

The Definite Integral. Let $f$ be continuous on $[a,b]$. The definite integral of $f$ from $a$ to $b$ is $$\int_a^b f(x)\,dx = \lim_{n\to\infty} \sum_{i=1}^{n} f(x_i^*)\,\Delta x,$$ where $\Delta x = (b-a)/n$ and $x_i^*$ is any sample point in the $i$-th subinterval. For continuous $f$ the limit exists and is independent of the choice of sample points.

The anatomy of the symbol, with Leibniz's deliberate echo of the Riemann sum:

  • The sign $\displaystyle\int$ is an elongated "S" for summa — it is the limit of the $\sum$.
  • $f(x)$ is the integrand, the height of a rectangle.
  • $dx$ is the differential, the limit of the width $\Delta x$.
  • $a$ and $b$ are the limits of integration (lower and upper).
  • The result is a number, not a function. The variable $x$ is a dummy: $\int_a^b f(x)\,dx = \int_a^b f(t)\,dt$.

Historical Note. Bernhard Riemann gave this definition in 1854, in the paper that introduced what we now call Riemann sums — though, remarkably, it appeared inside a habilitation thesis on Fourier series, where he needed a precise notion of "integrable" to say which functions have a valid Fourier representation. Leibniz had introduced the $\int$ symbol almost two centuries earlier (1675), and Cauchy had defined the integral for continuous functions in the 1820s. Riemann's contribution was the general definition via upper and lower sums that lets us ask which functions are integrable at all.

Math Major Sidebar. The clean "$n\to\infty$ with regular partitions" definition above is enough for continuous functions, but the fully general Riemann integral does not require equal widths. One defines the mesh of a partition as the width of its widest subinterval, $\|P\| = \max_i \Delta x_i$, and declares $f$ integrable with integral $I$ if for every $\varepsilon > 0$ there is a $\delta > 0$ such that every tagged partition with mesh $< \delta$ has $\big|\sum f(x_i^*)\Delta x_i - I\big| < \varepsilon$, no matter how the tags $x_i^*$ are chosen. Equivalently (Darboux's formulation), $f$ is integrable iff its upper and lower sums can be made arbitrarily close. The two formulations agree, and for continuous $f$ both deliver the same $I$ — which is why our simpler definition loses nothing in this book.

13.5 Computing an Integral from the Definition

Let us honor the claim of §13.2 and compute $\int_0^1 x^2\,dx$ exactly — with no antiderivatives, only the limit of a Riemann sum. This is the kind of calculation FTC will mercifully retire, so it is worth doing once by hand.

Use right endpoints: $\Delta x = 1/n$ and $x_i = i/n$. Then $f(x_i) = (i/n)^2 = i^2/n^2$, and

$$R_n = \sum_{i=1}^{n} \frac{i^2}{n^2}\cdot\frac1n = \frac{1}{n^3}\sum_{i=1}^{n} i^2.$$

Now invoke the classical sum-of-squares formula (provable by induction), $\displaystyle\sum_{i=1}^n i^2 = \frac{n(n+1)(2n+1)}{6}$. Substituting,

$$R_n = \frac{1}{n^3}\cdot\frac{n(n+1)(2n+1)}{6} = \frac{(n+1)(2n+1)}{6n^2} = \frac{2n^2 + 3n + 1}{6n^2} = \frac13 + \frac{1}{2n} + \frac{1}{6n^2}.$$

Take the limit. The two tail terms vanish, leaving

$$\int_0^1 x^2\,dx = \lim_{n\to\infty} R_n = \frac13.$$

There it is — the value the numerical table was sneaking up on, now pinned exactly. Notice the structure of $R_n = \tfrac13 + \tfrac{1}{2n} + \cdots$: the leading term is the true integral, and the $\tfrac{1}{2n}$ correction is the right-sum overshoot, decaying like $1/n$ exactly as the gap table predicted.

Geometric Intuition. The $\tfrac{1}{2n}$ error term has a picture. The right-endpoint rectangles overshoot the curve by a row of little triangular slivers along the top. Stack those slivers side by side and they form a shape of total width $1$ and height $f(1)-f(0) = 1$ but thickness $\Delta x = 1/n$ — area on the order of $\tfrac12\cdot 1\cdot\tfrac1n$. That is precisely the $\tfrac{1}{2n}$ you see in the formula. The algebra and the geometry are telling the identical story.

Check Your Understanding. Using right endpoints and the formula $\sum_{i=1}^n i = \frac{n(n+1)}{2}$, evaluate $\int_0^1 x\,dx$ from the definition.

Answer$R_n = \sum_{i=1}^n \frac{i}{n}\cdot\frac1n = \frac{1}{n^2}\cdot\frac{n(n+1)}{2} = \frac{n+1}{2n} = \frac12 + \frac{1}{2n}$. As $n\to\infty$ this $\to \frac12$. Geometry agrees: the region is a triangle of base 1 and height 1, area $\tfrac12$.

13.6 Signed Area

So far $f$ has been positive and the integral has been a literal area. What if $f$ dips below the axis?

Look again at the Riemann sum $\sum f(x_i^*)\Delta x$. When $f(x_i^*) < 0$, that term is negative: it subtracts the area of a rectangle hanging below the axis. So the integral does not measure raw area — it measures signed area, counting regions above the axis as positive and regions below as negative.

The Key Insight. $\displaystyle\int_a^b f(x)\,dx = (\text{area above the axis}) - (\text{area below the axis}).$ This "net" reading is not a quirk to be corrected; it is exactly what makes integrals report net change. If a particle drives forward then back, the signed area under its velocity must be allowed to cancel so the integral can correctly say it ended where it started (§13.10).

For the total, unsigned area between the graph and the axis, integrate the absolute value: $\int_a^b |f(x)|\,dx$. The two differ precisely on the intervals where $f < 0$.

Example (cancellation). Consider $\int_{-1}^{1} x\,dx$. The region is two triangles: one below the axis on $[-1,0]$ with signed area $-\tfrac12$, one above on $[0,1]$ with signed area $+\tfrac12$. They cancel: $$\int_{-1}^{1} x\,dx = -\tfrac12 + \tfrac12 = 0.$$ This also follows because $x$ is an odd function and the interval is symmetric — a shortcut worth remembering: the integral of an odd function over $[-c,c]$ is always $0$.

13.7 Evaluating Integrals by Geometry

Whenever the region under $f$ is a shape whose area you already know, you can read the integral straight off a picture — again, no FTC required.

Constant function. $\displaystyle\int_a^b c\,dx = c(b-a)$: a rectangle of height $c$ and width $b-a$. (If $c<0$ the signed area is negative.)

Linear function (a trapezoid). $\displaystyle\int_0^2 (3x+1)\,dx$. The region under the line $y = 3x+1$ over $[0,2]$ is a trapezoid with parallel vertical sides $f(0)=1$ and $f(2)=7$ and horizontal width $2$. The trapezoid area is the average of the parallel sides times the width: $$\int_0^2 (3x+1)\,dx = \frac{1 + 7}{2}\cdot 2 = 8.$$

Absolute value (two triangles). $\displaystyle\int_{-1}^{1} |x|\,dx$ is two right triangles, each with legs $1$ and area $\tfrac12$, totaling $1$. Here the integrand is never negative, so signed area and total area coincide.

Quarter circle. $\displaystyle\int_0^1 \sqrt{1-x^2}\,dx$. The graph $y = \sqrt{1-x^2}$ is the upper unit semicircle; over $[0,1]$ it traces a quarter of the unit disk, whose area is $\tfrac14\pi r^2 = \tfrac{\pi}{4}$. So $$\int_0^1 \sqrt{1-x^2}\,dx = \frac{\pi}{4}.$$ This one is worth savoring: an algebraic integrand produces $\pi$, and there is no elementary antiderivative shortcut that makes it obvious — geometry sees it instantly.

Common Pitfall. A geometric evaluation only works when the signed area is what you read off. For $\int_0^{2\pi}\sin x\,dx$, students sometimes compute the area of "the hump" as a positive number and forget the second hump dips below the axis. The two humps have equal area but opposite sign, so the integral is $0$, not twice the hump area. Always check where the integrand is negative before equating an integral with a geometric area.

13.8 Properties of the Definite Integral

Each property below is a statement about Riemann sums in the limit; each also has a one-line picture. Throughout, assume $f$ and $g$ are continuous on the relevant interval.

Linearity. Constants pull out and sums split: $$\int_a^b \big[\alpha f(x) + \beta g(x)\big]\,dx = \alpha\int_a^b f(x)\,dx + \beta\int_a^b g(x)\,dx.$$ Why: every Riemann sum of $\alpha f + \beta g$ is $\alpha$ times the sum of $f$ plus $\beta$ times the sum of $g$; limits respect that.

Additivity over intervals. For any $c$ between $a$ and $b$, $$\int_a^c f(x)\,dx + \int_c^b f(x)\,dx = \int_a^b f(x)\,dx.$$ Why: the area over $[a,b]$ is the area over $[a,c]$ plus the area over $[c,b]$ — just split the partition at $c$. This property is the workhorse for integrating piecewise-defined functions.

Reversing the limits. Flipping the limits flips the sign: $$\int_a^b f(x)\,dx = -\int_b^a f(x)\,dx.$$ This is a convention that makes additivity hold even when $c$ is not between $a$ and $b$, and it is consistent with reading $\Delta x = (b-a)/n$ as negative when $b

Equal limits. A region of zero width has zero area: $\displaystyle\int_a^a f(x)\,dx = 0$.

Comparison. If $f(x) \le g(x)$ for all $x\in[a,b]$, then $$\int_a^b f(x)\,dx \le \int_a^b g(x)\,dx.$$ Why: a lower curve encloses less signed area. In particular, if $f \ge 0$ then $\int_a^b f \ge 0$.

Bounding box. If $m \le f(x) \le M$ on $[a,b]$, then $$m(b-a) \le \int_a^b f(x)\,dx \le M(b-a).$$ Why: the region is trapped between the rectangle of height $m$ and the rectangle of height $M$. This crude bound is more useful than it looks — it is the seed of the Mean Value Theorem for Integrals in §13.11.

Check Your Understanding. Use the bounding-box property to bracket $\int_0^1 \frac{1}{1+x^2}\,dx$ without computing it.

AnswerOn $[0,1]$, the integrand $\frac{1}{1+x^2}$ decreases from $1$ (at $x=0$) to $\tfrac12$ (at $x=1$). So $m = \tfrac12$ and $M = 1$, giving $\tfrac12 \le \int_0^1 \frac{dx}{1+x^2} \le 1$. The true value, which we will identify in Chapter 14, is $\frac{\pi}{4}\approx 0.785$ — comfortably inside the bracket.

13.9 The Definite Integral as Total Accumulation

The deepest way to read $\int_a^b f\,dx$ is not "area" but total accumulated from a rate. In the Riemann sum, $f(x_i^*)\,\Delta x$ is a rate times a small chunk of the variable — and that product is an amount. Summing the amounts and refining gives the total amount accumulated across $[a,b]$. This single template covers an astonishing range of applications:

Setting Integrand (a rate) $\int_a^b$ accumulates
Linear motion velocity $v(t)$ net displacement
Linear motion speed $|v(t)|$ total distance traveled
Mechanics force $F(x)$ work done over $[a,b]$
A thin rod linear density $\rho(x)$ total mass
Probability density $p(x)$ probability that $X\in[a,b]$
Economics marginal cost $C'(q)$ added cost of units $a$ to $b$
Electricity power $P(t)$ total energy delivered

Real-World Application — Pharmacokinetics (medicine). When a drug is studied, regulators care about the area under the concentration-time curve (AUC): if $c(t)$ is the blood concentration over time, the total drug exposure is $\int_0^T c(t)\,dt$. Two formulations of the same drug are declared bioequivalent only if their AUCs match within tight tolerances. In practice $c(t)$ is sampled at a handful of blood draws and the AUC is computed by the trapezoidal rule of §13.13 — a Riemann-type sum applied directly to data, with no formula in sight.

We develop two of these accumulations in detail next, computing both by geometry so we stay scrupulously FTC-free.

13.10 Application: Displacement and Distance from Velocity

Let a particle move along a line with velocity $v(t) = 3t^2 - 6t$ for $0 \le t \le 3$. Velocity is a rate (the derivative of position), so by §13.9 the integral of $v$ accumulates position change.

First find where $v$ changes sign: $v(t) = 3t(t-2) = 0$ at $t = 0$ and $t = 2$, with $v < 0$ on $(0,2)$ and $v > 0$ on $(2,3)$. The particle drifts backward, stops at $t=2$, then moves forward.

Net displacement is the signed-area integral $\int_0^3 v\,dt$. We will get it by geometry-of-areas, splitting at the sign change with additivity (§13.8). The region on $[0,2]$ lies below the axis; the region on $(2,3)$ lies above. Computing each piece as a (signed) area of the region under the parabola — for instance with a Riemann-sum limit identical in spirit to §13.5 — gives $$\int_0^2 (3t^2 - 6t)\,dt = -4, \qquad \int_2^3 (3t^2 - 6t)\,dt = +4,$$ so the net displacement is $-4 + 4 = 0$: the particle returns exactly to its starting point.

Total distance ignores direction; it integrates the speed $|v|$: $$\int_0^3 |3t^2 - 6t|\,dt = \underbrace{\big|{-4}\big|}_{\text{backward leg}} + \underbrace{\big|{+4}\big|}_{\text{forward leg}} = 4 + 4 = 8.$$ The particle covers $8$ units of ground while netting zero displacement — it went $4$ back and $4$ forward.

Common Pitfall. "Distance traveled equals $\int v\,dt$" is one of the most expensive errors in integral calculus. That integral is net displacement, signed. Total distance is $\int |v|\,dt$, which forces you to split the interval at every sign change of $v$ and add the unsigned pieces. The particle above is the canonical trap: $\int v = 0$ but the particle is exhausted, having traveled $8$ units.

(Flag for the reader: I report the two signed sub-areas, $-4$ and $+4$, without re-deriving each by a full sum-of-squares limit. Each can be obtained exactly by the §13.5 method — a right-endpoint Riemann sum on the parabola — and Chapter 14 will recover them instantly via the antiderivative $t^3 - 3t^2$. They are stated, not invented; the values are correct.)

13.11 The Mean Value Theorem for Integrals and Average Value

This section sets up two results that Chapter 14 uses to prove the Fundamental Theorem, so we develop them carefully here.

Average value. The average of finitely many numbers is their sum over the count. For a continuous function on $[a,b]$ — infinitely many values — replace the sum by an integral and the count by the length:

$$\boxed{\ \overline{f} = \frac{1}{b-a}\int_a^b f(x)\,dx.\ }$$

Geometrically, $\overline{f}$ is the height of the rectangle on base $[a,b]$ whose area equals the area under $f$. If you sliced off the bumps of $f$ above this level and used them to fill the dips below, you would level the region into exactly that rectangle.

Example. The average value of $f(x) = x^2$ on $[0,1]$ is $\overline{f} = \frac{1}{1-0}\int_0^1 x^2\,dx = \frac13$ (using §13.5). The function ranges over $[0,1]$ but averages $\tfrac13$, since it spends most of the interval small.

Geometric Intuition. The average-value rectangle has the same area as the region under $f$, so its top must cross the graph of $f$ somewhere — it cannot lie entirely above the curve (then the rectangle would have more area) nor entirely below. That crossing point is the content of the next theorem: $f$ actually attains its own average.

Mean Value Theorem for Integrals. If $f$ is continuous on $[a,b]$, then there exists a point $c \in [a,b]$ with $$f(c) = \frac{1}{b-a}\int_a^b f(x)\,dx, \qquad\text{equivalently}\qquad \int_a^b f(x)\,dx = f(c)\,(b-a).$$

Why it is true. By the bounding-box property (§13.8), if $m$ and $M$ are the minimum and maximum of $f$ on $[a,b]$ (which exist by the Extreme Value Theorem, Chapter 4), then $$m \le \frac{1}{b-a}\int_a^b f(x)\,dx \le M.$$ So the average value $\overline{f}$ is a number between the min and the max of $f$. Since $f$ is continuous, the Intermediate Value Theorem (Chapter 4) guarantees $f$ takes every value between $m$ and $M$ — in particular it takes the value $\overline{f}$ at some point $c$. That is the whole proof.

Example. For $f(x)=x^2$ on $[0,1]$ the average is $\tfrac13$, attained where $c^2 = \tfrac13$, i.e. $c = 1/\sqrt3 \approx 0.577 \in [0,1]$.

The Key Insight. Continuity is doing the real work: a continuous function cannot skip its own average value. This is why Chapter 14 needs continuity for the Fundamental Theorem — the proof there squeezes a sliver of area into a single rectangle of height $f(c)$ using exactly this theorem, then lets the sliver shrink so $c \to x$. We are quietly laying the FTC's foundation right now.

13.12 When Does the Integral Exist?

We have repeatedly said "for continuous $f$, the limit exists." Why?

The argument is a squeeze. On each subinterval, the lower sum uses the minimum of $f$ and the upper sum uses the maximum; every Riemann sum lies between them. A continuous function on a closed bounded interval is uniformly continuous (Chapter 4): for any tolerance, once the subintervals are narrow enough, $f$ varies by less than that tolerance across each of them simultaneously. So the per-subinterval gap (max minus min) becomes uniformly tiny, the upper and lower sums are forced together, and every Riemann sum trapped between them converges to the same number. That number is the integral.

Not every function survives this. The Dirichlet function — $f(x) = 1$ if $x$ is rational, $0$ if irrational — has, on every subinterval no matter how small, both a rational point (where $f=1$) and an irrational point (where $f=0$). Its upper sum is always $1$ and its lower sum is always $0$; they never close the gap, so the function is not Riemann integrable on $[0,1]$.

Warning. "Integrable" is a real condition, not a formality. The criterion is: $f$ must be bounded and its set of discontinuities must be negligibly small (technically, of measure zero — for instance, finitely many jumps). Continuous functions qualify; so do piecewise-continuous bounded functions like step functions. But a function discontinuous at every point, like Dirichlet's, fails. The repair — Lebesgue integration, which partitions the $y$-axis instead of the $x$-axis — rescues such functions and is the foundation of modern probability and analysis, but it belongs to a later course. For all of calculus, Riemann integration of (piecewise-)continuous functions is exactly what we need.

13.13 Numerical Integration

Most integrals that arise in practice have integrands measured from data or lacking an elementary antiderivative; for them we approximate the integral with a Riemann-type sum. Two ideas improve on the crude left/right rectangles.

The midpoint rule samples $f$ at the center of each subinterval, $\overline{x}_i = a + (i-\tfrac12)\Delta x$: $$M_n = \Delta x\sum_{i=1}^{n} f(\overline{x}_i).$$ Centering balances the overshoot on one side of a strip against the undershoot on the other, so the midpoint rule is typically far better than either endpoint rule.

Example. For $\int_0^1 x^2\,dx$ with $n=4$, the midpoints are $\tfrac18,\tfrac38,\tfrac58,\tfrac78$ and $\Delta x = \tfrac14$: $$M_4 = \tfrac14\Big(\tfrac{1}{64}+\tfrac{9}{64}+\tfrac{25}{64}+\tfrac{49}{64}\Big) = \tfrac14\cdot\tfrac{84}{64} = \tfrac{21}{64} \approx 0.3281.$$ The true value is $\tfrac13 \approx 0.3333$, so even $n=4$ is within $2\%$ — a dramatic improvement over $L_4 = 0.219$ and $R_4 = 0.469$.

The trapezoidal rule replaces each flat-topped rectangle with a slanted-topped trapezoid connecting $(x_{i-1}, f(x_{i-1}))$ to $(x_i, f(x_i))$. Summing the trapezoid areas and collecting terms gives $$T_n = \frac{\Delta x}{2}\Big[f(x_0) + 2f(x_1) + 2f(x_2) + \cdots + 2f(x_{n-1}) + f(x_n)\Big].$$ The interior heights are doubled because each is shared by two adjacent trapezoids; only the two endpoints appear once. Equivalently, $T_n = \tfrac12(L_n + R_n)$ — the trapezoidal rule is just the average of the left and right sums, which is why it cancels much of their opposite-signed error.

How good are these? For a smooth function on a regular partition, the errors shrink at characteristic rates as $n$ grows (write $h = \Delta x$):

Method Error scaling Sample point used
Left / right rectangles $O(h)$ one endpoint
Trapezoidal $O(h^2)$ both endpoints
Midpoint $O(h^2)$ center

Doubling $n$ roughly halves the rectangle error but quarters the trapezoid and midpoint error — the payoff of using the geometry of the strip instead of a flat guess. (Higher-order schemes such as Simpson's rule, $O(h^4)$, and adaptive quadrature appear in Chapter 16, where numerical integration is treated in full.)

Computational Note. Beware that high accuracy assumes a smooth integrand. Near a singularity or a kink, these error rates degrade — a midpoint sum across a vertical asymptote can return a confident, completely wrong number. When in doubt, refine $n$ and watch whether the estimate stabilizes; if it drifts, suspect a singularity (the realm of improper integrals, Chapter 17).

13.14 The Area Under the Normal Curve

Here is the integral that will follow us through the rest of the book. The standard normal density — the bell curve — is

$$\phi(x) = \frac{1}{\sqrt{2\pi}}\,e^{-x^2/2}.$$

It is the most important function in all of statistics: heights, measurement errors, sample means, and countless natural quantities cluster according to it. The probability that a standard normal random variable lands between $a$ and $b$ is, by §13.9, an area under this curve:

$$P(a \le X \le b) = \int_a^b \frac{1}{\sqrt{2\pi}}\,e^{-x^2/2}\,dx.$$

And here is the shock. This integral cannot be evaluated by elementary means. There is no formula built from polynomials, roots, exponentials, logarithms, and trig functions whose derivative is $\phi(x)$ — a fact proved by Liouville in the 1830s, not a gap in our cleverness. The Fundamental Theorem of Chapter 14 will apply perfectly; it just hands us an antiderivative we cannot write down. So how does every statistics table, every $z$-score, every "$68$–$95$–$99.7$" rule get its numbers?

By exactly the tool of this chapter: a Riemann-type sum. We approximate the bell-curve area numerically. Let us estimate the famous central probability $P(-1 \le X \le 1)$ — the chance of landing within one standard deviation of the mean — and watch the rule converge.

# Area under the standard normal curve P(-1 <= X <= 1), with no antiderivative:
# approximate the integral of phi by left, right, midpoint Riemann sums and the trapezoidal rule.
import numpy as np

def phi(x: np.ndarray) -> np.ndarray:
    return np.exp(-x**2 / 2) / np.sqrt(2 * np.pi)   # standard normal density

def riemann(f, a: float, b: float, n: int) -> dict:
    dx = (b - a) / n
    xl = a + dx * np.arange(n)          # left endpoints
    xr = a + dx * np.arange(1, n + 1)   # right endpoints
    xm = a + dx * (np.arange(n) + 0.5)  # midpoints
    left  = dx * np.sum(f(xl))
    right = dx * np.sum(f(xr))
    mid   = dx * np.sum(f(xm))
    trap  = 0.5 * (left + right)        # trapezoidal = average of left and right
    return {"left": left, "right": right, "midpoint": mid, "trapezoid": trap}

for n in (4, 50, 1000):
    r = riemann(phi, -1.0, 1.0, n)
    print(n, {k: round(v, 6) for k, v in r.items()})

# Output:
# 4    {'left': 0.672522, 'right': 0.672522, 'midpoint': 0.687806, 'trapezoid': 0.672522}
# 50   {'left': 0.682625, 'right': 0.682625, 'midpoint': 0.682722, 'trapezoid': 0.682625}
# 1000 {'left': 0.682689, 'right': 0.682689, 'midpoint': 0.68269,  'trapezoid': 0.682689}
# The estimates lock onto 0.6827 -- the famous "68%" within one standard deviation.

The sum converges to $0.6827\ldots$ — the "$68\%$" of the empirical rule, computed from nothing but rectangles. (The left and right sums come out identical here because $\phi$ is symmetric about $0$ and $\phi(-1)=\phi(1)$, so on the symmetric interval $[-1,1]$ every left rectangle is matched by an equal right rectangle. The midpoint rule, sampling different points, is the most accurate of the three at small $n$.)

Real-World Application — Statistical inference (data science). Every confidence interval and $p$-value you will ever compute is, underneath, an area under a bell curve like this one. Statistical software does not store a magic formula for $\Phi(x) = \int_{-\infty}^{x}\phi$; it evaluates that area by high-accuracy numerical integration (or an equivalent series) — the grown-up version of the Riemann sum above. When you read "$p = 0.03$," a definite integral was approximated to get it.

We will return to this curve twice. In Chapter 14, FTC will explain why the cumulative area function $\Phi(x) = \int_{-\infty}^{x}\phi(t)\,dt$ satisfies $\Phi' = \phi$ even though $\Phi$ has no formula. In Chapter 23, Taylor series will let us expand $e^{-x^2/2}$ and integrate term by term, producing a convergent series for the bell-curve area that converges to any precision we like. The area under the normal curve is the thread that ties Riemann sums, the Fundamental Theorem, and infinite series into one story.

13.15 Looking Toward the Fundamental Theorem

Step back and notice the cost of everything in this chapter. To get $\int_0^1 x^2\,dx = \tfrac13$ we summoned the sum-of-squares formula and took a limit (§13.5). Geometry rescued us for lines, circles, and absolute values (§13.7), but most integrands are not geometric, and not every sum has a tidy closed form like $\sum i^2$. Computing integrals directly from the definition is, in general, brutal.

Chapter 14 changes everything. The Fundamental Theorem of Calculus will prove that

$$\int_a^b f(x)\,dx = F(b) - F(a),$$

where $F$ is any antiderivative of $f$ — any function with $F' = f$. Watch how the labor of §13.5 evaporates: an antiderivative of $x^2$ is $F(x) = x^3/3$, so $\int_0^1 x^2\,dx = F(1) - F(0) = \tfrac13 - 0 = \tfrac13$ in a single line, no sum-of-squares formula, no limit. The two halves of calculus — the derivative you built in Part II and the integral you built here — are about to be revealed as inverse operations. That revelation is the most important theorem in mathematics, and you now have the integral it is a theorem about.

Before we get there, internalize what the definite integral is, independent of any shortcut: the limit of Riemann sums, the signed area, the total accumulated from a rate. The shortcut computes it; this chapter is what it computes.

Add to Your Modeling Portfolio. Add a total-from-a-rate computation to your model, estimated numerically with a Riemann sum or the trapezoidal rule of §13.13 (you will re-derive these totals exactly via FTC next chapter). Biology: integrate a growth rate $P'(t)$ over a season to estimate the net change in a population; or accumulate a dose-response rate. Economics: integrate marginal cost $C'(q)$ over a production range to get the added cost, or a demand curve to get consumer surplus as an area. Physics: integrate a variable force $F(x)$ over a displacement to get work, or velocity over time to get displacement. Data Science: integrate a probability density (start with the standard normal $\phi$ of §13.14) over an interval to get a probability — the foundation of every distribution you will model.

Looking Ahead

Chapter 14 proves the Fundamental Theorem of Calculus, turning the hard limit of this chapter into a one-line subtraction and welding differentiation and integration into a single idea. Chapter 15 develops the two great antiderivative techniques — $u$-substitution and integration by parts — so that the "find an antiderivative" step of FTC becomes systematic. Chapter 16 adds trigonometric integrals, trigonometric substitution, partial fractions, and a fuller treatment of numerical integration. Chapter 17 handles improper integrals (infinite intervals and unbounded integrands, like the full-line normal integral). Chapter 18 turns FTC loose on areas, volumes, arc length, and work. The slice-sum-limit pattern you learned here will reappear in every one of them — and, much later, in the double and triple integrals of Chapter 32 and the line and surface integrals of Part VII, each a higher-dimensional echo of the definite integral you just built.

Reflection

The area problem is older than algebra, and for two thousand years it yielded only to ingenuity, one shape at a time. The Riemann sum replaced ingenuity with a procedure: slice, sum, take the limit — and suddenly the area under any continuous curve is a single well-defined number. That number does triple duty as area, as accumulated total, and as the inverse of differentiation. You computed one such integral by hand, the hard way, with a sum of squares and a limit, so that the shortcut waiting in the next chapter will land with full force. Turn the page: differentiation and integration are about to become two faces of one theorem.