Maths Olympiad Prep

Library / HMIC /21 of 22

HMIC, 2021

Combinatorics Difficulty 5.9 AIME, harder Prove it United States

Problem:

Let nn be a positive integer. Alice writes nn real numbers a1,a2,…,ana_{1}, a_{2}, \ldots, a_{n} in a line (in that order). Every move, she picks one number and replaces it with the average of itself and its neighbors (that is, ana_{n} is not a neighbor of a1a_{1}, nor vice versa). A number changes sign if it changes from being nonnegative to negative or vice versa. In terms of nn, determine the maximum number of times that a1a_{1} can change sign, across all possible values of a1,a2,…,ana_{1}, a_{2}, \ldots, a_{n} and all possible sequences of moves Alice may make.

Solution

Solution:

The maximum number is n−1n-1. We first prove the upper bound. For simplicity, color all negative numbers red, and all non-negative numbers blue. Let XX be the number of color changes among adjacent elements (i.e. pairs of adjacent elements with different colors). It is clear that the following two statements are true:
(1) When a1a_{1} changes sign, XX decreases by 1. If a1a_{1} changes from negative (red) to non-negative (blue), a2a_{2} must have been non-negative (blue), so the first two colors changed from RBR B to BBB B. The same applies when a1a_{1} changes from non-negative to negative.
(2) XX cannot increase after a move. Suppose Alice picks aia_{i} for her move where 1≤i≤n1 \leq i \leq n. If aia_{i} does not change sign, then XX clearly remains the same. Else, if aia_{i} changes sign and i=1i=1 or nn, then XX decreases by 1 (from (1)). Finally, if aia_{i} changes sign and i≠1,ni \neq 1, n, we have two cases:

Case 1: ai−1,ai+1a_{i-1}, a_{i+1} are of the same color. If they are both negative (red), then if aia_{i} changes color, it must be from non-negative to negative (blue to red). Thus, the colors change from RBRR B R to RRRR R R and XX decreases by 2. The same holds if both ai−1,ai+1a_{i-1}, a_{i+1} are non-negative.

Case 2: ai−1,ai+1a_{i-1}, a_{i+1} are of different colors. No matter what the color of aia_{i} is, there is exactly one color change among the three numbers, so XX will remain the same.

Now, since the initial value of XX is at most n−1n-1, it can decrease by 1 at most n−1n-1 times. Hence, a1a_{1} can change signs at most n−1n-1 times.

Now we prove the lower bound by constructing such a sequence inductively. Specifically, we induct on the following statement:
For every n≥2n \geq 2, there exists a sequence a1,a2,⋯ ,ana_{1}, a_{2}, \cdots, a_{n} such that by picking
a1,a2,a1,a3,a2,a1,⋯ ,an−1,an−2,⋯ ,a2,a1 a_{1}, a_{2}, a_{1}, a_{3}, a_{2}, a_{1}, \cdots, a_{n-1}, a_{n-2}, \cdots, a_{2}, a_{1}
in that order, a1a_{1} changes sign n−1n-1 times.

When n=2n=2, we can let a1a_{1} change sign once by starting with the sequence (1,−3)(1,-3), and picking a1a_{1} to obtain (−1,−3)(-1,-3), which satisfies the conditions in our statement.

Suppose we have proven the statement for n−1n-1. For nn, let a1,a2,⋯ ,an−1a_{1}, a_{2}, \cdots, a_{n-1} be as defined in our construction for n−1n-1 (we shall fix the value of ana_{n} later). After executing the steps a1,a2,a1,a3,a2,a1,⋯ ,an−2,an−3,⋯ ,a2,a1a_{1}, a_{2}, a_{1}, a_{3}, a_{2}, a_{1}, \cdots, a_{n-2}, a_{n-3}, \cdots, a_{2}, a_{1}, a1a_{1} would have changed sign n−2n-2 times.

It now remains to pick an−1,an−2,⋯ ,a2,a1a_{n-1}, a_{n-2}, \cdots, a_{2}, a_{1} in order so that a1a_{1} changes sign one more time. This is always possible as long as ana_{n} is sufficiently large in magnitude and of the opposite sign as a1a_{1}. Since the value of ana_{n} has remained unchanged since the start (as we have not picked ana_{n} at all), it suffices to let ana_{n} be a number satisfying the above conditions at the start.

This completes our induction, and we conclude that the maximum number of times that a1a_{1} can change sign is n−1n-1.

Want a route through all this instead of an archive? The track puts 2,604 problems in a working order, from Junior Challenge level to the IMO shortlist.

Source: MathNet, licensed CC-BY-4.0. Statement reproduced verbatim; metadata (topic, difficulty) added by this project.