How does $Z = \sqrt{\left( \frac{X_1 - 0}{\sigma} \right)^2 + \left( \frac{X_2 - 0}{\sigma} \right)^2}$ imply that $Z$ has a Rayleigh distribution? I have two i.i.d. $N(0, \sigma^2)$ random variables $X_1$ and $X_2$. Let $Z = \sqrt{X_1^2 + X_2^2}$. I am told that $R$ follows the Rayleigh distribution.
The Rayleigh distribution has PDF
$$f_{\sigma}(x) = \dfrac{x}{\sigma^2} e^{-\dfrac{x^2}{2\sigma^2}},$$
where $x \ge 0$.
My understanding is that, since $X_1$ and $X_2$ are independent $N(0, \sigma^2)$ random variables, we have that
$$Z = \sqrt{\left( \dfrac{X_1 - 0}{\sigma} \right)^2 + \left( \dfrac{X_2 - 0}{\sigma} \right)^2}$$
It is then said that this means that $Z$ has a Rayleigh distribution. But how does $Z = \sqrt{\left( \dfrac{X_1 - 0}{\sigma} \right)^2 + \left( \dfrac{X_2 - 0}{\sigma} \right)^2}$ imply that $Z$ has a Rayleigh distribution? (That is, what is the reasoning here?) And, in particular, how does this imply that $Z$ has density $f_{\sigma}(x) = \dfrac{x}{\sigma^2} e^{-\dfrac{x^2}{2\sigma^2}}$, $x \ge 0$?
 A: $$
P(Z \leq z) = P(\sqrt{X_1^2 + X_2^2} \leq z) = \int\int_A f_{X_1}f_{X_2}dx_1dx_2
$$
Where $A$ is the area where $Z$ is smaller than $z$ (but larger than zero since it is positive). Noting that $Z$ is a radius and switching to polar coordinates gives
$X_1 = Z cos(\Theta)$ and $X_2 = Z \sin(\Theta)$ so
$$
P(Z \leq z) = \frac{1}{2 \pi \sigma^2}\int_{0}^{2 \pi}\int_{0}^z\ r e^{-\tfrac{r^2}{2\sigma^2}}\,dr\,d\theta = (1 - e^{-\tfrac{z^2}{2\sigma^2}}).
$$
And, $f_Z(z) = \tfrac{d}{dz}F_Z(z) = \frac{1}{\sigma^2}ze^{-\tfrac{z^2}{2\sigma^2}}$.
We used that $2\pi\sigma^2 f_{X_1}(x_1)f_{X_2}(x_2) = e^{-\tfrac{x_1^2 + x_2^2}{2\sigma^2}}$
and $x_1^2 + x_2^2 = r^2(\cos^2 + \sin^2) = r^2$. Also, when we change variables we multiply by the Jacobian which gives us the extra $\lvert r \rvert = r.$
The radius $r$ must be positive and we want to calculate the probability that it is smaller than $z$, this gives the interval $0, z$. The angle $\theta$ is not restricted at all so it is allowed to be in $0, 2\pi$.
Even though the normal distribution arises naturally in many situations these formulas provide a very intuitive motivation with explanation for both the constant $\pi$ and the parameters for the normal distribution: It is the 1-dimensional version of something with exponential decay.
