π estimation
random sampling in the unit square
A quarter circle of radius 1 inscribed in the unit square has area π/4. Drop random points in the square — the fraction landing inside the quarter circle approximates π/4.
π ≈ 4 × (points inside) / (total points)
The error decreases as 1/√n — quadrupling the points halves the error. This is the Monte Carlo convergence rate.
references
Kalos & Whitlock. "Monte Carlo Methods." Wiley, 2008.
Kroese et al. "Why the Monte Carlo method is so important today." WIREs Computational Statistics, 2014.
live simulation
π estimate
—
points
0
error
—