I am trying to derive the simplified variance formula and am abit stuck on a part of the proof:
$$ \hspace{-7em} \sum_{i=0}^n (x_i-\mu)^2 f(x_i) = \sum_{i=0}^n x_i^2 f(x_i) - \mu^2 $$ $$ = \sum_{i=0}^n (x_i-\mu)^2 f(x_i)$$ $$ \hspace{3em} = \sum_{i=0}^n (x_i^2 -2x_i\mu + \mu^2) f(x_i)$$ $$ \hspace{10em}= \sum_{i=0}^n x_i^2 f(x_i) - \sum_{i=0}^n 2x_i\mu f(x_i) + \sum_{i=0}^n \mu^2 f(x_i)$$ $$ \hspace{9em}= \sum_{i=0}^n x_i^2 f(x_i) - 2\mu\sum_{i=0}^n x_i f(x_i) + n \mu^2 f(x_i)$$ $$ \hspace{5em}= \sum_{i=0}^n x_i^2 f(x_i) - 2\mu^2 + n \mu^2 f(x_i)$$ $$ [ n f(x_i) = 1 ? ] $$ $$ \hspace{3em}= \sum_{i=0}^n x_i^2 f(x_i) - 2\mu^2 + \mu^2$$ $$ = \sum_{i=0}^n x_i^2 f(x_i) - \mu^2$$
I am not sure where I am going wrong with this derivation and can't find the derivation. It seems to follow that $nf(x_i) = 1$ but don't know how to make sense of it. Is this correct? If you could steer me in the right direction, I would be grateful.
$\sum_{x=0}^n \mu^2 f(x)$ should equal $\mu^2 \sum_{x=0}^n f(x) = \mu^2$, not $n\mu^2 f(x)$, which doesn't make sense since the sum is over $x$.