Subfield: Algebra


Question: Let $n \geqslant 3$ be a positive integer and let $\left(a_{1}, a_{2}, \ldots, a_{n}\right)$ be a strictly increasing sequence of $n$ positive real numbers with sum equal to 2 . Let $X$ be a subset of $\{1,2, \ldots, n\}$ such that the value of

$$
\left|1-\sum_{i \in X} a_{i}\right|
$$

is minimised. Prove that there exists a strictly increasing sequence of $n$ positive real numbers $\left(b_{1}, b_{2}, \ldots, b_{n}\right)$ with sum equal to 2 such that

$$
\sum_{i \in X} b_{i}=1
$$

Solution:
we say an index set $X$ is $\left(a_{i}\right)$-minimising if it has the property in the problem for the given sequence $\left(a_{i}\right)$. Write $X^{c}$ for the complement of $X$, and $[a, b]$ for the interval of integers $k$ such that $a \leqslant k \leqslant b$. Note that

$$
\left|1-\sum_{i \in X} a_{i}\right|=\left|1-\sum_{i \in X^{c}} a_{i}\right|
$$

so we may exchange $X$ and $X^{c}$ where convenient. Let

$$
\Delta=\sum_{i \in X^{c}} a_{i}-\sum_{i \in X} a_{i}
$$

and note that $X$ is $\left(a_{i}\right)$-minimising if and only if it minimises $|\Delta|$, and that $\sum_{i \in X} a_{i}=1$ if and only if $\Delta=0$.

If we have a strictly increasing sequence of positive real numbers $c_{i}$ (typically obtained by perturbing the $a_{i}$ in some way) such that

$$
\sum_{i \in X} c_{i}=\sum_{i \in X^{c}} c_{i}
$$

then we may put $b_{i}=2 c_{i} / \sum_{j=1}^{n} c_{j}$. So it suffices to construct such a sequence without needing its sum to be 2 .


Without loss of generality, assume $\sum_{i \in X} a_{i} \leqslant 1$, and we may assume strict inequality as otherwise $b_{i}=a_{i}$ works. Also, $X$ clearly cannot be empty.

If $n \in X$, add $\Delta$ to $a_{n}$, producing a sequence of $c_{i}$ with $\sum_{i \in X} c_{i}=\sum_{i \in X^{c}} c_{i}$, and then scale as described above to make the sum equal to 2 . Otherwise, there is some $k$ with $k \in X$ and $k+1 \in X^{c}$. Let $\delta=a_{k+1}-a_{k}$.

- If $\delta>\Delta$, add $\Delta$ to $a_{k}$ and then scale.
- If $\delta<\Delta$, then considering $X \cup\{k+1\} \backslash\{k\}$ contradicts $X$ being $\left(a_{i}\right)$-minimising.
- If $\delta=\Delta$, choose any $j \neq k, k+1$ (possible since $n \geqslant 3$ ), and any $\epsilon$ less than the least of $a_{1}$ and all the differences $a_{i+1}-a_{i}$. If $j \in X$ then add $\Delta-\epsilon$ to $a_{k}$ and $\epsilon$ to $a_{j}$, then scale; otherwise, add $\Delta$ to $a_{k}$ and $\epsilon / 2$ to $a_{k+1}$, and subtract $\epsilon / 2$ from $a_{j}$, then scale.
we say an index set $X$ is $\left(a_{i}\right)$-minimising if it has the property in the problem for the given sequence $\left(a_{i}\right)$. Write $X^{c}$ for the complement of $X$, and $[a, b]$ for the interval of integers $k$ such that $a \leqslant k \leqslant b$. Note that

$$
\left|1-\sum_{i \in X} a_{i}\right|=\left|1-\sum_{i \in X^{c}} a_{i}\right|
$$

so we may exchange $X$ and $X^{c}$ where convenient. Let

$$
\Delta=\sum_{i \in X^{c}} a_{i}-\sum_{i \in X} a_{i}
$$

and note that $X$ is $\left(a_{i}\right)$-minimising if and only if it minimises $|\Delta|$, and that $\sum_{i \in X} a_{i}=1$ if and only if $\Delta=0$.

If we have a strictly increasing sequence of positive real numbers $c_{i}$ (typically obtained by perturbing the $a_{i}$ in some way) such that

$$
\sum_{i \in X} c_{i}=\sum_{i \in X^{c}} c_{i}
$$

then we may put $b_{i}=2 c_{i} / \sum_{j=1}^{n} c_{j}$. So it suffices to construct such a sequence without needing its sum to be 2 .

without loss of generality, assume $\sum_{i \in X} a_{i}<1$.

Suppose there exists $1 \leqslant j \leqslant n-1$ such that $j \in X$ but $j+1 \in X^{c}$. Then $a_{j+1}-a_{j} \geqslant \Delta$, because otherwise considering $X \cup\{j+1\} \backslash\{j\}$ contradicts $X$ being $\left(a_{i}\right)$-minimising.

If $a_{j+1}-a_{j}>\Delta$, put

$$
b_{i}= \begin{cases}a_{j}+\Delta / 2, & \text { if } i=j \\ a_{j+1}-\Delta / 2, & \text { if } i=j+1 \\ a_{i}, & \text { otherwise }\end{cases}
$$

If $a_{j+1}-a_{j}=\Delta$, choose any $\epsilon$ less than the least of $\Delta / 2, a_{1}$ and all the differences $a_{i+1}-a_{i}$. If $|X| \geqslant 2$, choose $k \in X$ with $k \neq j$, and put

$$
b_{i}= \begin{cases}a_{j}+\Delta / 2-\epsilon, & \text { if } i=j \\ a_{j+1}-\Delta / 2, & \text { if } i=j+1 \\ a_{k}+\epsilon, & \text { if } i=k \\ a_{i}, & \text { otherwise. }\end{cases}
$$

Otherwise, $\left|X^{c}\right| \geqslant 2$, so choose $k \in X^{c}$ with $k \neq j+1$, and put

$$
b_{i}= \begin{cases}a_{j}+\Delta / 2, & \text { if } i=j \\ a_{j+1}-\Delta / 2+\epsilon, & \text { if } i=j+1 \\ a_{k}-\epsilon, & \text { if } i=k ; \\ a_{i}, & \text { otherwise }\end{cases}
$$

If there is no $1 \leqslant j \leqslant n$ such that $j \in X$ but $j+1 \in X^{c}$, there must be some $1<k \leqslant n$ such that $X=[k, n]$ (certainly $X$ cannot be empty). We must have $a_{1}>\Delta$, as otherwise considering $X \cup\{1\}$ contradicts $X$ being $\left(a_{i}\right)$-minimising. Now put

$$
b_{i}= \begin{cases}a_{1}-\Delta / 2, & \text { if } i=1 \\ a_{n}+\Delta / 2, & \text { if } i=n \\ a_{i}, & \text { otherwise }\end{cases}
$$
we say an index set $X$ is $\left(a_{i}\right)$-minimising if it has the property in the problem for the given sequence $\left(a_{i}\right)$. Write $X^{c}$ for the complement of $X$, and $[a, b]$ for the interval of integers $k$ such that $a \leqslant k \leqslant b$. Note that

$$
\left|1-\sum_{i \in X} a_{i}\right|=\left|1-\sum_{i \in X^{c}} a_{i}\right|
$$

so we may exchange $X$ and $X^{c}$ where convenient. Let

$$
\Delta=\sum_{i \in X^{c}} a_{i}-\sum_{i \in X} a_{i}
$$

and note that $X$ is $\left(a_{i}\right)$-minimising if and only if it minimises $|\Delta|$, and that $\sum_{i \in X} a_{i}=1$ if and only if $\Delta=0$.

If we have a strictly increasing sequence of positive real numbers $c_{i}$ (typically obtained by perturbing the $a_{i}$ in some way) such that

$$
\sum_{i \in X} c_{i}=\sum_{i \in X^{c}} c_{i}
$$

then we may put $b_{i}=2 c_{i} / \sum_{j=1}^{n} c_{j}$. So it suffices to construct such a sequence without needing its sum to be 2 .


Without loss of generality, assume $\sum_{i \in X} a_{i} \leqslant 1$, so $\Delta \geqslant 0$. If $\Delta=0$ we can take $b_{i}=a_{i}$, so now assume that $\Delta>0$.

Suppose that there is some $k \leqslant n$ such that $|X \cap[k, n]|>\left|X^{c} \cap[k, n]\right|$. If we choose the largest such $k$ then $|X \cap[k, n]|-\left|X^{c} \cap[k, n]\right|=1$. We can now find the required sequence $\left(b_{i}\right)$ by starting with $c_{i}=a_{i}$ for $i<k$ and $c_{i}=a_{i}+\Delta$ for $i \geqslant k$, and then scaling as described above.

If no such $k$ exists, we will derive a contradiction. For each $i \in X$ we can choose $i<j_{i} \leqslant n$ in such a way that $j_{i} \in X^{c}$ and all the $j_{i}$ are different. (For instance, note that necessarily $n \in X^{c}$ and now just work downwards; each time an $i \in X$ is considered, let $j_{i}$ be the least element of $X^{c}$ greater than $i$ and not yet used.) Let $Y$ be the (possibly empty) subset of $[1, n]$ consisting of those elements in $X^{c}$ that are also not one of the $j_{i}$. In any case

$$
\Delta=\sum_{i \in X}\left(a_{j_{i}}-a_{i}\right)+\sum_{j \in Y} a_{j}
$$

where each term in the sums is positive. Since $n \geqslant 3$ the total number of terms above is at least two. Take a least such term and its corresponding index $i$ and consider the set $Z$ which we form from $X$ by removing $i$ and adding $j_{i}$ (if it is a term of the first type) or just by adding $j$ if it is a term of the second type. The corresponding expression of $\Delta$ for $Z$ has the sign of its least term changed, meaning that the sum is still nonnegative but strictly less than $\Delta$, which contradicts $X$ being $\left(a_{i}\right)$-minimising.
we say an index set $X$ is $\left(a_{i}\right)$-minimising if it has the property in the problem for the given sequence $\left(a_{i}\right)$. Write $X^{c}$ for the complement of $X$, and $[a, b]$ for the interval of integers $k$ such that $a \leqslant k \leqslant b$. Note that

$$
\left|1-\sum_{i \in X} a_{i}\right|=\left|1-\sum_{i \in X^{c}} a_{i}\right|
$$

so we may exchange $X$ and $X^{c}$ where convenient. Let

$$
\Delta=\sum_{i \in X^{c}} a_{i}-\sum_{i \in X} a_{i}
$$

and note that $X$ is $\left(a_{i}\right)$-minimising if and only if it minimises $|\Delta|$, and that $\sum_{i \in X} a_{i}=1$ if and only if $\Delta=0$.

If we have a strictly increasing sequence of positive real numbers $c_{i}$ (typically obtained by perturbing the $a_{i}$ in some way) such that

$$
\sum_{i \in X} c_{i}=\sum_{i \in X^{c}} c_{i}
$$

then we may put $b_{i}=2 c_{i} / \sum_{j=1}^{n} c_{j}$. So it suffices to construct such a sequence without needing its sum to be 2 .


we describes properties of the index sets $X$ that are sufficient to describe a corresponding sequence $\left(b_{i}\right)$ that is not derived from $\left(a_{i}\right)$.

Note that, for two subsets $X, Y$ of $[1, n]$, the following are equivalent:

- $|X \cap[i, n]| \leqslant|Y \cap[i, n]|$ for all $1 \leqslant i \leqslant n$;
- $Y$ is at least as large as $X$, and for all $1 \leqslant j \leqslant|Y|$, the $j^{\text {th }}$ largest element of $Y$ is at least as big as the $j^{\text {th }}$ largest element of $X$;
- there is an injective function $f: X \rightarrow Y$ such that $f(i) \geqslant i$ for all $i \in X$.

If these equivalent conditions are satisfied, we write $X \leq Y$. We write $X<Y$ if $X \leq Y$ and $X \neq Y$.

Note that if $X<Y$, then $\sum_{i \in X} a_{i}<\sum_{i \in Y} a_{i}$ (the second description above makes this clear).

We claim first that, if $n \geqslant 3$ and $X<X^{c}$, then there exists $Y$ with $X<Y<X^{c}$. Indeed, as $|X| \leqslant\left|X^{c}\right|$, we have $\left|X^{c}\right| \geqslant 2$. Define $Y$ to consist of the largest element of $X^{c}$, together with all but the largest element of $X$; it is clear both that $Y$ is distinct from $X$ and $X^{c}$, and that $X \leq Y \leq X^{c}$, which is what we need.

But, in this situation, we have

$$
\sum_{i \in X} a_{i}<\sum_{i \in Y} a_{i}<\sum_{i \in X^{c}} a_{i} \quad \text { and } \quad 1-\sum_{i \in X} a_{i}=-\left(1-\sum_{i \in X^{c}} a_{i}\right)
$$

so $\left|1-\sum_{i \in Y} a_{i}\right|<\left|1-\sum_{i \in X} a_{i}\right|$.

Hence if $X$ is $\left(a_{i}\right)$-minimising, we do not have $X<X^{c}$, and similarly we do not have $X^{c}<X$.

Considering the first description above, this immediately implies the following Claim.

Claim. There exist $1 \leqslant k, \ell \leqslant n$ such that $|X \cap[k, n]|>\frac{n-k+1}{2}$ and $|X \cap[\ell, n]|<\frac{n-\ell+1}{2}$.

We now construct our sequence $\left(b_{i}\right)$ using this claim. Let $k$ and $\ell$ be the greatest values satisfying the claim, and without loss of generality suppose $k=n$ and $\ell<n$ (otherwise replace $X$ by its complement). As $\ell$ is maximal, $n-\ell$ is even and $|X \cap[\ell, n]|=\frac{n-\ell}{2}$. For sufficiently small positive $\epsilon$, we take

$$
b_{i}=i \epsilon+ \begin{cases}0, & \text { if } i<\ell \\ \delta, & \text { if } \ell \leqslant i \leqslant n-1 \\ \gamma, & \text { if } i=n\end{cases}
$$

Let $M=\sum_{i \in X} i$. So we require

$$
M \epsilon+\left(\frac{n-\ell}{2}-1\right) \delta+\gamma=1
$$

and

$$
\frac{n(n+1)}{2} \epsilon+(n-\ell) \delta+\gamma=2
$$

These give

$$
\gamma=2 \delta+\left(\frac{n(n+1)}{2}-2 M\right) \epsilon
$$

and for sufficiently small positive $\epsilon$, solving for $\gamma$ and $\delta$ gives $0<\delta<\gamma$ (since $\epsilon=0$ gives $\delta=1 /\left(\frac{n-\ell}{2}+1\right)$ and $\left.\gamma=2 \delta\right)$, so the sequence is strictly increasing and has positive values.