Solution

ID: past-exam-of-the-mathematics-course-of-the-university-of-cambridge/2004/iii/paper-35/4/b/solution

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 , giving
This 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.

New to topics? Read the docs here!