Learning path

Full curriculum

Full curriculum

Unit content

Monte Carlo estimation by random sampling

Monte Carlo methods estimate mathematical quantities by averaging random samples. They are especially useful when direct integration or enumeration becomes expensive in many dimensions.

If $X$ is a random variable and we want $$\mu=\mathbb E[f(X)],$$ draw independent samples $X_1,\ldots,X_N$ and use $$\hat\mu_N=\frac1N\sum_{i=1}^N f(X_i).$$ By the law of large numbers, this average approaches the expectation as $N$ grows. If the sample variance is finite, the standard error decreases approximately as $1/\sqrt N$.

For example, estimate $\pi$ by sampling points uniformly in the square $[-1,1]^2$. A point lies inside the unit circle when $x^2+y^2\le1$. The circle occupies a fraction $\pi/4$ of the square, so if $M$ of $N$ sampled points fall inside, $$\hat\pi=4\frac{M}{N}.$$ With $N=10000$ and $M=7860$, the estimate is $\hat\pi=3.144$.

The slow $N^{-1/2}$ convergence is independent of dimension, which can make Monte Carlo attractive when grid-based integration suffers from exponentially growing point counts. But random sampling also introduces statistical uncertainty, so reporting an estimate without its sampling error is incomplete.

More advanced Monte Carlo methods change how samples are generated to reduce variance or reach distributions that cannot be sampled directly. The reusable core remains simple: represent the desired quantity as an expectation, sample from a known distribution, average the resulting observable, and quantify the uncertainty caused by finite sampling.