A student is playing computer. Computer shows randomly 2002 positive numbers. Game's rules let do the following operations - to take 2 numbers from these, to double first one, to add the second one and to save the sum. - to take another 2 numbers from the remainder numbers, to double the first one, to add the second one, to multiply this sum with previous and to save the result. - to repeat this procedure, until all the 2002 numbers won't be used. Student wins the game if final product is maximum possible. Find the winning strategy and prove it.
Problem
Source: JBMO Shortlist 2002
Tags: combinatorics proposed, combinatorics
22.10.2013 20:50
The question can be translated to: Given $a_1,a_2,\dots,a_{2n}$, find the permutation $b_1,b_2,\dots,b_{2n}$ for which the product $P=(2b_1+b_{n+1})(2b_2+b_{n+2})\dots(2b_{n}+b_{2n})$ is maximal. We will use a switching algorithm. First, observe that if $b_k\le b_{k+n}$ ($k\in\{1,2,\dots,n\}$), then $2b_k+b_{k+n}\le 2b_{k+n}+b_k$, so switching the two yields a larger $P$. We can keep performing this operation until we get $x\ge y$ for all $x\in\{b_1,b_2,\dots,b_n\}$ and $y\in\{b_{n+1},b_{n+2},\dots,b_{2n}$. After this, we should investigate what happens when we switch $b_k$ for $b_\ell$ ($k,\ell\in\{1,2,\dots,n\}$,$k\neq \ell$). The product $P$ after this switch becomes $P'$, so $\frac{P'}P=\frac{(2b_\ell+b_{k+n})(2b_k+b_{\ell+n})}{(2b_k+b_{k+n})(2b_\ell+b_{\ell+n})}$. This increases $P$ iff $(2b_\ell+b_{k+n})(2b_k+b_{\ell+n})\ge (2b_k+b_{k+n})(2b_\ell+b_{\ell+n})$, which is equivalent to $b_\ell b_{\ell+n}+b_{k+n} b_k\ge b_k b_{\ell+n}+b_{k+n}b_\ell$, factoring to $(b_\ell-b_k)(b_{\ell+n}-b_{k+n})\ge0$. From here we can see that the maximal $P$ is taken when sequences $b_1,b_2,\dots,b_n$ and $b_{1+n},b_{2+n},\dots,b_{n+n}$ are oppositely sorted, and the first sequence is larger than the latter. Indeed, if this doesn't hold, we can always conduct a switch described above.
25.02.2021 20:59
Could someone explain what does "..to take 2 numbers from these, to double first one, to add the second one and to save the sum." mean?!
25.02.2021 21:28
randomusername wrote: The question can be translated to: Given $a_1,a_2,\dots,a_{2n}$, find the permutation $b_1,b_2,\dots,b_{2n}$ for which the product $P=(2b_1+b_{n+1})(2b_2+b_{n+2})\dots(2b_{n}+b_{2n})$ is maximal. We will use a switching algorithm. First, observe that if $b_k\le b_{k+n}$ ($k\in\{1,2,\dots,n\}$), then $2b_k+b_{k+n}\le 2b_{k+n}+b_k$, so switching the two yields a larger $P$. We can keep performing this operation until we get $x\ge y$ for all $x\in\{b_1,b_2,\dots,b_n\}$ and $y\in\{b_{n+1},b_{n+2},\dots,b_{2n}$. After this, we should investigate what happens when we switch $b_k$ for $b_\ell$ ($k,\ell\in\{1,2,\dots,n\}$,$k\neq \ell$). The product $P$ after this switch becomes $P'$, so $\frac{P'}P=\frac{(2b_\ell+b_{k+n})(2b_k+b_{\ell+n})}{(2b_k+b_{k+n})(2b_\ell+b_{\ell+n})}$. This increases $P$ iff $(2b_\ell+b_{k+n})(2b_k+b_{\ell+n})\ge (2b_k+b_{k+n})(2b_\ell+b_{\ell+n})$, which is equivalent to $b_\ell b_{\ell+n}+b_{k+n} b_k\ge b_k b_{\ell+n}+b_{k+n}b_\ell$, factoring to $(b_\ell-b_k)(b_{\ell+n}-b_{k+n})\ge0$. From here we can see that the maximal $P$ is taken when sequences $b_1,b_2,\dots,b_n$ and $b_{1+n},b_{2+n},\dots,b_{n+n}$ are oppositely sorted, and the first sequence is larger than the latter. Indeed, if this doesn't hold, we can always conduct a switch described above. Do we also switch $b_i$ with $b_{n+j}$ where $i$ is not equal to $j$?
25.02.2021 21:31
randomusername wrote: The question can be translated to: Given $a_1,a_2,\dots,a_{2n}$, find the permutation $b_1,b_2,\dots,b_{2n}$ for which the product $P=(2b_1+b_{n+1})(2b_2+b_{n+2})\dots(2b_{n}+b_{2n})$ is maximal. We will use a switching algorithm. First, observe that if $b_k\le b_{k+n}$ ($k\in\{1,2,\dots,n\}$), then $2b_k+b_{k+n}\le 2b_{k+n}+b_k$, so switching the two yields a larger $P$. We can keep performing this operation until we get $x\ge y$ for all $x\in\{b_1,b_2,\dots,b_n\}$ and $y\in\{b_{n+1},b_{n+2},\dots,b_{2n}$. After this, we should investigate what happens when we switch $b_k$ for $b_\ell$ ($k,\ell\in\{1,2,\dots,n\}$,$k\neq \ell$). The product $P$ after this switch becomes $P'$, so $\frac{P'}P=\frac{(2b_\ell+b_{k+n})(2b_k+b_{\ell+n})}{(2b_k+b_{k+n})(2b_\ell+b_{\ell+n})}$. This increases $P$ iff $(2b_\ell+b_{k+n})(2b_k+b_{\ell+n})\ge (2b_k+b_{k+n})(2b_\ell+b_{\ell+n})$, which is equivalent to $b_\ell b_{\ell+n}+b_{k+n} b_k\ge b_k b_{\ell+n}+b_{k+n}b_\ell$, factoring to $(b_\ell-b_k)(b_{\ell+n}-b_{k+n})\ge0$. From here we can see that the maximal $P$ is taken when sequences $b_1,b_2,\dots,b_n$ and $b_{1+n},b_{2+n},\dots,b_{n+n}$ are oppositely sorted, and the first sequence is larger than the latter. Indeed, if this doesn't hold, we can always conduct a switch described above. Moreover, what do you mean by "oppositely sorted'? One of them increasing the other one decreasing, or vice versa?
28.05.2021 03:19
@Arslan, yes that is what "oppositely sorted" means. In this question, it should be clear that the "vice versa" part does not matter. WLOG suppose that this set of numbers $\{a_n\}$ obeys the following: $a_1 \geq a_2 \geq ... \geq a_{2002}$. Claim: The numbers that are doubled are precisely the largest 1001 numbers in $\{a_n\}$. Proof: Suppose by contradiction that the maximal product $P$ has a doubled number $a_i$ not in $\{a_1, a_2, ..., a_{1001}\}$. In $P$, there exists two factors $(2a_i+a_j)$ and $(2a_k+a_l)$. For the sake of maximality, $a_j$ must be less than or equal to $a_i$, otherwise switching the two numbers would yield a larger product. By the pigeonhole principle, there exist numbers $a_k, a_l$ where $a_k, a_l \in \{a_1, a_2, ..., a_{1001}\}$. So $P = (2a_i+a_j)(2a_k+a_l)K = (4a_i a_k + 2a_i a_l + 2a_j a_k + a_j a_l)K$. Define $Q = (2a_l+a_j)(2a_k+a_i)K = (4a_k a_l + 2a_i a_l + 2a_j a_k + a_i a_j)K$. It is clear that $Q > P$ and $P$ is not the largest product; contradiction. Thus, the largest product cannot have any doubled numbers that are not from the set $\{a_1, a_2, ..., a_{1001}\}$, and the claim is proven. Claim: For the maximal product $P=(2a_1+b_1)(2a_2+b_2)...(2a_{1001}+b_{1001})$, we have that $b_1\leq b_2 \leq ... \leq b_{1001}$. That is, $a_1, a_2,...,a_{1001}$ is oppositely ordered from the sequence $b_1,b_2,...,b_{1001}$. Proof: Suppose that there exists two indices $i, j$ such that $a_i > a_j$ and $b_i > b_j$. Rewrite $P$ as $(2a_i+b_i)(2a_j+b_j)K=(4a_i a_j + 2a_i b_j + 2a_j b_i + b_i b_j)K$. Define $Q = (2a_i+b_j)(2a_j+b_i)K = (4a_i a_j + 2a_i b_i + 2a_j b_j + b_i b_j)K$. Clearly, similarly sorted sequences imply that $Q > P$, so there is once again a contradiction. Therefore the maximal product must not have $b_i > b_j$ and $i > j$ for any pairs $(i,j)$. This forces $b_1 \leq b_2 \leq ... \leq b_{1001}$, and so the largest possible answer is $P=(2a_1+a_{2002})(2a_2+a_{2001})...(2a_{1001}+a_{1002})$.