Probability & Statistics

Monte Carlo Simulation

Estimating Pi using random points in a circle.

Monte Carlo Simulation

Concept Overview

Monte Carlo simulations are a broad class of computational algorithms that rely on repeated random sampling to obtain numerical results. The underlying concept is to use randomness to solve problems that might be deterministic in principle. They are often used in physical and mathematical problems and are most useful when it is difficult or impossible to use other approaches. A classic and intuitive example of a Monte Carlo simulation is the estimation of the mathematical constant Pi (π) using random points in a square.

Estimating Pi

To estimate Pi, we imagine a square of side length 2, centered at the origin (0,0). Inside this square, we inscribe a circle of radius 1. We then randomly generate points (x, y) such that both x and y are between -1 and 1.

The area of the square is 2 × 2 = 4. The area of the inscribed circle is π × r2 = π × 12 = π. Thus, the ratio of the area of the circle to the area of the square is π / 4.

Areacircle / Areasquare = π / 4

If we scatter a large number of random points uniformly inside the square, the proportion of points that fall inside the circle will approximately equal the ratio of their areas. A point (x, y) is inside the circle if x2 + y2 ≤ 1.

π ≈ 4 × (Number of points inside circle / Total number of points)

Key Concepts

  • Random Sampling: The core of the method is the generation of random variables that follow a specific probability distribution (in this case, uniform distribution).
  • Law of Large Numbers: As the number of random samples increases, the empirical probability (ratio of points inside the circle) converges to the theoretical probability (π / 4), thereby improving the estimate.
  • Convergence Rate: The error of a Monte Carlo simulation typically decreases as the square root of the number of samples, 1/√N. This means getting 10 times more precision requires 100 times more samples.

Historical Context

The modern version of the Monte Carlo method was invented in the late 1940s by Stanislaw Ulam, while he was working on nuclear weapons projects at the Los Alamos National Laboratory. After Ulam shared his idea with John von Neumann, they programmed the first Monte Carlo simulations on the ENIAC computer to solve neutron diffusion problems. The method is named after the Monte Carlo Casino in Monaco, referencing the element of chance and randomness at its core.

Real-world Applications

  • Finance: Evaluating complex financial instruments like options and simulating risk (e.g., Value at Risk) through potential future market scenarios.
  • Physics: Simulating particle interactions, fluid dynamics, and quantum chromodynamics.
  • Computer Graphics: Path tracing algorithms use Monte Carlo integration to simulate how light bounces off surfaces to render highly realistic images.
  • Operations Research: Optimizing complex logistics, supply chain problems, and queuing systems.

Related Concepts

  • Law of Large Numbers — The theoretical foundation for why Monte Carlo simulation converges.
  • Central Limit Theorem — Describes the distribution of the estimation error in Monte Carlo methods.
  • Probability Distributions — Monte Carlo often involves sampling from various probability distributions beyond the uniform distribution.

Experience it interactively

Adjust parameters, observe in real time, and build deep intuition with Riano’s interactive Monte Carlo Simulation module.

Try Monte Carlo Simulation on Riano →

More in Probability & Statistics