Suppose that X and Y are independent discrete random variables. Let h(x,y) be a bounded two-variable function. Show that:
E [h(X,Y)|X = x] = E [h(x,Y )]
Explain why this is usually not true if X and Y are not independent!
Hint: write out both sides using the joint probability mass function
Since $X$ and $Y$ are independent, the probability mass function is the product of the mass function of $X$ and the mass function of $Y$, i.e.
$$ \rho_{XY}(x,y) =\rho_X(x)\rho_Y(y)\text{ for }x\in\Omega_X,y\in\Omega_Y $$
where $\Omega_X$ and $\Omega_Y$ are the sample spacess of $X$ and $Y$ respectively. The unconditional expectation of $h(x,y)$ is
$$ E\left[h(X,Y)\right]=\sum_{x\in\Omega_X,y\in\Omega_Y}h(x,y)\rho_X(x)\rho_Y(y). $$
but if X=x, the conditional expectation is given by
$$ \begin{align*} E\left[h(X,Y)|X=x\right] & =\sum_{y\in\Omega_Y}h(x,y)\rho_Y(y)\\ & = E\left[h(x,Y)\right]. \end{align*} $$
If X and Y are not independent, then $$ E\left[h(X,Y)|X=x\right] =\sum_{y\in\Omega_Y}h(x,y)\rho_{XY}(x,y) $$ which isn't equal to $E\left[h(x,Y)\right]$