What's the best way to evenly distribute this quantity? So the problem is this. I have some quantity $\alpha \in [0,1]$ and a set $X = \{x_{i}\}_{i \in I} \subseteq [0, 1]$ such that $\Sigma_{(i \in I)} x_{i} \geq \alpha$. Now, I want to subtract $\alpha$ from $\Sigma_{(i \in I)} x_{i}$ as 'evenly' as possible, i.e. ideally, I want to take the new quantities $ e_{i} =  x_{i}- \alpha /|I|$ so that I am subtracting an even share of $\alpha$ from each of the $x_{i}$'s.However, I want the new set $E = \{e_{i}\}_{i \in I}$ to satisfy $E \subseteq [0, 1]$ and $\Sigma_{i \in I} e_{i} = (\Sigma_{(i \in I)} x_{i}) - \alpha$. But this isn't guaranteed by the method I suggested, since there might be $i \in I$ such that $x_{i} - \alpha /|I| < 0$, and so $e_{i} \notin [0, 1]$. Is there some nice canonical way to do this that gets around this problem, satisfies the conditions, and tries, as far as possible, to keep the distribution of $- \alpha$ 'even' across all the $x_{i}$'s?
 A: The idea is to choose the decrements $\beta_k$, which sum to $\alpha$, so that the largest of them are all equal and as small as possible.
Let the given numbers in $[0\,,\!\!,\,1]$ be $x_1\leqslant\cdots\leqslant x_n$. Define $$m:=\min\{l\in\Bbb N:x_1+\cdots+x_l+(n-l)x_{l+1}>\alpha\}.$$(Clearly such $m\in\{0,...,n-1\}$ exists, since the condition is satisfied by at least one $l$: namely $l=n-1$.) Now set $\beta_k:=x_k$ ($k=1,...,m$) and  $$\beta_k:=\frac{\alpha-(\beta_1+\cdots+\beta_m)}{n-m}\quad(k=m+1,...,n).$$From the definition of $m$, setting $l=m-1$ gives $$\alpha\geqslant x_1+\cdots+x_{m-1}+(n-m+1)x_m$$ $$=\beta_1+\cdots+\beta_m+(n-m)\beta_m,$$whence $\beta_m\leqslant\beta_{m+1}$. Combining this with other facts about the $\beta_k$ yields $$\beta_1\leqslant\cdots\leqslant\beta_m\leqslant\beta_{m+1}=\cdots=\beta_n.$$Now, for $k=1,...,n,$ we have $$(n-m)(x_k-\beta_k)=\beta_1+\cdots+\beta_m+(n-m)x_k-\alpha$$ $$\geqslant x_1+\cdots+x_m+(n-m)x_{m+1}-\alpha,$$which is positive by the definition of $m$. Hence $\beta_k<x_k$ ($k=m+1,...,n$). Since $\beta_k\leqslant x_k$ for $k=1,...,m$, it follows that $\beta_k\leqslant x_k$ for $k=1,...,n$. Clearly also $\beta_k\geqslant0$ for $k=1,...,n$ since $\beta_1=x_1\geqslant0$. It is further easy to see that $\beta_1+\cdots+\beta_n=\alpha$. Thus the $\beta_k$ satisfy the required conditions for decrements to the $x_k$, and we set $$e_k:=x_k-\beta_k\quad(k=1,...,n).$$ $\qquad$To see that this choice of the $\beta_k$ is optimal, in the sense of having minimal variance, first observe that none of the $\beta_1,...,\beta_m$ can be replaced by larger quantities: only reductions are possible. The most variance-conservative reduction would be a decrement to a $\beta_l$ above the mean $\alpha/n$ that is nearest to $\alpha/n$: say by the replacement of $\beta_l$ with $\beta_l-\epsilon$, where $\epsilon>0$. The most variance-conservative compensation (to maintain $\beta_1+\cdots+\beta_n=\alpha$) would be to increase each of the (equal) $\beta_{m+1},...,\beta_n$ equally by $\epsilon/(n-m)$. Some straightforward algebraic manipulation shows the resulting change in the variance to be $$\frac2n(\beta_{m+1}-\beta_l)\epsilon+\frac{n-m+1}{n(n-m)}\epsilon^2,$$which is positive.
