Mathematics RU

Part IV · Calculus Chapter 28 of 60

The integral

The biography of one idea: cut a figure into thin strips and add them up. It was born in Syracuse, grew up in the age of indivisibles, met the tangent in the hands of Newton and Leibniz, and got a rigorous definition from Riemann.

Ages 16–18 55 minutes

Builds on: 27 · Extrema and optimization

You will learn

  • find distance from speed and the area under a curve as a limit of sums
  • compute integrals by the Newton–Leibniz formula and find antiderivatives by substitution and by parts
  • compute volumes of revolution, the work of a variable force and average values
  • tell a convergent improper integral from a divergent one

The last chapter ended with the reverse problem. A dashcam recorded the speedometer readings for the whole trip, and at every moment we know the car’s speed. How far did it go? The derivative turns distance into speed, and now we need the turn in the opposite direction.

While the speed is constant, the problem can be done in your head: $60$ km/h for ten minutes is $10$ km. On the speed graph this answer is the area of a rectangle $60$ km/h high and $\frac16$ of an hour wide. If for the first five minutes the car went at $30$ km/h and for the next five at $90$, the graph consists of two steps, and the distance is the sum of their areas: $2.5 + 7.5 = 10$ km. And when the speedometer needle doesn’t stand still for a second, let’s split the trip into short stretches, treat the speed as constant on each, and add up the areas of the narrow rectangles. The shorter the stretches, the more accurate the answer, and in the limit the distance equals the area under the speed graph.

So finding distance from speed and finding the area under a curve are one and the same problem. It’s solved by an idea that’s easy to state: cut the figure into thin strips and add up their areas. This idea has had a long life. It was born in Syracuse more than two thousand years ago; in the seventeenth century everything was sliced with it, from wine barrels to curves of any degree; then it met the tangent and became all-powerful; and it got a rigorous definition only in 1854. Let’s tell its biography in order.

Birth in Syracuse

Archimedes (around 287–212 BC) sent the Alexandrian mathematician Dositheus a treatise, The Quadrature of the Parabola. By quadrature the Greeks meant constructing a square equal in area to a given figure, and more broadly, computing an area exactly. By then polygons could be re-cut into one another, as in the workshop of chapter 20. Archimedes took on a figure bounded by a curve: the piece of the plane cut off from a parabola by a chord. It’s called a parabolic segment.

Archimedes’ answer is astonishingly simple: the segment is exactly a third larger than the triangle inscribed in it. Here’s the precise statement.

Let a chord $AB$ cut off a segment from a parabola, and let $C$ be the point of the parabola between $A$ and $B$ at which the tangent is parallel to the chord. Then the area of the segment is $\frac43$ of the area of triangle $ABC$.

The sum of the infinite progression $1 + \frac14 + \frac1{16} + \ldots$: each new generation of triangles in the proof is a quarter the size of the one before. The area of the triangle $ABC$ inscribed in the segment. For the parabola $y = x^2$ this area depends only on the horizontal width of the chord: $h = b - a$, where $a$ and $b$ are the $x$-coordinates of the points $A$ and $B$. Example: the chord of the parabola $y = x^2$ between the points with $x$-coordinates $-1$ and $2$. Here $h = 3$, $T = \frac{27}{8}$, and the area of the segment is $S = \frac43 \cdot \frac{27}{8} = \frac92$. Two sections from now we’ll get this number in a completely different way.

Archimedes proves the theorem by filling the segment with triangles: first one big one, then a smaller triangle in each of the two remaining pieces, then four, eight and so on. The proof below follows his plan, but more briefly: where Archimedes relied on properties of conic sections, we’ll use the derivative.

The trick is to fill the segment with triangles generation by generation and prove two things: each new generation is a quarter the size of the previous one, and the unfilled part melts away. Take the parabola $y = x^2$ and points $A$, $B$ on it with $x$-coordinates $a < b$; the width of the chord is $h = b - a$.

Take the point $C$ midway horizontally, with $x$-coordinate $m = \frac{a+b}{2}$. The slope of the chord is $\frac{b^2 - a^2}{b - a} = a + b$, and the slope of the tangent at $C$ is the derivative of $x^2$, that is, $2m = a + b$ (chapter 26). The slopes are equal, so the tangent at $C$ is parallel to the chord: this is the point from the statement of the theorem. Find the area of triangle $ABC$. Draw through $C$ a vertical line up to the chord, to the point $M$. The segment $CM$ cuts the triangle in two; it’s the base of both, and their heights, dropped to this vertical, are $m - a$ and $b - m$, adding up to $h$. So $T = \frac12 \cdot CM \cdot h$. The chord is the line $y = (a + b)x - ab$, and above the point $m$ it’s higher than the parabola by $(a + b)m - ab - m^2 = (m - a)(b - m) = \frac{h^2}{4}$. So $T = \frac12 \cdot \frac{h^2}{4} \cdot h = \frac{h^3}{8}$: the area depends only on the width of the chord. The unfilled part melts away. The verticals through $A$ and $B$ cut a parallelogram out of the strip between the chord and the tangent, and the segment lies inside it: on $[a, b]$ the parabola is no higher than the chord, because $(a + b)x - ab - x^2 = (x - a)(b - x) \ge 0$, and no lower than the tangent $y = 2mx - m^2$, because $x^2 - 2mx + m^2 = (x - m)^2 \ge 0$. Triangle $ABC$ is exactly half the parallelogram: they share the base $AB$ and the height, the distance between the parallel lines. So the triangle takes up more than half the segment. The same holds for each of the smaller segments, so each generation of triangles cuts the unfilled area by more than half. The next generation. After triangle $ABC$ two segments are left, over the chords $AC$ and $CB$ of width $\frac h2$. By the formula from the second step the triangle in each has area $\frac{(h/2)^3}{8} = \frac T8$, both together $\frac T4$. Then come four triangles of $\frac{T}{64}$ each, that is, $\frac{T}{16}$, and so on: each generation is a quarter the size of the one before. After $k$ generations the triangles take up $T\left(1 + \frac14 + \ldots + \frac{1}{4^{k-1}}\right)$, and less than $\frac{S}{2^k}$ is left unfilled, less than any number given in advance if $k$ is large. So the area of the segment is the sum of the infinite progression: $S = \frac{T}{1 - 1/4} = \frac43 T$ (chapter 13). For the parabola $y = x^2$ we’ve also got $S = \frac43 \cdot \frac{h^3}{8} = \frac{h^3}{6}$.

A chord of the parabola $y = x^2$ is moved so that its horizontal width doubles. By what factor does the area of the segment grow?

$S = \frac{h^3}{6}$, so doubling $h$ multiplies the area by $2^3 = 8$. The chord can be slanted and stand anywhere: for the parabola $y = x^2$ only its width matters.

Youth: the age of indivisibles

Then the idea fell asleep for a long time. Archimedes’ treatises were copied, translated into Arabic and Latin and commented on, but for almost two thousand years there was nobody to continue his work. It was woken by the seventeenth century, and woken unceremoniously.

In 1613 the astronomer Johannes Kepler married for the second time and laid in wine for the wedding. The wine merchant measured barrels in a single movement: he pushed a measuring rod through the bung-hole in the middle of the barrel to the far edge of the bottom and announced the volume from the length of the part that went in, whatever the barrel’s shape. Kepler doubted this method and set about calculating for himself. In 1615 his New Stereometry of Wine Barrels came out, in which the volumes of solids of revolution are found by slicing them into thin slices. Twenty years later Bonaventura Cavalieri turned slicing into a system: for him a figure is woven from all its segments, like cloth from threads, and a solid is made up of all its plane sections, like a book from pages. We’ve already used his principle about solids with equal sections in chapter 20.

The main test for the new methods was the area under the curve $y = x^n$. By the middle of the century several mathematicians could find it, Cavalieri, Fermat, Roberval, Torricelli, each in his own way. The most elegant trick belongs to Pierre de Fermat, a councillor of the parlement in Toulouse, whose theorem on the zero derivative we met in chapter 27.

For natural $n$ and $b > 0$, the area under the graph of $y = x^n$ on the interval $[0, b]$ is $\frac{b^{n+1}}{n+1}$.

The trick is to cut not into equal strips but into strips whose widths shrink in a geometric progression. Then the areas of the rectangles form a progression too, and we know how to sum a progression. In the picture $n = 2$ and $b = 1$.

Take a number $r$ between $0$ and $1$ and mark on the axis the points $b$, $br$, $br^2$, $br^3$, … They crowd towards zero and divide the interval into infinitely many pieces. Over the piece $[br^{k+1}, br^k]$ stand a rectangle of height $(br^k)^n$, the value of the function at the right end. Its width is $br^k(1 - r)$ and its area $b^{n+1}(1 - r)\left(r^{n+1}\right)^k$. The function $x^n$ is increasing, so the right end of each piece is its highest point, and the rectangles cover the whole area under the curve. Their areas form a geometric progression with ratio $r^{n+1} < 1$, whose sum is $U = \frac{b^{n+1}(1 - r)}{1 - r^{n+1}}$. Cancel $1 - r$, since $1 - r^{n+1} = (1 - r)(1 + r + r^2 + \ldots + r^n)$: we get $U = \frac{b^{n+1}}{1 + r + r^2 + \ldots + r^n}$. The rectangles with heights at the left ends lie under the curve. Each is exactly $r^n$ times lower than its “right” neighbour, since $(br^{k+1})^n = r^n(br^k)^n$. So their sum is $L = r^n U$, and the area $S$ is squeezed: $r^n U \le S \le U$ for every $r$. Move $r$ towards one. The sum $1 + r + \ldots + r^n$ of $n + 1$ terms approaches $n + 1$, and the factor $r^n$ approaches one, so both bounds approach $\frac{b^{n+1}}{n+1}$. The number $S$ doesn’t depend on $r$ and always lies between them, so $S = \frac{b^{n+1}}{n+1}$.
The area of the $b \times b^n$ rectangle in which the figure under the graph is inscribed. What fraction of the rectangle the figure occupies: for the line $y = x$ a half (it’s a triangle), for the parabola $y = x^2$ a third, for the cubic a quarter. Example: at $n = 2$, $b = 1$ the area is $\frac13$. Check with Archimedes: the chord from $(0, 0)$ to $(1, 1)$ cuts off a segment of area $\frac{1^3}{6} = \frac16$, the triangle under the chord has area $\frac12$, and what’s left under the parabola is $\frac12 - \frac16 = \frac13$. Two methods almost two thousand years apart gave the same number.

Fermat’s progression works for fractional exponents too: for example, the area under the graph of $y = \sqrt{x}$ on $[0, 1]$ is $\frac{1}{3/2} = \frac23$. The formula fails only at $n = -1$, where a zero appears in the denominator. We’ll come back to this hole at the very end of the chapter.

Meeting the tangent

By the 1660s the areas under many curves had been found, but each in its own way: one trick for one curve, another for another. It was the same with tangents. Isaac Barrow, Newton’s teacher at Cambridge, in his Geometrical Lectures (1670) proved a geometric theorem in which the tangent problem and the area problem turn out to be two sides of one problem. Newton in 1665–1666 and Leibniz in the 1670s turned this link into an algorithm that works for all curves at once.

Fix the left edge $a$ and move the right one. The area under the graph from $a$ to $x$ is no longer a number but a function of $x$. In the trip problem it’s the distance from the start at time $x$. Area below the axis, when the car is reversing, counts with a minus sign: driving backwards reduces the distance from the start. Physicists would put it more precisely: the integral of velocity is displacement, while the distance travelled, which the odometer counts, is the integral of the absolute value of velocity.

Set the speed at six moments of the trip or choose a scenario, then drag the point along the lower graph or press “Drive”. The tangent to the lower graph is tilted exactly as much as the speed. Turn on “Reversing”: what happens to the distance from the start when the speed graph goes below the axis?

How fast does the accumulated area grow? When the right edge moves by a small $h$, a narrow strip of width $h$ and height roughly $f(x)$ is added to the area. So the accumulated area grows at the rate $f(x)$: its derivative is the function itself. That’s the link Barrow saw. Let’s make the argument rigorous. We’ll need three properties of the area under a graph: under a constant function $c$ on an interval of length $\ell$ the area is $c\ell$; areas of neighbouring pieces add up; under a smaller function the area is no larger. Two sections below the area under a graph will get a precise definition, and we’ll check that it really has these properties.

Leibniz wrote the area under the graph from $a$ to $b$ like this: $\int_a^b f(x)\,dx$. The product $f(x)\,dx$ is the area of an infinitely narrow strip of height $f(x)$ and width $dx$, and the sign $\int$ is an elongated letter S, the first letter of the Latin summa: the area is a sum of strips. If the upper edge varies, the letter under the integral is changed so as not to confuse it with the edge: $\int_a^x f(t)\,dt$.

Let a function $f$ be continuous on the interval $[a, b]$, and let $\Phi(x) = \int_a^x f(t)\,dt$ be the (signed) area under its graph from $a$ to $x$. Then at every point $x$ of the open interval $(a, b)$ the function $\Phi$ has a derivative, and $\Phi'(x) = f(x)$.

The idea is to squeeze a narrow strip between two rectangles.

The accumulated area $\Phi(x)$ is the area under the graph from $a$ to $x$. Move the right edge by $h$; first let $h > 0$. Areas of neighbouring pieces add up, so the area from $a$ to $x + h$ equals $\Phi(x)$ plus the area of the strip over the interval $[x, x + h]$. So the increment $\Phi(x + h) - \Phi(x)$ is the area of the strip. Take any $\varepsilon > 0$. The function $f$ is continuous at $x$, so for small enough $h$ all its values on $[x, x + h]$ differ from $f(x)$ by less than $\varepsilon$ (chapter 25): above the strip the graph doesn’t leave the corridor between $f(x) - \varepsilon$ and $f(x) + \varepsilon$. Under a smaller function the area is no larger, and under a constant it’s the height times the width. So the strip is squeezed between two rectangles: $\bigl(f(x) - \varepsilon\bigr)h \le \Phi(x + h) - \Phi(x) \le \bigl(f(x) + \varepsilon\bigr)h$. Divide by $h$: the ratio $\frac{\Phi(x + h) - \Phi(x)}{h}$ differs from $f(x)$ by at most $\varepsilon$. For $h < 0$ the strip lies to the left of $x$, its area enters the increment with a minus sign, and after dividing by the negative $h$ we get the same bound. Whatever $\varepsilon$ we’re given, for all small enough $h$ the ratio differs from $f(x)$ by at most $\varepsilon$. That’s exactly what it means for its limit as $h \to 0$ to be $f(x)$: $\Phi'(x) = f(x)$.

The theorem says: the accumulated area is a function whose derivative is $f$. Such functions deserve a name.

An antiderivative of a function $f$ on an interval is a function $F$ with $F'(x) = f(x)$ at every point of the interval. For example, $\frac{x^3}{3}$ is an antiderivative of $x^2$, and $-\cos x$ of $\sin x$.

A function has many antiderivatives: you can add any constant to $\frac{x^3}{3}$ without changing the derivative. On an interval there are no antiderivatives other than these shifts.

If $F'(x) = 0$ at every point of an interval, then $F$ is constant on it. As a consequence, two antiderivatives of the same function on an interval differ by a constant.

Take any two points of the interval, $p < q$. By Lagrange’s theorem (chapter 27) there’s a point $c$ between them at which $F(q) - F(p) = F'(c)(q - p)$. But $F'(c) = 0$, so $F(q) = F(p)$: the function’s values at any two points coincide. If $F$ and $G$ are antiderivatives of the same function $f$, then $(F - G)' = f - f = 0$, and by what we’ve proved $F - G$ is a constant.

Now everything is ready for the main computational rule of calculus.

If $f$ is continuous on the interval $[a, b]$ and $F$ is any antiderivative of it on this interval, then $\int_a^b f(x)\,dx = F(b) - F(a)$.

By the fundamental theorem, the accumulated area $\Phi(x) = \int_a^x f(t)\,dt$ is also an antiderivative of $f$. By the lemma $\Phi(x) = F(x) + C$ for some constant $C$: first inside the interval, and at the ends by continuity. ($\Phi$ is continuous because the strip over an interval of length $h$ is at most $Mh$, where $M$ is the largest value of $|f|$, and $F$ is continuous because it has a derivative.) At $x = a$ the area is zero: $0 = F(a) + C$, so $C = -F(a)$. At $x = b$ we get $\int_a^b f(x)\,dx = \Phi(b) = F(b) - F(a)$.

The lower limit: where we start accumulating area. The upper limit: where we stop. The integrand, the height of the strip; $dx$ is its width. The increment of any antiderivative. A constant added to $F$ cancels out, so any one will do. The difference is often written $F(x)\Big|_a^b$. Example: $\int_0^1 x^2\,dx = \frac{1^3}{3} - \frac{0^3}{3} = \frac13$: Fermat’s result in one line. Archimedes’ segment from the first section: the chord between the points $(-1, 1)$ and $(2, 4)$ is the line $y = x + 2$, and $\int_{-1}^{2} \left(x + 2 - x^2\right)dx = \left(\frac{x^2}{2} + 2x - \frac{x^3}{3}\right)\Big|_{-1}^{2} = \frac{10}{3} + \frac{7}{6} = \frac92$. And the area under one arch of the sine wave is $\int_0^\pi \sin x\,dx = -\cos \pi + \cos 0 = 2$, exactly two.

To find an area you no longer have to cut the figure up. It’s enough to find a function whose derivative is the given one and subtract its values at the ends. The area problem has been reduced to the problem inverse to differentiation, and this has joined the two main tools of calculus into one.

Antiderivatives are found by reading the table of derivatives from right to left. Each formula below holds on any interval where the function is defined. The notation $\int f(x)\,dx = F(x) + C$ without limits means all the antiderivatives at once.

The indefinite integral of a function $f$ is the set of all its antiderivatives on an interval. We write $\int f(x)\,dx = F(x) + C$, where $F$ is one of the antiderivatives and $C$ any constant.

Function $f(x)$Antiderivatives $\int f(x)\,dx$
$x^n$, $n \ne -1$$\frac{x^{n+1}}{n+1} + C$
$\frac1x$, $x \ne 0$$\ln\lvert x\rvert + C$
$e^x$$e^x + C$
$\sin x$$-\cos x + C$
$\cos x$$\sin x + C$
$\frac{1}{\cos^2 x}$, $\cos x \ne 0$$\tan x + C$
$\frac{1}{1 + x^2}$$\arctan x + C$

Calculate $\int_1^2 \left(3x^2 - 2x\right)dx$.

An antiderivative of $3x^2$ is $x^3$, and of $2x$ is $x^2$. So $F(x) = x^3 - x^2$, and the integral is $F(2) - F(1) = (8 - 4) - (1 - 1) = 4$.

What is $\int_{-1}^{1} \frac{dx}{x^2}$?

The Newton–Leibniz formula requires $f$ to be continuous on the whole interval, but $\frac{1}{x^2}$ has a discontinuity at zero, where the graph runs off to infinity. Even from $\varepsilon$ to $1$ the area is $\frac1\varepsilon - 1$, which grows without bound as $\varepsilon \to 0$. We’ll look at such integrals in the last section.

A passport from Riemann

For a century and a half the integral was used without asking what the area under a graph is. For the smooth curves of physicists and engineers this went unpunished. But at the start of the nineteenth century Fourier series began producing functions stranger than any curve, and the question “what exactly are we adding up?” became unavoidable. In 1829 Peter Gustav Lejeune Dirichlet produced a function equal to $1$ at rational points and $0$ at irrational ones: where is its “area under the graph”? Augustin-Louis Cauchy in 1823 defined the integral of a continuous function as a limit of sums, and Bernhard Riemann in 1854, in a paper on trigonometric series published after his death, gave a definition for any function. It’s still in use today.

Divide the interval $[a, b]$ by points $a = x_0 < x_1 < \ldots < x_n = b$ into pieces of length $\Delta x_i = x_i - x_{i-1}$ and choose any point $\xi_i$ in each piece.

A Riemann sum is the number $f(\xi_1)\Delta x_1 + f(\xi_2)\Delta x_2 + \ldots + f(\xi_n)\Delta x_n$. Each term is the area of a rectangle of height $f(\xi_i)$ over the $i$th piece; if $f(\xi_i) < 0$, this area comes with a minus sign.

A function is integrable on $[a, b]$ if there’s a number $I$ with this property: whatever $\varepsilon > 0$ we’re given, there’s a $\delta > 0$ such that every Riemann sum for a partition into pieces shorter than $\delta$ differs from $I$ by less than $\varepsilon$, however the points $\xi_i$ are chosen. This number is called the definite integral and written $\int_a^b f(x)\,dx$.

$\Delta$ is the length of the longest piece. The limit is taken as all the pieces become arbitrarily short. The height of the $i$th rectangle: the value of the function at any point $\xi_i$ of the piece. The result mustn’t depend on which point is chosen. The width of the piece, $x_i - x_{i-1}$. Example: $f(x) = x^2$ on $[0, 1]$, ten equal pieces. With the points at the right ends the sum is $\frac{1^2 + 2^2 + \ldots + 10^2}{1000} = 0.385$, with the midpoints $0.3325$, and the integral is $\frac13 = 0.333\ldots$

Riemann sums aren’t only a definition but a way of computing. An antiderivative can’t always be found, and then the integral is computed from sums. That’s what calculators and computers do, and different ways of choosing the points give very different accuracy.

Choose a function and a method, and move $n$. The lower graph shows how the error falls as $n$ grows, for all five methods at once. Compare the slopes of the lines for $x^2$ and for $\sqrt{x}$, and see what happens to the left and right sums for the sine.

Not every function is integrable. Dirichlet’s function has both rational and irrational points in every piece: choose all the $\xi_i$ rational and the sum is $b - a$; choose them irrational and it’s zero. The sums don’t approach any single number, and there’s no Riemann integral. In 1902 Henri Lebesgue devised a stronger integral that can handle even such a function; it awaits us in chapter 54. But for functions that only increase or only decrease, integrability can be proved with one picture.

If a function $f$ is increasing (or decreasing) on the interval $[a, b]$, it’s integrable on it.

The idea: squeeze all the Riemann sums between a lower and an upper sum, and see that the gap between them stacks into one narrow column. Let $f$ be increasing; for a decreasing one everything is mirrored.

Divide the interval into pieces, each no longer than $\delta$. The function increases, so on each piece it’s smallest at the left end. The rectangles with heights $f(x_{i-1})$ give the lower sum $L$. The rectangles with heights $f(x_i)$ at the right ends give the upper sum $U$. Any Riemann sum for the same partition lies between them, because $f(x_{i-1}) \le f(\xi_i) \le f(x_i)$. The difference $U - L$ is the little boxes along the graph: over the $i$th piece, a box of width $\Delta x_i$ and height $f(x_i) - f(x_{i-1})$. Slide the boxes to the right, to the edge $b$, keeping their heights. The top of each box is the bottom of the next, so they stack into one column from $f(a)$ to $f(b)$. Each is no wider than $\delta$, so $U - L \le \bigl(f(b) - f(a)\bigr)\delta$. Every lower sum is no larger than every upper sum: two partitions have a common refinement, and adding points can only raise a lower sum and only lower an upper one. By the completeness of the real numbers (chapter 53) there’s a number $I$ between all the lower and all the upper sums. A Riemann sum and $I$ lie between the same $L$ and $U$, so they differ by at most $\bigl(f(b) - f(a)\bigr)\delta$, which is less than any $\varepsilon$ for small $\delta$. So $f$ is integrable and $I = \int_a^b f(x)\,dx$.

Continuous functions are integrable too, but the proof needs the subtler notion of uniform continuity and is put off to chapter 53. It will also be proved there that a continuous function on a closed interval has a largest and a smallest value. We’ll use both facts. And the three properties the fundamental theorem relied on follow straight from the definition.

Let $f$ and $g$ be integrable on $[a, b]$, and $k$ a number. Then

1) $\int_a^b \bigl(f(x) + g(x)\bigr)dx = \int_a^b f(x)\,dx + \int_a^b g(x)\,dx$ and $\int_a^b kf(x)\,dx = k\int_a^b f(x)\,dx$;

2) if $f(x) \le g(x)$ on the whole interval, then $\int_a^b f(x)\,dx \le \int_a^b g(x)\,dx$; in particular, the integral of a constant $c$ is $c(b - a)$;

3) if $a < c < b$ and $f$ is integrable on $[a, c]$ and $[c, b]$, then $\int_a^b f(x)\,dx = \int_a^c f(x)\,dx + \int_c^b f(x)\,dx$.

All three properties hold for every Riemann sum and so carry over to the limit. For the same partition and the same points, the Riemann sum for $f + g$ is the sum of the Riemann sums for $f$ and for $g$, and the sum for $kf$ is the sum for $f$ times $k$. As the pieces get smaller, the left sides approach the integrals of the left sides and the right sides the right, and the equations are preserved. If $f \le g$, each term $f(\xi_i)\Delta x_i$ is no larger than $g(\xi_i)\Delta x_i$, and the sums, and after them the limits, compare the same way. For a constant $c$ every sum is $c\bigl(\Delta x_1 + \ldots + \Delta x_n\bigr) = c(b - a)$. Finally, if the point $c$ is in the partition, the Riemann sum on $[a, b]$ splits into a sum on $[a, c]$ and a sum on $[c, b]$, which approach the two integrals on the right. If $c$ falls inside a piece, cut that piece at $c$: the sum changes by less than $2M\delta$, where $M$ is the largest value of $|f|$, and this correction disappears as $\delta \to 0$. So that property 3 holds for any order of the points, one agrees that $\int_a^a f(x)\,dx = 0$ and $\int_b^a f(x)\,dx = -\int_a^b f(x)\,dx$.

Back to computing. In the explorer above, Simpson’s method is usually the most accurate: on each pair of neighbouring pieces it replaces the graph with a parabola through three points, Archimedes’ parabola again.

The length of a piece, $h = \frac{b - a}{n}$; the number of pieces $n$ is even, and $f_k$ is the value of the function at $a + kh$. The values at the ends of the interval, with weight $1$. The middle points of the pairs, with weight $4$. The joins between neighbouring pairs, with weight $2$: each join belongs to two parabolas. Example: $\int_0^\pi \sin x\,dx$ with $n = 4$: $\frac{\pi}{12}\left(0 + 4\left(\frac{\sqrt2}{2} + \frac{\sqrt2}{2}\right) + 2 \cdot 1 + 0\right) = \frac{\pi\left(4\sqrt2 + 2\right)}{12} \approx 2.00456$. The error is less than five thousandths, while trapezia through the same five points give $1.896$, off by a tenth.

Where do the weights $1$, $4$, $1$ come from? Shift a pair of pieces so that its middle is at zero, and let the parabola $q(x) = \alpha x^2 + \beta x + \gamma$ pass through the points with $x$-coordinates $-h$, $0$, $h$. By the Newton–Leibniz formula $\int_{-h}^{h} q(x)\,dx = \frac{2\alpha h^3}{3} + 2\gamma h$: the $\beta$ term dropped out, because for the odd function $\beta x$ the areas over $[-h, 0]$ and $[0, h]$ cancel. And $q(-h) + 4q(0) + q(h) = 2\alpha h^2 + 6\gamma$, and $\frac h3$ of this is exactly the same integral. If a term $\delta x^3$ is added to the parabola, neither side changes: the cubes at $-h$ and $h$ cancel too. So Simpson’s rule is exact not only for parabolas but for any cubic polynomial.

The integral $\int_0^\pi \sin x\,dx = 2$ is computed with four pieces. Which method errs less: rectangles with heights at the midpoints of the pieces, or trapezia?

Midpoints give $2.0523$ (error $+0.052$), trapezia $1.8961$ (error $-0.104$): twice as bad, and with the opposite sign. This happens for any smooth function with a fine partition, and Simpson’s rule exploits it: with $2n$ pieces it equals $\frac{2M + T}{3}$, where $M$ and $T$ are the midpoint and trapezium sums for $n$ pieces, and the errors almost cancel: for the sine it gives $2.00027$.

The craft

The derivative of any formula is found mechanically, by the rules of chapter 26. Antiderivatives are different: there’s more craft here than rules. A sum is integrated term by term and a constant factor comes out (that’s property 1 of the last section, read for antiderivatives), and after that the two main techniques come into play. Both are rules of differentiation read from right to left.

If $F$ is an antiderivative of $f$ and the function $g$ has a derivative, then $\int f\bigl(g(x)\bigr)g'(x)\,dx = F\bigl(g(x)\bigr) + C$. For a definite integral with continuous $f$ and $g'$: $\int_a^b f\bigl(g(x)\bigr)g'(x)\,dx = \int_{g(a)}^{g(b)} f(u)\,du$.

By the chain rule (chapter 26) $\Bigl(F\bigl(g(x)\bigr)\Bigr)' = F'\bigl(g(x)\bigr)g'(x) = f\bigl(g(x)\bigr)g'(x)$, that is, $F(g(x))$ is an antiderivative of the integrand, and the first formula holds by the definition of the indefinite integral. By the Newton–Leibniz formula the left side of the second formula equals $F\bigl(g(b)\bigr) - F\bigl(g(a)\bigr)$, and so does the right side.

In practice you look inside the integrand for a piece $u = g(x)$ whose derivative also appears as a factor. In $\int 2x\cos\left(x^2\right)dx$ that piece is $u = x^2$: $du = 2x\,dx$, and the integral turns into $\int \cos u\,du = \sin u + C = \sin\left(x^2\right) + C$. A special case that comes up all the time is a linear substitution: $\int f(kx + b)\,dx = \frac1k F(kx + b) + C$. For example, $\int \cos 3x\,dx = \frac13\sin 3x + C$: without the factor $\frac13$ the derivative of the answer would be three times too large.

Calculate $\int_0^1 x e^{x^2}\,dx$.

Substitute $u = x^2$, $du = 2x\,dx$, that is, $x\,dx = \frac12 du$. The limits: at $x = 0$, $u = 0$; at $x = 1$, $u = 1$. We get $\frac12 \int_0^1 e^u\,du = \frac12\left(e - 1\right) \approx 0.859$.

The second technique turns the product rule into a rule for integrals. It has an honest picture: two areas that together make an L-shaped band between rectangles.

If the functions $u$ and $v$ have continuous derivatives on $[a, b]$, then $\int_a^b u(x)v'(x)\,dx = u(x)v(x)\Big|_a^b - \int_a^b v(x)u'(x)\,dx$. In short: $\int u\,dv = uv - \int v\,du$.

The idea: draw, on a plane with axes $u$ and $v$, the curve traced by the point $\bigl(u(x), v(x)\bigr)$, and see both areas of the formula at once. First let $u$ and $v$ be positive and increasing.

As $x$ runs over $[a, b]$, the point $\bigl(u(x), v(x)\bigr)$ draws a curve from $P_1 = (u_1, v_1)$ to $P_2 = (u_2, v_2)$, where $u_1 = u(a)$, $u_2 = u(b)$, and likewise for $v$. The area under the curve, down to the $u$-axis, is $\int_{u_1}^{u_2} v\,du$. In the language of $x$, the strip under the curve over the interval from $u(x)$ to $u(x + dx)$ has height $v(x)$ and width $u'(x)\,dx$, so by the substitution formula this area equals $\int_a^b v(x)u'(x)\,dx$. The area to the left of the curve, out to the $v$-axis, is for the same reason $\int_{v_1}^{v_2} u\,dv = \int_a^b u(x)v'(x)\,dx$. Together the two regions fill the large rectangle $u_2 \times v_2$ minus the small one $u_1 \times v_1$: $\int v\,du + \int u\,dv = u_2v_2 - u_1v_1$. Moving one area to the right side gives the formula. The picture required $u$ and $v$ to increase. In general the same formula takes one line: by the product rule (chapter 26) $(uv)' = u'v + uv'$, and the Newton–Leibniz formula applied to both sides gives $u(x)v(x)\Big|_a^b = \int_a^b u'v\,dx + \int_a^b uv'\,dx$.
The factor that gets simpler when differentiated: a polynomial, a logarithm, an arctangent. The factor that’s easy to integrate, together with $dx$: $dv = v'(x)\,dx$. An antiderivative of that factor; the constant can be left out here. $du = u'(x)\,dx$. Example: $\int x e^x\,dx$. Take $u = x$, $dv = e^x dx$; then $du = dx$, $v = e^x$ and $\int x e^x\,dx = x e^x - \int e^x\,dx = e^x(x - 1) + C$. Check: $\bigl(e^x(x - 1)\bigr)' = e^x(x - 1) + e^x = x e^x$. Likewise $\int \ln x\,dx = x\ln x - x + C$ with $u = \ln x$, $dv = dx$.

Fractions of polynomials have a technique of their own, partial fractions: $\frac{1}{x^2 - 1} = \frac12\left(\frac{1}{x - 1} - \frac{1}{x + 1}\right)$, and $\int \frac{dx}{x^2 - 1} = \frac12 \ln\left|\frac{x - 1}{x + 1}\right| + C$. The integral solver will take apart integrals like these and many others step by step, explaining every move.

All the course’s trainers are collected on the practice page.

Careers

Armed with the Newton–Leibniz formula, the idea went to work. Wherever a quantity is made up of small pieces (a volume of layers, work of short displacements, an average of instantaneous values), it’s computed with an integral. Let’s start with volume, keeping a promise from chapter 20 along the way.

Let a function $f$ be continuous and non-negative on $[a, b]$. The solid obtained by rotating its graph about the $x$-axis has volume $V = \pi\int_a^b f(x)^2\,dx$.

The idea: slice the solid into thin layers, replace each layer with a coin, and squeeze the volume between two stacks of coins.

Cut the solid with the planes $x = x_k$, perpendicular to the axis, into layers of thickness at most $\Delta x$. The section by the plane $x$ is a disc of radius $f(x)$ and area $\pi f(x)^2$. Replace each layer with a coin, an upright cylinder of radius $f(x_k)$ and the same thickness. The coin’s volume is $\pi f(x_k)^2\,\Delta x_k$, and the stack’s volume is a Riemann sum for the function $\pi f(x)^2$. Squeeze each layer. Let $m_k$ and $M_k$ be the smallest and largest values of $f$ on the $k$th piece (a continuous function has them). The layer contains the cylinder of radius $m_k$ and is contained in the cylinder of radius $M_k$, and a solid inside another has no larger volume (chapter 20). So $\sum \pi m_k^2\,\Delta x_k \le V \le \sum \pi M_k^2\,\Delta x_k$. Both outer sums are Riemann sums of the continuous function $\pi f^2$ (with the points where $f$ is smallest and largest), and as the partition gets finer both approach $\pi\int_a^b f(x)^2\,dx$. The volume is squeezed between them, so it equals this integral.
The area of the cross-section: a disc of radius $f(x)$. The thickness of a layer. The volume is a sum of infinitely thin coins. Example: a cone with base radius $r$ and height $h$ is obtained by rotating the line $f(x) = \frac{r}{h}x$ on $[0, h]$, and $V = \pi\frac{r^2}{h^2}\int_0^h x^2\,dx = \pi \frac{r^2}{h^2} \cdot \frac{h^3}{3} = \frac13\pi r^2 h$: a third of the cylinder, as in chapter 20. A ball of radius $R$ is the rotation of the semicircle $f(x) = \sqrt{R^2 - x^2}$: $V = \pi\int_{-R}^{R}\left(R^2 - x^2\right)dx = \pi\left(2R^3 - \frac{2R^3}{3}\right) = \frac43\pi R^3$.
Choose a shape or model your own by moving the points of the profile. The coins are a Riemann sum for the volume; add more of them. “Kepler’s rule” knows the volume from only three cross-sections: for the cone, the ball and the cylinder it gives the exact answer, for the barrel an almost exact one. Simpson’s rule explains why.

For a solid of any shape the argument is the same: the volume is $\int_a^b S(x)\,dx$, where $S(x)$ is the area of the cross-section by the plane perpendicular to the $x$-axis. In general this statement is proved rigorously in measure theory (chapter 54; it’s a special case of Fubini’s theorem), and for solids of revolution we’ve just proved it. Cavalieri’s principle follows at once from this formula: if two solids have cross-sections of equal area at every height, the functions under the integral are the same, and the volumes are equal.

The second career is mechanics. A constant force $F$ over a distance $s$ does work $Fs$. If the force varies, the path is cut into short stretches, the force treated as constant on each, and in the limit the work is $\int_a^b F(x)\,dx$. By Hooke’s law a spring is stretched by a force $F = kx$ proportional to the extension, and the work of stretching it from zero to $x$ is $\int_0^x kt\,dt = \frac{kx^2}{2}$: the area of the triangle under the force graph.

A spring has stiffness $k = 200$ N/m. How much work (in joules) is needed to stretch it from $0.1$ m to $0.2$ m?

$A = \int_{0.1}^{0.2} 200x\,dx = 100x^2\Big|_{0.1}^{0.2} = 100 \cdot (0.04 - 0.01) = 3$ J. The first ten centimetres would have cost only $1$ J: each next centimetre is harder.

The third career is the average. The arithmetic mean of $n$ numbers is their sum divided by $n$. A function has infinitely many values, and the integral replaces the sum.

The average value of a function $f$ on the interval $[a, b]$ is the number $\frac{1}{b - a}\int_a^b f(x)\,dx$. It’s the height of the rectangle over $[a, b]$ with the same area as under the graph: as if the water under the graph had been levelled off.

The length of the interval: “how many values” we’re averaging. The instantaneous values, added up by the integral. Example: the average value of $\sin x$ on $[0, \pi]$ is $\frac{2}{\pi} \approx 0.637$. The mains voltage in the UK and Europe varies as a sine wave: $U(t) = U_0 \sin(100\pi t)$, fifty oscillations a second. The label “$230$ V” means not the amplitude $U_0$ but the square root of the average value of $U^2$. The average value of $\sin^2$ over half a period is $\frac12$, since $\sin^2 x = \frac{1 - \cos 2x}{2}$ and $\int_0^\pi \sin^2 x\,dx = \frac\pi2$. So $\frac{U_0}{\sqrt2} = 230$ and $U_0 = 230\sqrt2 \approx 325$ V: that’s the voltage at the peaks of the sine wave.

Quirks: Torricelli’s trumpet

Every powerful idea has its oddities. The integral’s main one has to do with infinity: sometimes you can add up an infinitely long strip and get a finite number.

An improper integral over an infinite interval is the limit $\int_a^{+\infty} f(x)\,dx = \lim_{B \to +\infty} \int_a^B f(x)\,dx$. If the limit exists and is finite, the integral converges; otherwise it diverges. The integral of a function that grows without bound near one end of an interval is understood in the same way.

The exponent everything depends on. For $p > 1$ by the Newton–Leibniz formula $\int_1^B \frac{dx}{x^p} = \frac{1 - B^{1-p}}{p - 1}$, and $B^{1-p} \to 0$. For $p = 1$ the integral $\int_1^B \frac{dx}{x} = \ln B$ grows without limit, and for $p < 1$ even more so: the integral diverges. The value. The closer $p$ is to one, the larger it is, but as long as $p > 1$ it’s finite. Example: $\int_1^{+\infty} \frac{dx}{x^2} = 1$. The infinitely long strip under the graph of $\frac{1}{x^2}$ has area exactly $1$, while the strip under $\frac1x$, which looks almost the same, is infinite.

Improper integrals aren’t needed only for paradoxes. To take a body of mass $m$ away from the Earth’s surface for good, work $\int_R^{+\infty} \frac{GMm}{r^2}\,dr = \frac{GMm}{R}$ has to be done against the gravitational force $\frac{GMm}{r^2}$, where $R$ is the Earth’s radius, $M$ its mass and $G$ the gravitational constant. The path is infinite, but the work is finite. Setting it equal to the kinetic energy $\frac{mv^2}{2}$ gives the escape velocity $v = \sqrt{\frac{2GM}{R}} \approx 11.2$ km/s.

Now the oddity itself. In 1643 Evangelista Torricelli, a pupil of Galileo and the inventor of the mercury barometer, rotated the graph of $y = \frac1x$ for $x \ge 1$ about the $x$-axis and got an infinitely long trumpet with a flared bell.

The solid obtained by rotating the graph of $y = \frac1x$, $x \ge 1$, about the $x$-axis has the finite volume $\pi$, while its surface area is infinite.

The volume of the trumpet up to $x = B$ is, by the formula for a solid of revolution, $\pi\int_1^B \frac{dx}{x^2} = \pi\left(1 - \frac1B\right)$, and as $B \to +\infty$ it approaches $\pi$. With the surface it’s the other way round. Cut the trumpet with the planes $x = 1, 2, 3, \ldots$ into bands. The band between $x = k$ and $x = k + 1$ is nowhere narrower than at its right end, where the radius is $\frac{1}{k+1}$. Press it along the radii towards the axis onto the cylinder of radius $\frac{1}{k+1}$ and height $1$: each little piece of the band gets closer to the axis and shorter (its slope disappears), so the area doesn’t increase, and the cylinder is covered completely. So the band’s area is at least the curved surface of the cylinder, that is, $\frac{2\pi}{k + 1}$. Then the surface area of the trumpet up to $x = B$ is at least $2\pi\left(\frac12 + \frac13 + \ldots + \frac{1}{B}\right)$ for whole $B$. Each term $\frac{1}{k+1}$ is the area of a rectangle of height $\frac{1}{k+1}$ over the interval $[k + 1, k + 2]$, and the graph of $\frac1x$ is no higher than this there, so the sum is at least $\int_2^{B+1}\frac{dx}{x} = \ln\frac{B + 1}{2}$, which grows without limit. So the surface area grows without limit too.

Lengthen the trumpet: the slider stretches it to a hundred million units. The volume runs up against $\pi$, the area keeps growing. Compare how much paint it takes to fill the trumpet and to paint its outside with layers of different thickness.

This stunned contemporaries: a solid of infinite length with finite volume. The paradox is usually told as a story about a painter: the trumpet can be filled to the brim with $\pi$ litres of paint, yet no amount of paint is enough to paint its surface. But doesn’t the paint poured in touch the whole inner surface, that is, paint it? There’s no contradiction. A real layer of paint has thickness, and in the narrow end of the trumpet, where the radius is smaller than that thickness, the layer simply doesn’t fit: the paint poured in coats the walls with a layer that gets thinner and thinner. Mathematical paint in an infinitely thin layer has no volume at all, and area and volume measure different things. Look in the widget at how slowly the area grows: each time the trumpet is made ten times longer, it adds almost the same amount, about $2\pi\ln 10 \approx 14.5$, like a logarithm.

Does the integral $\int_1^{+\infty} \frac{dx}{x^{1.01}}$ converge?

At $p = 1.01$ the formula gives $\frac{1}{0.01} = 100$. The boundary between “converges” and “diverges” runs exactly along $p = 1$, and the closer you get to it, the larger the area, but for any $p > 1$ it’s finite.

Where next

The formula $\int x^n\,dx = \frac{x^{n+1}}{n+1} + C$ from the first sections works for every exponent but one: at $n = -1$ there’s a zero in the denominator. We know the antiderivative of $\frac1x$, it’s $\ln|x|$, but where does a logarithm come from here? Look at the hyperbola $y = \frac1x$ through Fermat’s eyes. Divide the interval $[1, q^k]$ by the points $1, q, q^2, \ldots, q^k$ and stand a rectangle over each piece with its height at the left end. The $j$th rectangle has width $q^j(q - 1)$, height $\frac{1}{q^j}$ and area $q - 1$: the same for all. The area under the hyperbola counts steps, that is, it grows like a logarithm: multiplying the right edge by $q$ adds the same amount to the area. This was noticed by Grégoire de Saint-Vincent and Alphonse Antonio de Sarasa in the 1640s. But a logarithm to what base? At what $x$ is the area under the hyperbola from $1$ to $x$ equal to one? And a second question, posed by the derivative: is there a function equal to its own derivative, growing at each moment at exactly the rate its value says? Both answers lead to the same number, $2.71828\ldots$, the hero of the next chapter.