# Random variable as source of variance for a second random variable?

I am trying to obtain the pdf of a random variable with a Gaussian distribution $$X \sim \mathcal{N}(0, A)$$, whose variance A is determined by another random variable A with an exponential distribution with $$\lambda=1$$.

So the process would be the following:

1. Obtain a particular value $$a$$ from random variable $$A$$
2. Obtain a particular value $$x$$ from random variable $$X$$ with variance $$a$$

I have found that the correct pdf for random variable X is:

$$\frac{1}{\sqrt{2}}\exp\left(-\sqrt{2}|x|\right)$$

And I have also checked that this formula is correct doing a simulation. But, how can I compute this pdf analitically?

Simulated histogram + plotted pdf

Thanks!

• Your question is not clear to me. It looks like you've already found the analytical solution, which is $\exp\left(-\sqrt{2}|x|\right)/\sqrt{2}$. – Wood May 13 at 22:31
• I have found the final solution and checked that indeed it is correct, but I would like to know how to derive this pdf by myself. – Iyán May 13 at 22:34

Given $$A$$, $$X$$ has same distribution as $$\sqrt A Z$$ where $$Z$$ has standard normal distribution. So the coniditional density of $$X$$ is $$\frac 1 {\sqrt A} \phi (\frac x {\sqrt A})$$ where $$\phi$$ is the standard normal density. Finally the density of $$X$$ is $$\int_0^{\infty} \frac 1 {\sqrt a} \phi (\frac x {\sqrt a})e^{-a}da$$. I will let you carry out this integration.
• Thanks for your answer Kavi! Just one small additional question: why is $\frac{1}{\sqrt{A}}\Phi\left(\frac{x}{\sqrt{A}}\right)$ instead of $\frac{1}{A}\Phi\left(\frac{x}{A}\right)$, since A is the variance? – Iyán May 14 at 10:14
• The density of $tX$ is $\frac 1 t f_X(\frac x t)$. Note that $\frac 1 A \Phi(\frac x {\sqrt A})$ does not even inetgrate to $1$ so it is not a density funtion. – Kabo Murphy May 14 at 10:19