# Marginal densities of a joint distribution

Let $X$ and $Y$ be continuous random variables having joint density $f$ given by $f(x,y) = \lambda^2 e^{-\lambda y}, 0 \leq x \leq y$ and $f(x,y) = 0$ elsewhere.

Find the marginal densities of $X$ and $Y$. Find the joint distribution function of $X$ and $Y$.

This is what I have but I'm sure it is incorrect:

$f_X(x) = \int_0^{\infty} f(x,y) dy = \int_0^{\infty} \lambda^2 e^{-\lambda y} dy = \lambda(\lim_{y \rightarrow \infty} e^{-\lambda y} - e^{-\lambda 0}) = \lambda$

• On which domain does this relation hold? Jul 24, 2014 at 19:50
• @MTurgeon Could you be more specific? Jul 24, 2014 at 19:52
• If $f_X$ is indeed a density, its integral over the domain should be 1. You're saying $f_X(x)=\lambda$. If this is true for all $x$, then you know right away that $f_X$ cannot be a density. Therefore, you need a domain, which you haven't specified. Jul 24, 2014 at 19:54
• @MTurgeon I get it now! Jul 24, 2014 at 20:19
• @MTurgeon It seems to me the error is a wrong assumption about the support of $f(x,y)$ for a given value of $x$. For almost all $x$, $\int_0^{\infty} f(x,y) dy \ne \int_0^{\infty} \lambda^2 e^{-\lambda y} dy$, as you correctly showed in your answer. Jul 24, 2014 at 20:22

As I've hinted at in the comments, the domain is very important. I will compute $f_X$ to show you how.
First, we fix $x$. For this particular value of $x$, I know that $f(x,y)\neq 0$ only if $0\leq x\leq y$ holds. Therefore, when you integrate out $y$, your lower bound should be $x$.
\begin{align} f(x) &= \int_{-\infty}^\infty f(x,y) dy\\ &= \int_{-\infty}^x f(x,y)dy + \int_{x}^\infty f(x,y) dy\\ &= \int_{-\infty}^x 0 dy + \int_{x}^\infty \lambda^2e^{-\lambda y} dy\\ &= \lambda\left(\lim_{y\to \infty} -e^{-\lambda y} + e^{-\lambda x}\right)\\ &= \lambda e^{-\lambda x}. \end{align} So this relation holds for $x\leq 0$, since otherwise you are simply integrating the function which is 0 everywhere.
Computing $f_Y$ should be similar.