An extension of the topic of probability and the area of a circle. Dropping points uniformly in a square with an inscribed circle, the ratio of hits inside the circle to all draws approximates π/4 — because it is the ratio of areas: circle to square. The more draws, the better the estimate of π. The Monte Carlo method was invented by Stanisław Ulam in 1946 at Los Alamos, developed together with John von Neumann.

I’ll give you a target value for the estimate of π — tune the number of draws N with the slider to reach it.
What just happened?
We draw points uniformly in a square of side 2 (from −1 to 1), with a circle of radius r = 1 inscribed in it. We count how many points fell inside the circle. The ratio of hits to all draws approximates the ratio of areas: the more draws, the closer to the true value.
The Monte Carlo formula:
— because the area of the circle is , and with r = 1 the area of the square is . So the ratio of areas is exactly , and the random sampling only estimates it.
The invariant — what random sampling does NOT change:
This ratio is always exactly the same, independent of N — it is pure geometry. Drawing points only estimates it, with an error that shrinks as N grows (the law of large numbers).
Where did this method come from?
The idea came to Stanisław Ulam in 1946 at Los Alamos, while recovering from an illness — pondering a game of solitaire, he noticed that instead of computing the odds of card arrangements combinatorially, one could play many random games and tally the statistics. Together with John von Neumann he developed this idea into calculations of neutron diffusion during work on the hydrogen bomb. The name “Monte Carlo” was proposed by Nicholas Metropolis, after the casino in Monte Carlo, where Ulam’s uncle gambled.
What does this mean in practice?
The Monte Carlo method is a general technique: when an exact calculation is too complicated, random sampling gives a good approximation. Today it is used in physics (nuclear, particle simulations), finance (option pricing, risk), machine learning and engineering.
Why you need this for the exam:
Geometric-probability problems are computed exactly from the ratio of areas (as here: π/4), without random sampling — Monte Carlo is only a visual intuition for how to estimate such a ratio when the exact formula is unknown or too hard.
Remember: more draws ⇒ smaller estimation error, but the ratio of areas P(circle)/P(square) = π/4 has always been constant — random sampling only uncovers it.
A circle of radius inscribed in a square of side :
Dropping points uniformly in the square, the fraction of hits inside the circle tends to , so:
The error shrinks like — four times as many draws gives roughly twice the accuracy.
Notation: radius, number of draws, .
The ratio of points landing inside the circle to all draws approximates π/4, because it is the ratio of the circle's area to the square's area.
Stanisław Ulam in 1946 at Los Alamos, developed in collaboration with John von Neumann.
In physics, finance and machine learning — wherever an exact calculation is too complicated.
Teaching? Embed this experiment on your site.
Free widget — paste it on your school site, blog or notes. It links to the full version.