Conditional distribution to find the marginal distribution

probability

I have this problem which made me think a bit more.

"Suppose $X$ has gamma distribution $(2,\lambda)$ and the distribution of $Y|X=x$ is uniform in $(0, x)$. Find the density function of $y$"

My solution so far:

$f_{X,Y}(x,y)=\frac{1}{\Gamma(2)}\lambda^2e^{-\lambda x}$ and I was thinking for $f_Y(y)$, do I integrate $f_{X,Y}(x,y)$ from $x=0$ or from $x=y$ to infinity?

Am I right in claiming that every pair of $(x,y)$ obtained, $y<x$? In which case I should really refine the joint density function to $$f_{X,Y}(x,y)=\frac{1}{\Gamma(2)}\lambda^2e^{-\lambda x}, 0<y<x<\infty$$
In other words, I should have really integrate from $x=y$ to infinity?

Best Answer

You are correct. The marginal density of $X$ is $f_X(x) = \frac1{\Gamma(2)}\lambda(\lambda x)e^{-\lambda x}\cdot 1_{(0,\infty)}(x)$ and the conditional density of $Y$ given $X=x$ is $f_{Y\mid X=x}=\frac1x\cdot\mathsf 1_{(0,x)}(y)$, so the joint density of $(X,Y)$ is the product of the marginal and conditional densities: $$ f_{X,Y} = f_X(x)f_{Y\mid X=x} = f_{X,Y}(x,y) = \frac1{\Gamma(2)}\lambda^2e^{-\lambda x}\cdot \mathsf 1_{\{0<y<x<\infty\}}. $$ To find the marginal density of $Y$, we simply integrate the joint density over all possible values of $X$: $$ f_Y(y) = \int_{\mathbb R}f_{X,Y}(x,y)\ \mathsf dx = \int_y^\infty \frac1{\Gamma(2)}\lambda(\lambda x)e^{-\lambda x}\cdot\frac1x\ \mathsf dx = \lambda e^{-\lambda y}\cdot\mathsf 1_{(0,\infty)}(y). $$

In other words, the marginal density of $Y$ is exponential with rate $\lambda$.

Related Question