Skip to content
GK LibraryA home for curious minds
English

Collecting Chance to Find the Answer: The Monte Carlo Method

Calculating how many times a coin will land heads if you toss it a thousand times is not hard. But for problems with far too many possible cases, such as the odds of winning a game of solitaire with 52 cards, solving them with a formula can feel hopeless. In such cases, instead of giving up on the calculation, you can actually try it many times and count the results. That is the “Monte Carlo Method.”

Put simply, the Monte Carlo method is “a way of calculating that repeats a huge number of random trials, then gathers the results and averages them to estimate the answer.” The idea behind it is that even without knowing the exact formula, if you collect enough chance outcomes, you get closer to the true answer.

In this article, we will look in turn at the background of how the Monte Carlo method was born, how it works, representative examples, and the fields where it is used today, along with points to watch out for.

A Monte Carlo simulation that scatters 100 random points on a square, counts the 78 that fall inside the quarter circle, and estimates pi as 3.12 using 4 times 78 divided by 100. It also explains that adding more samples does not guarantee better accuracy every time.
An example of estimating pi with the Monte Carlo method. In a fixed-seed simulation of 100 points, 78 fell inside the quarter circle. Sources: Oxford statistics exercise (https://www.stats.ox.ac.uk/~deligian/pdf/sc5/R_Exercises_2018-19/Exercise_1.3.1.html), LANL Monte Carlo & Random Sampling.

A Way of Calculating That Finds Answers by Collecting Chance

How Was the Monte Carlo Method Born?

A man in a cardigan playing solitaire with cards spread out on a wooden table in a sunlit 1940s-style room by the window

In 1946, Polish-born mathematician Stanisław Ulam was recovering from an illness and playing solitaire when a question came to him: what were the chances that a game of solitaire would come out successfully? Worn out from trying to work it out by counting the possible cases, he thought, “Wouldn’t it be more practical to just play it a hundred times or so and count how many times it succeeds?”

Ulam shared this idea with John von Neumann, who worked with him at Los Alamos Laboratory in the United States. The two decided to apply the method to the problem of neutron diffusion, which had not yet been solved at the time. Because the research was secret, it needed a code name, and their colleague Nicholas Metropolis took the name from the Monte Carlo Casino in Monaco, where Ulam’s uncle would borrow money from relatives to go gambling. In the spring of 1948, the first automated calculations were run on ENIAC, an early electronic computer.


The Four Steps of How the Monte Carlo Method Works

Colorful little glass beads pouring out of a wooden ladle and scattering randomly across a bright wooden table

The details differ from method to method, but the Monte Carlo method generally follows the same flow.

(1) Define the possible range
First, define the range in which the input values can fall in order to find the answer. This is the step where you set the variables that affect the result, such as sales volume, raw material prices, or weather, along with their ranges.

(2) Draw values at random
Within the defined range, draw input values at random according to their probabilities. Today, random numbers generated by computers are used, and if they are not drawn evenly, the results can go badly wrong.

(3) Calculate each one
Plug in the drawn values and calculate the result in the set way. This process is repeated thousands or even millions of times.

(4) Gather the results
Gather all the results and find the average or distribution. According to the law of large numbers, the more trials you run, the closer the average gets to the true value. A big advantage is that you do not just get a single average; you can also see how the results are spread out, such as “what is the chance of losing money, in %.”


Understanding the Monte Carlo Method Through Easy Examples

A large blue quarter circle drawn on a square sheet of white paper on a bright desk, with hundreds of small colored dots scattered randomly inside and outside the curve

The easiest example that shows the Monte Carlo method is finding pi.

[Example 1] Finding Pi by Scattering Dots

Draw a quarter circle with a radius of 1 inside a square with sides of 1. The ratio of the two areas is pi divided by 4. Now scatter dots evenly and randomly over the square, and count the proportion of dots that land inside the quarter circle. Multiply this proportion by 4 and you get a value close to pi, and the more dots you scatter, the closer it gets to 3.14. With about 100 dots, you are likely to get uneven values like 3.0 or 3.3, but once you pass several hundred thousand, it is often correct to the second decimal place. In effect, you have found pi just by counting dots, without any complicated calculation.

[Example 2] The Needle-Dropping Experiment

A similar idea existed much earlier. The 18th-century French naturalist Comte de Buffon calculated the probability that a needle dropped on a floor marked with parallel lines would cross a line. Because pi appears in this probability, you can estimate pi by tossing the needle countless times and counting how often it crosses a line. This “Buffon's Needle” problem is regarded as an early form of the Monte Carlo method.


Where the Monte Carlo Method Is Used and Its Limits

An analyst in a bright office looking at a large monitor showing many thin colored lines fanning out to the right from a single point

The Monte Carlo method is especially powerful for problems with many variables and great uncertainty. When the variables grow to dozens or hundreds, checking every case one by one quickly becomes impossible, but random sampling can be used the same way no matter how many variables there are.

  • Finance: It creates countless paths that stock prices and interest rates could take to weigh investment risk and option prices.
  • Weather Forecasting: It forms the basis of ensemble forecasting, which runs many forecasts at once with slightly varied starting conditions.
  • Computer Graphics: It traces the paths light takes at random to render photo-like scenes.
  • Game AI: Using Monte Carlo tree search, it plays out countless virtual games of Go to choose good moves.
  • Search and Rescue: The U.S. Coast Guard generates thousands of possible locations for a missing vessel, reflecting wind and ocean currents, to set its search areas.

Still, its limits are clear. Because the error shrinks in inverse proportion to the square root of the number of trials, you need four times as many trials to cut the error in half. For problems where a single calculation is heavy, this can take an enormous amount of time. And if you set the range or probabilities of the input values wrong, no matter how many times you repeat it, you will only get closer to the wrong answer.


The Monte Carlo method shows that when you cannot get the right answer in one go, collecting enough chance outcomes can bring you to a trustworthy answer. A small question that began with a card game ended up changing nuclear physics, finance, and even artificial intelligence.

Not stopping just because there is no perfect formula, and instead testing countless possibilities for yourself: that is the first step of wisdom toward making better decisions in an uncertain world.