<p><span class="math-container">$$E[(X-E[X])^2]$$</span></p>
<p>We FOIL the quadratic,</p>
<p><span class="math-container">$$E[X^2 -2XE[X]+(E[X])^2]$$</span></p>
<p>We apply the expectation to each term,</p>
<p><span class="math-container">$$E[X^2] -2E[XE[X]]+(E[X])^2$$</span></p>
<p>In the middle piece, <span class="math-container">$E[X]$</span> is a constant number that can be brought out of the expectation.</p>
<p><span class="math-container">$$E[X^2] -2E[X]E[X]+(E[X])^2$$</span></p>
<p>We have that <span class="math-container">$E[X]E[X]=(E[X])^2$</span></p>
<p><span class="math-container">$$E[X^2] -2(E[X])^2+(E[X])^2$$</span></p>
<p>We are done,
<span class="math-container">$$E[X^2] -(E[X])^2$$</span></p>

CC BY-SA 4.0
2022-10-30T19:15:58.867Z
Thank you very much, that's exactly what I was looking for!!
Sera
CC BY-SA 4.0
2022-10-30T17:45:04.620Z
2022-10-30T17:45:04.620Z
Michael Gmeiner
<p>Could someone help me to derive/understand how we can derive <span class="math-container">$E[X^2]-E[X]^2$</span> from
<span class="math-container">$E[(X-E(X))^2]$</span> in the variance formula of a random variable <span class="math-container">$X$</span>?</p>
<p>I am writing the formula below:</p>
<p><span class="math-container">$Var(X)=E[(X-E(X))^2]=E[X^2]-E[X]^2$</span></p>

CC BY-SA 4.0
2022-10-30T10:33:36.823Z
What is your particular difficulty?  Can you expand the square in $E[(X-E(X))^2]$?
Adam Bailey
CC BY-SA 4.0
2022-10-30T12:37:24.937Z
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.
Richard Hardy
CC BY-SA 4.0
2022-10-30T19:17:23.407Z
The answer that I was looking for was solved below, but thank you very much for your comments!
Sera
<econometrics><statistics>
Variance of a random variable / Econometrics
Sera
# Variance of a random variable / Econometrics

(Asked by: username_0 on 2022-10-30)

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$

**Tags:** econometrics, statistics

> **Comments:**
> **username_1**: What is your particular difficulty?  Can you expand the square in $E[(X-E(X))^2]$?  
> **username_2**: 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.  
> **username_0**: The answer that I was looking for was solved below, but thank you very much for your comments!  

---

## 1 answers

### Answer by username_3 on 2022-10-30. Score: 5 | Accepted answer

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

We FOIL the quadratic,

$$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$$

> **Comments:**
> **username_0**: Thank you very much, that's exactly what I was looking for!!  

---

