Skip to main content

5.7 Monte Carlo variance reduction

Source: Ideas from Computational Physics (Landau, Páez, Bordeianu), §5.7. Rewritten in original wording. Continues 5.6 Mean-value theorem and high-D Monte Carlo. Labs: 5.7b Variance-reduction labs.

When plain sampling wastes effort​

Crude Monte Carlo draws xx uniformly on [a,b][a,b] and averages f(x)f(x). That is fine when ff is smooth and comparable everywhere. It is wasteful when ff is rapidly varying — for example a narrow Gaussian peak on a wide interval. Most samples land where f≈0f\approx 0 and barely change the average, while the rare hits near the peak dominate both the estimate and its variance. Raising NN still helps like 1/N1/\sqrt{N}, but you are paying for samples that teach you almost nothing.

Control-variate idea​

Pick a comparison function gg that tracks ff closely,

∣f(x)−g(x)∣≤ε,\bigl|f(x)-g(x)\bigr|\le\varepsilon,

and whose integral is known exactly:

J=∫abg(x) dx.J=\int_a^b g(x)\,dx.

Then rewrite the target as a small correction plus the known piece:

I=∫abf=∫ab(f−g)+J.I=\int_a^b f=\int_a^b\bigl(f-g\bigr)+J.

Estimate only the residual by Monte Carlo:

I≃b−aN∑i=1N(f(xi)−g(xi))+JI\simeq\frac{b-a}{N}\sum_{i=1}^{N}\bigl(f(x_i)-g(x_i)\bigr)+J

(with xix_i uniform on [a,b][a,b]; on [0,1][0,1] the factor b−ab-a is 11).

Walk the same four equations — each step offers three lookalike formulas:

Goal: shrink the variance​

The method pays off when

Var(f−g)<Var(f).\mathrm{Var}(f-g)<\mathrm{Var}(f).

If gg mirrors the shape of ff, the residual f−gf-g is flatter and less noisy under uniform sampling. Exact JJ absorbs the bulk of the integral; Monte Carlo only has to resolve a small leftover. A simple textbook calibration on [0,1][0,1] is f(x)=e−xf(x)=e^{-x} with g(x)=1−xg(x)=1-x (so J=1/2J=1/2): the control-variate estimate typically beats plain mean-value MC at the same NN and seed.

Quiz

Variance reduction

1 / 3

Order the control-variate derivation (top = first).

OrderDrag the handle to rearrange — top should be first.

  1. 1Rewrite I=∫(f−g)+J
  2. 2MC-average the residual and add known J
  3. 3Require |f−g|≤ε so g tracks f
  4. 4Introduce known J=∫g

Drag items into the correct order (or use ↑↓), then check.

Next: 5.7b Variance-reduction labs.