Sign up ×
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 have a list of values of a random variable $x \in \mathbb R$. Is it possible to find the varience $\overline{(x - \overline x)^2}$ without computing the mean $\overline x$ first? That is to process the list only once.

share|cite|improve this question

1 Answer 1

up vote 2 down vote accepted

You can use that the variance is $\overline{x^2} - \overline {x}^2$, which takes only one pass (computing the mean and the mean of the squares simultaneously), but can be more prone to roundoff error if the variance is small compared with the mean.

share|cite|improve this answer
oh, how could I forget this. – Yrogirg Jan 24 '12 at 17:24
And should have stated from wikipedia At first I thought it would be impossible and there would be no such algorithm. – Yrogirg Jan 24 '12 at 18:48

Your Answer


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.