# 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?

• If you write $Z$ for $XY$ (note $Z$ has nothing to do with normal random variables), then would you agree that $E[Z\mid X=x] = E[xY\mid X=x] = xE[Y\mid X=x]$? If so, then note that when $X$ equals $x$, the random variable $E[Z\mid X] = E[XY\mid X]$ takes on value $xE[Y\mid X=x]$ and so the random variable $E[XY \mid X]$ is $XE[Y\mid X]$ (and is a function of $X$ as it shoud be),. – Dilip Sarwate Mar 27 '19 at 15:41

This is correct: $$E[XY] = E[E[XY\lvert 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]=a\mu+b(\mu^2+\sigma^2).$$
• So $E[Y \lvert X] = E[X \lvert Y]$? How? – Anon Mar 27 '19 at 16:08
• Of course not, where did you get this? $E(Y|X)$ is a function of $X$, while $E(X|Y)$ is a function of $Y$. I copied the first line from your post. – dlnB Mar 27 '19 at 16:09
• You write that $E[Y \lvert X] = a + bX$, however, it is given that $E[X \lvert Y] = a + bX$. – Anon Mar 27 '19 at 16:11
• Oh right I didn't notice that. It must be a typo. $E(X|Y)$ would have to be a function of $Y$, not $X$. If your assigned problem has written that $E(X|Y)=a+bX$, it must be a typo that should read $E(Y|X)=a+bX$. – dlnB Mar 27 '19 at 16:12