Past exam of the mathematics course of the University of Cambridge 2001 iii Paper 23 4 b Solution Created 2026-10-03 Updated 2026-10-14
One method applies inverse transform sampling to the standard normal cumulative distribution function: , followed by for mean and standard deviation . Numerical approximations to are needed, and the endpoints must be avoided.
A convenient alternative is the Box-Muller transform. From independent uniforms setThe radial probability density function is for , and the angle is independently uniform on . Dividing their joint density by the polar-coordinate Jacobian determinant givesThus the outputs are independent standard normal distribution draws. Apply to obtain other normal means and variances. With finite pseudorandom number generators, this is an approximation to the ideal independent-uniform model; poor dependence in the input stream is not cured by the transform.
Past exam of the mathematics course of the University of Cambridge 2004 iii Paper 35 4 b Solution Created 2026-10-03 Updated 2026-10-14
One route is inverse transform sampling: if is the standard normal cumulative distribution function, then has the normal distribution with mean and variance .
Alternatively the Box-Muller transform uses two independent uniform inputs :To verify this, set and . The radial density is for , and the angle is independent and uniform. Their joint density is . Changing to Cartesian coordinates divides by the Jacobian determinant , givingThis factors into two standard normal densities, proving both normality and independence. Then provides the required means and variances. Implementations must avoid the zero input to the logarithm; ideal continuous uniforms hit it with probability zero.
Past exam of the mathematics course of the University of Cambridge 2005 ia Paper 2 11F Solution Created 2026-09-24 Updated 2026-10-14
All the following distributions are conditional on the point lying in the unit disk. Initially the joint probability density of is on the square. The disk has area , so the conditioning event has probability . Dividing by this probability gives the constant conditional density on the disk, proving its uniform distribution there.
The polar coordinates have Jacobian determinant . ConsequentlyIntegrating the joint probability density gives and . Since the joint density equals the product of these marginal densities on a product support, and are independent. In particular has the uniform distribution on .
The second change of variables preserves the angle and changes the radius toThe event has probability zero, so arbitrary definitions at that point have no effect on the distribution. For , monotonicity of the logarithm givesSince is a function of , it remains independent of the uniform angle. Hence the new joint probability density isFinally, has polar Jacobian determinant . Dividing the preceding density by gives the Cartesian joint probability densityThis factors into two standard normal distribution densities on . Thus and are independent, each with mean zero and variance one. This derivation is the radial form of the Box-Muller transform.
Past exam of the mathematics course of the University of Cambridge 2008 iii Paper 47 3 b ii Solution Created 2026-10-03 Updated 2026-10-14
The first algorithm uses independent normal distributions: generate with law and returnFor example, the Box-Muller transform generates two such normal variates from independent uniforms:To verify this, has density and is an independent uniform angle. Converting the resulting polar density to Cartesian coordinates gives , which factors into two independent normal distributions. Independent pairs therefore give the required sum, discarding a spare coordinate when is odd. Its moment-generating function is , that of the chi-squared distribution.
A genuinely different algorithm uses exponential-envelope rejection sampling for a chi-squared variable. Put . The target and proposal probability density functions areFor , differentiating gives , so the maximum is at . The envelope constant and normalized density ratio areThey remain valid at , where and . Repeatedly draw fresh independent , put , and accept whenThe right side is nonpositive by , so this is a legitimate acceptance probability. The joint probability of proposing and accepting in is ; conditional on acceptance the density is exactly . This proves the rejection sampling algorithm, rather than only identifying the target law.
For I prefer the second method: it reduces to a single exponential draw with no rejection. The first method is simple and attractive when normal draws are already available or is small. For larger , the second method avoids generating normals: its acceptance probability is , asymptotic to by Stirling's formula. Its expected number of proposals grows like , rather than the linear number of normal draws in the first method. Both are exact ideal-uniform algorithms; actual runtime also depends on the implementation.
Past exam of the mathematics course of the University of Cambridge 2013 iii Paper 29 3 Solution Created 2026-10-03 Updated 2026-10-07
For the Box-Muller transform, draw independent from the uniform distribution on and setThe radial density is for , with an independent uniform angle. The polar-to-Cartesian Jacobian determinant is , so the joint density of isThis factorization proves that both outputs have the standard normal distribution and are independent. Repeating the Box-Muller transform with fresh independent uniform pairs gives independent normal outputs; discard one extra output if the desired sample size is odd.
For the prescribed binary probabilities, generate independent standard normal values in this way and useThe standard normal distribution function gives , and independence is preserved because each threshold uses a different independent normal value.
For the probit regression posterior, introduce latent variablesGiven , these are independent variables, and normal symmetry gives . Thus this data augmentation has exactly the observed binary likelihood. With the specified normal prior distribution, the augmented joint posterior is proportional toThe latent-normal Gibbs sampler for probit regression alternates two blocks. First, given the current , draw each independently from its truncated normal distribution, namely restricted to the sign fixed by . One exact method is to use the Box-Muller transform for , form , and reject until the sign is correct. The probability of success is positive at every finite parameter value, so the method is valid, although it can be slow for a rare sign.
For direct sign-truncated normal sampling, let , and draw . An inverse transform sampling implementation isUse suitable tail or survival-function evaluations when floating-point probabilities approach zero or one; the rejection construction remains a valid alternative.
Second, completing the square in yields its full conditional distribution:Generate a fresh standard normal value by the Box-Muller transform, multiply by the conditional standard deviation, and add the conditional mean. Start from any finite , alternate these steps, discard an initial transient and use the retained values to approximate its posterior distribution. These are dependent Markov chain Monte Carlo samples, rather than independent posterior draws. Each block is an exact Gibbs sampling update for the augmented posterior, whose marginal in is the requested posterior.
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.