# Joint density calculation-Spot the error

Suppose $X_1$ and $X_2$ are i.i.d standard normal r.v.s and $Y=X_1^2+X_2^2$, then we know $Y \sim \chi_2^2$ and $f_Y(y)= \frac{1}{2}e^{\frac{-y}{2}}$. Using the identity $f_{X,Y}=f_{X\mid Y} \cdot f_Y$, we can calculate the joint density of $X=(X_1, X_2)$ and $Y$.

$f_{X\mid Y}(x\mid y)=f_X(x)=f_{X_1}(x_1)f_{X_2}(x_2)=\frac{1}{2\pi}e^{\frac{-y}{2}}$ if $x_1^2 +x_2^2 =y$ and zero otherwise. Finally we get $f_{X\mid Y}f_Y=\frac{1}{4\pi}e^{-y}$ if $x_1^2+x_2^2=y$ and zero otherwise. However this must not be the joint density because it does not integrate to one. Demonstration:

$$\int \int f_{X,Y} \,dx\,dy=\int_0^\infty\frac{e^{-y}}{4\pi}\int_{x_1^2+x_2^2=y} 1\,dx\, dy= \int_0^\infty\frac{e^{-y}}{4\pi}2\pi y^{\frac{1}{2}}\,dy=\frac{1}{2}\Gamma(\frac{3}{2})=\frac{\sqrt{\pi}}{4} \neq 1$$

What did I do wrong?

1. The equality $$\int_{x_1^2+x_2^2 =y}1 \, dx = 2\pi \sqrt{y}$$ is not correct. Note that you integrate with respect to the two-dimensional Lebesgue measure and that the (two-dimensional) Lebesgue measure of the set $\{x \in \mathbb{R}^2; x_1^2+x_2^2=y\}$ is $0$. Hence, $$\int_{x_1^2+x_2^2 =y}1 \, dx=0.$$ I just want to mention this, obviously, this doesn't answer your question.
2. You didn't calculate the conditional density $f_{X \mid Y}$ correctly and therefore you do not obtain the correct joint density. But since $Y=X_1^2+X_2^2$ is fully determined by $X=(X_1,X_2)$ we can calculate the joint distribution $\mu_{X,Y}$ of $(X,Y)$ directly: Recall that $\mu_{X,Y}$ is the distribution of $(X,Y)$ if, and only if, $$\mathbb{E}g(X,Y) = \int g(x,y) \, d\mu_{X,Y}(x,y)$$ for all $g$ such that $g(X,Y) \in L^1$. It follows from the definition and the image measure theorem that $$\mathbb{E}g(X,Y) = \mathbb{E}(X,X_1^2+X_2^2) = \int g((x_1,x_2),x_1^2+x_2^2) \, d\mu_{X_1,X_2}(x_1,x_2).$$ Now we can rewrite the last expression using the Dirac measure $\delta_{x_1^2+x_2^2}$ concentrated at $x_1^2+x_2^2$: $$\mathbb{E}g(X,Y) = \int \int g((x_1,x_2),y) \delta_{x_1^2+x_2^2}(y) \, d\mu_{X_1,X_2}(x_1,x_2).$$ Finally, we can use that the joint distribution $\mu_{X_1,X_2}$ equals -by the independence- the product of the marginals, i.e. $$\mathbb{E}g(X,Y) = \int \int \int g((x_1,x_2),y) \delta_{x_1^2+x_2^2}(y) \, f_{X_1}(x_1) f_{X_2}(x_2) \, dx_1 \, dx_2.$$ Consequently, $$d\mu_{X,Y}(x,y) = \delta_{x_1^2+x_2^2}(y) \, f_{X_1}(x_1) f_{X_2}(x_2) \, dx_1 \, dx_2.$$
• @Patrick In exactly the same way as in the example above. Show that $$\mathbb{E}g(X,Y) = \int g((x_1,x_2),y) \underbrace{f_{X_1,X_2}(x_1,x_2)}_{f_{X_1}(x_1) f_{X_2}(x_2)} \, \delta_{x_1^2+x_2^2}(dy) \, dx_1 \, dx_2$$ holds for any integrable function $g$. – saz Sep 27 '14 at 17:11