Box Muller Transformation
- Converts two uniform(0,1) random numbers into two normally distributed random numbers.
- Simple to implement and commonly used in statistical and mathematical applications where normal samples are needed.
- Works with uniformly generated inputs (e.g., from a linear congruential generator) to produce outputs with mean 0 and standard deviation 1 in the example shown.
Definition
Section titled “Definition”The Box-Muller Transformation is a method used to generate normally distributed random numbers by transforming two uniformly distributed random numbers into two normally distributed random numbers.
The transformation uses the following equations:
where ln is the natural logarithm and π is the mathematical constant.
Explanation
Section titled “Explanation”- Start with two uniformly distributed random numbers, typically in the interval (0, 1). These can be produced by a uniform random number generator such as a linear congruential generator (which uses a seed, multiplies by a constant, adds another constant, and takes the remainder after dividing by a modulus to produce a sequence).
- The Box-Muller Transformation maps the pair of uniform samples (x, y) to a pair of normally distributed values (z1, z2) using the two equations above.
- The transformation is based on the source statement that “the sum of two independent uniformly distributed random variables has a normal distribution” and leverages trigonometric functions with a radial transform to produce normally distributed outputs.
- The method is simple to implement and can be integrated into statistical and mathematical applications that require normally distributed random samples.
Examples
Section titled “Examples”Example with x = 0.5 and y = 0.5
Section titled “Example with x = 0.5 and y = 0.5”Using x = 0.5 and y = 0.5 and the equations above:
Thus the two normally distributed random numbers obtained are -0.73 and 0, with a mean of 0 and a standard deviation of 1 in this example.
Use cases
Section titled “Use cases”- Generating normally distributed random numbers for statistical and mathematical applications.
- Applicable when many real-world phenomena that are modeled follow a normal distribution.
Related terms
Section titled “Related terms”- Linear congruential generator
- Uniform distribution
- Normal distribution