0% found this document useful (0 votes)
473 views5 pages

Probability - Why Is The Expected Value of X-Squared - $E (X 2) - Neq E (X) 2$ - Mathematics Stack Exchange

The document discusses an update to a site's Code of Conduct. It notes that anybody can ask or answer questions on the site, which is for studying math at any level or for professionals in related fields. It takes only a minute to sign up and join the community. The best answers rise to the top.

Uploaded by

ScarfaceXXX
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
473 views5 pages

Probability - Why Is The Expected Value of X-Squared - $E (X 2) - Neq E (X) 2$ - Mathematics Stack Exchange

The document discusses an update to a site's Code of Conduct. It notes that anybody can ask or answer questions on the site, which is for studying math at any level or for professionals in related fields. It takes only a minute to sign up and join the community. The best answers rise to the top.

Uploaded by

ScarfaceXXX
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

As of May 31, 2023, we have updated our Code of Conduct.

Mathematics Stack Exchange is a question and Anybody can ask a question


answer site for people studying math at any
level and professionals in related fields. It only
takes a minute to sign up. Anybody can answer

Join this community The best answers are voted up and


rise to the top

Why is the expected value E(X 2 ) ≠ E(X)2 ?


Asked 11 years ago Modified 1 year, 9 months ago Viewed 248k times

I wish to use the Computational formula of the variance to calculate the variance of a normal-distributed function. For this, I need the expected value of
X as well as the one of X 2 . Intuitively, I would have assumed that E(X 2 ) is always equal to E(X)2 . In fact, I cannot imagine how they could be
31 different.

Could you explain how this is possible, e.g. with an example?

probability

Share Cite Follow asked May 25, 2012 at 17:10


Nova
427 1 4 6
17 If two random variables X, Y are independent, then it is indeed true that E(XY ) = E(X)E(Y ). But X is as far as possible from being independent of itself!
– Qiaochu Yuan May 25, 2012 at 17:44
2
4
Just take a simple example: if we have 1 and 2 as being equally probable, then ( )
1+2 9 12 +22
2
= 4
but 2
= 52 . – BlueRaja - Danny Pflughoeft May 25, 2012 at 20:50

15 No offense, but if you tried anything at all (even just blindly guessing a distribution) and computed E(X 2 ) and E(X)2 , you would almost surely have found an example
on your own. Experimentation is a very useful tool in mathematics. – user14972 May 26, 2012 at 0:28

Jensens inequality. See mathoverflow.net/questions/47258/… – David LeBauer May 26, 2012 at 22:55

1 @David: No, Cauchy-Schwarz. (Besides, indicating this MO page as a reference for Cauchy-Schwarz or for Jensen is, at best, a joke.) – Did Jul 25, 2012 at 23:51

9 Answers Sorted by: Highest score (default)

Assume X is a random variable that is 0 half the time and 1 half the time. Then

EX = 0.5 × 0 + 0.5 × 1 = 0.5


30
so that

(EX)2 = 0.25,

whereas on the other hand

E(X 2 ) = 0.5 × 02 + 0.5 × 12 = 0.5.

By the way, since V ar(X) = E[(X − μ)2 ] = ∑x (x − μ)2 P (x), the only way the variance could ever be 0 in the discrete case is when X is constant.

Share Cite Follow edited May 25, 2012 at 17:21 answered May 25, 2012 at 17:13
GeoffDS
11.1k 2 40 76
Let EX = μ and E(X − μ)2 = σ 2 , then

EX 2 = E[X − μ + μ]2 =
25
= E(X − μ)2 + 2E[(X − μ)μ] + E(μ2 ) =
= σ 2 + 2μE(X − μ) + μ2 =
= σ 2 + μ2

So EX 2 = σ 2 + μ2 , no matter the distribution, and EX 2 ≠ (EX)2 unless the variance equals zero.

Share Cite Follow edited Aug 11, 2021 at 13:12 answered Apr 2, 2014 at 21:03
Guile
351 3 5

1 Isn't 2E[(X − μ)μ] supposed to have a plus in front of it instead of a minus? Not a huge deal since it equals 0 though. – Zachary Aug 11, 2021 at 4:13

you are right! corrected, thanks! – Guile Aug 11, 2021 at 13:12

One is an average of squares, the other a square of an average. In general, when you reverse two procedures (mix cookies, bake cookies), you have no
right to expect the same outcome.
8
Share Cite Follow answered May 25, 2012 at 17:58
ncmathsadist
48.5k 3 78 128

Note that your logic applied to a uniform distribution would give that

(x1 + x2 + ⋯ + xn )2 = n(x1 2 + x2 2 + ⋯ + xn 2 )
8
which is clearly not true in general.

Share Cite Follow edited Jul 26, 2012 at 2:17 answered May 25, 2012 at 17:28
Robert Mastragostino
15.4k 3 33 53
1 What are the dots for? – SBF May 25, 2012 at 20:54

whoops. Meant to include them in both as an ellipsis. Fixed. – Robert Mastragostino May 25, 2012 at 23:57

The usual style is x + y + z + ⋯, FYI. – user856 May 26, 2012 at 1:07

Thanks the for the tip Rahul! – Robert Mastragostino May 26, 2012 at 1:57

3 This (highly upvoted) explanation is seductive but it seems to miss the point: what E(X 2 ) = E(X)2 would imply is something more like the square of the sum being the
sum of the squares times the number of terms (not simply the sum of the squares). Another way to see it is that E(X 2 ) = E(X)2 is true when X is constant while the
square of the sum is not the sum of the squares, even when the arguments are all equal. – Did May 26, 2012 at 7:43

Let us take for example X the standard normal, or any normal with mean 0. Then E(X) = 0.

But X 2 is always positive, so clearly its mean must be positive.


6
This shows that (in this case) E(X 2 ) ≠ (E(X))2 .

In fact, when the expectations exist, E(X 2 ) > (E(X))2 except when X is constant with probability 1.

Share Cite Follow edited May 25, 2012 at 17:20 answered May 25, 2012 at 17:14
André Nicolas
499k 47 537 970

3 Even easier to see, maybe, if you make the values −1 and 1. – Robert Israel May 25, 2012 at 17:18

@RobertIsrael: I had deleted my post, since someone had posted the same example. Then decided to use normal, since that's what OP was working with, and ended up
with a variant of your example. – André Nicolas May 25, 2012 at 17:22

1
Say you have a fair coin that says X = 1 on one side and X = 3 on the other side. You flip the coin. Clearly, E(X) = 2
(1 + 3) = 2 .

1
If you are counting X 2 instead of X , then one side of the coin is worth 12 = 1 and the other side is worth 32 = 9, so E(X 2 ) = (1 + 9) = 5 .
1 2

5 ≠ 22 .

Share Cite Follow answered May 25, 2012 at 17:14


MJD
63.9k 38 287 528
My turn:

1 1 1 1
Let X be uniformly distributed on [0, 1]. The EX = ∫t=0 tdt = , but EX 2 = ∫t=0 t2 dt = .
1 2 3

Share Cite Follow answered May 25, 2012 at 17:49


copper.hat
167k 9 103 245

May as well chime in :)

Expectations are linear pretty much by definition, so E(aX + b) = aE(X) + b . Also linear is the function f(x) = ax. If we take a look at f(x2 ) , we
0
get

f(x2 ) = a(x2 ) ≠ (ax)2 = f(x)2 .

If E(X 2 ) = E(X)2 , then E(X) could not be linear, which is a contradiction of its definition. So, it's not true :)

Share Cite Follow answered May 25, 2012 at 17:40


joshin4colours
211 1 8

2
Assuming X is a discrete random variable E(X) = ∑ xi pi . Therefore E(X 2 ) = ∑ x2i pi while [E(X)]2 = (∑ xi pi ) . Now, as Robert Mastragostino
says, this would imply that (x + y + z + ⋯)2 = x2 + y 2 + z 2 + ⋯ which is not true unless X is constant.
0
Share Cite Follow edited May 26, 2012 at 8:43 answered May 26, 2012 at 4:19
E.O.
6,792 6 34 56

2 How so? See my comment on the other answer. – Did May 26, 2012 at 7:45

You might also like