# changing values ​​in a distribution without changing the average

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.

-
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