Quadrature
The word quadrature comes from Latin quadratura — literally squaring, the classical geometric problem of constructing a square of equal area to a given figure. Mathematicians later borrowed the term for computing the area under a curve, and today it stands more broadly for computing any definite integral. This chapter is concerned with high-dimensional quadrature: extending the definite integral of one variable into multiple dimensions, integrating scalar fields over 2D regions and 3D solids.
Double and triple integrals
The 1D definite integral accumulates a 1D scalar field over an interval . In two variables, we accumulate over a 2D region — a rectangle — and call the result the double integral of over .
For a scalar field on a rectangle, the double integral of over is the iterated integral
equivalently obtained by integrating in the opposite order:
To evaluate an iterated integral, peel one layer at a time from the inside out. The inner integral runs first, treating the other variable as a constant — that produces a function of one variable, which the outer integral then accumulates. Each or marks the variable being integrated at that step; the parentheses are just for clarity.
The same construction lifts to three variables. For a scalar field on a box , three nested integrals give the triple integral:
For a scalar field on a 3D box, the triple integral of over is
The recipe extends to any number of variables: peel off one variable at a time, evaluating the innermost integral first.
Fubini’s theorem — the order doesn’t matter
We wrote the double integral in two orders ( versus ) and asserted both give the same answer. That equivalence is not automatic — it’s a theorem.
Fubini’s theorem. If is continuous on a closed rectangular box , then all iterated integrals of over have the same value, regardless of the order of integration. For example in 2D:
What this buys us in practice: if one order makes the inner integral easier — perhaps because the integrand factors more cleanly when one variable is treated as constant — we can switch freely. The two orderings are not just numerically equal; they’re interchangeable as a computational strategy, and we will exploit that whenever we have the freedom to choose.
Standard domains
Rectangles and boxes are the easy targets — every integration bound is a constant. Most regions of practical interest aren’t that clean. The next-simplest class is the standard domain (or simple domain): one variable still spans a fixed interval, and the other slides between bounds that depend on the first.
A region is a standard domain if it can be written in one of the two forms
or, with the variables swapped,
where and are continuous functions defining the lower and upper boundaries of .
The figure below shows both forms side by side. In either case, one variable spans a fixed interval, while the other lies between a lower and upper bound that shift as the first variable moves.
Rectangles are a special case. Take constant boundary functions and ; the first form collapses to — a plain rectangle. So everything we did in the previous section sits inside this framework as the trivially-constant case.
The construction lifts to three variables, with each inner layer’s bounds allowed to depend on every variable from the layers outside it:
A region is a standard domain if it can be written as
where and are continuous.
The pattern generalizes: each layer’s bounds may depend on all the variables from layers outside it; the outermost layer always lands on constants. Permuting which variable goes outermost gives equally valid standard-domain forms.
Splitting non-standard domains. Not every region fits the standard mold — take an annulus (a ring-shaped region between two concentric circles): any vertical line through the inner hole cuts it into two segments, not one. But many such regions can be partitioned into a finite collection of disjoint standard sub-domains, which is enough to bring them back inside the framework.
Integration over standard domains
With a standard domain, the bounds of the inner integrals are no longer constants — they depend on the variables from the layers outside. Otherwise the iterated structure is unchanged: peel from the inside out, treating outer variables as constants while evaluating each inner integral.
For a scalar field on a 2D standard domain , the double integral of over is
The outermost integral lands on the constant interval ; the inner integral has bounds that move with . The same recipe lifts to three variables, where each layer’s bounds may reference every variable from the layers outside it:
For a scalar field on a 3D standard domain , the triple integral of over is
Swapping order takes work. Fubini still applies — all integration orders give the same value — but unlike the rectangular case the swap isn’t a mere relabeling of differentials. The inner bounds reference the outer variables, so changing order means re-describing in its alternative standard form (e.g. -outermost instead of -outermost in 2D) and deriving new boundary functions from the geometry. Worth doing whenever the alternative order makes the inner integral simpler or more intuitive to evaluate.
Splitting, formalized. When is a disjoint split of into standard sub-domains , then integral splits along the partition:
This is the splitting workaround previewed earlier, made concrete — partition the awkward region into standard pieces, integrate over each, sum.
Area and volume of a standard domain
To calculate the area or volume of itself, we set to be the constant () — that is, at every point of a 2D domain, or at every point of a 3D one. With the integrand contributing the same constant weight everywhere, accumulating over adds up all the infinitesimal pieces that fill it, and out comes the area or volume:
On a 2D standard domain , the area integral collapses cleanly:
The double integral reduces to the area between two curves from 1D calculus — the area under the upper curve minus the area under the lower curve.
Integration under coordinate transformations
The integrals defined so far run in Cartesian coordinates: every region is described by , and every infinitesimal slice has volume . But sometimes a region’s geometry fits other coordinates much better — a circular disk wants polar, a sphere wants spherical — and an integral that’s painful in can become almost trivial after a rewrite. The price is a correction factor that accounts for how the new coordinates locally stretch or compress space.
That factor is the absolute value of the Jacobian determinant of the transformation, and the rule for swapping coordinates inside an integral is:
Let be open and let be a coordinate transformation, so each point has a unique address with . For an integrable scalar field on ,
The formula reads naturally: integrate the same field over using the new coordinates , but at every point reweight by how much distorts an infinitesimal volume there. Where is small, is compressing — many -points crowd into a small region of , so each contributes proportionally less to the total. Where is large, is stretching — each -point covers a larger patch of and counts for more.
The 1D analog. With , a coordinate transformation is just a smooth bijection , and collapses to the single number . The formula becomes
— exactly the substitution rule from 1D calculus. The absolute value measures how much stretches an infinitesimal interval; that’s the role plays in higher dimensions.
Area of a disk. The open disk has awkward Cartesian bounds — the inner integral runs from to . In polar coordinates, maps the rectangle onto , with Jacobian determinant . Change of variables gives
— the disk area, no awkward bounds in sight.
Surface integrals
Every integral so far has accumulated a field over a flat region — an interval, a 2D area in , a 3D solid in . Surface integrals are a different kind of integration: the integration domain is a curved 2D patch sitting inside 3D space. The setup pairs a regular surface with a field function (scalar field or vector field) defined on a 3D region that contains the surface. The integral evaluates the function at each surface point and accumulates those values, weighted by a local distortion factor built from the tangent vectors . Two flavors arise depending on whether the field is scalar- or vector-valued.
Scalar surface integrals
When the integrand is a scalar field with , each parameter point contributes the reading , weighted by how much surface area the tiny parameter patch around sweeps out.
For a regular surface and a scalar field with , the scalar surface integral of over is
We multiply by — the local area-stretch factor — because the integral runs over ‘s parameter domain , naturally weighting each -value by the parameter-patch area . But the values come from the surface, and each tiny parameter patch around maps to a surface patch of a different size — so weighting by alone doesn’t reflect how large the corresponding patch on the surface is. Scaling by swaps in the surface-patch area as the weight, so each -value is weighted by the actual amount of surface it represents. For the geometric derivation, see the in-depth note below.
In-depth: where comes from
Pick a tiny rectangle in parameter space at with sides and . Under , its four corners land on four nearby points of the surface, bounding a tiny curved patch — and we need its area.
A small step of size along the -parameter (with fixed) shifts the surface point by approximately — that is precisely the role of the tangent vectors: they record the 3D rate of change of when we wiggle one parameter at a time. Similarly a -step shifts the point by . The two displacements span a parallelogram in 3D with edges and , and to first-order Taylor approximation the curved patch is indistinguishable from that parallelogram — same shape, and to that order, the same area.
So computing the patch’s area reduces to computing the parallelogram’s. By a standard property of the cross product, the area of a parallelogram spanned by two vectors in is the cross-product norm of its edges — applied here, the patch carries surface area — i.e. the magnitude of the cross product of the tangent vectors, times the parameter-area element . The cross-product vector itself is the surface normal at — the perpendicular vector named when we introduced the tangent vectors — and its magnitude is exactly the area element we just derived.
So is the local area-stretch factor: it converts one unit of parameter-space area at into the corresponding amount of true surface area. Where is large, is stretching — each parameter point covers a wide swath of surface, so its -reading should count for more in the total. Where it is small, is compressing — many parameter points crowd onto a tiny surface patch, so each one should count for less. Multiplying by the factor before integrating accounts for that distortion, leaving a value that depends only on the surface’s geometry, not on how we chose to parametrize it.
Cousin of change of variables. The shape mirrors the change-of-variables formula: both rewrite an integral over a curved or differently-coordinatized region as one over a flat parameter region, paying a local distortion factor at each point.
The difference is dimensional. Change of variables maps — the Jacobian is square, and measures the local volume distortion. A surface parametrization maps — the Jacobian is , non-square, so it has no determinant. But its two columns are precisely and , and the natural replacement for is the area of the parallelogram those columns span — exactly . Same role (local distortion factor); the codimension forces a cross product in place of a determinant.
Vector surface integrals
When the integrand is a vector field with , each parameter point contributes the inner product of with the vector — the surface normal itself, not its norm as in the scalar case.
For a regular surface and a vector field with , the vector surface integral of over — also called the flux of across , in the direction — is
At each surface point, computes the scalar projection of onto the surface normal weighted by the length of the normal, which is the area-stretch factor from the scalar case. (For the general inner-product principle behind splitting a dot product into “projection × magnitude”, see the weighted-projection remark.) To picture what this measures, think of as a fluid’s velocity field — at each point in space, an arrow giving the direction and speed of the flow. At a surface point, split into a perpendicular and a tangential part: only the perpendicular part crosses the surface (carries fluid from one side to the other), while the tangential part just slides along the surface, never crossing. A flow heading obliquely into the surface contributes its perpendicular share to crossing, not zero — only a flow that’s exactly parallel to the surface contributes nothing. So — projection onto the normal, scaled by the patch’s surface area — measures the rate at which fluid is crossing the surface patch around . That is what we call the flux through the local patch. Integrating over sums these per-patch contributions into the total flux of through — the overall rate at which the fluid crosses the surface. For the geometric breakdown, see the in-depth note below.
In-depth: how encodes flux
Using the geometric form of the inner product:
where is the angle between and the surface normal. Group the factors:
— a product of two pieces we already understand. The first is the scalar projection of onto the unit normal : the signed length of ‘s shadow on the normal direction. It is positive when points through the surface in the direction, negative when it points the other way, and zero when is tangent to the surface — purely tangential motion slides along the surface rather than crossing it. The second factor is the same area-stretch weight that appeared in the scalar case. Multiplied, they give the flux through the local surface patch — how much of crosses that patch, accounting for both alignment and patch size.
Sign depends on orientation. has a definite direction set by the parameter order; swapping and flips it, and with it the sign of the integral. Vector surface integrals are signed, with the sign tied to which side of counts as “outward” — that is what the qualifier “in the direction ” records.
Physical readings. When is a fluid-velocity field, the integral measures the volume of fluid crossing per unit time — the literal flux. When is an electric field, it gives the electric flux through , the quantity that appears in Gauss’s law. In both cases the vanishing of tangential contributions matches physical intuition: fluid sliding parallel to a wall doesn’t cross it.
Surface area
The same trick that gave us the area or volume of a standard domain — set the integrand to the constant — lifts to surfaces. With in the scalar surface integral, the integrand contributes nothing of its own and what remains is a pure sum of area-stretch factors over the parameter domain. The result is the surface area of .
For a regular surface , the surface area of is the scalar surface integral of the unit function over :
Each parameter patch of area maps under to a surface patch of area — the per-patch area element built earlier. Summing those elements across all of recovers the total area of the surface in 3D space.
Gauss’s divergence theorem
The two integrals built so far in this chapter look like they belong to different worlds: the triple integral accumulates a scalar density throughout a 3D solid, while the vector surface integral accumulates a vector field’s flow across a 2D boundary. Gauss’s divergence theorem says they are the same number in a precise case — integrating the divergence of a vector field over a 3D region equals the flux of that field through the region’s boundary surface.
Gauss’s divergence theorem. Let be a domain with piecewise continuously differentiable boundary . For any continuously differentiable vector field with :
Each continuously differentiable piece of must be parametrized by some with pointing outward from .
The divergence referenced here is exactly the differential operator built earlier: , the trace of the Jacobian of .
Reading both sides — divergence as source density, flux as net escape
The two integrals are different views on the same physical accounting:
- Volume side (). The divergence at a point measures how much the vector field is locally creating per unit volume there: positive divergence means has a tiny source at pumping new flow out into space (a faucet); negative means a sink absorbing flow (a drain); zero means whatever flows in immediately flows out (incompressible flow). The triple integral sums those local source strengths over every point of — the total amount of stuff being generated inside per unit time.
- Boundary side (). The flux through , with the outward orientation, measures the net amount of stuff crossing the boundary outward per unit time — what escapes minus what re-enters.
The theorem says the two match exactly: every drop of fluid produced by a source inside has to cross the boundary on its way out (it has nowhere else to go), and every drop absorbed by a sink must have entered through the boundary first. Local generation inside ↔ net escape through the wall — a conservation principle dressed in calculus.
The “outward” condition — what orientation each boundary patch must have
Recall from vector surface integrals that has a definite direction fixed by the parameter order — swap and and the normal flips. For the theorem to balance, every boundary patch must be parametrized so its normal points away from the solid material of , never into it; the wrong orientation on any patch flips a sign on the right-hand side and breaks the equation.
The condition becomes subtle when has more than one connected piece. Picture as the rubber wall of a hollow ball — material trapped between an outer sphere and an inner sphere — so is the union of those two spheres. On the outer sphere, “out of the rubber” points away from the center, as you’d expect. On the inner sphere, “out of the rubber” points into the cavity — toward the center, which looks like the opposite direction. Both normals correctly leave ‘s material; the lesson is that “outward” is relative to where the material lives, not to any fixed origin.
Why the theorem is useful — computational shortcut and backbone of conservation laws
Two distinct payoffs:
- A computational shortcut. The two sides of the equation often differ wildly in difficulty for the same problem, and the theorem lets us pick the easier one. If a triple integral over an awkward 3D region is the painful side, swap it for the flux through the boundary. Going the other way, a flux integral over a complicated closed surface — say one stitched from many patches that would each need separate parametrizations — can be rewritten as a single triple integral of over the enclosed solid. Whichever side is friendlier wins.
- The mathematical backbone of conservation laws. Most fundamental conservation statements in physics — of mass, of electric charge, of energy — are this theorem applied to a specific vector field. Gauss’s law of electromagnetism — electric flux through any closed surface equals the enclosed charge (up to a constant) — is the divergence theorem applied to the electric field. The continuity equation in fluid dynamics — “the rate of mass change inside a region equals the net mass flow across its boundary” — is the same identity rearranged into local form. The theorem is what lets physics translate freely between “what’s happening at every point inside” and “what’s crossing the boundary”.
Applications
Two short examples of where high-dimensional integrals show up in practice — one from statistics, one from machine learning.
Statistics — computing moments
Probability theory uses integrals to extract single-number summaries from a distribution. Given a random variable — a quantity whose value is uncertain, like a measurement or a coin flip — its probability density is a non-negative function (with ) encoding how likely each value of is. From it we extract single-number summaries — moments — by integrating powers of the offset from a reference point against the density.
For a probability density on and a reference point , the -th moment of about is the definite integral
Two specific choices recover the most familiar summary statistics:
- , : — the expected value (or mean) , the average of weighted by how likely each value is.
- , : — the variance, the average squared deviation of from its mean.
Reading the variance form. You may know variance from a finite sample as the average squared deviation, — every sample contributes equally with weight . In the integral, the density takes that weighting role: each squared deviation is scaled by how likely is to occur, then accumulated. Same averaging operation, lifted from a discrete sample to a continuous distribution — and the expected value formula reads as the continuous version of .
The multivariate case. When the random object is a vector with joint density , the same recipe runs over — every moment integral becomes an -fold integral, exactly the kind of high-dimensional quadrature this chapter has been about.
Machine learning — kernel density estimation
The previous example assumed the probability density was known. The reverse problem — given a sample drawn from an unknown distribution, estimate its density — is kernel density estimation (KDE). The idea is to place a small smooth “bump” at each data point and average them all: where the data clusters, the bumps pile up and the estimated density is high; where data is sparse, it is low.
The kernel is a non-negative function (typically a Gaussian centered at zero), and the bandwidth controls each bump’s width — small gives narrow spikes that overfit individual points, large gives wide bumps that oversmooth fine structure. The catch is picking .
A standard selection criterion minimizes the mean integrated squared error:
— the average (over random samples) of how far deviates from the true density , integrated across all . In practice is unknown, so MISE cannot be computed directly; practical methods such as cross-validation or Silverman’s rule of thumb approximate it instead. However, analyzing MISE theoretically reveals that finding the optimal requires evaluating an -fold integral over the data’s joint distribution — a high-dimensional quadrature problem that explains why no simple closed-form solution exists.