# Finding a marginal PDF of a joint probability distribution

I understand the idea of how to do it, but I'm currently getting a constant as my marginal PDF, which doesn't make sense.

The overall distribution is as follows: $f(x,y) = 5ye^{-xy}$ for $0 < x, 0.2 < y < 0.4$

I'm trying to find the probability that $0 < x < 2$ given that $y = 0.25$, which should be $\frac{f(0<x<2,y=0.25)}{f_y(0.25)}$. As a minor double-check, should the top be a single integral evaluated with $y=0.25$?

The bulk of my question is that I'm finding $f_y$ to be a constant, which doesn't make sense. What am I doing wrong?

$f_y = \int_{0}^{\infty} 5ye^{-xy} dx = 5[-e^{-xy}]_{0}^{\infty} = 5[0-(-1)]=5$

-
Why do you have $f_y(1)$ in the denominator instead of $f_y(0.25)$? Also, you aren't calculating the PDF, you're calculating the probability so it SHOULD be a constant. –  Tyler Oct 26 '13 at 20:27
Whoops, that was supposed to be $f_y(0.25$. That's just a typo. The probability should be a constant, but as far as I know, the marginal function should not, as it should vary with different values of $y$. –  ProbablyMath Oct 26 '13 at 20:30
There's nothing wrong with the probability for the marginal distribution being constant... what leads you to believe it doesn't make sense? –  Tyler Oct 26 '13 at 20:33

What am I doing wrong?

Answer: you are forgetting the support of the density.

A sure way to stop making this mistake is to write the densities rigorously, for example using indicator functions. In your case the density $f$ is the function defined on the whole set $\mathbb R^2$, by $$f(x,y)=5y\mathrm e^{-yx}\mathbf 1_{x\gt0}\mathbf 1_{0.2\lt y\lt0.4}.$$ Hence, the second marginal of $f$ is the function $f_Y$ defined on the whole set $\mathbb R$, by $$f_Y(y)=\int_\mathbb R f(x,y)\mathrm dx=5\,\mathbf 1_{0.2\lt y\lt0.4}\int_0^\infty y\mathrm e^{-yx}\mathrm dx=5\,\mathbf 1_{0.2\lt y\lt0.4}.$$ Thus, $f_Y$ is a constant on the interval $(0.2,0.4)$, which makes perfect sense. Once again, note that $f_Y(y)$ is well defined, for every $y$ in $\mathbb R$, for example $f_Y(3)=0$.

Edit: By definition, the conditional density of $X$ conditionally on $Y$ is defined for every $x$ and every $y$ such that $f_Y(y)\ne0$ by $$f_{X\mid Y}(x\mid y)=f(x,y)/f_Y(y).$$ (If $f_Y(y)=0$, one can set $f_{X\mid Y}(x\mid y)=0$.) Then, for every $y$ such that $f_Y(y)\ne0$, $$P[0\lt X\lt 2\mid Y=y]=\int_0^2f_{X\mid Y}(x\mid y)\mathrm dx.$$ Try this computation and you will get a result for $P[0\lt X\lt 2\mid Y=y]$ between $0$ and $1$, as it should.

-
So in that case, regardless of $y$, $f_y(y)=5$ as long as $0.2<y<0.4$. Isn't that the probability of a value? How is it greater than 1? –  ProbablyMath Oct 26 '13 at 20:49
"Isn't that the probability of a value" Not at all. That the random variable $Y$ has a density means that $Y$ is a continuous random variable hence $P[Y=y]=0$ for every $y$. The density gives the probability that $Y$ is in, for example, an interval $I$ as $P[Y\in I]=\int\limits_If_Y$. –  Did Oct 26 '13 at 20:51
So the issue I was having was that I was forgetting to actually just integrate to check--$\int_{0.2}^{0.4}5dy=5y|_{0.2}^{0.4}=5(0.4-0.2)=1$. So to actually get the answer, I'm now having a different stumbling block. $f(x<3,y=0.25)=\int_{0}^{3}{\frac{5}{4}e^{-\frac{x}{4}}dx}=\left[-5e^{-\frac{x}{‌​4}}\right]_0^3=-5(e^{-\frac{3}{4}}-1)=2.6382$ is what I was getting for the top of the equation. This ends up giving a probability greater than 1 for the initial question. Am I evaluating the integral wrong, or did I simply put the question together wrong overall? –  ProbablyMath Oct 26 '13 at 20:57
See Edit.   –  Did Oct 26 '13 at 21:07
@ProbablyMath your 5/4 should be 1/4. Remember to divide by the marginal density. –  Tyler Oct 26 '13 at 21:32