Given $X,Y$ random variables, I want to find the explicit expression of
$$\mathbb{E}[h(X)g(Y)|Y = y]$$
I always think of this question like this:
Define a new function $f(X,Y) = h(X)g(Y)$,
$$\mathbb{E}[f(X,Y)|Y = y] = \sum\limits_x \sum\limits_y f(x,y) \Pr[X = x,Y = y|Y = y]$$
$$\implies \mathbb{E}[h(X)g(Y)|Y = y] = \sum\limits_x \sum\limits_y h(x)g(y) \Pr[X = x,Y = y|Y = y]$$
(perhaps I am thinking of the case of the un-conditioned expectation over two random variables)
However, the correct answer is:
$$\mathbb{E}[h(X)g(Y)|Y = y] = \sum\limits_x h(x)g(y) \Pr[X = x,Y = y|Y = y]$$
(alternatively: $\mathbb{E}[h(X)g(Y)|Y = y] = \sum\limits_x h(x)g(y) \Pr[X = x|Y = y]$)
I have an intuitive feeling as to why the correct answer does not sum over $y$, however, I cannot express it. I want to say something like: since $Y$ is given, therefore $Y$ is no longer a random variable, hence $X$ is the only random variable, and therefore the average is summed over the values of $X$ only. It doesn't feel correct because $Y$ is still a random variable.
Can someone clear this up for me and offer a reason why we do not sum over $y$?
Following this logic, would the following expressions also be correct?
$$\mathbb{E}[h(X)g(Y)l(z)|Z = z] = \sum\limits_x \sum\limits_y h(x)g(y)l(z) \Pr[X = x,Y = y, Z = z|Z = z]$$
or
$$\mathbb{E}[\mathbb{E}[h(X)|Y, Z]|Z = z] = \sum\limits_y \sum\limits_x h(x) \Pr[X = x|Y = y, Z = z]\Pr[Y=y, Z = z|Z = z]$$
Because the expectation is under the condition that $Y=y$, where $y$ is a singular value .
If you sum over just one value, what are you doing?
Would it help to use a different symbol for the condition value?
$$\mathsf E(g(X)h(Y)\mid Y=c) ~{= \sum_{x}\sum_y g(x)h(y)\Pr(X=x,Y=y\mid Y=c) \\ = \sum_x g(x)h(c)\Pr(X=x\mid Y=c) \\ = \mathsf E(g(X)\mid Y=c) \;h(c)}$$
Since $\Pr(X=x, Y=y\mid Y=c) = \begin{cases}\Pr(X=x\mid Y=c)&:& y=c\\ 0 &:& y\neq c\end{cases}$