Subfield: Combinatorics


Question: Let $S=\left\{x_{1}, x_{2}, \ldots, x_{k+\ell}\right\}$ be a $(k+\ell)$-element set of real numbers contained in the interval $[0,1] ; k$ and $\ell$ are positive integers. A $k$-element subset $A \subset S$ is called nice if

$$
\left|\frac{1}{k} \sum_{x_{i} \in A} x_{i}-\frac{1}{\ell} \sum_{x_{j} \in S \backslash A} x_{j}\right| \leq \frac{k+\ell}{2 k \ell}
$$

Prove that the number of nice subsets is at least $\frac{2}{k+\ell}\left(\begin{array}{c}k+\ell \\ k\end{array}\right)$.

Solution:
For a $k$-element subset $A \subset S$, let $f(A)=\frac{1}{k} \sum_{x_{i} \in A} x_{i}-\frac{1}{\ell} \sum_{x_{j} \in S \backslash A} x_{j}$. Denote $\frac{k+\ell}{2 k \ell}=d$. By definition a subset $A$ is nice if $|f(A)| \leq d$.

To each permutation $\left(y_{1}, y_{2}, \ldots, y_{k+\ell}\right)$ of the set $S=\left\{x_{1}, x_{2}, \ldots, x_{k+\ell}\right\}$ we assign $k+\ell$ subsets of $S$ with $k$ elements each, namely $A_{i}=\left\{y_{i}, y_{i+1}, \ldots, y_{i+k-1}\right\}, i=1,2, \ldots, k+\ell$. Indices are taken modulo $k+\ell$ here and henceforth. In other words, if $y_{1}, y_{2}, \ldots, y_{k+\ell}$ are arranged around a circle in this order, the sets in question are all possible blocks of $k$ consecutive elements.

Claim. At least two nice sets are assigned to every permutation of $S$.

Proof. Adjacent sets $A_{i}$ and $A_{i+1}$ differ only by the elements $y_{i}$ and $y_{i+k}, i=1, \ldots, k+\ell$. By the definition of $f$, and because $y_{i}, y_{i+k} \in[0,1]$,

$$
\left|f\left(A_{i+1}\right)-f\left(A_{i}\right)\right|=\left|\left(\frac{1}{k}+\frac{1}{\ell}\right)\left(y_{i+k}-y_{i}\right)\right| \leq \frac{1}{k}+\frac{1}{\ell}=2 d
$$

Each element $y_{i} \in S$ belongs to exactly $k$ of the sets $A_{1}, \ldots, A_{k+\ell}$. Hence in $k$ of the expressions $f\left(A_{1}\right), \ldots, f\left(A_{k+\ell}\right)$ the coefficient of $y_{i}$ is $1 / k$; in the remaining $\ell$ expressions, its coefficient is $-1 / \ell$. So the contribution of $y_{i}$ to the sum of all $f\left(A_{i}\right)$ equals $k \cdot 1 / k-\ell \cdot 1 / \ell=0$. Since this holds for all $i$, it follows that $f\left(A_{1}\right)+\cdots+f\left(A_{k+\ell}\right)=0$.

If $f\left(A_{p}\right)=\min f\left(A_{i}\right), f\left(A_{q}\right)=\max f\left(A_{i}\right)$, we obtain in particular $f\left(A_{p}\right) \leq 0, f\left(A_{q}\right) \geq 0$. Let $p<q$ (the case $p>q$ is analogous; and the claim is true for $p=q$ as $f\left(A_{i}\right)=0$ for all $i$ ).

We are ready to prove that at least two of the sets $A_{1}, \ldots, A_{k+\ell}$ are nice. The interval $[-d, d]$ has length $2 d$, and we saw that adjacent numbers in the circular arrangement $f\left(A_{1}\right), \ldots, f\left(A_{k+\ell}\right)$ differ by at most $2 d$. Suppose that $f\left(A_{p}\right)<-d$ and $f\left(A_{q}\right)>d$. Then one of the numbers $f\left(A_{p+1}\right), \ldots, f\left(A_{q-1}\right)$ lies in $[-d, d]$, and also one of the numbers $f\left(A_{q+1}\right), \ldots, f\left(A_{p-1}\right)$ lies there. Consequently, one of the sets $A_{p+1}, \ldots, A_{q-1}$ is nice, as well as one of the sets $A_{q+1}, \ldots, A_{p-1}$. If $-d \leq f\left(A_{p}\right)$ and $f\left(A_{q}\right) \leq d$ then $A_{p}$ and $A_{q}$ are nice.

Let now $f\left(A_{p}\right)<-d$ and $f\left(A_{q}\right) \leq d$. Then $f\left(A_{p}\right)+f\left(A_{q}\right)<0$, and since $\sum f\left(A_{i}\right)=0$, there is an $r \neq q$ such that $f\left(A_{r}\right)>0$. We have $0<f\left(A_{r}\right) \leq f\left(A_{q}\right) \leq d$, so the sets $f\left(A_{r}\right)$ and $f\left(A_{q}\right)$ are nice. The only case remaining, $-d \leq f\left(A_{p}\right)$ and $d<f\left(A_{q}\right)$, is analogous.

Apply the claim to each of the $(k+\ell)$ ! permutations of $S=\left\{x_{1}, x_{2}, \ldots, x_{k+\ell}\right\}$. This gives at least $2(k+\ell)$ ! nice sets, counted with repetitions: each nice set is counted as many times as there are permutations to which it is assigned.

On the other hand, each $k$-element set $A \subset S$ is assigned to exactly $(k+\ell) k ! \ell$ ! permutations. Indeed, such a permutation $\left(y_{1}, y_{2}, \ldots, y_{k+\ell}\right)$ is determined by three independent choices: an in$\operatorname{dex} i \in\{1,2, \ldots, k+\ell\}$ such that $A=\left\{y_{i}, y_{i+1}, \ldots, y_{i+k-1}\right\}$, a permutation $\left(y_{i}, y_{i+1}, \ldots, y_{i+k-1}\right)$ of the set $A$, and a permutation $\left(y_{i+k}, y_{i+k+1}, \ldots, y_{i-1}\right)$ of the set $S \backslash A$.

In summary, there are at least $\frac{2(k+\ell) !}{(k+\ell) k ! \ell !}=\frac{2}{k+\ell}\left(\begin{array}{c}k+\ell \\ k\end{array}\right)$ nice sets.