# Simplifying with Summation

This is a problem out of my statistics book but my issue is simplifying from Step 3 to Step 4 below:

Step 1: var X=$\sum\:p_i\:(x_i-E[X])^2$

Step 2: var X=$\sum\:p_i[x_i^2+E[X]^2-2x_iE[X]]$

Step 3: var X=$\sum\:p_ix_i^2+(E[X])^2\sum\:p_i-2E[X]\sum\:p_ix_i$

Step 4: var X=$\sum\:p_ix_i^2-(E[X])^2$

• $p_i$ is the probability that X takes the value $x_i$
• E[X] is the expected value of X, defined as $\sum\:p_ix_i$

My attempt to Step 4 is provided below but that is where I am stuck:

var X=$\sum\:p_ix_i^2+(E[X])^2\sum\:p_i-2E[X]^2$

• $\sum p_i{x_i}^{2}=E[X^2]$ Aug 27, 2015 at 0:00
• remind that $\sum p_i = 1$ Aug 27, 2015 at 1:45
• @NP-hard Thank you. That is what I was forgetting. Aug 27, 2015 at 21:59

Step 3 is given by

$\mathrm{Var}[X] = \sum p_i x_i^2 + (\mathrm{E}[X])^2 \cdot \color{red}{\sum p_i} - 2 \cdot \mathrm{E}[X] \cdot \color{blue}{\sum p_i x_i}.$

This is equivalent to

$\mathrm{Var}[X] = \sum p_i x_i^2 + (\mathrm{E}[X])^2 \cdot \color{red}{1} - 2 \cdot \mathrm{E}[X] \cdot \color{blue}{\mathrm{E}[X]}.$

This, in turn, is equivalent to step 5, given by

$\mathrm{Var}[X] = \sum p_i x_i^2 + (\mathrm{E}[X])^2 - 2 \cdot (\mathrm{E}[X])^2 = \sum p_i x_i^2 - (\mathrm{E}[X])^2.$

Note that:

$$\sum f(x_i)p_i=E[f(X)]$$

$$\sum {x_i}p_i= E[X]$$
$$\sigma{(x)}=\sum {x_i}^{2}p_i +{E[X]}^{2}-2E[X]\sum {x_i}p_i\\ \sigma{(x)}=\sum {x_i}^{2}p_i +{(E[X])}^{2}-2E[X]\times E[X]\\ \sigma{(x)}=\sum {x_i}^{2}p_i +{(E[X])}^{2}-2{(E[X])}^{2}\\ \sigma{(x)}=\sum {x_i}^{2}p_i -{(E[X])}^2$$