25 November 2026 · 3 min readInteractive 3D
How can random dots find π? Monte Carlo
Throw random dots into a box with a ball inside, count how many land in the ball, and π appears. Try it yourself.
Here is a strange way to find π: no circles drawn, no formulas, just random guessing. Fill a cube with random dots and count how many land inside a ball that just fits in the cube.
Why it works
A ball of radius 1 has volume 4π/3. The cube around it has sides of 2, so its volume is 8. The ball fills (4π/3) ÷ 8 = π/6 of the cube. So if dots land at random, about π/6 of them, roughly 52%, land inside. Turn that around: π ≈ 6 × inside ÷ total.
Randomness as a tool
Using random samples to estimate something hard to calculate is called a Monte Carlo method, after the famous casino. It is used to price financial products, plan how particles move through a reactor, forecast weather and test how AI behaves.
- 100 dots: often off by 0.2 or more.
- 1,000 dots: usually within about 0.1.
- To halve the error, you need about four times as many dots.
The calculation behind it
Draw a square of side 2 with a circle of radius 1 inside it. The circle’s area is π × 1² = π and the square’s area is 4. A random dot in the square lands inside the circle with probability π ÷ 4.
- Throw 1000 random dots
- Suppose 786 land inside the circle
- Fraction inside = 0.786 ≈ π ÷ 4
- So π ≈ 4 × 0.786 = 3.144
How accurate is it?
The error shrinks like 1 ÷ √n, where n is the number of dots. 100 dots give π to within about 0.2; 10,000 dots to within about 0.02; a million dots to within about 0.002. To get one more correct digit you need about 100 times as many dots, which makes this a slow way to find π but a wonderful way to see how randomness can be used.
Where Monte Carlo is used for real
- Weather and climate models run thousands of slightly different simulations.
- Banks estimate risk by simulating many possible futures for the market.
- Physicists simulate particles in nuclear reactors and detectors.
- Game-playing AI tries many random continuations of a game to judge a move.
The method is named after the Monte Carlo casino, because it relies on chance like a game of roulette.
Randomness on a computer
Computers usually create pseudo-random numbers with a formula that looks random but repeats if started from the same seed. That repeatability is useful: scientists can rerun the same simulation exactly to check results.
Glossary
- Simulation: imitating a process on a computer.
- Sample: one random trial.
- Seed: the starting value for random numbers.
- Estimate: an approximate answer from data.
Try these yourself
- Q1. 400 dots, 314 inside: π ≈ 4 × 314 ÷ 400 = 3.14
- Q2. 50 dots, 40 inside: π ≈ 3.2
- Q3. To halve the error, how many more dots? Four times as many
- Q4. Estimate the chance of two dice summing to 7 by rolling 600 times: expect about 100, so ≈ 1/6
Where it came from
Stanisław Ulam thought of the method in 1946 while playing solitaire and wondering about his chances of winning. With John von Neumann he used it on early computers to study neutrons.
In short
Throw random points, count the hits, and the fraction estimates an area or probability. Accuracy grows slowly, but the idea solves problems no formula can.
Keep going
Questions people ask
What is the Monte Carlo method?
Using many random samples to estimate an answer, such as an area, a probability or the outcome of a complicated process.
Why does it give π?
The chance a random point in a square lands inside the inscribed circle is π ÷ 4, so four times the fraction inside approximates π.
How many points do you need?
Accuracy improves with the square root of the number of points: 100 times as many points give about one more correct digit.