# Joint distribution

What is the difference between E(X|Y) and E(E(X|Y))?

For example, in the following table, what is the value if E(X|Y) and the value of E(E(X|Y)). Also, if we have a function h(Y)=Y^3, how can we prove that E(Xh(Y)|Y)=h(Y)E(X|Y)?

           Y=0          Y=1
X=0        0.1          0.2
X=1        0.3          0.4


Thank you

$E(X|Y)$ is a random variable and $E(E(X|Y))$ is it's expectation (a real number).
"Randomness" of $E(X|Y)$ works like this: when $Y=y$ then $E(X|Y)$ is the expectation of $X$ given $Y=y$.
In your example: $P(X=1|Y=0) = \frac{0.3}{0.1+0.3}=0.75$, so $E(X|Y=0) = 0.75$. Similarly $P(X=1|Y=1) = \frac{0.4}{0.2+0.4}=0.66666...$, so $E(X|Y=1) = 0.66666...$.
$P(Y=0) = 0.4$ and $P(Y=1) = 0.6$. So $E(X|Y)$ is a random variable that takes two values: 0.75 and 0.66666... first one with probabilty of 0.4, second one with probability 0.6.
Expectation of such random variable is $0.75 \cdot 0.4 + 0.66666.... \cdot 0.6 = 0.7$ and this is your $E(E(X|Y))$.
Easier way to get the last result is.using law of total expectation: $E(E(X|Y))=E(X)$.