# Can I calculate the new standard deviation when adding a value without knowing the original set of values?

I have these three mathematical values that describe an unknown set of values.

• Mean (population mean, not from sample)

$\bar{x} = 3$

• Standard deviation

$s = 1.5$

• Number of elements in population (number of values in original set)

$n = 15$

Now I have another value ($x = 4$) that adds to the unknown group of original values.

Is there a way to calculate the new standard deviation without knowing the original set of values?

You can, but have you to take a small detour. Remember that the standard deviation is the square root of the variance, which is a lot easier to work with: $$s^2 = \frac{1}{N-1} \sum_{i=1}^N (x_i - \bar{x}_N)^2$$

Now suppose we have computed the variance $s_{N-1}^2$ and mean $\bar{x}_{N-1}$ based on N-1 samples, and a new sample $x_N$ arrives and you want to compute $s_N^2$. If you look at the difference in the sums of the squared differences used in the formulas for variance you get something surprisingly simple:

$$(N-1)s_N^2 - (N-2)s_{N-1}^2 = (x_N-\bar{x}_N)(x_N - \bar{x}_{N-1}) \\$$

(See the full derivation)

Therefore the updated variance is $$s_N^2 = \frac{(N-2)s_{N-1}^2 + (x_N-\bar{x}_N)(x_N - \bar{x}_{N-1})}{N-1}$$

and the updated standard deviation would be just the square root. If you want the population variance or standard deviation replace N-1 with N and N-2 with N-1.