# A Rearrangement Inequality

Given the function $$f(x) = \prod_{i=1}^k x_i \prod_{j=k+1}^n (1-x_j) + \prod_{i=1}^k (1-x_i) \prod_{j=k+1}^n x_j$$ with $$\frac{1}{2} < x_i < 1$$ and $$k > \frac{n}{2}$$, I wish to produce a rearrangement inequality. It seems pretty intuitive that you'd want all the largest $$x_i$$ to be in places $$\left\{1, \ldots, k\right\}$$. In other words:

Given the numbers $$a_1 \geq a_2 \geq \dots \geq a_n$$, with $$\frac{1}{2} < a_i < 1$$ prove that $$f(a_1,a_2,\dots ,a_n) \geq f(a_{\sigma(1)},a_{\sigma(2)},\dots ,a_{\sigma(n)})$$ for any permutation $$\sigma$$.

Let $$(x_1,\dots, x_n)$$ be a permutation of $$(a_1,\dots, a_n)$$. Then
$$f(x) \prod_{i=1}^n \frac 1{a_i} = f(x) \prod_{i=1}^n\frac 1{x_i}= \prod_{j=k+1}^n \left(\frac 1{x_j}-1\right) + \prod_{i=1}^k\left(\frac 1{x_i}-1\right)=\prod_{j=k+1}^n y_j + \prod_{i=1}^k y_i,$$
where $$y_i=\frac 1{x_i}-1$$ for each $$i$$, so $$0. Put $$\prod_{j=k+1}^n y_j=B$$ and $$\prod_{i=1}^k y_i=A$$. Since $$AB= \prod_{i=1}^n \left(\frac 1{a_i}-1\right)=\operatorname{const}$$, sum $$A+B$$ is maximal when one of the summand achieves the smallest possible value. Since $$k>\frac n2$$ this holds when the numbers $$\{y_1,\dots, y_k\}$$ are the smallest $$y_i$$’s, that is iff the numbers $$\{x_1,\dots, x_k\}$$ are the largest $$a_i$$’s.