# How do I calculate the conditional expectation?

How do I find a conditional expectation, $$E(Y|X)$$ for:

$$f_{XY}(x,y)=2e^{-(x+y)}$$ for $$0.

I researched that the formula for a conditional expectation is:

$$E(Y|X) = \Sigma yf_{Y|X}(y|x)$$

And I have already calculated the conditional density as:

$$f_{Y|X}(y|x) = e^{x-y}$$ for $$0

Thus,

$$E(Y|X) = \Sigma ye^{x-y}$$ for $$0

• You have nor written $f_{y|x}$ correctly. – Kavi Rama Murthy May 23 at 11:47
• @KaviRamaMurthy sorry can you clarify what you mean that is is incorrect ? – i9-9980XE May 23 at 12:00
• You have to specify that the conditional density is $e^{x-y}$ for $0<x<y$. Leaving out the condition $0<x<y$ will lead to wrong answers. – Kavi Rama Murthy May 23 at 12:02
• I have re-edited the question for a more correct explanation. Thank you – i9-9980XE May 23 at 12:05

The conditional density you have found is for $$0. $$E(Y|X)=\int_x^{\infty} ye^{x-y} dy$$. Integrate by parts to find the exact value.
• The answer is $x+1$. – Kavi Rama Murthy May 23 at 11:51
First your density function $$f_{Y\mid X=x}$$ is wrong. Anyway, suppose it's true : what you computed (if you replace of cours $$\sum_{y}$$ by $$\int_{\mathbb R}$$) is $$\mathbb E[Y\mid X=x].$$ But $$\mathbb E[Y\mid X]=\int_{\mathbb R}ye^{X-y}\,\mathrm d y=e^X\int_{\mathbb R}ye^{-y}\,\mathrm d y.$$
• Yes indeed.$\ \ \ \ \$ – Surb May 23 at 11:46
• @Surb sorry, isn’t the density function $\frac{f(x,y)}{f_X(x)} = \frac{2e^{-(x+y)}}{2e^{-2x}} = e^{x-y}$? – i9-9980XE May 23 at 11:57