# Transformation of standard normal into chi-squared

I am trying to compute the marginal pdf of transformed standard normals. I'm not sure if I have followed the method correctly. Any help would be most appreciated.

Let $$X_1, X_2 \sim \mathcal{N}(0,1)$$. And let $$Y_1 := X_1^2 + X_2^2$$ and $$Y_2 := X_2$$.

$$\sqrt{Y_1 - Y_2^2} = X_1 \qquad \text{ and } \qquad Y_2 = X_2$$ $$\implies J = \left | \begin{matrix} \frac{1}{2}(Y_1 - Y_2^2)^{-1/2} & -Y_2(Y_1-Y_2^2)^{-1/2} \\ 0 & 1 \end{matrix} \right | = (Y_1-Y_2^2)^{-1/2} - 0$$ $$= \frac{1}{\sqrt{(Y_1-Y_2^2)}}$$

$$\text{So, } \, \, f_{X_1,X_2}(x_1,x_2) = \left(\frac{1}{\sqrt{2 \pi}}\right)^2 e^{-X_1^2/2}e^{-X_2^2/2} \, = \, \frac{1}{2 \pi} e^{-(X_1^2 + X_2^2)/2} =|J|f_{X_1,X_2}(w_1(X_1), w_2(X_2))$$ $$\implies f_{Y_1, Y_2}(y_1,y_2) = \begin{cases} \frac{1}{2 \pi \sqrt{(Y_1-Y_2^2)}} e^{-Y_1/2}& \text{ for } -\sqrt{Y_1} < Y_2 < \sqrt{Y_1} \text{ and } 0 < Y_1 < \infty\\ 0 & \, \, \text{ elsewhere}\end{cases}$$

Is this the correct transformed joint pdf, or have I made a mistake somewhere?

$$\text{Now, } \, \, f_{Y_1}(y_1) =C \int_{-\sqrt{y_1} }^{\sqrt{y_1}} \frac{B}{\sqrt{1 - B^2 y_2^2}} \,dy_2 = C \sin^{-1}\left ( \frac{y_2}{\sqrt{y_1}}\right) \Bigr|_{-\sqrt{y_1}}^{\sqrt{y_1}} = C\left( \frac{\pi}{2} - \left( -\frac{\pi}{2}\right) \right) = C\pi$$ $$\text{Since, } \, \, y_2 := B^{-1}\sin{\theta} \implies \, dy_2 = B^{-1}\cos{\theta}\, d\theta$$

$$\text{And } \, \, \frac{B}{\sqrt{1 - B^2 y_2^2}} \, dy_2 = \frac{B}{B\sqrt{\cos^2{\theta}} }\cos{\theta}\, d\theta = \, d\theta$$

$$\therefore \qquad f_{Y_1}(y_1) =\frac{1}{2} e^{-y_1/2}$$ So, $$Y_1 \sim \chi^2(2)$$.

• The definition of a $\chi^2(d)$ distribution is that it's the one followed by the sum of squares of $d$ independent standard Normals.
– whuber
Feb 21 '21 at 23:05
• I'm aware that a sum of squares for $d$ i.i.d. normals will be a $\chi^2(d)$ distribution. I guess I'm just not sure about the transformation steps. Like should I be picking up an extra $1/2$ somewhere or doing something extra with the Jacobian since we're going from a distribution over $\mathbb{R}$ to $\mathbb{R}^{+}$? Feb 21 '21 at 23:52
• If you made such a mistake, it ought to show up in the final check: does your $f_{Y_1}$ integrate to unity?
– whuber
Feb 22 '21 at 0:09
• Fair point! Thanks. Feb 22 '21 at 0:12

Comment. A brief check with a simulation in R: With a sample of size one million the mean and variance of the sample should match the mean and variance of the chi-squared distribution with degrees of freedom $$\nu = 2$$ to one or two decimal places.

set.seed(2021)
x1 = rnorm(10^6);  x2 = rnorm(10^6)
y1 = x1^2 + x2^2
mean(y1);  var(y1)
[1] 2.002323   # aprx 2, consistent with CHISQ(2) mean
[1] 4.022933   # aprx 4, consistent with CHISQ(2) variance


A histogram of a sample of a million seems consistent with the density function (orange curve) of $$\mathsf{Chisq}(\nu = 2).$$

hdr = "Simulated Values of CHISQ(df = 2)"
hist(y1, prob=T, br=30, col="skyblue2", main=hdr)

• Granted, but $Y_2=X_2,$ so it seemed worthwhile to illustrate that $Y_1$ is chi-squared, as intended. One more indication OP's work is OK. Feb 23 '21 at 8:25