TITLE: Proof of the Box-Muller method
QUESTION [23 upvotes]: This is Exercise 2.2.2 from Achim Klenke: »Probability Theory — A Comprehensive Course«.

Exercise (Box–Muller method): Let $U$ and $V$ be independent random variables that are uniformly distributed on $[0,1]$. Define
  $$X := \sqrt{−2\log(U)}\, \cos(2\pi V) \quad \text{and} \quad Y := \sqrt{−2\log(U)}\, \sin(2\pi V)\, .$$
Show that $X$ and $Y$ are independent and $\mathcal{N}_{0,1}$-distributed.

Solution:
Define random variable $R:= \sqrt{-2\log(U)}$, then 
\begin{align*}
\mathbf{P}\bigl[R \leq r\bigr] & = \mathbf{P}\bigl[-2 \log(U) \leq r^2\bigr] = \\
& = \mathbf{P}\bigl[\log(U) \geq -\frac{r^2}{2}\bigr] = \\
& = 1 - \mathbf{P}\biggl[U < \exp\Bigl(-\frac{r^2}{2}\Bigr)\biggr]\, .
\end{align*}
$U$ is uniformly defined on $[0, 1]$, so the distribution of $R$ is $$\mathbf{P}[R\leq r] = 1 - \int_0^{\exp(-r^2/2)} \, dt = 1 - \exp\Bigl(-\frac{r^2}{2}\Bigr)\, .$$
For the density of $R$ we get: $f_R(t) = \exp\Bigl(-\frac{t^2}{2}\Bigr)\cdot t$ with $t> 0$.
We also define the random variable $\Phi := 2\pi V$. Since $V$ is uniformly distributed on $[0, 1]$, $f_\Phi(t) = \frac{1}{2\pi}$ with $0< t \leq 2\pi$. 
Since $U, V$ are independent, $R, \Phi$ must also be independent and $$f_{R, \Phi}(t_1, t_2) = f_R(t_1) f_\Phi(t_2) = \frac{1}{2 \pi} \exp\Bigl(-\frac{t_1^2}{2}\Bigr)\cdot t_1 \, .$$
With \begin{align*}
g\colon (0,\infty)\times(0, 2\pi] &\rightarrow \mathbb{R}^2 \\
(r, \phi) &\mapsto \bigl(r \cos(\phi), r \sin(\phi)\bigr)
\end{align*} we see that
$$(X, Y) = g(R, \Phi)\, ,$$ so we want to find the image measure
$$\mathbf{P}_{X, Y} = \mathbf{P}_{R, \Phi}\circ g^{-1}\, .$$
We use the transformation formula for densities:
$$ f_{X, Y}(\tau_1, \tau_2) = \frac{f_{R, \Phi}(g^{-1}(\tau_1, \tau_2))}{|\det(g'(g^{-1}(\tau_1, \tau_2)))|}$$
$g$ is just the transformation for polar coordinates. With
$$ t_1 = \sqrt{\tau_1^2 + \tau_2^2} = |\det(g'(g^{-1}(\tau_1, \tau_2)))|$$
we finally get
$$f_{X, Y}(\tau_1, \tau_2) = \frac{1}{2 \pi} \exp\Bigl(-\frac{\tau_1^2 + \tau_2^2}{2}\Bigr) = \underbrace{\frac{1}{\sqrt{2 \pi}} \exp\Bigl(-\frac{\tau_1^2}{2}\Bigr)}_{=f_X(\tau_1)} \cdot \underbrace{\frac{1}{\sqrt{2 \pi}} \exp\Bigl(-\frac{\tau_2^2}{2}\Bigr)}_{=f_Y(\tau_2)}\, ,$$
that is: $X, Y$ are $\mathcal{N}_{0, 1}$-distributed and independent. $\square$

Could you please check my proof?  I'm sorry that it's so long — it seems right to me, but I'm self-studying and really need to catch any eventual mistakes... 
Thank you!

REPLY [2 votes]: I would like to give some complimentary comments. It is less rigorous mathematically but might be more intuitive in the sense that it involves fewer formulae, which on some level also serves as a proof.
In principle, as Gaussian probability distribution is one-dimensional, one might wonder why one does not provide a generation mechanism with only one random variable (which, for instance, takes its value uniformly on the interval $[0, 1]$). This usually can be carried out by integrating the probability density. (In particular, it is not difficult to show, if the integral of the probability density $f(x)$ equals to $1$, namely, $\int dx f(x) = 1$, then the inverse of the function $y(x)=\int^x dx' f(x') $ provides precisely the desired distribution of $x$, when $y$ is drawn randomly from the interval $[0, 1]$.)
For the present case, the problem is that the related integral does not possess an analytic resulting expression. Therefore, unless you carry out the procedure by using a numerical integral, the above solution is somewhat cumbersome.
Now, an elegant solution is to realize, if one considers two independent variables $x$ and $y$, whose values both satisfy a Gaussian probability distribution. Furthermore, If one views the two variable as the coordinates in a Cartesian coordinate system, then the related variables in the polar coordinate1, namely $R$ and $\Theta$ satisfy a more convenient probability distribution. To be specific, these two variables are still independent ones2; moreover, $\Theta$ satisfies a uniform distribution, integrated to $2\pi$, while $R$ satisfies the distribution $f(R)=Re^{-\frac{R^2}{2}}$ which integrates to 1. 
Therefore, the significance of the coordinate transformation resides entirely in the fact that now we DO have an analytic expression for the integral $f(R)dR$, and the Box–Muller method can be viewed as a consequence of this convenience.
Hopefully, it helps to clarify, to a certain extent, the motivation of the method for someone who was also looking for an intuitive explanation like I. ^^


1. Here we use the capital letters for the consistency with the notations employed in other answers.


2. This is intuitive.