Monte Carlo simulation is a method for using randomness to solve problems that may be difficult to solve exactly. Instead of calculating every possible outcome, it repeatedly samples random inputs and records the results. This makes it useful for estimating probabilities, averages, integrals, and risks in complex systems.
It matters because many real problems in physics, finance, engineering, and biology involve uncertainty and many interacting variables.
The core idea is to build a model, generate many random trials, and use the trial results as an estimate of the true answer. As the number of trials increases, the estimate usually becomes more stable because of the law of large numbers. For example, random points in a square can estimate pi by counting how many land inside an inscribed circle.
Monte Carlo simulation does not give an exact answer, but it can give a reliable approximation with a measurable amount of uncertainty.
Key Facts
- Monte Carlo estimate of a mean: x_bar = (x1 + x2 + ... + xn) / n
- Estimated probability: P(A) ≈ number of trials where A occurs / total number of trials
- Law of large numbers: as n increases, x_bar tends to approach the expected value E(X)
- Standard error of a sample mean: SE = s / sqrt(n)
- Monte Carlo integration: integral from a to b of f(x) dx ≈ (b - a)(1/n) sum f(xi)
- Pi estimate using random points: pi ≈ 4(number inside quarter circle / total points)
Vocabulary
- Monte Carlo simulation
- A computational method that uses many random trials to estimate an unknown probability, average, integral, or outcome.
- Random sample
- A set of values chosen by a random process so that they represent possible outcomes of a model.
- Trial
- One complete run of a simulation using one set of randomly generated inputs.
- Law of large numbers
- The principle that an average from many independent trials tends to get closer to the true expected value as the number of trials grows.
- Standard error
- A measure of how much a sample estimate is expected to vary from the true value due to random sampling.
Common Mistakes to Avoid
- Using too few trials, which makes the estimate highly unstable and sensitive to random luck. Increase the number of trials and check whether the result settles down.
- Treating a Monte Carlo answer as exact, which is wrong because random sampling always leaves some uncertainty. Report the estimate along with a measure such as standard error or a confidence interval.
- Sampling from the wrong distribution, which makes the simulation model a different problem than the one being studied. Match the random inputs to the real probabilities or assumptions in the situation.
- Ignoring independence between trials, which can bias the results if one trial affects another when the model assumes independent sampling. Make sure each simulated trial is generated under the correct conditions.
Practice Questions
- 1 A simulation rolls two fair dice 10,000 times and gets a sum of 7 in 1,690 trials. Estimate the probability of rolling a sum of 7.
- 2 Random points are generated in a unit square, and 7,860 out of 10,000 points land inside the quarter circle x^2 + y^2 <= 1. Use pi ≈ 4(number inside / total) to estimate pi.
- 3 A Monte Carlo estimate changes a lot when run with 100 trials but changes very little when run with 100,000 trials. Explain this behavior using the law of large numbers and sampling uncertainty.