Substitution, parts, and going numeric
Two rules undo the two rules that made differentiation mechanical. Substitution runs the chain rule backwards; integration by parts runs the product rule backwards. When neither produces a formula, you stop looking for one and compute the number — that is the whole of numerical quadrature.
Substitution: the chain rule backwards
Recognise a composition, and its inner derivative
Differentiation has a rule for compositions. For smooth $F$ and $g$,
Integrate both sides with respect to $x$. The integral of a derivative is the function back again, so
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:
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.
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:
On a definite interval the boundary term is evaluated, and the rule becomes
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$.
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:
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.
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.
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.
Techniques and error orders
| Rule | What it inverts / assumes | Use it when |
|---|---|---|
u = g(x), du = g'(x)dx | Chain rule, backwards | The integrand is a composition times its inner derivative, as in $2x\cos(x^2)$ |
∫ u dv = uv − ∫ v du | Product rule, backwards | A product where one factor simplifies on differentiation: $x e^x$, $x\cos x$, $\ln x$ |
h = (b−a)/n | Interval width for every rule | Any time you sample instead of integrate symbolically |
left, right ∈ O(h) | Piecewise-constant panels | Only when nothing better is available; error falls slowly |
mid, trapezoid ∈ O(h²) | Linear model on each panel | The default for smooth integrands without second-derivative trouble |
Simpson ∈ O(h⁴) | Quadratic through three samples | Smooth integrands; error falls by $16\times$ when $n$ doubles |
erf, Si | Non-elementary functions defined by their integrals | $e^{-x^2}$ and $\sin x/x$ — closed forms genuinely do not exist |
Further reading
- Wikipedia, Integration by parts — the product-rule derivation with the geometric area picture.
- Wikipedia, Numerical integration — the rule table and the derivation of each error order.
- MIT 18.01, Single Variable Calculus — substitution, parts and Simpson's rule with the standard problem sets.