# Solved – Conditional expectation; how to find E[xy] when E[x|y] is known

In my studies for an exam which I have on Friday I have come across this assignment from last year in which the following question is asked:

"Let $$E[x] = mu$$ and $$var[x] = sigma^2$$. If $$E[x lvert y] = a + bx$$, find $$E[xy]$$ as a function of $$mu$$ and $$sigma^2$$."

Now in this assignment of last year, an answer by a group of students from that year was provided:

"The law of total expectations states $$E[xy] = E[E[xy lvert x]]$$. By linearity of conditional expectations, $$E[E[xy lvert x]] = E[xE[y lvert x]]$$. We get

$$E[xy] = E[E[xy lvert x]] = E[x[E[y lvert x]] = E[x(a + bx)] =$$ …."

Where at the end they simply write out the expression and then input the given $$mu$$ and $$sigma^2$$. I'm not sure whether this is correct. First of all, I'm not sure whether I understand correctly how $$E[xy] = E[E[xy lvert x]]$$ follows from the law of total expectation. I thought that it might be as follows:

$$E[E[XY lvert X = x]] = E[xE[Y lvert X = x]] = sum_x xE[Y lvert X]P[X = x] =$$
$$sum_x sum_y x y P[X = x lvert Y = y]P[X = x] = sum_x sum_y x y P[X = x, Y = y] = E[XY].$$

However I would like to know if that line of reasoning is correct.

Secondly I don't see why $$E[y lvert x] = E[x lvert y]$$ would have to be true. Could anyone tell me whether this is correct and possibly explain why it is correct or what is correct if it isn't? Mathematically, intuitively, or both?

Contents

This is correct: $$E[XY] = E[E[XYlvert X]] = E[X[E[Y lvert X]] = E[X(a + bX)].$$
By linearity of the expectation operator, we get $$E[XY]=aE[X]+bE[X^2].$$ Using the fact that $$E[X]=mu$$ and $$E[X^2]=sigma^2+mu^2$$, we get
$$E[XY]=amu+b(mu^2+sigma^2).$$