# Obtaining the variance of $X$, given the joint probability density of $x$ and $y$

Let the joint distribution of $x$ and $y$ has been given as:

$f(x,y)=\frac{e^{\frac{-y^2}{2}}}{y \sqrt{2\pi}}$ where $0\leq|x|\leq y \ <\infty$. It is required to obtain the mean and variance of the random variable $X$.

Although, I have solved these types of problems but in this one I am having trouble beacuse the expression which is coming out while obtaining the marginal density is not in nice and analytic for. Please help me with the problem. Thanks in advance.

You have probably figured this out by now.

In any case, the joint density factors as $$f(x,y)=\underbrace{\frac1{2y}\mathbf1_{|x|0}}_{f_Y(y)}$$

So $$X$$ conditioned on $$Y=y$$ is uniform on $$(-y,y)$$ for $$y>0$$ and $$Y$$ itself has a folded normal distribution. This is enough information to find mean and variance of $$X$$ using the law of total expectation/variance.

It seems kind of hard. I tried this:

Using u-substitution, let $t = \frac{y^2}{2}$ and change the bound,

$$f(x) = \int_{|x|}^\infty \frac{e^{-\frac{y^2}{2}}}{\sqrt{2\pi}y} dy = \int_{\frac{x^2}{2}}^\infty \frac{e^{-t}}{2t \sqrt{2\pi}}dt$$

I checked the integral calculator and it seems that there is no definite integral too, but the result is the incomplete Gamma.