# Thread: Find E[X] and E[E[X|Y]]

1. ## Find E[X] and E[E[X|Y]]

Let X and Y be random variables with $\displaystyle p(x,y)=e^ {-y}$ for $\displaystyle 0<x<y<+ \infty$

Find $\displaystyle E[X]$ and $\displaystyle E[E[X|Y]]$

My solution:

a) First of all, $\displaystyle p(x) = e^{-x}$, so I have $\displaystyle E[X] = \int ^ y _0 xe^{-x}dx = -ye^{-y}-e^{-y}+1$

b) Here, $\displaystyle E[X|Y] = \frac {Y}{2}$ and $\displaystyle p(y)=ye^{-y}$, so I have $\displaystyle E[E[X|Y]] = \int E[X|Y=y]p(y)dy = \int ^ \infty _x \frac {y}{2}(ye^{-y})dy= \frac {1}{2} e^{-x}(x^2+2x+2)$

But according to the law of total expectation, they should be the same thing, so what am I doing wrong? Thank you!

2. ## Re: Find E[X] and E[E[X|Y]]

part of this was asked in another question here

(a) Yes, $\displaystyle f_X(x)=e^{-x}$
BUT that is the marginal, hence the range is x>0
you no longer want x<y.
Plus the E(X) is a constant, which cannot have Y's in it.
E(X)=1, this is an exponential

(b) Yes, $\displaystyle E(X|Y)=y/2$

and $\displaystyle f_Y(y)=ye^{-y}$, y>0 a Gamma RV

So $\displaystyle E_Y(E(X|Y)) =\int_0^{\infty}(y/2)ye^{-y}dy=(1/2)\int_0^{\infty}y^2e^{-y}dy=(1/2)\Gamma(3)=1.$