# Variance of a random variable / Econometrics

Could someone help me to derive/understand how we can derive $$E[X^2]-E[X]^2$$ from $$E[(X-E(X))^2]$$ in the variance formula of a random variable $$X$$?

I am writing the formula below:

$$Var(X)=E[(X-E(X))^2]=E[X^2]-E[X]^2$$

• What is your particular difficulty? Can you expand the square in $E[(X-E(X))^2]$? Oct 30, 2022 at 10:33
• I think many introductory statistics or probability theory textbooks (and lecture notes) derive the equivalence between the two expressions. You just need to find one to look it up. Oct 30, 2022 at 12:37
• The answer that I was looking for was solved below, but thank you very much for your comments!
– Sera
Oct 30, 2022 at 19:17

$$E[(X-E[X])^2]$$

$$E[X^2 -2XE[X]+(E[X])^2]$$

We apply the expectation to each term,

$$E[X^2] -2E[XE[X]]+(E[X])^2$$

In the middle piece, $$E[X]$$ is a constant number that can be brought out of the expectation.

$$E[X^2] -2E[X]E[X]+(E[X])^2$$

We have that $$E[X]E[X]=(E[X])^2$$

$$E[X^2] -2(E[X])^2+(E[X])^2$$

We are done, $$E[X^2] -(E[X])^2$$

• Thank you very much, that's exactly what I was looking for!!
– Sera
Oct 30, 2022 at 19:15