Courses / Mathematics I
Scientific Programming

Simulation and Monte Carlo Methods

Mathematics I 333 words Free to read

Computing with Randomness

Some problems are too complex to solve exactly but can be estimated by random sampling. Monte Carlo methods use randomness deliberately: generate many random scenarios, and use their statistics to approximate an answer. Counterintuitively, injecting randomness solves deterministic problems — estimating integrals, areas, and probabilities that resist analytic attack.

The classic illustration estimates π\pi. Scatter random points uniformly in a unit square containing a quarter-circle of radius 1. The fraction landing inside the quarter-circle approximates its area, π4\frac{\pi}{4}, so π4points insidetotal points.\pi \approx 4 \cdot \frac{\text{points inside}}{\text{total points}}. More points give a better estimate. Monte Carlo shines especially for high-dimensional integrals, where grid-based methods fail (a grid needs exponentially many points as dimensions grow, but Monte Carlo's cost does not).

The defining characteristic — and the crucial caveat — is convergence rate. A Monte Carlo estimate's error shrinks like 1N\frac{1}{\sqrt{N}} with the number of samples NN. This is slow: to get one more decimal digit of accuracy (tenfold error reduction), you need one hundred times as many samples. So Monte Carlo gives quick rough answers but expensive precise ones — it is a tool for estimation, not high-accuracy computation.

Monte Carlo methods also simulate stochastic systems directly: modeling particle diffusion, financial-market scenarios, queueing systems, or the spread of a disease by playing out many random trials and averaging. Random sampling also underlies randomized algorithms and much of modern statistics and machine learning. Its power is turning an intractable exact problem into a tractable statistical estimate.

Common pitfall: expecting Monte Carlo estimates to be highly precise or to improve quickly with more samples. The error shrinks only as 1N\frac{1}{\sqrt{N}}, so each additional decimal digit of accuracy costs 100 times more samples — Monte Carlo is inherently slow to converge. It is excellent for quick estimates and high-dimensional problems, but a poor choice when many accurate digits are needed; do not treat a Monte Carlo result as exact or assume doubling the samples halves the error (it only cuts it by 2\sqrt{2}).

Practise this lesson

The explanation above is free to read. The graded practice for this lesson lives in the Tryals app.

11practice questions
2interactive scenes
Start Mathematics I free

Scientific Programming