# Homework Help: Sample Variance (conversion?)

1. Jul 26, 2016

### Abigail1997

1. The problem statement, all variables and given/known data
Not sure if this is the right place to post this, but I'm really confused about what is going on here. Any sort of breakdown of the mathematical operations for each step would be incredibly helpful.

2. Relevant equations
The ones given in the photo, not sure how to type them out in a readable way.

3. The attempt at a solution
No clue, the answer is there but I can't make head or tail of it.

2. Jul 26, 2016

### jambaugh

It is a matter of carrying through the algebra. Some missing steps in the answer are: (with all sums implicitly indexed by i from 1 to n)
$\sum \frac{(x_i - \bar{x})^2}{n-1} = \frac{1}{n-1}\sum (x_i^2 -2 x_i \bar{x} + \bar{x}^2) =$ the second form in the solution equation given that you can break apart the sums. ($\sum(a+b) = \sum a + \sum b$)
Now in these sums note that $\bar{x}$ is a constant with respect to the index variable i over which you are summing. You can thus factor it out giving...
$\frac{1}{n-1}\left(\sum x_i^2 -2 \bar{x}\sum x_i + \bar{x}^2\sum 1\right)$ or the third form in the solution equation.
(the sum of 1 over the range of the index gives you n since there are n terms.)

Now the "trick" is to realize the definition of the mean and rewrite the sum of x's in terms of their mean:
$\bar{x} =\tfrac{1}{n} \sum x_i$ so $\sum x_i = n\bar{x}$
Putting this into the middle term gives you...
$-2 \bar{x}\sum x_i = -2\bar{x} n\bar{x} = - 2\bar{x}^2$ it becomes a like term with the third term.. You get $- 2n\bar{x}^2 + n\bar{x}^2= -n\bar{x}^2$

Now when I show this formula I prefer to work with generalized bar notation:
$$\overline{f(x)} = \tfrac{1}{n}\sum f(x_i)$$

Then rewrite the original formula and the alternative formula as:
$$S^2 = \tfrac{n}{n-1} \overline{(x-\bar{x})} = \tfrac{n}{n-1} \overline{x^2} - \bar{x}^2$$

I then work with means instead of sums and things make a bit more sense along the way (once you get used to the bar notation). In particular you can immediately rescale the expression to $\tfrac{n-1}{n}S^2 = ...$
then its a matter of using the fact that the generalized bar notation (average) is a linear operation:
$$\overline{(x-\bar{x})^2 } = \overline{ x^2 -2\bar{x} x + \bar{x}^2}= \overline{x^2} - 2\bar{x}\bar{x} + \bar{x}^2 = \overline{x^2} - \bar{x}^2$$
keeping in mind again that the mean $\bar{x}$ is a constant.

3. Jul 27, 2016

### Ray Vickson

It is just elementary algebra: $(a-b)^2 = a^2 - 2 a b + b^2$. Apply that to $a = x_i$, $b = \bar{x}$. Do that for each term $i = 1,2, \ldots, n$, then add them up. Remember that $\sum_{i=1}^n x_i = n \bar{x}$.