π 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.

live simulation
π estimate
points 0
error