📊 Section 1 — Interactive Simulation
Pick a function $f(x,y)$ and a 2D region. Watch the Riemann sum approximate $\iint_R f\,\dd{A}$ as the grid refines. Switch between rectangular, polar (Jacobian $r$), or compare iterated orders to confirm Fubini.
Run
Integrand f(x, y)
Sum rule
Parameters
Display Options
Tips
• Midpoint rule is 2nd order — doubling $n$ cuts error ×4.
• Simpson 2D is 4th order — doubling $n$ cuts error ×16.
• Switch to Polar to integrate $e^{-r^2}$ — the trick behind $\int_\R e^{-x^2}\,dx=\sqrt\pi$.
• Monte Carlo error decays only as $1/\sqrt n$ but works in any dimension.
🪜 Section 2 — The Idea, Step by Step
From "stack of tiles" to "slice and sum" — building a double integral out of something you can actually picture, then climbing to the precise form and the sliders above.
📐 Section 3 — Theory & Construction
Build the double integral as a limit of Riemann sums, prove Fubini's theorem informally, then extend to triple integrals and change of variables.
If $f:[a,b]\times[c,d]\to\R$ is continuous (or just integrable with absolutely integrable iterated integrals), then $$\iint_{[a,b]\times[c,d]} f(x,y)\dd{A} \;=\; \int_a^b\!\!\int_c^d f(x,y)\dd{y}\dd{x} \;=\; \int_c^d\!\!\int_a^b f(x,y)\dd{x}\dd{y}.$$
In short: a double integral splits into two single integrals in either order. For non-rectangular regions you may need to swap inner/outer bounds carefully.
Symbol Table
| Symbol | Meaning | Type |
|---|---|---|
| $R$ | Region of integration in $\R^2$ (or $\R^3$) | Bounded, measurable |
| $\Delta A_i$ | Area of $i$-th subrectangle in partition | $\Delta x_i \Delta y_j$ |
| $(x_i^*,y_j^*)$ | Sample point inside each subrectangle | Point in $R$ |
| $S_n$ | Riemann sum $\sum_{i,j} f(x_i^*,y_j^*)\Delta A_{ij}$ | Real scalar |
| $\iint_R f\dd{A}$ | Limit $\lim_{\norm{P}\to 0} S_n$ | Real scalar (the integral) |
| $\dd{A}$ | Area element: $\dd{x}\dd{y}$ rectangular, $r\dd{r}\dd\theta$ polar | 2-form |
| $J$ | Jacobian $\partial(x,y)/\partial(u,v)$ for change of variables | $2\times 2$ determinant |
| $\dd{V}$ | Volume element: $\dd{x}\dd{y}\dd{z}$, $r\dd{r}\dd\theta\dd{z}$, $\rho^2\sin\phi\dd\rho\dd\phi\dd\theta$ | 3-form |
From Single to Double Integral
Simulation ↔ Symbol Mapping
tab Rectangle | $R=[a,b]\times[c,d]$ — Cartesian Riemann grid |
tab General Region | Type-I region with $g_1(x), g_2(x)$ curves bounding $y$ |
tab Polar | $\dd{A}=r\dd{r}\dd\theta$ — note grid cells widen with $r$ |
tab Fubini | Run both orders, compare — should agree for continuous $f$ |
slider n | refinement: $\Delta x = \Delta y = 1/n$ |
readout approx Sₙ | the Riemann sum value for current partition |
readout error | $\abs{S_n - I}$ where $I$ is the analytic answer |
readout mean f̄ | $\frac{1}{\text{area}(R)}\iint_R f\dd{A}$ — average value of $f$ over $R$ |
graph error log–log | slope $-2$ = midpoint (2nd-order); slope $-4$ = Simpson; $-1/2$ = Monte Carlo |
Worked Example — Volume Under a Paraboloid
Compute $V = \iint_R (x^2+y^2)\dd{A}$ where $R = \{(x,y):x^2+y^2\le 1\}$ (unit disc).
Cartesian (hard): $V = \int_{-1}^{1}\!\int_{-\sqrt{1-x^2}}^{\sqrt{1-x^2}}(x^2+y^2)\dd{y}\dd{x}$. Inner: $2x^2\sqrt{1-x^2} + \frac{2}{3}(1-x^2)^{3/2}$. Outer requires trig substitution — painful but doable.
Polar (easy): $x^2+y^2 = r^2$, $\dd{A}=r\dd{r}\dd\theta$. $R: 0\le r\le 1$, $0\le\theta\le 2\pi$. $$V \;=\; \int_0^{2\pi}\!\!\int_0^1 r^2\cdot r\dd{r}\dd\theta \;=\; \int_0^{2\pi}\!\!\int_0^1 r^3\dd{r}\dd\theta = \int_0^{2\pi}\frac{1}{4}\dd\theta = \frac{\pi}{2}.$$
Numerical check (simulation): with Cartesian midpoint rule on $[-1,1]^2$ masking the disc, $n=20$ gives $S\approx 1.564$; exact $\pi/2 \approx 1.5708$. Polar with $n=20$ gives $S\approx 1.5708$ — essentially exact because the integrand $r^3$ is a polynomial that midpoint integrates well after the substitution. $\boxed{V = \pi/2.}$
Worked Example — The Gaussian Integral via Polar
Famous trick: $I = \int_{-\infty}^{\infty} e^{-x^2}\dd{x}$ has no elementary antiderivative. But $I^2 = \iint_{\R^2}e^{-x^2-y^2}\dd{A}$. Convert to polar: $$I^2 \;=\; \int_0^{2\pi}\!\!\int_0^\infty e^{-r^2} r\dd{r}\dd\theta \;=\; 2\pi \cdot \left[-\tfrac12 e^{-r^2}\right]_0^\infty \;=\; \pi.$$
Therefore $\boxed{I = \sqrt\pi.}$ This single change of variables solves a problem that's impossible in 1D.
❓ Section 4 — Frequently Asked Questions
Fubini's theorem says the two orders agree whenever $f$ is continuous on a closed bounded region, or more generally when $\iint_R \abs{f}\,\dd{A} < \infty$ (Tonelli–Fubini for measurable functions). Geometrically, you're computing the same volume by slicing it two different ways — vertical strips vs horizontal strips. They must agree because volume doesn't depend on how you slice.
It can fail when $f$ is unbounded and $\iint\abs{f}=\infty$. Classic counterexample: $f(x,y) = (x^2-y^2)/(x^2+y^2)^2$ on $[0,1]^2$. The two iterated integrals give $\pi/4$ and $-\pi/4$ — different! The double integral doesn't exist in the Riemann/Lebesgue sense because $\iint\abs{f}=\infty$.
Key takeaway: continuous on a compact region ⇒ orders agree (Fubini). For improper / unbounded $f$, check absolute integrability first.In polar coordinates, a "cell" with $\Delta r$ and $\Delta\theta$ is an annular sector. Its area is approximately $r\,\Delta r\,\Delta\theta$ — not $\Delta r\,\Delta\theta$. The extra factor of $r$ is exactly $\abs{\det J_\Phi}$ where $\Phi(r,\theta)=(r\cos\theta,r\sin\theta)$. Sectors at large $r$ are much bigger than sectors near the origin, even though both have the same $\Delta r,\Delta\theta$. The simulation paints each sector with its actual Cartesian area, which is why outer rings appear wider.
Operationally: when you switch to polar mode, the readout shows $S_n = \sum f(r_i,\theta_j)\cdot r_i\,\Delta r\,\Delta\theta$. Drop the $r$ and you get a wrong answer that systematically under-weights large-$r$ contributions.
Key takeaway: $\dd{A}_{polar} = r\dd{r}\dd\theta$ — that $r$ is the Jacobian, geometrically the area amplification of the polar grid.Physics: mass $m=\iiint_E \rho\dd{V}$ and center of mass $\bar x = \frac{1}{m}\iiint_E x\rho\dd{V}$; moments of inertia $I_z = \iiint_E (x^2+y^2)\rho\dd{V}$; electric/gravitational potentials are 3D integrals of source densities; flux through a surface is a double integral; total charge from charge density. Probability: for jointly continuous $(X,Y)$ with density $f$, $P((X,Y)\in B) = \iint_B f\dd{A}$ and $E[g(X,Y)] = \iint g f\dd{A}$. The normalizing constant of a 2D Gaussian is exactly the polar trick above. Engineering: finite-element methods reduce PDE problems to assembling many local 2D/3D integrals over mesh elements; computing volumes/areas of CAD parts; structural moments. Statistics / ML: Bayesian posteriors are integrals over high-dimensional parameter spaces — Monte Carlo and MCMC exist because deterministic quadrature collapses past $\sim 6$ dimensions.
Key takeaway: anywhere a quantity is "density × region", you have a multiple integral.For a smooth map $\Phi:S\to R$, near any point $\Phi$ is well-approximated by its derivative — a linear map represented by the Jacobian matrix $J_\Phi$. A linear map sends a unit square to a parallelogram whose area equals $\abs{\det J}$. So $\abs{\det J_\Phi(u,v)}$ is the local area amplification factor at $(u,v)$. The change-of-variables formula is "weight each tiny patch in $S$ by how much it stretches when mapped to $R$, then integrate".
In 3D the same idea works with volume amplification; in $n$ dimensions, $\abs{\det J}$ is an $n$-volume scaling. If $\det J = 0$ at a point, the map collapses dimensions locally (singularity — handle with care). If $\det J < 0$, $\Phi$ flips orientation; we take absolute value because area is unsigned in this context (signed forms appear in differential geometry).
Key takeaway: $\abs{\det J_\Phi}$ tells you how much area/volume is stretched by $\Phi$ at each point — the universal "weight" for any change of variables.Tensor-product quadrature (Simpson, Gauss, midpoint on a grid) in $d$ dimensions needs $n^d$ function evaluations for $n$ points per axis. Error decays as $n^{-p}$ where $p$ is the rule's order — so error vs cost: $\text{err} \sim N^{-p/d}$ for $N = n^d$ evaluations. For $d=6$, even Simpson ($p=4$) gives $N^{-2/3}$ — slow.
Monte Carlo: pick $N$ uniform random points in $R$, average $f$ values, multiply by $\text{vol}(R)$. By CLT, error decays as $1/\sqrt N$ regardless of $d$. So once $d \gtrsim 2p$, Monte Carlo wins. Bayesian inference routinely operates in $d = 100$–$10^6$ — quadrature is hopeless, Monte Carlo (especially MCMC/HMC) is the only option.
This is the famous "curse of dimensionality" for deterministic integration. Quasi-Monte Carlo (low-discrepancy sequences like Sobol/Halton) bridges the gap with $\sim N^{-1}(\log N)^d$ — better than MC for moderate $d \approx 10$–$50$ but still defeated eventually.
Key takeaway: deterministic rules pay an exponential cost in $d$; MC pays none. Crossover is around $d=4$–$8$ depending on smoothness.The Riemann integral in $\R^n$ has serious limitations: it can't handle wildly discontinuous integrands and behaves badly under limits ($\lim\int \neq \int\lim$ for many useful sequences). Lebesgue's reformulation: replace "partition the domain" with "partition the range". For a measurable $f\ge 0$, $\int_R f\dd\mu = \sup\{\int_R s\dd\mu : s \text{ simple, } 0\le s\le f\}$ where simple functions take finitely many values.
Fubini's theorem in measure-theoretic form (for product measures $\mu\times\nu$): $\int_{X\times Y} f\,d(\mu\times\nu) = \int_X\int_Y f(x,y)\,d\nu\,d\mu$ when $f$ is non-negative measurable (Tonelli) or when $\int\abs{f}<\infty$ (Fubini). This is the right framework for probability theory: an integral over $\R^n$ is the same kind of object as an expectation $\int_\Omega X\,dP$, and product measures correspond to independent random variables.
The change of variables formula generalizes: for $\Phi:U\to V$ a $C^1$-diffeomorphism between open sets in $\R^n$, $\int_V f\,d\lambda = \int_U (f\circ\Phi)\abs{\det D\Phi}\,d\lambda$ where $\lambda$ is Lebesgue measure. Same formula, just rigorously proven for measurable $f$ on Lebesgue-measurable sets.
Key takeaway: multiple integration is a clean, robust object once you upgrade to Lebesgue measure — Fubini, change of variables, and dominated convergence theorems all extend without surprises.Cylindrical $(r,\theta,z)$ with $\dd{V}=r\dd{r}\dd\theta\dd{z}$: choose when the region has rotational symmetry about an axis (typically the $z$-axis) and the bounds in $z$ are simple — e.g.\ paraboloid $z=r^2$ to plane $z=1$, or cylinder cores.
Spherical $(\rho,\phi,\theta)$ with $\dd{V}=\rho^2\sin\phi\dd\rho\dd\phi\dd\theta$ (here $\rho$ = distance from origin, $\phi$ = polar angle from $+z$ axis, $\theta$ = azimuth): choose when the region has radial symmetry from a point — balls, spherical shells, cones from the origin, gravitational/electric problems of point sources.
Quick test: does the integrand or region simplify when written in those coordinates? $x^2+y^2 \to r^2$ (cylindrical) or $\rho^2\sin^2\phi$ (spherical); $x^2+y^2+z^2 \to \rho^2$ (spherical, dramatically simpler). If yes, switch. Don't forget the Jacobian — that $r$ or $\rho^2\sin\phi$ is mandatory.
Key takeaway: cylindrical for axis-symmetric problems, spherical for point-symmetric problems. The Jacobian is what makes the answer correct.