= Solution
Draw independent $U_1,U_2$ uniformly on $(0,1)$, and set
$$
R=\sqrt{-2\log U_1},\qquad\Theta=2\pi U_2,
$$
$$
\boxed{X_1=R\cos\Theta,\qquad X_2=R\sin\Theta.}
$$
This is the <Box-Muller transform>. The endpoint $U_1=0$ has probability zero; an implementation should avoid evaluating its logarithm.
For $r\geq0$, $P(R\leq r)=1-e^{-r^2/2}$, so $R$ has density $re^{-r^2/2}$. It is independent of the angle, which has a <uniform distribution> on $[0,2\pi)$, and their joint density is $(2\pi)^{-1}re^{-r^2/2}$. Transforming to Cartesian coordinates divides by the polar-coordinate Jacobian $r$, yielding
$$
f_{X_1,X_2}(x_1,x_2)=\frac1{2\pi}e^{-(x_1^2+x_2^2)/2}=\varphi(x_1)\varphi(x_2).
$$
Thus the outputs are <independent random variables> with the <standard normal distribution>, proving the algorithm.
Back to article page