Maths Olympiad Prep

Library / China Hong Kong Mathematical Olympiad /66 of 89

China Hong Kong Mathematical Olympiad

Combinatorics Difficulty 6.6 National Olympiad Prove it Hong Kong

Let nn be a positive integer. Determine the number of sequences x1,x2,…,x2n−1,x2nx_1, x_2, \dots, x_{2n-1}, x_{2n}, with xi=1x_i = 1 or −1-1, and such that ∣∑i=2k−12mxi∣≤2\left|\sum_{i=2k-1}^{2m} x_i\right| \le 2 for all integers k,mk, m, with 1≤k≤m≤n1 \le k \le m \le n.

Solution

The answer is 2⋅3n−2n2 \cdot 3^n - 2^n.
Let yj=x2j−1+x2jy_j = x_{2j-1} + x_{2j} for j=1,2,…,nj = 1, 2, \dots, n. Every desired sequence {xj}\{x_j\} corresponds to a sequence {yj}\{y_j\} such that yj=−2,0,2y_j = -2, 0, 2 for each jj, and ∣yk+yk+1+⋯+ym∣≤2|y_k + y_{k+1} + \dots + y_m| \le 2 for any 1≤k≤m≤n1 \le k \le m \le n. Suppose there are rr terms of {yj}\{y_j\} which are nonzero, say yi1,yi2,…,yiry_{i_1}, y_{i_2}, \dots, y_{i_r} where i1<i2<⋯<iri_1 < i_2 < \dots < i_r. Since
∣yi1+yi1+1+⋯+yi2∣=∣yi1+yi2∣≤2, |y_{i_1} + y_{i_1+1} + \dots + y_{i_2}| = |y_{i_1} + y_{i_2}| \le 2,
we must have yi2=−yi1y_{i_2} = -y_{i_1}. Similarly, yi3=−yi2=yi1y_{i_3} = -y_{i_2} = y_{i_1}, and inductively yi2j−1=yi1y_{i_{2j-1}} = y_{i_1} and yi2j=−yi1y_{i_{2j}} = -y_{i_1} for any integer jj. In other words, the sequence {yj}\{y_j\} only depends on the indices i1,i2,…,iri_1, i_2, \dots, i_r and the term yi1y_{i_1}.
Conversely, for any such sequence {yj}\{y_j\}, consider any 1≤k≤m≤n1 \le k \le m \le n. Let isi_s be the smallest index such that k≤isk \le i_s, and let iti_t be the largest index such that it≤mi_t \le m. Then
yk+yk+1+⋯+ym=yis+yis+1+⋯+yit=±(2−2+2−2+… )=−2,0,2. y_k + y_{k+1} + \dots + y_m = y_{i_s} + y_{i_{s+1}} + \dots + y_{i_t} = \pm(2 - 2 + 2 - 2 + \dots) = -2, 0, 2.
So the condition is satisfied.
Now, for each sequence {yj}\{y_j\} satisfying the condition, we can construct the sequence {xj}\{x_j\} as follows. For any index jj of the form iui_u, the terms x2j−1x_{2j-1} and x2jx_{2j} are uniquely determined. Indeed, if yiu=±2y_{i_u} = \pm 2, then x2iu−1=x2iu=±1x_{2i_u-1} = x_{2i_u} = \pm 1. For any other index jj, there are two choices for x2j−1x_{2j-1} and x2jx_{2j}, since exactly one of them is 1 and the other is -1. Since there are (nr)\binom{n}{r} ways to choose the indices i1,i2,…,iri_1, i_2, \dots, i_r and two ways to choose yi1y_{i_1} if r≥1r \ge 1, the total number of sequences is
(n0)2n+∑r=1n2(nr)⋅2n−r=2n+2∑r=1n(nn−r)2n−r=2n+2∑d=0n−1(nd)2d \binom{n}{0}2^n + \sum_{r=1}^{n} 2\binom{n}{r} \cdot 2^{n-r} = 2^n + 2\sum_{r=1}^{n} \binom{n}{n-r} 2^{n-r} = 2^n + 2\sum_{d=0}^{n-1} \binom{n}{d} 2^d
using the change of variable d=n−rd = n-r. By the binomial theorem, this is equal to
2n+2∑d=0n(nd)2d−2n+1=2n+2(2+1)n−2n+1=2⋅3n−2n. 2^n + 2 \sum_{d=0}^{n} \binom{n}{d} 2^d - 2^{n+1} = 2^n + 2(2+1)^n - 2^{n+1} = 2 \cdot 3^n - 2^n.

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.