Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I know that the variance formula is $$\sigma^2 = \frac{ \left( x_1 - \bar{x} \right) ^2 + \left( x_2 - \bar{x} \right) ^2 + \dots + \left( x_n - \bar{x} \right) ^2 }{n}$$ Where $\sigma^2$ is the variance; $x_1,\ x_2,\ \dots,\ x_n$ are the statistical data, and $n$ is the number of data.

My question is: how can I expand that formula to get this equivalent one:

$$ \sigma^2 = \frac{x_1^2 + x_2^2 + \dots + x^2_n}{n} -\bar{x}^2$$

?

share|improve this question
    
Hi JnxF. Wellcome to MathStackExchange. I think you may be confusing statistical data $x_1, ...,x_n$ with random variables $X_1,...,X_n$ that have zero correlation $\sigma(X_1,X_2)=0,...,\sigma(X_{n-1},X_{n})=0$. –  Elias Dec 16 '12 at 14:39
    
See wikipedia site (en.wikipedia.org/wiki/Covariance) for more information about correlation. –  Elias Dec 16 '12 at 14:41
    
Thanks, but I have not much "mathematical level", I'm doing high school, and, by the moment, I don't know so much statistic. –  JnxF Dec 16 '12 at 14:42
add comment

3 Answers

up vote 2 down vote accepted

Each of the $(x_i - \bar x)^2$ terms expands into $x_i^2 - 2x_i\bar x + \bar x^2$.

Since the sum of all $x_i$ is also equal to $n \bar x$ (by definition), we get that the sum of all the $2x_i\bar x$ is actually $2n\bar x^2$.

Then, the equation becomes: $\displaystyle \sigma^2 = \frac{x_1^2 + x_2^2 + \cdots + x_n^2 - 2n\bar x^2 + n\bar x^2}{n}$

which is $\displaystyle \frac{x_1^2 + x_2^2 + \cdots + x_n^2 - n\bar x^2}{n}$ or $\displaystyle \frac{x_1^2 + x_2^2 + \cdots + x_n^2}{n} - \bar x^2$, as required

share|improve this answer
    
Thanks, really clear explanation. –  JnxF Dec 16 '12 at 14:37
    
The same trick works for finding the expected value of X^3, X^4, etc. as well. –  Joe Z. Dec 25 '12 at 16:08
    
Sorry, I don't understand you. Can you explain it a bit more, please? Do you want to mean that is also possible to expand $(x_i - \bar{x})^n$ for any integer? –  JnxF Dec 25 '12 at 21:35
    
Yes, and the result will still be $(x_1^k + x_2^k + \cdots + x_n^k)/n - \bar x^k$. –  Joe Z. Dec 25 '12 at 23:07
add comment

Since $$\bar{x}=\frac1n\sum_{i=1}^nx_i$$ we have that $$ \begin{align} \sigma^2 &= \frac{1}{n}\sum_{i=1}^n \left( x_i - \bar{x} \right) ^2\\ &=\frac1n\sum_{i=1}^nx_i^2-2x_i\bar{x}+\bar{x}^2\\ &=\frac1n\sum_{i=1}^nx_i^2-2\bar{x}\frac1n\sum_{i=1}^nx_i+\frac1n\sum_{i=1}^n\bar{x}^2\\ &=\frac1n\sum_{i=1}^nx_i^2-2\bar{x}\bar{x}+\frac nn\bar{x}^2\\ &=\frac1n\sum_{i=1}^nx_i^2-\bar{x}^2 \end{align} $$

share|improve this answer
1  
I hope you don't mind that I edited your answer to use the align environment to, in my opinion, improve readability. –  robjohn Dec 16 '12 at 14:50
    
@robjohn No problem mr. robjohn. It is much better now –  Nameless Dec 16 '12 at 14:51
add comment

Expand square terms and use the definition $\bar{x} = (x_1 + x_2 + .. + x_n)/n$

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.