Given a sequence of real numbers , standard deviation of the sequence is

where

is the average of all the given values. At first site, a person might think that he or she has to compute the average first, after which he or she has to do another pass in order to compute that funky sum, divide it by and take the square root of it. This is, however, not quite true, and that’s why:

So, whenever computing standard deviation, just keep two sums: one for each value and another one for each . As soon as you have them, return

Advertisements