Suppose x is a discrete random variable with values 2,3,1 and probabilities 0.2,0.3, and 0.4 respectively. NOw say we have the function y=x2+3 and we want to find the expected value of this equation. So, in my opinion, we first have to square all the values of x so they become 4,9 and 1 and then multiply them with their respective probabilities and then add them all up and in the end, just add 3 to the answer.

This works out to give the answer 6.9, but my teacher at the university solvedthis question another way. He said that since x2 is just x times x, the expected value of x squared should be the E(x) times E(x) so we can just multiply the value of x with its probability and then add em all up and then square the answer. This gives the answer 5.89. So which way is correct?

I'm pretty sure that the way I think it should be done is correct so if it is, then I'm gonna have to confront my teacher about this matter. And I just know that he'll state the rule that the expected value of the product of two or more random variables is equal to the product of their individual expected values. How do I explain to him why this rule doesn't apply here?

I think it is because of the rule applies to two different random variables, but here x is the same random variable.

  • 2
    $\begingroup$ Just to clarify, you're calculating $\bar{y}$ rather than $\langle y \rangle$. You're calculating the average value of y over a sample, rather than the expected value of y $\endgroup$
    – gazza89
    Oct 16, 2018 at 12:27
  • 1
    $\begingroup$ en.wikipedia.org/wiki/Law_of_the_unconscious_statistician $\endgroup$ Oct 16, 2018 at 12:58
  • $\begingroup$ @Ferdi hmm.. can you elucidate? $\endgroup$
    – NoLifeKing
    Oct 16, 2018 at 16:09

1 Answer 1



$E[X]=\sum_i x_i f(x_i)$



We can see that in general $E[X^2] \neq E[X]^2$, unless $Var[X]=0$

  • $\begingroup$ Great, never thought to use this relationship. this verifies my answer. thanks $\endgroup$
    – NoLifeKing
    Oct 16, 2018 at 12:20

Your Answer

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

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