Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I need to find $E(X|Y=1)$ and have: $$f(x,y)=\begin{cases}\lambda^3xe^{-\lambda y} & 0\lt x\lt y\\ 0 & \text{elsewhere}\end{cases}$$ Do I need to find both marginal densities to do this? I know that the definition of $E(X|Y=y)=$$$\begin{align}\int_{-\infty}^{\infty} g(x)f_X(x|Y=1)dx\\ =\int_{-\infty}^{\infty}g(x)P(x|Y=1)dx\\=\int_{-\infty}^{\infty}g(x)*\frac{f(x,y)}{f_Y(y)} dx\end{align}$$ This is the definitiion given in my textbook. Is the $g(x)$ supposed to be the marginal density of $X$?

share|cite|improve this question
up vote 1 down vote accepted

First you need to find $f_Y(y) = \int_{-\infty}^{\infty}f(x,y)dx$.

Then, $$E(X|Y=y) = \int_{-\infty}^{\infty}x\frac{f(x,y)}{f_Y(y)}dx$$ The formula you have written is correct for $E(g(X)|Y=y)$, which is a generalized version of the above.

share|cite|improve this answer
So when we plug in for $y=1$ would the upper limit on the integral be $1$ since it's saying $y=1$? – TheHopefulActuary Dec 13 '12 at 4:04
yeah. you may do so in this case. – dexter04 Dec 13 '12 at 4:07
What kind of cases wouldn't that be acceptable? – TheHopefulActuary Dec 13 '12 at 4:10
It is OK to change the limits to the range where $f(x,y)$ is non-zero. – dexter04 Dec 13 '12 at 7:21

I think your book is telling you $E[g(X)\mid Y = y]$ for arbitrary measurable function $g(\cdot)$, not $E[X\mid Y = y]$. And yes, you do need to compute the marginal density of $Y$ in order to divide $f_{X,Y}(x,y)$ in your formula. But you don't need to find both marginal densities, and in this simple case, it is even unnecessary to compute $f_Y(y)$ explicitly; one can get find $f_{X\mid Y=1}$ without knowing the formula for $f_Y(y)$ or what kind of random variable $Y$ is (it is a Gamma random variable, by the way).

The way I would approach the problem is to say that given $Y = 1$, the conditional density of $X$ has shape given by $f(x,1)$ which is a linear function of $x$ for $x \in (0,1)$. The graph shows a triangle whose area must equal $1$ in order to get a valid density. So the conditional density must be $$f_{X\mid Y=1}(x\mid Y=1) = 2x\mathbf 1_{(0,1)}$$ and so the mean is $\frac{2}{3}$.

share|cite|improve this answer
And you got the $f_{X|Y=1}(x|Y=1)=2x1_{(0,1)}$ from the density function divided by $Y$'s marginal density correct? – TheHopefulActuary Dec 13 '12 at 3:52
Well, I didn't actually bother to compute $f_Y(y)$ explicitly. Instead, I claim that the conditional density of $X$ given $Y = y_0$ is proportional to $$f_{X,Y}(x,y_0) = (\lambda^3\exp(-\lambda y_0))\cdot x\mathbf 1_{(0,y_0)} = c\cdot x\mathbf 1_{(0,y_0)}$$ whose graph is a straight line with value $0$ at $x=0$ and value $c\cdot y_0$ as $x\to y_0$. The area under this curve is $\frac{1}{2}(c\cdot y_0)y_0$, and so it must be that $$f_{X\mid Y=y_0}(x\mid Y=y_0) = \frac{2}{y_0^2}x\mathbf 1_{(0,y_0)}.$$ – Dilip Sarwate Dec 13 '12 at 11:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.