Olympiad Maths Prep

Track / Stage 7 / 24 of 300 #1424 of 2000

Problem 1424

National olympiad second round; IMO P1/P4
Algebra Difficulty 7.0 Find the answer

Let nn be a positive integer. Find the number of sequences x1,x2,x2n1,x2nx_{1},x_{2},\ldots x_{2n-1},x_{2n}, where xi{1,1}x_{i}\in\{-1,1\} for each ii, satisfying the following condition: for any integer kk and mm such that 1kmn1\le k\le m\le n then the following inequality holds i=2k12mxi 2\left|\sum_{i=2k-1}^{2m}x_{i}\right|\le\ 2

This one wants a proof. Work it on paper, read the official solution, then mark yourself honestly — the ladder only means something if the record is true.

Official solution

1. Define the problem and constraints: We need to find the number of sequences x1,x2,,x2n1,x2n x_1, x_2, \ldots, x_{2n-1}, x_{2n} where xi{1,1} x_i \in \{-1, 1\} for each i i , such that for any integers k k and m m with 1kmn 1 \le k \le m \le n , the inequality i=2k12mxi2\left|\sum_{i=2k-1}^{2m} x_i \right| \le 2 holds.

2. Group the terms: Consider the sequence in pairs (x2i1,x2i)(x_{2i-1}, x_{2i}) for i=1,2,,n i = 1, 2, \ldots, n . Define Si=x2i1+x2i S_i = x_{2i-1} + x_{2i} . The possible values for Si S_i are:
- Si=2 S_i = 2 if x2i1=1 x_{2i-1} = 1 and x2i=1 x_{2i} = 1
- Si=2 S_i = -2 if x2i1=1 x_{2i-1} = -1 and x2i=1 x_{2i} = -1
- Si=0 S_i = 0 if x2i1=1 x_{2i-1} = 1 and x2i=1 x_{2i} = -1 or x2i1=1 x_{2i-1} = -1 and x2i=1 x_{2i} = 1

3. Analyze the constraints: The condition i=2k12mxi2\left|\sum_{i=2k-1}^{2m} x_i \right| \le 2 implies that the sum of any contiguous subsequence of pairs must be between -2 and 2. This means that the sequence of Si S_i values must be such that the sum of any contiguous subsequence of Si S_i values is between -2 and 2.

4. Count the valid sequences:
- If Si=0 S_i = 0 , there are 2 ways to choose (x2i1,x2i) (x_{2i-1}, x_{2i}) .
- If Si=2 S_i = 2 or Si=2 S_i = -2 , there is only 1 way to choose (x2i1,x2i) (x_{2i-1}, x_{2i}) .

5. Formulate the sequence: The sequence of Si S_i values must be such that the sum of any contiguous subsequence is between -2 and 2. This means that the sequence can have any number of 0s, but the non-zero values must alternate between 2 and -2.

6. Calculate the number of sequences:
- Let k k be the number of pairs where Si=0 S_i = 0 . There are (nk) \binom{n}{k} ways to choose these positions.
- For each of these k k positions, there are 2k 2^k ways to assign (x2i1,x2i) (x_{2i-1}, x_{2i}) .
- For the remaining nk n-k positions, the non-zero Si S_i values must alternate between 2 and -2. There are 2 ways to start this alternation (starting with 2 or starting with -2).

7. **Sum over all possible values of k k **:
Total number of sequences=2k=0n(nk)2k \text{Total number of sequences} = 2 \sum_{k=0}^{n} \binom{n}{k} 2^k

8. Simplify the expression: Using the binomial theorem, we have:
k=0n(nk)2k=(1+2)n=3n \sum_{k=0}^{n} \binom{n}{k} 2^k = (1 + 2)^n = 3^n
Therefore, the total number of sequences is:
23n 2 \cdot 3^n

9. Subtract the overcounted sequences: We need to subtract the sequences where all Si=0 S_i = 0 , which is 2n 2^n sequences.

10. Final count:
Total number of valid sequences=23n2n \text{Total number of valid sequences} = 2 \cdot 3^n - 2^n

Source: NuminaMath-1.5, licensed Apache-2.0. Statement and solution reproduced as published; topic, difficulty and ordering added by this site.