numerical integration
Monte Carlo Integration
You should know: monte carlo methods, numerical integration
Overview
Monte Carlo integration estimates a definite integral by averaging the integrand at random sample points rather than evaluating it on a fixed grid, as the trapezoidal or Simpson's rules do. For ∫ₐᵇ f(x) dx, the estimate is (b−a) times the average of f at N points drawn uniformly at random from [a, b]. This is a direct consequence of the law of large numbers — the sample mean of f converges to the true average of f over the interval as N grows — and the error shrinks like 1/√N regardless of the number of dimensions, unlike grid-based quadrature rules whose cost explodes exponentially with dimension (the 'curse of dimensionality'). This dimension-independence is precisely why Monte Carlo integration is the method of choice for high-dimensional integrals in computational physics, finance (option pricing), and Bayesian statistics, even though its 1/√N convergence is slower than a grid method in low dimensions.
Intuition
Suppose you want the average height of everyone in a large stadium, but can't measure everyone. Instead, you measure a random sample of people and average their heights — by the law of large numbers, that sample average approaches the true average as the sample grows, regardless of the (huge) size of the crowd. Estimating ∫ₐᵇ f(x) dx is exactly this: the true value of the integral is (b−a) times the average value of f over the interval, so measuring f at random points and averaging estimates that average value directly. The key payoff shows up in higher dimensions: to estimate an integral over a d-dimensional region with a grid, the number of grid points needed to keep the same resolution grows exponentially in d, but a random sample of N points needs no grid at all — its error depends only on N, not on d, which is why physicists reach for Monte Carlo methods once dimension climbs past a handful of variables.
Formal Definition
For f integrable on [a, b], draw N independent samples x₁, …, x_N uniformly from [a, b] and estimate the integral by the scaled sample mean of f:
Worked Examples
Evaluate f(x) = x² at each sample point.
Average the 5 function values.
Scale by (b − a) = (1 − 0) = 1 to get the estimate.
Compare to the exact value.
Answer: Monte Carlo estimate ≈ 0.4145 vs exact 1/3 ≈ 0.3333 — a sizable gap with only 5 samples, illustrating why the method needs many samples (typically thousands or more) before the 1/√N error becomes small.
Practice Problems
Using the 3 sample points x = 0.2, 0.5, 0.9 for f(x) = x², estimate ∫₀¹ x² dx by Monte Carlo integration.
If the Monte Carlo standard error at N = 100 samples is 0.05, approximately what is the standard error at N = 10,000 samples (same integrand and interval)?
A physicist needs to compute a 6-dimensional integral for a statistical mechanics partition function. Explain why Monte Carlo integration is preferred over a grid-based method like the composite trapezoidal rule extended to 6 dimensions.
Quiz
Summary
- Monte Carlo integration estimates ∫ₐᵇ f(x) dx as (b−a) times the average of f at N random points in [a,b], using the law of large numbers.
- For f(x)=x² on [0,1], 5 sample points (0.1, 0.4, 0.6, 0.8, 0.95) give an estimate of 0.4145 versus the exact value 1/3 ≈ 0.3333; the error shrinks toward 0 as N grows.
- The standard error decreases as O(1/√N), independent of the dimension of the integration domain — unlike grid-based methods whose cost grows exponentially with dimension.
- This dimension-independence makes Monte Carlo integration the standard tool for high-dimensional integrals in physics, finance, and Bayesian statistics.
References
- BookPress, W. H. et al. Numerical Recipes: The Art of Scientific Computing, 3rd ed. Cambridge, 2007.
Mathematics