Calculating a multivariate probability density - how to invert the function? This is an example from a lecture, however it was presented without proof, so I'm trying to find a way to calculate the PDF for the given condition:
$X_1$ and $X_2$ are two independent random variables with an uniform distribution on $(0,1)$.
For the random variables: $(Z_1, Z_2) := \sqrt{-2 \ln X_1} (\cos 2\pi X_2, \sin 2\pi X_2)$ calculate the PDF.
My reasoning is as follows:


*

*Use the formula for $Z = Z(X)$: $\;\rho_Z(\mathbf{z}) = \rho_X[\mathbf{x}(\mathbf{z})] \cdot
\left| \frac{ \partial \mathbf{x} }{ \partial \mathbf{z} } \right|$

*I can calculate the Jacobian:
$$\frac{\partial (Z_1, Z_2)}{\partial (X_1, X_2)} =
\begin{vmatrix}
-\frac{\cos (2 \pi X_2)}{\sqrt{2} X_1 \sqrt{-\ln{X_1}}} &
-\frac{\sin (2 \pi X_2)}{\sqrt{2} X_1 \sqrt{-\ln X_1 }} \\
-2 \sqrt{2} \pi \sqrt{-\ln X_1} \sin(2 \pi X_2) &
2 \sqrt{2} \pi \cos (2 \pi X_2) \sqrt{-\ln X_1}
\end{vmatrix}
$$

*and then the inverse:
$$\frac{\partial (X_1, X_2)}{\partial (Z_1, Z_2)} =
\begin{vmatrix}
-\sqrt{2} X_1 \cos (2 \pi X_2) \sqrt{- \ln X_1} &
-\frac{\sin (2 \pi X_2)}{2 \sqrt{2} \pi \sqrt{- \ln X_1}} \\
-\sqrt{2} X_1 \sqrt{-\ln{X_1} \sin (2 \pi X_2)} &
\frac{\cos (2 \pi X_2)}{2 \sqrt{2} \pi \sqrt{- \ln X_1}}
\end{vmatrix}
$$


*

*Then multiply the inverse Jacobian by $\rho_{(X_1, X_2)}(x_1,x_2)$ to get:
$$
\begin{pmatrix}
X_1 \left(1 + \cos (4 \pi X_2) \right) \ln X_1 -
\frac{ \sin^2 (2 \pi x_2) }{2 \pi} &
\frac{ (1 + 4 \pi X_1 \ln X_1) \sin (4 \pi X_2) }{ 4 \pi}
\end{pmatrix}
$$


But how can I obtain the relation this inverse relation $(X_1(Z_1, Z_2), X_2(Z_1, Z_2))$?
Am I suppose to calculate this PDF by different means?
All my calculation are from Mathematica. Thanks for any suggestions!
 A: This is called the Box–Muller transform.
You're dealing with polar coordinates.  Notice that if you draw the ray from $(0,0)$ to $(Z_1,Z_2)$, and look at the angle from the positive ray on the $Z_1$-axis to the former ray, it is $2\pi X_2$ radians.  Since $2\pi X_2$ is uniformly distributed on the interval from $0$ to $2\pi$, that means the probability distribution of $Z_1,Z_2$ is invariant under rotations centered at $(0,0)$.
And
$$
Z_1^2+Z_2^2 = -2\ln X_1.
$$
So for $z\ge 0$ we have
$$
\Pr(Z_2^2+Z_2^2>z) = \Pr(-2\ln X_1>z) = \Pr(X_1 < e^{-z/2}) = e^{-z/2},
$$
so the distribution of the square of the distance from the origin is exponential with expected value $2$.
If two probability distributions in the plane are both invariant under rotations centered at the origin, and both have the same distribution of distance from the origin, then they're the same distribution.
Now recall that if $W_1,W_2 \sim N(0,1)$ and are independent, then the bivariate normal distribution of $(W_1,W_2)$ is invariant under rotations centered at $(0,0)$, the the chi-square distribution of $W_1^2+W_2^2$ is an exponential distribution with expected value $2$.
That tells you $Z_1,Z_2$ are independent and each has a standard normal distribution.
Thus the Box–Muller transform is used for generating i.i.d. normals.
This is not entirely "from scratch" since I've invited you to recall some things about bivariate normal and chi-square distributions.  Maybe I'll post some details of a more concrete approach later . . . . . . .
