Draw a circle inside a square, and scatter points across that square completely at random. Just from the fraction of points that land inside the circle, you can astonishingly estimate the value of pi (π). This way of finding π through probability, instead of calculation, is called the Monte Carlo method.
Draw a circle of radius 1 filling a square with side length 2, and the square's area is 4, while the circle's area is π. So circle's area ÷ square's area = π/4. Scatter points completely evenly at random across the square, and the probability of a point landing inside the circle also gets closer to this same ratio (π/4). So you can estimate π ≈ 4 × (points inside the circle ÷ total points).
Press the button to scatter random points. Points that land inside the circle show up violet; points outside show up gray.
Every time you scatter points above, check on the graph how close the estimate up to that point gets to the true value of π (3.14159...).
Unfortunately, the Monte Carlo method converges very slowly. To cut the error down to a tenth, you have to increase the number of points by a hundredfold (10² times) — this is called the "1/√n rule." Getting π accurate to 6 decimal places would take scattering literally billions of points.
Methods like "circumference ÷ diameter" or Leibniz's series, which you saw on the special numbers page earlier, reach an accurate π far faster. Even so, the Monte Carlo method matters because for problems like complex shapes or high-dimensional spaces, where setting up an exact formula is difficult, this "scatter randomly and count the ratio" approach is often practically the only solution available.
In practice, the Monte Carlo method is used across a huge range of fields — nuclear reactor design, pricing financial products, weather forecasting, drug-development simulations, and more. Estimating π is just about the easiest example for experiencing this powerful method firsthand.