Past exam of the mathematics course of the University of Cambridge 2014 iii Paper 36 3 a Solution Created 2026-10-03 Updated 2026-10-06
Generate independent and use the Box-Muller transformFor , , so its density is on . The angle is uniform on and independent of . Dividing the joint radial-angular density by the polar-coordinate Jacobian givesThus both outputs are independent and have the standard normal distribution. Independent pairs of uniforms give further independent normal observations. The null event is excluded in implementation so the logarithm is finite.
Past exam of the mathematics course of the University of Cambridge 2015 iii Paper 37 4 c iii Solution Created 2026-10-03 Updated 2026-10-06
Recognize the integrand as a Gaussian scale mixture. If has the unit Rayleigh distribution and is an independent standard normal distribution variable, then the conditional density of given is . Multiplying by the radius density givesThus use for the independent radius and for the normal output of the Box-Muller transform:The mixture argument also proves that integrates to one, by the Tonelli theorem. As a check, is exponential of rate , so the characteristic function of is . This is the Rayleigh-normal scale mixture, with Laplace distribution density .
Past exam of the mathematics course of the University of Cambridge 2015 iii Paper 37 4 c ii Solution Created 2026-10-03 Updated 2026-10-06
The Box-Muller transform uses independent uniforms to setThe radius has the unit Rayleigh distribution, with density for , and the angle is independently uniform on . Their joint density is . The Cartesian change of variables has absolute Jacobian determinant , so the joint density of isThe factorization proves that the outputs are independent random variables, each with a standard normal distribution.
Past exam of the mathematics course of the University of Cambridge 2016 iii Paper 208 4 a Solution Created 2026-10-03 Updated 2026-10-06
Draw independent uniformly on , and setThis is the Box-Muller transform. The endpoint has probability zero; an implementation should avoid evaluating its logarithm.
For , , so has density . It is independent of the angle, which has a uniform distribution on , and their joint density is . Transforming to Cartesian coordinates divides by the polar-coordinate Jacobian , yieldingThus the outputs are independent random variables with the standard normal distribution, proving the algorithm.