Inverse of the transform in the Box-Muller transform

386 Views Asked by At

I am following this writeup of the Box-Muller method but I am confused how they derived the inverse. In this method, they write

Box-Muller Algorithm is a classic method to generate identical and independent standard normal random variables. Box-Muller Algorithm

  1. Generate $U_{1} \sim$ uniform $(0,1)$ and $U_{2} \sim$ uniform $(0,1)$ where $U_{1} \perp U_{2}$
  2. Set $R=\sqrt{-2 \log \left(U_{1}\right)}$ and $\theta=2 \pi U_{2}$
  3. Set $X=R \cos (\theta)$ and $Y=R \sin (\theta)$ Overall, $$ \begin{aligned} &X=\sqrt{-2 \log U_{1}} \cos \left(2 \pi U_{2}\right) \ &Y=\sqrt{-2 \log U_{1}} \sin \left(2 \pi U_{2}\right) \end{aligned}

This can be verified by solving $U_{1}$ and $U_{2}$,

\begin{aligned} &U_{1}=e^{-\left(X^{2}+Y^{2}\right) / 2} \ &U_{2}=\frac{1}{2 \pi} \arctan \left(\frac{X}{Y}\right) \end{aligned}

I am trying to understand how exactly the inverse of $X=\sqrt{-2 \log U_{1}} \cos \left(2 \pi U_{2}\right)$ and $Y=\sqrt{-2 \log U_{1}} \sin \left(2 \pi U_{2}\right)$ was computed, i.e.

$$ \begin{aligned} &U_{1}=e^{-\left(X^{2}+Y^{2}\right) / 2} \\ &U_{2}=\frac{1}{2 \pi} \arctan \left(\frac{X}{Y}\right) \end{aligned} $$

Looking at these formulas, I can't directly compute it so I'm not sure how they came up with their result.