Maths Olympiad Prep

Library /

Combinatorics Difficulty 7.8 National Olympiad, round 2 Prove it Nordic Mathematical Olympiad

Problem:

An encyclopedia consists of 20002000 numbered volumes. The volumes are stacked in order with number 11 on top and 20002000 on the bottom. One may perform two operations with the stack:

(i) For nn even, one may take the top nn volumes and put them in the bottom of the stack without changing the order.

(ii) For nn odd, one may take the top nn volumes, turn the order around and put them on top of the stack again.

How many different permutations of the volumes can be obtained by using these two operations repeatedly?

Solutions — 3

Solution 1

Solution:

Let the positions of the books in the stack be 1,2,3,,20001,2,3, \ldots, 2000 from the top (and consider them modulo 20002000). Notice that both operations fix the parity of the number of the book at any given position. Operation (i) subtracts an even integer from the number of the book at each position. If AA is an operation of type (i), and BB is an operation of type (ii), then the operation A1BAA^{-1} B A changes the order of the books in the positions n+1n+1 to n+mn+m where nn is even and mm is odd. This is called turning the interval.

Now we prove that all the volumes in odd positions can be placed in the odd positions in every way we like: If the volume we want in position 11 is in position m1m_{1}, we turn the interval 11 to m1m_{1}. Now if the volume we want in position 33 is in position m3m_{3}, we turn the interval 33 to m3m_{3}, and so on. In this way we can permute the volumes in odd positions exactly as we want to.

Now we prove that we can permute the volumes in even positions exactly as we want without changing the positions of the volumes in the odd positions: We can make a transposition of the two volumes in position 2n2n and 2n+2m2n+2m by turning the interval 2n+12n+1 to 2n+2m12n+2m-1, then turning the interval 2n+2m+12n+2m+1 to 2n12n-1, then turning the interval 2n+12n+1 to 2n12n-1, and finally adding 2m2m to the number of the volume in each position.

Since there are 1000!1000! permutations of the volumes in the odd positions, and 1000!1000! permutations of the volumes in the even positions, altogether we have (1000!)2(1000!)^{2} different permutations.

Solution 2

Solution:

We show that the volumes can be permuted so that the volumes with odd numbers are in an arbitrary order in the odd-numbered places and the volumes with even numbers are in an arbitrary order in the even-numbered places. The main idea is to construct two combinations of the allowed operations. The first one turns the volumes in a specified interval, starting and ending in an odd-numbered place, in the opposite order while keeping everything outside this interval fixed, or keeps everything fixed in an interval while turning the order of the volumes outside this interval in the opposite direction, when the counting starts below that interval and is continued from the top after reaching the bottom volume. The second combined operation just exchanges two volumes in even-numbered places while keeping everything else fixed.

Let E={1,2,,2000}E=\{1,2, \ldots, 2000\}. We formulate the operations described in conditions (i) and (ii), depending on an even integer nn and odd integer mm as functions fn:EEf_{n}: E \rightarrow E and gm:EEg_{m}: E \rightarrow E, defined by

fn(p)={2000+pn for pn,pn for n<pandgm(p)={mp+1 for pmp for m<p f_{n}(p)=\begin{cases} 2000+p-n & \text{ for } p \geq n, \\ p-n & \text{ for } n<p \end{cases} \quad \text{and} \quad g_{m}(p)= \begin{cases}m-p+1 & \text{ for } p \leq m \\ p & \text{ for } m<p\end{cases}

We immediately see that fnf_{n} and gmg_{m} map even numbers into even numbers and odd numbers into odd numbers. So the volumes can never be permuted so that an odd-numbered volume would be in an even place or an even-numbered would be in an odd place. The observation f([1,n])=[2000(n+1),2000]f([1, n])=[2000-(n+1), 2000] easily leads to fn1=f2000nf_{n}^{-1}=f_{2000-n}.

Now let nn be even and mm odd and n+m<2000n+m<2000. Consider the combined mapping fn1gmfnf_{n}^{-1} \circ g_{m} \circ f_{n}. If n<n+pn+mn<n+p \leq n+m, then fn(n+p)=pmf_{n}(n+p)=p \leq m, gm(p)=mp+1<2000ng_{m}(p)=m-p+1<2000-n and fn1(mp+1)=f2000n(mp+1)=2000+mp+12000+n=n+m+1pf_{n}^{-1}(m-p+1)=f_{2000-n}(m-p+1)=2000+m-p+1-2000+n=n+m+1-p. Because fn([n+1,n+m])=[1,m]f_{n}([n+1, n+m])=[1, m], fnf_{n} maps numbers pp outside the interval [n+1,n+m][n+1, n+m] into numbers outside the interval [1,m][1, m]; gmg_{m} keeps these numbers fixed and fn1f_{n}^{-1} returns fn(p)f_{n}(p) into pp. So we have shown that for any interval [s,t]E[s, t] \subset E with ss and tt odd, there is a function hs,th_{s, t}, combined of functions of the ff type and gg type such that hs,th_{s, t} reverses the order of numbers in the interval [s,t][s, t] and is the identity function outside this interval.

The functions hs,th_{s, t} allow us to order the odd numbers in an arbitrary manner. If p1p_{1} ought to be in position 11, then apply (if needed) h1,p1h_{1, p_{1}}; if the number p2p_{2} which ought to be in position 33 now is in position xx, the x3x \geq 3 and we may apply (if needed) h3,xh_{3, x}. Continuing this way, we eventually arrive at the desired order of the odd numbers.

To construct the second one of the desired operations, we have to obtain a counterpart for hs,th_{s, t} for t<st<s. To this end, consider fn1gmfnf_{n}^{-1} \circ g_{m} \circ f_{n} for m+n>2000m+n>2000. By the definition of fnf_{n}, fn(n+m2000)=2000+(n+m2000)n=mf_{n}(n+m-2000)=2000+(n+m-2000)-n=m, and so fn[n+m2000+1,n]=[m+1,2000]f_{n}[n+m-2000+1, n]=[m+1, 2000]. Consequently, fn1gmfnf_{n}^{-1} \circ g_{m} \circ f_{n} keeps numbers in the interval [n+m2000+1,n][n+m-2000+1, n] (with even endpoints) fixed. Since gmg_{m} turns the order around in [1,m][1, m] and fn1=f2000nf_{n}^{-1}=f_{2000-n} maps [1,m][1, m] onto the complement of [n+m2000+1,n][n+m-2000+1, n] in such a way that f20001(1)=n+1f_{2000-1}(1)=n+1, the order of numbers in the complement is reversed in the desired manner. We have shown that for odd ss and tt such that t<st<s there exists a function hs,th_{s, t}, combined of functions of the ff type and gg type such that hs,th_{s, t} is the identity on the interval [t+1,s1][t+1, s-1], but reverses the order of the numbers outside this interval, when counting is started from ss and continued through over 20002000 and 11 over to tt, in other words modulo 20002000.

To finish the proof, we show that two numbers in the even positions can be exchanged while everything else is fixed. This clearly allows us to put the even numbers in an arbitrary order without violating the order of the odd numbers. To achieve this, we take two even numbers pp and qq, p<qp<q, and consider the function ϕp,q=f2000+pqhp+1,p1hq+1,p1hp+1,q1\phi_{p, q}=f_{2000+p-q} \circ h_{p+1, p-1} \circ h_{q+1, p-1} \circ h_{p+1, q-1}. The innermost function hp+1,q1h_{p+1, q-1} reverses the order on [p+1,q1][p+1, q-1] and fixes everything else, the next function hq+1,p1h_{q+1, p-1} fixes numbers in [p,q][p, q], hp+1,p1h_{p+1, p-1} fixes pp and reverses the order (mod2000)(\bmod 2000) in E{p}E \setminus \{p\}, and f2000+pq(p)=qf_{2000+p-q}(p)=q. The two innermost components of ϕp,q\phi_{p, q} fix qq, hp+1,p1h_{p+1, p-1} takes qq to a position xx qpq-p steps ahead of pp (mod2000)(\bmod 2000) and f2000+pq=fqp1f_{2000+p-q}=f_{q-p}^{-1} moves xx qpq-p positions back, i.e. to pp. If p+kp+k is between pp and qq, then the innermost function maps it to qkq-k, the next one fixes qkq-k, the third function maps qkq-k to p(qkp)=2pq+kp-(q-k-p)=2p-q+k (mod2000)(\bmod 2000), and fqp1f_{q-p}^{-1} maps 2pq+k2p-q+k back to p+kp+k. A similar reasoning shows that ϕp,q\phi_{p, q} also fixes numbers in E[p,q]E \setminus [p, q].

Since both even and odd numbers have 1000!1000! different permutations, the volumes can be permuted into (1000!)2(1000!)^{2} different orders by using the given operations repeatedly.

Solution 3

Solution:

We show by induction, that if in an ordered sequence one may exchange two consecutive elements without changing the places of any other element, then any two elements can be exchanged so that all other elements remain in place. We assume that this is true for elements which are at most kk steps away from each other in the sequence. Assuming that aa precedes bb by k+1k+1 steps and that cc is immediately behind aa, the following sequence of exchanges is allowed: ,a,c,,b,,a,b,,c,,b,a,,c,,b,c,,a,\ldots, a, c, \ldots, b, \ldots \rightarrow \ldots, a, b, \ldots, c, \ldots \rightarrow \ldots, b, a, \ldots, c, \ldots \rightarrow \ldots, b, c, \ldots, a, \ldots. By assumption, all elements in the places indicated by three dots remain on their places, as does cc.

If any two elements can be exchanged without violating the other elements, then the elements in the sequence can be arranged to any order. One just gets the desired first element to its place by (at most) one exchange, and if the first kk elements already are in their desired places, then the one wanted to be in place k+1k+1 is not among the first kk elements, and it can be moved to its place by at most one exchange, not violating the order of the first kk elements.

We now show, that any two volumes in consecutive odd places can be exchanged. The volumes on top and in place 33 can be exchanged by operation (ii) applied to the three topmost volumes. The volumes in places 2n+12n+1 and 2n+32n+3 can be exchanged by first applying operation (i) to the 2n2n topmost volumes, which moves them to the bottom but preserves their order, then applying (ii) to the three topmost volumes and finally operation (i) to the 20002n2000-2n topmost volumes. The last operation returns the 2n2n volumes to top preserving the order and returns the remaining 20002n2000-2n volumes to the bottom, preserving the order, save the volumes in places 2n+12n+1 and 2n+32n+3, which have changed places. By the general remarks above, it is now clear that operations (i) and (ii) can be used to arrange the volumes in odd positions into any order while the volumes in even positions remain in their places.

We still need to show, that a similar procedure is possible for volumes in even positions. First of all, the volumes in positions 11 to 55 can be moved to order 5,4,3,2,15,4,3,2,1 by performing operation (ii) to the five topmost volumes. Then it is possible to exchange the volumes in positions 11 and 55 without changing anything else. So the volumes in even positions closest to the top can be exchanged. For volumes on positions 2n2n and 2n+22n+2 one can first perform operation (i) to the 2n22n-2 topmost volumes. The volumes in places 2n2n and 2n+22n+2 will be taken to places 22 and 44, and they can be exchanged. Performing operation (i) to the 2000(2n1)2000-(2n-1) topmost volumes then returns everything to their previous places, except that the volumes in positions 2n2n and 2n+22n+2 have changed places. So all volumes in even positions can be put into any order by using the operations (i) and (ii), and the total number of possible orderings is (1000!)2(1000!)^{2}.

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

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