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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a set of positive values and I need to increase or decrease this set by adding or reducing number of values. But I would like the mean of values is not altered much.

Example: I have this array {1,1,1,1,1,2,4,4,15,20} size is 10 I need size 8 or 16 (I always need pow of two) so not to alter too, I prefer to delete two values in this array, instead reaching size 16. How I chose this two value ?? The average may change a little bit, but not too.

share|cite|improve this question
If you delete two 4s, the mean will be 5.25, the closest to the original. – Sasha Feb 12 '12 at 20:14
Please retag this question to "Probability-distribution". "Distribution-theory" is meant for generalized functions. – Vobo Feb 12 '12 at 21:29

Let say our set of values is $S=\{a_1,a_2,\dots,a_n\}$. You should look for values $x,y\in S$ such that have closest average to the average of the set: $$\min_{x,y}|\frac{x+y}{2}-\frac{1}{n}\sum_{i=1}^na_i|$$ This is what I mean: the average of $\{1,1,1,1,1,2,4,4,15,20\}$ is 5, so the perfect choice would be such $x,y$ that $\frac{x+y}{2}=5$, in this case we take $4,4$, because any other pair would have average further from 5 than 4

share|cite|improve this answer
thank you julius, you know some algorthm that do this ? My set can have 100 values too, and in this case, I must reach 128, so I add 28 values... – tulkas85 Feb 13 '12 at 16:43
If I remove one value at time, removing value that minimize the change of avarage at each step, and repeat until the size is correct, is this a valid approach ?? – tulkas85 Feb 13 '12 at 17:29

Your Answer


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.