# Expectation value with condition

how can i show that:

$E[XY \vert X ] = XE[Y \vert X]$ for two random variables $X$ and $Y$

sorry this must be wrong what i meant was

$E[ E[XY \vert X ] ]= E [XE[Y \vert X]]$

Ok I'll give you a hint. Does $E[3Y|X]=3E[Y|X]$? Can you prove this?

Let $f(x,y)$ be the joint probability density of $X$ and $Y$. Then $$g(x)=\int f(x,y)\,\mathrm{d}y$$ is the probability density of $X$ and $$h(y|x)=\frac{f(x,y)}{g(x)}$$ is the conditional density of $Y$ given $X$. Then $$\mathrm{E}[X\mathrm{E}[Y|X]]=\int x\left(\int y\,h(y|x)\,\mathrm{d}y\right)\,g(x)\,\mathrm{d}x$$ and $$\mathrm{E}[\mathrm{E}[XY|X]]=\int\left(\int xy\,h(y|x)\,\mathrm{d}y\right)\,g(x)\,\mathrm{d}x$$

• "E[Y|X] is the expected value of Y for a given X." This is not the definition of E[Y|X] (and absurd in many cases).
– Did
Mar 29, 2014 at 15:43
• Sorry, that was my understanding, which is obviously flawed.
– robjohn
Mar 29, 2014 at 15:46
• @Did: is what I have above incorrect?
– robjohn
Mar 29, 2014 at 16:30
• The new version is "Since X is fixed for the evaluation of the expectation and since expectation is linear". Unfortunately I don't know what "X is fixed for the evaluation of the expectation" means and I don't see how "expectation is linear" is related. Why not being rigorous, why not using the definition?
– Did
Mar 29, 2014 at 16:51
• @Did: I am learning while doing. I think I have properly converted my ideas to the case of continuous random variables.
– robjohn
Mar 30, 2014 at 0:40