# Change of variables technique to show that for iid standard normals $X_1,X_2$, $Y_1 = X_1^2 + X_2^2$ has a $\chi^2(2)$ distribution

Suppose $X_1$ and $X_2$ are iid with a common standard normal distribution. Find the joint pdf of $Y_1 = X_1^2 + X_2^2$ and $Y_2=X_2$ and the marginal pdf of $Y_1$.

It's easy to see that $Y_1$ has a $\chi^2(2)$ distribution, but this problem asks to show it using change of variables technique. Here, I can find the Jacobian $\partial(x_1,x_2) / \partial(y_1,y_2) = \frac{1}{2x_1}$, where $x_1^2 = y_1 - y_2^2$. Hence we must have

$$f_{Y_1,Y_2}(y_1,y_2) = \frac{1}{2x_1} \frac{1}{2\pi} e^{-y_1^2}.$$

However, in this case we have $x_1 = \pm \sqrt{y_1 - y_2^2}$. How can we integrate $y_2$ out from this pdf to get the marginal pdf of $Y_1$?

• If $X_1,X_2\sim\operatorname{{i.}{i.}{d.}} N(0,1),$ then $X_1^2+X_2^2 \sim \chi^2_2,$ not $\chi^2_1. \qquad$ Commented Aug 5, 2018 at 15:28
• @MichaelHardy Thanks that was my mistake. Commented Aug 5, 2018 at 15:29
• When the transformation is not injective (in your post you noted that there are two values of $x_1$ to consider), you need to add up all the cases separately. Also, you forgot to take the absolute value of your Jacobian determinant. \begin{align}f_{Y_1, Y_2}(y_1, y_2) = f_{X_1, X_2}(\sqrt{y_1 - y_2^2}, y_2) \cdot \frac{1}{2 \sqrt{y_1 - y_2^2}} + f_{X_1, X_2}(-\sqrt{y_1 - y_2^2}, y_2) \cdot \frac{1}{2 \sqrt{y_1 - y_2^2}} = \frac{1}{\sqrt{y_1 - y_2^2}} \frac{1}{2 \pi} e^{-y_1/2} \end{align} But this is not integrable with respect to $y_2$, so I must have made a mistake somewhere... Commented Aug 5, 2018 at 15:53
• Ah, I see from StubbronAtom's answer below that I should have integrated over $y_2$ in $[-\sqrt{y_1}, \sqrt{y_1}]$ rather than over all real numbers. Commented Aug 5, 2018 at 15:59
• If the purpose was to find the distribution of $X_1^2+X_2^2$ using change of variables, I would have proposed the one-to-one polar transformation $(x_1,x_2)\to(r,\theta)$ such that $x_1=r\cos\theta$ and $x_2=r\sin\theta$. Commented Aug 5, 2018 at 16:36

Joint density of $(X_1,X_2)$ is $$f_{X_1,X_2}(x_1,x_2)=\frac{1}{2\pi}e^{-\frac{1}{2}(x_1^2+x_2^2)}\quad,(x_1,x_2)\in\mathbb R^2$$

We change variables $(X_1,X_2)\to(Y_1,Y_2)$ such that $Y_1=X_1^2+X_2^2$ and $Y_2=X_2$.

The inverse solutions of the transform are

$$x_1=\begin{cases}\sqrt{y_1-y_2^2}&,\text{ if }x_1\ge0\\-\sqrt{y_1-y_2^2}&,\text{ if }x_1<0\end{cases}\qquad\text{ and }\quad x_2=y_2$$

We have, $(x_1,x_2)\in\mathbb R^2\implies y_1\ge0\,,y_2\in\mathbb R$.

But for $x_1$ to be defined, $y_1-y_2^2\ge0\implies -\sqrt{y_1}\le y_2\le \sqrt{y_1}$.

So the joint support of $(Y_1,Y_2)$ is $$S=\{(y_1,y_2):y_1\ge0\,,\, -\sqrt{y_1}\le y_2\le\sqrt{y_1}\}$$

Clearly, this is not a one-to-one transformation.

Jacobian of the transformation is given by

$$J_1=\det J\left(\frac{x_1,x_2}{y_2,y_2}\right)=\frac{1}{2\sqrt{y_1-y_2^2}}\quad\text{ if }x_1\ge0$$

and $$J_2=\frac{-1}{2\sqrt{y_1-y_2^2}}\quad\text{ if }x_1<0$$

Hence joint density of $(Y_1,Y_2)$ is

\begin{align} f_{Y_1,Y_2}(y_1,y_2)&=\frac{1}{2\pi}e^{-y_1/2}|J_1|\mathbf1_S+\frac{1}{2\pi}e^{-y_1/2}|J_2|\mathbf1_S \\&=2\times\frac{1}{2\pi}e^{-y_1/2}\frac{1}{2\sqrt{y_1-y_2^2}}\mathbf1_S \\&=\frac{1}{2\pi}e^{-y_1/2}\frac{1}{\sqrt{y_1-y_2^2}}\mathbf1_S \end{align}

For $y_1\ge 0$, marginal pdf of $Y_1$ is thus

\begin{align} f_{Y_1}(y_1)&=\int_{-\sqrt {y_1}}^{\sqrt {y_1}}f_{Y_1,Y_2}(y_1,v)\,dv \\&=\frac{e^{-y_1/2}}{2\pi}\sin^{-1}\left(\frac{v}{\sqrt{y_1}}\right)\big|_{-\sqrt {y_1}}^{\sqrt {y_1}} \\&=\frac{1}{2}e^{-y_1/2} \end{align}

That is, $$f_{Y_1}(y_1)=\frac{1}{2}e^{-y_1/2}\mathbf1_{y_1\ge 0}$$

So we have shown that $Y_1\sim\text{Exp}$ with mean $2$ or simply, $Y_1\sim\chi^2_2$.