conditional expectation, covariance

Question. Let X and Y be random variables with joint density

$\displaystyle f_{X,Y}(x,y)=\left\{\begin{array}{cc}{ke^{-{\lambda}x},0<y<x<{\infty}\\0, &otherwise\end{array}\right.$

Derive the conditional density, $\displaystyle f_{X|Y}(x|y)$, and the conditional expectation, E[X|Y]. Hence or otherwise, evaluate E(X) and Cov(X,Y).

Answer.

(I highlighted the questions that came up along the answer write up by ->>>>>)

$\displaystyle f_Y(y)=\int_{-\infty}^{\infty}f_{X,Y}(x,y)dx=\int_y^{\infty}ke^{-{\lambda}x}dx=k\int_y^{\infty}e^{-{\lambda}x}dx=k[(-\frac{1}{\lambda}e^{-{\lambda}x}]_y^{\infty}=\frac{k}{\lambda}e^{-{\lambda}y}$,

$\displaystyle 0<y<{\infty}$.

->>>>>>>Is this support right, or should I say $\displaystyle 0<y<x<{\infty}$ (ie include x in it)

$\displaystyle f_{X|Y}(x|y)=\frac{f_{X,Y}(x|y)}{f_Y(y)}=\frac{ke^ {-{\lambda}x}}{\frac{k}{\lambda}e^{-{\lambda}y}}={\lambda}e^{\lambda(y-x)}$

Then expected value

$\displaystyle E(X|Y)=\int_{-infty}^{\infty}xf_{X|Y}(x|y)dx=\int_y^{\infty}x{\l ambda}e^{({\lambda}y-{\lambda}x)}dx={\lambda}e^{{\lambda}y}\int_y^{\inf ty}xe^{-{\lambda}x}dx=$

$\displaystyle ={\lambda}e^{{\lambda}y}\frac{e^{-{\lambda}y}}{\lambda}(y-1)=y-1$

($\displaystyle \int_y^{\infty}xe^{-{\lambda}x}=[x(-\frac{1}{\lambda}})e^{-{\lambda}x}]_y^{\infty}-\int_y^{\infty}e^{-{\lambda}x}dx=[\frac{-xe^{-{\lambda}x}}{\lambda}]_y^{\infty}-[-\frac{1}{\lambda}e^{-{\lambda}x}]_y^{\infty}=\frac{ye^{-{\lambda}y}}{\lambda}-\frac{e^{-{\lambda}y}}{\lambda}=\frac{e^{{-\lambda}y}}{\lambda}(y-1)$)

Therefore E(X|Y)=Y-1

"Hence" somehow hint on using E(X|Y) in evaluating E(X), and I try that:

$\displaystyle E(X)=E[E[X|Y]]=E[Y-1]=E(Y)-1$

->>>>>>So still need to do the integration to find E(X) directly from the integral, or E(Y) first and then deduct 1 to get E(X). Right?

I find E(Y) since the integration is slightly easier.

$\displaystyle \int_{-\infty}^{\infty}=\int_0^{\infty}y\frac{k}{\lambda} e^{-{\lambda}y}dy=\frac{k}{\lambda}\int_0^{\infty}ye^{-{\lambda}y}dy=-k$ but I probably messed up signs somewhere and I feel it should be k... (no big deal, I'll recheck).

->>>>>The question is, do I need to take into account the bound on y which is y<x?

Once I get E(Y), $\displaystyle E(X)=E(Y)-1=k-1$.

Then $\displaystyle Cov(X,Y)=E(XY)-E(X)E(Y)$ and again I need to integrate to find E(XY), right? Or there is an easy way...