10.4 Simulating the Normal Distribution
Result 10.4.1 (Box–Muller). If \(U_1\) and \(U_2\) are independent UNIF\((0,1)\) variables, then \[Z_1 = \sqrt {-2\log U_1}\,\cos \left (2\pi U_2\right ),\qquad Z_2 = \sqrt {-2\log U_1}\,\sin \left (2\pi U_2\right )\] are independent \(N(0,1)\) variables.
Proof. Work backwards from the polar form. If \(Z_1,Z_2\) are independent standard normals, their joint density is \[\frac {1}{2\pi }e^{-\frac 12\left (z_1^{2}+z_2^{2}\right )} .\] Putting \(z_1 = r\cos \theta \), \(z_2 = r\sin \theta \) with Jacobian \(r\), the joint density of \((R,\Theta )\) is \[\frac {1}{2\pi }\,r\,e^{-r^{2}/2},\qquad r>0,\ 0<\theta <2\pi ,\] which factorises: \(\Theta \) is uniform on \((0,2\pi )\) and \(R\) has density \(re^{-r^{2}/2}\). Hence \(R^{2}\) has density \(\tfrac 12e^{-s/2}\), that is \(R^{2}\sim \) EXP\(\left (\tfrac 12\right )\), and by the inverse transform \(R^{2} = -2\log U_1\). Setting \(\Theta = 2\pi U_2\) completes the construction. □
Note. Box–Muller produces two independent normals from two uniforms, which is efficient, and it needs no inverse of the normal distribution function — sidestepping exactly the obstacle noted above. The alternative in wide use is to sum twelve uniforms and subtract six, which by the central limit theorem is approximately \(N(0,1)\); it is quicker to write but wrong in the tails, since the result is confined to \([-6,6]\), and it should not be used where extreme values matter.
Questions on this section
Stuck on something here? Ask below and it stays attached to this topic.