find new average if removing one element from current average

Hey guys, found an old question that I would like to build on if possible, would appreciate your help.

To piggyback on this old question I found...Is it possible to find calculate a median by removing one number from the current median?

Let's say all you have is the median of a set of numbers (e.g., $= 40$) and the number of observation (e.g., $= 100$), and want to find the new median if one of the observations was removed (e.g., $= 50$)?

Going back and recalculating the median without the focal observation is not an option.

Thanks, J


2 Answers 2


Sure. You have $n$ observations $x_i$ which are sorted. Say $n$ was even, then the median after deleting $x_j$ is the $n/2$th observation among those which are left. This is just the $n/2$th of the original observations if that is less than $j$, otherwise it is the $(n+2)/2$th of the original observations. You can proceed similarly if $n$ was odd.

The tricky aspect here is: if you keep on doing this, when do you actually update the data structure rather than continuing to modify your accessor function?

One difference from the case of the mean is that it actually doesn't really matter what the old median was or even what the removed value was, all that matters is where the removed value was in the sorted sequence.

That said, if all you have is the old median and the deleted observation, then no, you cannot know the new median in general. All you can be sure is that the median could only increase (resp. decrease) if the deleted observation was smaller (resp. larger) than the old median.


No, this is not possible unless there were only 2 numbers to begin with or if there were an even number of numbers to begin with and the number which was removed was the median.

If there were only 2 numbers to begin with, the median is the same as the mean, so you can continue as before.

If there were an even number of numbers and you remove the median, we know that the median was in the list. By definition, the median was the average of the two numbers in the middle of the list, so the median must have been one of those two numbers (or else the median would be the average of two number which were either both greater than the median or both less than the median, depending on where the median was in the list). Then the other number in the middle was also the median, and removing one copy of the median leaves the same number of numbers to the left of the other median as to the right, so the new median is still the median.

To prove it is impossible in any other case, there are 2 cases:

Case 1: There were an odd number of numbers

It is sufficient to show that two lists with a given number of elements, a given median, and a given number to be removed can have different medians after removing the number. Consider the following list where $k$ and $l$ are variables:

median - $k$, median - $k$, $\dots$, median, median + $l$, median + $l$, $\dots$

If the number to be removed was the median, the new median is the average of median-$k$ and median + $l$, and you do not have any information on $k$ and $l$, so this is impossible.

If the number to be removed was greater than the median, choose $l$ so that median+$l$ is that number. The median is now the average of median and median-$k$, and you have no information about $k$, so this is impossible.

A similar analysis shows that it is impossible if the number to be removed was less than the median.

Case 2: There were an even number of numbers, and the number to be removed is not the median

Consider the following list of numbers:

median-$k$, median-$k$, $\dots$, median, median, median + $l$, median + $l$, $\dots$

Doing a similar analysis as to case 1 gives the result.

  • $\begingroup$ I'm not sure I understand what you mean; what requirements for this "updated median function" are you enforcing? Are you only allowed to use the deleted observation and the old median? $\endgroup$
    – Ian
    Commented May 8, 2016 at 21:34
  • $\begingroup$ I am assuming that the only information he has is the old median, the number removed, and the number of terms, because that is the way it was presented in the question. $\endgroup$ Commented May 8, 2016 at 21:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .