Foundations to Frontier
Tests
A. Mathematical Foundations › A3 Calculus and Analysis › Multivariable calculus

Multiple Integrals and Change of Variables

Areas, volumes, masses, probabilities and expected costs over 2-D and 3-D regions are integrals over several variables. Choosing the right coordinates, with the Jacobian determinant as the exchange rate, makes them tractable. In high dimensions only Monte Carlo survives.

Level 0: Foundation

★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.

Adding up tiny tiles

To find the area of a floor, count the tiles. To find how much paint covers a wall where the paint is thicker in some places, add up (thickness × tile area) over every tile. Making the tiles smaller and smaller gives an exact answer: a double integral, or a triple integral for volumes.

Square tiles are awkward for a round pizza. Ring-shaped slices fit it perfectly. Choosing tiles that match the shape is called a change of variables.

Double integrals: add up tiny cells (squares or polar wedges)
·
Cartesian sum = 3.111111 · exact = 3.141593 · error 3.05e-2 · 112 cells
Squares that straddle the curved boundary are either in or out, so the jagged edge limits the accuracy. Darker cells = larger f.
Why engineers care

To know whether a robot will hit an obstacle, engineers add up the probability of the robot being at each tiny spot inside the obstacle. That’s a double integral of a probability map. To find a spacecraft’s centre of mass, they add up (mass × position) over its whole body: a triple integral.

📝 Quick check (Level 0)
0/3 answered
  1. 1. A box 2 × 3 × 4 holds how many unit cubes?
  2. 2. To cover a round pizza neatly, the best tiles are…
  3. 3. Smaller tiles make the total…

Level 1: Beginner

★★☆☆☆ Basic⏱ 15 minSecondary-school mathematics: arithmetic and elementary algebra.

Iterated integrals (Fubini)

Over a rectangle, integrate one variable at a time:

∬[a,b]×[c,d]f dA=∫ab(∫cdf(x,y) dy)dx\iint_{[a,b]\times[c,d]}f\,dA = \int_a^b\Big(\int_c^df(x,y)\,dy\Big)dx

Example. ∫01∫02xy dy dx=∫01x[y22]02dx=∫012x dx=1\int_0^1\int_0^2xy\,dy\,dx = \int_0^1x\Big[\tfrac{y^2}2\Big]_0^2dx = \int_0^12x\,dx = 1.

  • ∬D1 dA\iint_D1\,dA is the area of DD.
  • ∬Df dA\iint_Df\,dA is the volume under the surface z=f(x,y)z = f(x,y) (or a total mass, if ff is a density).
  • ∭Ef dV\iiint_Ef\,dV does the same in 3-D.
📝 Quick check (Level 1)
0/3 answered
  1. 1. ∬ over [0, 2] × [0, 3] of 1 dA = ?
  2. 2. ∫₀¹∫₀¹ (x + y) dy dx = ?
  3. 3. ∫₀²∫₀¹ x² dx dy = ?

Level 2: Intermediate

★★★☆☆ Intermediate⏱ 45 minUndergraduate students and practising engineers.

Non-rectangular regions

The inner limits can depend on the outer variable. For the triangle under y=xy = x:

∫01∫0x(x+y) dy dx=∫01(x2+x22)dx=12\int_0^1\int_0^x(x + y)\,dy\,dx = \int_0^1\Big(x^2 + \frac{x^2}2\Big)dx = \frac12

Change of variables

If (x,y)=T(u,v)(x,y) = T(u,v) is a smooth, one-to-one map:

∬Df(x,y) dx dy=∬T−1(D)f(T(u,v)) ∣det⁡JT∣ du dv\iint_Df(x,y)\,dx\,dy = \iint_{T^{-1}(D)}f(T(u,v))\,\lvert\det J_T\rvert\,du\,dv

The Jacobian determinant (A3.2-5) is the exchange rate between the areas of tiny cells.

Coordinates Map Area/volume element
polar x=rcos⁡θ, y=rsin⁡θx = r\cos\theta,\ y = r\sin\theta dA=r dr dθdA = r\,dr\,d\theta
cylindrical (rcos⁡θ,rsin⁡θ,z)(r\cos\theta, r\sin\theta, z) dV=r dr dθ dzdV = r\,dr\,d\theta\,dz
spherical (rsin⁡φcos⁡θ,rsin⁡φsin⁡θ,rcos⁡φ)(r\sin\varphi\cos\theta, r\sin\varphi\sin\theta, r\cos\varphi) dV=r2sin⁡φ dr dφ dθdV = r^2\sin\varphi\,dr\,d\varphi\,d\theta
linear x=Au\mathbf x = A\mathbf u dV=∣det⁡A∣ dudV = \lvert\det A\rvert\,d\mathbf u

Examples.

  • Disc area: ∫02π∫0Rr dr dθ=πR2\int_0^{2\pi}\int_0^Rr\,dr\,d\theta = \pi R^2.
  • Sphere volume: ∫∫∫r2sin⁡φ=43πR3\int\int\int r^2\sin\varphi = \frac43\pi R^3.
  • The Gaussian: ∬e−(x2+y2)dA=∫02π∫0∞e−r2r dr dθ=π\iint e^{-(x^2+y^2)}dA = \int_0^{2\pi}\int_0^\infty e^{-r^2}r\,dr\,d\theta = \pi.
🐍 Exercise 1: Cartesian vs polar integration
Implement midpoint double integration on a rectangle and in polar coordinates (with the factor r). The polar disc area is accurate to 10⁻¹⁰, while counting squares is jagged. Recover ∬ e^(−r²) = π.
📝 Quick check (Level 2)
0/3 answered
  1. 1. In polar coordinates, dA = ?
  2. 2. ∬ over the unit disc of (x² + y²) dA = ?
  3. 3. The volume of the unit ball?

Level 3: Advanced

★★★★☆ Advanced⏱ 40 minGraduate level, with full derivations and proofs.

Fubini’s theorem, and when it fails

Theorem (Fubini–Tonelli)

If ∬∣f∣<∞\iint\lvert f\rvert<\infty (or f≥0f\ge0), the iterated integrals in either order exist and equal the double integral.

Without absolute integrability, the order can matter. For f=x2−y2(x2+y2)2f = \frac{x^2 - y^2}{(x^2+y^2)^2} on [0,1]2[0,1]^2:

∫01 ⁣ ⁣∫01f dy dx=π4,∫01 ⁣ ⁣∫01f dx dy=−π4\int_0^1\!\!\int_0^1f\,dy\,dx = \frac\pi4, \qquad \int_0^1\!\!\int_0^1f\,dx\,dy = -\frac\pi4

The singularity at the origin makes ∬∣f∣=∞\iint\lvert f\rvert = \infty.

Why the Jacobian appears

Cut the (u,v)(u,v) domain into tiny rectangles of area ΔuΔv\Delta u\Delta v. TT maps each one to an almost-parallelogram of area ∣det⁡JT∣ΔuΔv+o(ΔuΔv)\lvert\det J_T\rvert\Delta u\Delta v + o(\Delta u\Delta v) (A3.2-5). Summing f×f\times these areas gives a Riemann sum for the right-hand side, and the errors vanish in the limit. ∎

Probability with several variables

A joint density p(x,y)p(x,y) satisfies ∬p=1\iint p = 1, and P((X,Y)∈D)=∬DpP((X,Y)\in D) = \iint_Dp. For (X,Y)=T(U,V)(X,Y) = T(U,V), densities transform by pX,Y=pU,V/∣det⁡JT∣p_{X,Y} = p_{U,V}/\lvert\det J_T\rvert. This is the multivariate version of A3.1-7, and the basis of normalizing flows.

Exercise 3.1: Find the centroid height of the upper half disc of radius 1

yˉ=∬y dA∬dA=∫0π∫01rsin⁡θ⋅r dr dθπ/2=2/3π/2=43π≈0.4244\bar y = \frac{\iint y\,dA}{\iint dA} = \frac{\int_0^\pi\int_0^1r\sin\theta\cdot r\,dr\,d\theta}{\pi/2} = \frac{2/3}{\pi/2} = \frac4{3\pi}\approx0.4244.

📝 Quick check (Level 3)
0/3 answered
  1. 1. Swapping the order of integration is always safe when…
  2. 2. The magnitude of the counterexample's iterated integrals?
  3. 3. Under (x, y) = T(u, v), densities divide by…

Level 4: Expert

★★★★★ Expert⏱ 40 minResearchers: original papers and open problems.

The curse of dimensionality

A grid with kk points per axis needs kdk^d evaluations in dd dimensions. Ten points per axis in 10-D is 101010^{10}. Monte Carlo averages ff at NN random points, with error ∼σ/N\sim\sigma/\sqrt N whatever the dimension (Metropolis and Ulam, 1949). The unit ball also shows how strange high dimensions are: its volume peaks near d=5d = 5, then vanishes, filling only 0.25%0.25\% of its bounding cube at d=10d = 10.

🐍 Exercise 2 (research): grid vs Monte Carlo for ball volumes
Estimate the volume of the d-dimensional unit ball with a midpoint grid and with Monte Carlo at the same budget, for d = 2 to 8. The grid wins in 2-D; Monte Carlo wins from d = 4 or 6 on.

Integrals that robots and models compute

  • Collision probability. With a Gaussian belief about its position, a robot’s chance of being inside an obstacle is ∬obstacleN(x;μ,Σ) dx\iint_{\text{obstacle}}\mathcal N(\mathbf x;\boldsymbol\mu,\Sigma)\,d\mathbf x. Chance-constrained planners keep it below a threshold (Blackmore, Ono and Williams, 2011; Practice Code 5).
  • Expected cost and reward. Stochastic control and RL optimize E[J]=∫J(ξ)p(ξ)dξ\mathbb E[J] = \int J(\boldsymbol\xi)p(\boldsymbol\xi)d\boldsymbol\xi over noise and trajectories. These are high-dimensional integrals estimated by sampling (MPPI, Williams et al., 2017; policy gradients).
  • Rendering and perception. Each pixel is an integral over light paths. Path tracing is Monte Carlo integration with importance sampling (Kajiya, 1986). It is now used for synthetic training data and differentiable rendering.
  • Bayesian inference. Posterior normalizers and predictions are integrals over parameter space, attacked with MCMC, variational methods and the Laplace approximation (A3.1-8).

References

  1. G. Fubini (1907). “Sugli integrali multipli.” Rendiconti della Accademia dei Lincei, 16.
  2. N. Metropolis, S. Ulam (1949). “The Monte Carlo method.” JASA, 44.
  3. J. Kajiya (1986). “The rendering equation.” SIGGRAPH.
  4. L. Blackmore, M. Ono, B. Williams (2011). “Chance-constrained optimal path planning with obstacles.” IEEE Transactions on Robotics, 27(6).
  5. G. Williams, A. Aldrich, E. Theodorou (2017). “Model predictive path integral control: from theory to parallel computation.” Journal of Guidance, Control, and Dynamics, 40(2).
  6. C. Robert, G. Casella (2004). Monte Carlo Statistical Methods, 2nd ed. Springer.
  7. J. Stewart (2015). Calculus: Early Transcendentals, 8th ed. Chapter 15.