How to find joint distribution of two variables given their conditional distribution? As the title says, I am wondering how to find the joint distribution of two variables when only given the conditional distribution. 

An example problem is,  Suppose, $Y$ given $X = x$ follows Exponential($1/x$): $f_{Y \mid X}(y\mid X = x) ~=~ (1/x)e^{-(y/x)}$ iff $y > 0$ and $X$ follows Exponential(1) distribution. Find joint distribution of $Y$ and $X$. 

I know the joint distribution of two variables is equal to the conditional distribution multiplied by the marginal distribution of the 'given' variable, but I am not sure how to find the marginals from the information given. 


*

*Is the marginal of $X$ equal to the probability density function of an Exponential(1) distribution?

*Also, how can I find the variance of $Y$? 

*Would I just use moment generating functions to solve for the variance of Y? 
 A: The joint distribution is simply: $f_{Y,X}(y, x) ~{=~ f_{Y\mid X}(y\mid x)\cdot f_X(x)\\=~ \tfrac 1x \mathsf e^{-y/x}\mathbf 1_{0\leqslant y} \cdot \mathsf e^{-x} \mathbf 1_{0\leqslant x} \\ = \tfrac 1x\mathsf e^{-x-y/x}~\mathbf 1_{0\leqslant y, 0\leqslant x} }$
That is all.   You know $f_X(x)=\mathsf e^{-x}\mathbf 1_{0\leqslant x}$ because you were told that $X\sim\mathcal{Exp}(1)$ .   Everything else is just the definition of conditional probability density function (for jointly continuous random variables).

Don't try to find the marginal pdf for $Y$; it looks unlikely to be expressable in terms of elementary functions.

The variance for $Y$ is easiest found via the Law of Total Variance: $$\mathsf{Var}(Y)~=~\mathsf E(\mathsf {Var}(Y\mid X))+\mathsf{Var}(\mathsf E(Y\mid X))$$
Since $Y\mid X\sim\mathcal{Exp}(1/X)$ we know $\mathsf{E}(Y\mid X)=X, \mathsf {Var}(Y\mid X)=X^2$, and since $X\sim\mathcal{Exp}(1)$ we know $\mathsf E(X)=1$ and $\mathsf {E}(X^2) = \mathsf{Var}(X)+\mathsf E(X)^2 = 2$.  Put it together.

Otherwise use $\mathsf{Var}(Y) =\int_0^\infty \int_0^\infty y^2~f_{Y,X}(y,x)\mathsf d y\mathsf d x- \left(\int_0^\infty \int_0^\infty y~f_{Y,X}(y,x)\mathsf d y\mathsf d x\right)^2$

Also, similarly the expectation for $Y$ is  $\mathsf E(Y)~{=\mathsf E(\mathsf E(Y\mid X)) \\= \mathsf E(X) \\= 1}$
