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.

Say I have 100 numbers that are averaged:

number of values = 100
total sum of values = 2000
mean = 2000 / 100 => 20

If I want to add a value and find out the new average:

total sum of values = 2000 + 100
mean = 2100 / 101 => 20.79

If I want to subtract a value and find out the new average:

total sum of values = 2100 - 100
mean = 2000 / 100 => 20

It seems to work, but is the above correct?

Is this the proper way to add/subtract values from a average without having to re-sum all the 100 numbers first?

share|improve this question
add comment

1 Answer 1

up vote 7 down vote accepted

$s=\frac{a_1+...+a_n}{n}$.

If you want the average of $a_1,...,a_n$ and $a_{n+1}$, then $s'=\frac{a_1+...+a_n+a_{n+1}}{n+1}=\frac{ns+a_{n+1}}{n+1}$.

If you want the average of $a_1,...,a_{n-1}$ then $s''=\frac{a_1+...+a_{n-1}}{n-1}=\frac{ns-a_n}{n-1}$.

share|improve this answer
    
And $ns$ is the old sum, as you can derive from the first equation. –  Ross Millikan Feb 16 '11 at 13:21
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.