# Is it possible to compute the variance without computing the mean first?

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.

-

## 1 Answer

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.

-
oh, how could I forget this. –  Yrogirg Jan 24 '12 at 17:24
And should have stated from wikipedia en.wikipedia.org/wiki/Algorithms_for_calculating_variance At first I thought it would be impossible and there would be no such algorithm. –  Yrogirg Jan 24 '12 at 18:48