The Box-Muller Transform
A trick for turning two ordinary, easy-to-generate uniform random numbers into two independent, exactly normally distributed random numbers, without needing to invert the normal CDF.
Computers generate uniform random numbers easily (any value equally likely between 0 and 1), but simulations — pricing an option, running a Monte Carlo risk model — need normally distributed random numbers instead. The normal distribution's cumulative distribution function has no simple closed-form inverse, so directly transforming a uniform draw into a normal one isn't straightforward. The Box-Muller transform sidesteps this by using two uniform draws at once and a bit of trigonometry to produce two independent standard normal draws exactly, with no approximation.
Given two independent uniform random numbers on , the transform computes
and are exactly independent, standard normal random variables. The term generates a random radius and the term generates a random angle, so geometrically the pair is just a uniformly random angle at a radius drawn from the right distribution — which works out, after the math, to be exactly bivariate normal.
A worked example
Draw and . Then , and , so and . This gives and — two standard normal draws obtained from nothing more than two uniform numbers and a square root, log, and pair of trig functions.
The Box-Muller transform converts two independent uniform random draws into two independent standard normal draws exactly, using a random-radius, random-angle geometric trick that avoids ever inverting the normal distribution's CDF.
Related concepts
Practice in interviews
Further reading
- Box & Muller, A Note on the Generation of Random Normal Deviates (1958)