Reading and display settings

Appearance

System follows your operating system and keeps following it, even if you change it later. The header's sun, moon and monitor cycle the same three options.

Text size (%) 100%

Default. Scales every text size on the site, equations and tables included.

Reading width 70ch

How much text runs across one line of prose. Narrower is easier to track; wider fits more on screen.

Line spacing 1.6

The leading on body text. Taller leading helps a tired eye stay on the line.

Density

Padding and gaps around controls, cards, and tables — how much breathing room the layout leaves itself.

Motion

System follows your operating system. Reduced removes every transition on this site. Full keeps them on unless your system asks for less.

1

Substitution: the chain rule backwards

Recognise a composition, and its inner derivative

Differentiation has a rule for compositions. For smooth $F$ and $g$,

$$ \frac{d}{dx}\,F\bigl(g(x)\bigr) \;=\; F'\bigl(g(x)\bigr)\,g'(x). $$

Integrate both sides with respect to $x$. The integral of a derivative is the function back again, so

$$ \int F'\bigl(g(x)\bigr)\,g'(x)\,dx \;=\; F\bigl(g(x)\bigr) + C. $$

Now name the inner function $u = g(x)$. Its differential is $du = g'(x)\,dx$, exactly the factor sitting in the integrand. Writing $f = F'$, the statement above collapses to something you can read at a glance:

$$ \int f\bigl(g(x)\bigr)\,g'(x)\,dx \;=\; \int f(u)\,du. $$

That is the entire rule. It works when the integrand contains a composition and its inner derivative — a pattern that is rare in a textbook exercise and everywhere in practice. The robot's speed along a line is often a function of position, $v(x)$, and the time to travel from $0$ to $b$ is $\int_0^b dx/v(x)$; when $v$ is a composition, substitution is the only clean handle.

The running example here is the textbook one, $\int 2x\cos(x^2)\,dx$. The inner function is $u = g(x) = x^2$, and $g'(x) = 2x$ is already present. Slide the upper limit $b$: the left panel is the integral in $x$, the right panel is the same accumulation after mapping $u = x^2$, and the two numbers agree because they are the same signed area re-labelled.

Top: the integrand $2x\cos(x^2)$ (solid) and the inner function $g(x)=x^2$ (dashed) over $x$. Bottom: the transformed integrand $\cos u$ over the $u$-axis; the shaded regions have equal area.

💡 Check: $\int_0^b 2x\cos(x^2)\,dx = \sin(b^2)$ exactly. Substitution is not an approximation — it is the same integral, written in the variable the chain rule prefers.
2

Integration by parts: the product rule backwards

Trade one integral for a simpler one

The product rule says $(uv)' = u'v + uv'$. Integrate it and rearrange:

$$ uv \;=\; \int u\,dv \;+\; \int v\,du \qquad\Longrightarrow\qquad \int u\,dv \;=\; uv \;-\; \int v\,du. $$

On a definite interval the boundary term is evaluated, and the rule becomes

$$ \int_a^b u\,dv \;=\; \Bigl[uv\Bigr]_a^b \;-\; \int_a^b v\,du. $$

The picture is an area exchange in the $u$–$v$ plane. For a monotone curve $u = u(v)$, the rectangle of area $u_b v_b - u_a v_a$ splits into the area under the curve (the $\int u\,dv$ strip) plus the area to its left (the $\int v\,du$ strip). Parts says the rectangle equals those two pieces — so if the new integral $\int v\,du$ is easier than the old one, you win. Choose $u$ to be the factor that gets simpler when differentiated: $x$ in $x e^x$, $\ln x$ in $\ln x\,dx$. Slide the two limits to watch the strips re-cut the rectangle.

The curve $u = v^2$ in the $u$–$v$ plane. Blue is $\int_{v_a}^{v_b} u\,dv$; pink is $\int_{u_a}^{u_b} v\,du$; their sum is the dashed rectangle difference $u_bv_b - u_av_a$.

3

Quadrature accuracy: how fast does the error fall?

Error orders, read off a log–log slope

A quadrature rule replaces the integral by a weighted sum of samples. Split $[a,b]$ into $n$ pieces of width $h = (b-a)/n$. The rules differ in what they assume about the function between samples, and that assumption sets the error order:

$$ \text{left/right}:\; O(h), \qquad \text{midpoint/trapezoid}:\; O(h^2), \qquad \text{Simpson}:\; O(h^4). $$

Concretely, trapezoid costs about $\tfrac{b-a}{12}h^2\max|f''|$ and Simpson about $\tfrac{b-a}{180}h^4\max|f''''|$. Doubling $n$ therefore cuts the error by $2$, $4$ or $16$ respectively — the observed order is the slope of the error against $n$ on log–log axes. Slide $n$, switch the rule, and read the slope off the plot. Simpson was built to be exact on cubics (Part 7's polynomials), which is exactly why its error starts at the fourth power.

Error $|\text{rule}(n) - 2|$ for $\int_0^\pi \sin x\,dx$ against $n$, both axes logarithmic. Slope $=1$ for left/right, $2$ for midpoint/trapezoid, $4$ for Simpson.

4

When numeric wins: no closed form exists

The rule that runs out, and the method that does not

Substitution and parts are heuristics. They succeed on a vanishingly small share of integrands. The Gaussian $\int_0^2 e^{-x^2}dx$ and the sinc integral $\int_0^\pi \frac{\sin x}{x}\,dx$ have no elementary antiderivative at all — no finite combination of the functions you know will produce them. That is not a gap in the toolbox; it is a theorem about which functions are integrable in closed form.

The integral still exists whenever the integrand is continuous, and a quadrature rule still computes it. Increase $n$ and the estimate converges to a number you can use. The special functions $\operatorname{erf}$ and $\operatorname{Si}$ are nothing more than names we give those numbers. This is the practical default, not a defeat — and it is the same architecture as the ODE integrators ahead: sample, weight, sum, refine.

The integrand with midpoint panels. Switch the function and raise $n$; the readout shows the value at $n$ and at $2n$ closing on the true area.

⚠️ Composition and non-elementary integrands are the norm, not the exception. Reach for a formula when one is known; reach for quadrature by default.
5

Where this shows up

Every quantity that has no formula

The Gaussian integral is the normalisation constant of the normal distribution, and it has no elementary antiderivative — which is why Calculus of probability (Volume II, Part 11) works with $\operatorname{erf}$ and a change of variables rather than an antiderivative. Numerical quadrature is how the density under a map gets a number attached to it.

More directly, Differential equations (Volume II, Part 12) is quadrature in disguise: Euler, midpoint and RK4 each sample the slope field at chosen points and take a weighted step, exactly the way midpoint and Simpson sample a function. The error-order bookkeeping you just read on log–log axes is the same bookkeeping that ranks RK4 above Euler. The accumulation and Fundamental Theorem parts supply the meaning; these techniques supply the value.

6

Techniques and error orders

RuleWhat it inverts / assumesUse it when
u = g(x), du = g'(x)dxChain rule, backwardsThe integrand is a composition times its inner derivative, as in $2x\cos(x^2)$
∫ u dv = uv − ∫ v duProduct rule, backwardsA product where one factor simplifies on differentiation: $x e^x$, $x\cos x$, $\ln x$
h = (b−a)/nInterval width for every ruleAny time you sample instead of integrate symbolically
left, right ∈ O(h)Piecewise-constant panelsOnly when nothing better is available; error falls slowly
mid, trapezoid ∈ O(h²)Linear model on each panelThe default for smooth integrands without second-derivative trouble
Simpson ∈ O(h⁴)Quadratic through three samplesSmooth integrands; error falls by $16\times$ when $n$ doubles
erf, SiNon-elementary functions defined by their integrals$e^{-x^2}$ and $\sin x/x$ — closed forms genuinely do not exist
7

Further reading

8

Check your understanding

0/4 answered