dailymathdailymathMainPostsLogin
dailymath logo
dailymath
Login
Login
MainPosts

Curricula

RO M1UK A-LevelUK GCSEIB AAUS APUS SATUS HonorsFR SpéFR SecondeFR Expertes
AboutPostsPracticeSubmit a problemPrivacyTermsCookies

© 2026 dailymath

Back to posts
University / ProfessionalLessonProbability & simulation

Monte Carlo: Solving the Unsolvable by Rolling Dice

How Monte Carlo methods turn unsolvable integrals into dice rolls — from Ulam's solitaire hunch to pricing options and rendering every Pixar frame.

dailymath · July 17, 2026 · 9 min read

In 1946, the mathematician Stanislaw Ulam was laid up in Los Angeles, recovering from a bout of encephalitis, killing time with hand after hand of Canfield solitaire. Bored enough to actually think about the game instead of just playing it, he found himself wondering something sharper than idle curiosity: what fraction of Canfield deals can actually be won? He tried the honest way first — enumerate the possible sequences of plays and work out the exact combinatorics — and ran straight into a wall. Fifty-two cards and a long tree of choices blow the state space up past anything you could hope to count by hand, and the "just solve it with algebra" instinct that works for a coin flip collapses completely.

The reframe that followed is the one Ulam is actually remembered for. Don't compute the probability of winning — *estimate* it. Deal out the cards a hundred times, actually or on paper, and count how many hands come out. The fraction of successes is your answer: noisy, not exact, but obtainable in an afternoon instead of never. He described the idea to John von Neumann, who saw immediately that it generalized far past card games — any quantity you can write as an average has a stand-in, and you don't need a formula for it, only a way to sample. His Los Alamos colleague Nicholas Metropolis gave the method its name, borrowed from the Monte Carlo casino, where Ulam had an uncle who would reliably borrow money from relatives because, as Ulam put it, he simply had to go gamble there. The name stuck for the obvious reason: this is a method built out of rolling dice on purpose, as a way of doing arithmetic.

That's the whole idea, and it stretches from a dartboard to a derivatives desk without changing shape: when the integral you need is impossible — too many dimensions, no closed form, a boundary too irregular to write down — stop trying to solve it exactly. Simulate it instead. The rest of this piece is that one idea worked through three times: once with actual darts, once with the formula for how fast the guessing gets good, and once with the machinery a real trading desk runs every day.

Fig. 1 · π from 400 darts

n = 400inside = 313π ≈ 3.1300
inside (x² + y² ≤ 1)
outside
Four hundred darts thrown uniformly at random across a unit square, blue where they land inside the quarter circle, gray where they miss. The fraction landing inside estimates the quarter circle's share of the square's area — one quarter of π — so multiplying that fraction by 4 estimates π itself. The readout is the actual estimate this run produced; replay throws a fresh 400 and it moves.

Why counting darts computes an integral

Set up a unit square and inscribe a quarter circle of radius 1 in one corner. The square has area 1; the quarter circle has area π/4\pi/4π/4 — that's just πr2\pi r^2πr2 scaled down by a factor of four for one quadrant. Throw darts uniformly at random inside the square, and each dart has probability exactly π/4\pi/4π/4 of landing inside the quarter circle, since probability for a uniform distribution over a region is nothing but area. Throw enough darts and count what fraction land inside, and that fraction has to settle down near π/4\pi/4π/4 — this is the law of large numbers doing its ordinary job, the same reason a fair coin flipped a million times lands close to half heads.

Multiply the fraction by 4 and you have an estimate of π:
π≈4⋅insiden\pi \approx 4 \cdot \frac{\text{inside}}{n}π≈4⋅ninside​
It looks like a party trick, but the mechanism underneath is completely general. Being "inside the quarter circle" is just an indicator function — 1 if x2+y2≤1x^2 + y^2 \le 1x2+y2≤1, 0 otherwise — and its average value over the square is exactly its integral over the square. Swap that indicator for *any* function fff, and the same trick estimates ∫f\int f∫f: sample points at random from wherever you're integrating over, average fff at those points, and the average converges to the true integral as the sample grows. An integral is an expected value wearing a different name, and once you see that, Monte Carlo stops being a curiosity about darts and starts being a general-purpose way to compute any integral you can sample from, no matter how ugly its shape.

The 1/√N law: curse and miracle

How fast does the dart estimate actually converge? The central limit theorem answers precisely: the error of a Monte Carlo estimate built from NNN samples shrinks like
error∼σN\text{error} \sim \frac{\sigma}{\sqrt{N}}error∼N​σ​
where σ\sigmaσ is the standard deviation of whatever you're averaging — for the dart game, a fixed number close to 0.4. That 1/N1/\sqrt{N}1/N​ is a curse and a miracle in the same breath. The curse: convergence is slow. To knock one more correct decimal digit off your error — shrink it by a factor of 10 — you need 102=10010^2 = 100102=100 times as many samples. Monte Carlo is not a fast way to get a lot of digits.

The miracle is what that rate *doesn't* mention: dimension. Grid-based quadrature — laying down evenly spaced points and summing — needs kdk^dkd evaluations to place kkk points along each of ddd axes, so ten points per axis in 100 dimensions is 1010010^{100}10100 evaluations, more than there are atoms in the observable universe. Monte Carlo's error still shrinks as 1/N1/\sqrt{N}1/N​ regardless of ddd. That's not a free lunch — σ\sigmaσ itself, the spread of the quantity you're averaging, can genuinely grow as the problem gets higher-dimensional and messier, so the constant in front of 1/N1/\sqrt{N}1/N​ isn't guaranteed to stay small. But the *rate* — the exponent on NNN — never picks up a dependence on ddd the way a grid's does. That single fact is why finance, pricing payoffs that depend on baskets of dozens of correlated assets, and physics, evaluating path integrals over infinitely many degrees of freedom, have no real alternative to sampling. Nothing else scales. A quant pricing an option on ten correlated stocks, or a physicist integrating over every possible path a particle could take, is not choosing Monte Carlo out of laziness — a grid over that many dimensions was never on the table to begin with.

Fig. 2 · Error vs sample count

101001k10ksamples n0.0010.010.11|estimate − π|
seed 42
seed 7
seed 1999
1/√n reference
Three independently seeded runs of the dart experiment, |estimate − π| plotted against sample count on log-log axes. Each run — chart colors distinguishing the three seeds — rattles around unevenly rather than dropping in a straight line; error is not a promise about any one run, only a statistical tendency. The dashed gray line is the 1/n1/\sqrt{n}1/n​ reference slope all three are converging toward: noisy individually, lawful in aggregate.

The quant's workhorse: simulating prices

The model quants reach for to describe a stock price's random wander is geometric Brownian motion (GBM): the price never goes negative, and its percentage moves, not its absolute moves, are what's roughly Gaussian. One simulation step looks like this:
St+Δt=St exp⁡ ⁣[(μ−σ22)Δt+σΔt  Z],Z∼N(0,1)S_{t+\Delta t} = S_t \, \exp\!\left[\left(\mu - \frac{\sigma^2}{2}\right)\Delta t + \sigma\sqrt{\Delta t}\; Z\right],\quad Z \sim \mathcal{N}(0,1)St+Δt​=St​exp[(μ−2σ2​)Δt+σΔt​Z],Z∼N(0,1)
Draw a fresh standard normal ZZZ at every step, apply the update, and you get one possible future for the price. Draw thousands of independent price paths this way and you get a whole fan of futures — which is exactly what a Monte Carlo option-pricing engine does, because most options that actually trade have no closed-form price. Anything path-dependent, or written on a basket of several assets at once, or exercisable at times a formula can't cleanly capture — simulate a large number of paths, evaluate the payoff at the end of each one, and average.

Honesty matters here: a real pricing desk does not simulate under the drift μ\muμ that historical data suggests the stock has — real-world drift turns out not to matter for a no-arbitrage price at all. It simulates under the *risk-neutral* measure, replacing μ\muμ with the risk-free rate, then discounts the average payoff back to today at that same rate. Risk-neutral drift plus discounting, together, is the actual recipe; either piece alone gives you the wrong number. That's a subtlety worth sitting with: the price a desk quotes does not depend on whether the trader thinks the stock is going up — it depends only on the volatility σ\sigmaσ, the risk-free rate, and the payoff's shape. Two traders with wildly different opinions about where the stock is headed still agree on the option's arbitrage-free price, because both of them are, correctly, simulating under the same risk-neutral drift.

Fig. 3 · 30 futures for one stock

020406080100120trading days8090100110120130140price
simulated paths
mean of 30 paths
start price
Thirty simulated GBM price paths for one stock (thin blue), all starting from the same price (dashed gray) and fanning apart as random shocks accumulate; their mean (orange) traces the average trajectory. This run uses a real-world drift purely to show the shape a fan of futures takes — a genuine pricing computation would swap in the risk-neutral drift and add the discounting step, but the mechanics are identical: simulate the paths, then average what you need across them.

Where the dice roll

Option desks price exotic derivatives this way and risk teams estimate Value at Risk by simulating thousands of portfolio scenarios. Actuaries reserve for insurance losses by simulating claim distributions instead of solving for them. Reliability engineers simulate component failure times to estimate a system's odds of surviving a mission. Every frame Pixar renders traces thousands of randomly sampled light paths per pixel to approximate the physics of how light actually bounces. Epidemiologists simulate outbreaks across a population instead of solving the underlying equations exactly. And Go and poker engines search their game trees by Monte Carlo tree search — playing out random continuations and counting who tends to win.
Two habits separate a Monte Carlo simulation you can trust from one you can't. First, seed it, and keep the seed. A simulation driven by a pseudo-random number generator seeded with a fixed value produces the exact same sequence of "random" numbers every time it runs, which turns an otherwise unrepeatable experiment into something you can debug, diff, and hand to a colleague who gets your exact numbers back. Second, know that the 1/N1/\sqrt{N}1/N​ rate is not the last word on cost — a family of variance reduction techniques exists specifically to shrink σ\sigmaσ itself: antithetic variates pair each random draw with its mirror image to cancel noise, control variates lean on a correlated quantity you already know the answer to, and quasi-random (low-discrepancy) sequences replace pure randomness with more evenly spread points. Each can cut the practical cost by a large constant factor. None of them changes the 1/N1/\sqrt{N}1/N​ exponent — that rate is structural, not a matter of cleverness.
1

Check your intuition

Question 1 of 4

You want one more decimal digit of accuracy from a Monte Carlo estimate. Roughly how many more samples?

Monte Carlo is what's left when an exact answer is out of reach but a sample isn't — trade the formula you can't write for a die you can roll a million times. If chasing that kind of intuition down to the arithmetic is your thing, solve a fresh math problem every morning with dailymath. One drop, one coffee, one win.

Try dailymath
Monte CarloProbabilitySimulationQuantFinanceLesson