Pairing $2n$ real numbers

74 Views Asked by At

Let $\{l_1,l_2,\dots,l_{2n}\}$ be a set of real numbers.

I need to divide those numbers into -$n$- pairs such that the sum of their multiplications (of each pair) will be as maximum as possible.

I know that for $\{1,2,3,4,5,6,7,8\}$ the best pairing is: $(8,7),(6,5),(4,3),(2,1)$ because $8·7+6·5+4·3+2·1$ is the maximal summation in that case.

Is it Kosher to use it for the general case? How do I prove it?

1

There are 1 best solutions below

0
On

It's enough to observe any pairing that includes pairs $(a,b)$ and $(c,d)$ with $a > c > b > d$ is suboptimal: $(a,c)$ and $(b,d)$ would be better. This follows from the rearrangement inequality or, more directly, because $$(ac + bd) - (ab + cd) = a(c-b) + (b-c)d = (a-d)(c-b) > 0.$$

As a consequence, assuming $l_1 \le l_2 \le \dots \le l_{2n}$, you can guarantee that a pairing that includes the pair $(l_{2n-1}, l_{2n})$ must be optimal. (It's not necessarily the only optimal one, but other pairings are never made worse by changing them to put $l_{2n-1}$ and $l_{2n}$ together.) By induction, $$(l_1, l_2),\ (l_3, l_4),\ \dots,\ (l_{2n-1}, l_{2n})$$ is a pairing that maximizes the sum of products of the pairs.

(The general principle in use here is that any globally optimal solution must also be a solution that's not improved by small local changes.)