# Sample variance

Given the following data: $102, 40, 27, 108, 124, 113, 143, 100, 115, 128$

If $\sum_{i=1}^{10} X^2 = 112600$, what is the sample variance?

The correct answer is $1400$.

However, when I tried calculating in Excel, I got an answer of $34,047,397$.

I took each $X$ value, squared it, subtracted the mean of $112,600$, took the difference and squared that, summed it, and then divided by $10$ terms.

I also tried using a chi-squared variance of $2v=20$, but that didn't match the answer either.

Can someone please point me in the right direction?

• Hi castielle and welcome to the site! The sample variance is defined as $s^2=\frac{1}{n-1}\sum_{i=1}^{n}(x_{i}-\bar{x})^2$. So you have to square the value after you subtracted the mean (which equals $100$ in this case). In Excel, you can use the function VAR.S to calculate the sample variance. Alternatively, you could make use of the following relationship: $\mathrm{Var}(X)=\mathrm{E}(X^2)-\mathrm{E}(X)^2$. – COOLSerdash Feb 16 '14 at 9:40
• @COOLSerdash: In my answer below, I have expanded a little bit on your comment to highlight the fact that the sample variance requires division by $n-1$, not explicitly seen form $Va(X) = E(X^2) - E(X)^2$. – ocram Feb 16 '14 at 9:56

The sample variance is calculated as $$s^2 = \frac{1}{n-1} \sum_{i=1}^n (x_i - \bar{x})^2$$ with $\bar{x}$ the sample mean, $$\bar{x} = \frac{1}{n}\sum_{i=1}^n x_i$$ A little of algebra (essentially expanding the square, distributing the sum, and noting that $\sum_i x_i = n \bar{x}$) gives $$s^2 = \frac{1}{n-1} \left[ \left(\sum_{i=1}^n x_i^2\right) - n \bar{x}^2 \right]$$
$s^2 = 1400$ is the correct answer.