Lably
Skip to content

Box–Muller transform

Statistical transform

  • 11 min read
  • 5 chapters

Related on Lably

Through Mathematics, Independence (probability theory) and Normal distribution

The Box–Muller transform is commonly expressed in two forms. The basic form as given by Box and Muller takes two samples from the uniform distribution on the interval (0,1) and maps them to two standard, normally distributed samples. The polar form takes two samples from a different interval, [−1,1], and maps them to two normally distributed samples without the use of sine or cosine functions.

The Box–Muller transform was developed as a more computationally efficient alternative to the inverse transform sampling method. The ziggurat algorithm gives a more efficient method for scalar processors (e.g. old CPUs), while the Box–Muller transform is superior for processors with vector units (e.g. GPUs or modern CPUs).

Basic form

Suppose U1 and U2 are independent samples chosen from the uniform distribution on the unit interval (0,1). Set

Z0=−2ln⁡U1cos⁡(2πU2)=Rcos⁡(Θ)

and

Z1=−2ln⁡U1sin⁡(2πU2)=Rsin⁡(Θ).

Then Z0 and Z1 are independent random variables with a standard normal distribution.

The derivation is based on a property of a two-dimensional Cartesian system, where X and Y coordinates are described by two independent and normally distributed random variables, the random variables for R2 and Θ (shown above) in the corresponding polar coordinates are also independent and can be expressed as R2=−2⋅ln⁡U1 and Θ=2πU2.

Because R2 is the square of the norm of the standard bivariate normal variable (X, Y), it has the chi-squared distribution with two degrees of freedom. In the special case of two degrees of freedom, the chi-squared distribution coincides with the exponential distribution, and the equation for R2 above is a simple way of generating the required exponential variate.

Sign in to keep reading

4 more chapters are free with a Lably account.

More in Topics in mathematics