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?

Thank you in advance

  • $\begingroup$ 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),. $\endgroup$ Mar 27, 2019 at 15:41

1 Answer 1


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


  • $\begingroup$ So $E[Y \lvert X] = E[X \lvert Y]$? How? $\endgroup$
    – Anon
    Mar 27, 2019 at 16:08
  • 1
    $\begingroup$ 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. $\endgroup$
    – dlnB
    Mar 27, 2019 at 16:09
  • $\begingroup$ You write that $E[Y \lvert X] = a + bX$, however, it is given that $E[X \lvert Y] = a + bX$. $\endgroup$
    – Anon
    Mar 27, 2019 at 16:11
  • $\begingroup$ 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$. $\endgroup$
    – dlnB
    Mar 27, 2019 at 16:12
  • $\begingroup$ As you were typing that the same idea came to me... I checked the original assignment file and indeed it was a typo. Now excuse me as I go stab myself with a pen while realizing I wasted 40 minutes thinking about this. Thank you for your help. $\endgroup$
    – Anon
    Mar 27, 2019 at 16:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.