Maths Olympiad Prep

Library / /114 of 121

Combinatorics Difficulty 7.4 National Olympiad, round 2 Prove it India

Problem:

A Magician and a Detective play a game. The Magician lays down cards numbered from 11 to 5252 face-down on a table. On each move, the Detective can point to two cards and inquire if the numbers on them are consecutive. The Magician replies truthfully. After a finite number of moves the Detective points to two cards. She wins if the numbers on these two cards are consecutive, and loses otherwise.

Prove that the Detective can guarantee a win if and only if she is allowed to ask at least 5050 questions.

Solution

Solution:

Strategy for the Detective: Pick a card AA and compare against all others except one. If he ever gets a "Yes", that pair works; else the remaining card is consecutive with AA. This process takes at most 5050 queries.

Strategy for the Magician: We show that it is not always possible to obtain a "Yes" in 5050 turns, hence showing that 4949 turns are not enough to figure out a consecutive pair. It is enough to conjure a labelling of cards for which denying all 5050 inquiries is valid.

Replace 5252 by any N>3N>3. Think of the cards as vertices of a complete graph KNK_{N}. Delete all edges joining vertices which correspond to pairs of cards the Detective inquired about. We will show that deleting any N2N-2 edges of KNK_{N} still leaves a graph that admits a path containing all the vertices. Labelling all cards along this path as 11 to NN would finish. Several proofs of this claim are possible. We present three of them.

## Proof 1

For any two vertices aa and bb, since dega+degb2(N1)(N2)=N\operatorname{deg} a + \operatorname{deg} b \geq 2(N-1)-(N-2)=N, they share a common neighbour. Hence the graph is connected.

Pick the longest path P:u=u0u1uk=v\mathcal{P}: u=u_{0} \rightarrow u_{1} \rightarrow \cdots \rightarrow u_{k}=v. All neighbours of uu and vv must remain within the path, else we could get a longer path. Let uu have xx neighbours {ui1,ui2,,uix}\{u_{i_{1}}, u_{i_{2}}, \ldots, u_{i_{x}}\} with 1=i1<i2<<ixk1=i_{1}<i_{2}<\cdots<i_{x} \leq k. Let vv have yy neighbours {uj1,,ujy}\{u_{j_{1}}, \ldots, u_{j_{y}}\}. Since x+ynx+y \geq n, we see that is=jr+1i_{s}=j_{r}+1 for some rr and ss. Thus there exists ii such that uui+1u \rightarrow u_{i+1} and uivu_{i} \rightarrow v are edges. Thus the path is a cycle
C=ui+1u0u1uivuk1ui+1 \mathcal{C}=u_{i+1} \rightarrow u_{0} \rightarrow u_{1} \cdots \rightarrow u_{i} \rightarrow v \rightarrow u_{k-1} \cdots \rightarrow u_{i+1}
Suppose a vertex ww is not in the path P\mathcal{P}. By connectedness, we have a path P\mathcal{P}' from ww to some vertex of P\mathcal{P}. Continue along this path via the cycle C\mathcal{C} to obtain a path longer than P\mathcal{P}; contradiction! Thus the graph has a path of length N1N-1, as desired.

## Proof 2

Pick the longest cycle C=v1vkv1\mathcal{C}=v_{1} \rightarrow \cdots \rightarrow v_{k} \rightarrow v_{1}. Note that any vertex ww not in the cycle can be incident to no more than k2\frac{k}{2} of the vertices in it; else there exists ii such that wviw v_{i} and wvi+1w v_{i+1} (indices mod kk) are edges, so we can put ww in to get a longer cycle. Thus our graph is missing at least 12k(Nk)\frac{1}{2} k(N-k) edges. So 2(N2)k(Nk)2(N-2) \geq k(N-k). Clearly k>2k>2 so we see that k{N2,N1}k \in\{N-2, N-1\}.

Case 1. k=N1k=N-1. Pick the leftover ww outside C\mathcal{C}. Not all edges from ww to the cycle are missing (since only N2N-2 are missing in total), so follow an edge from ww to C\mathcal{C} and continue along C\mathcal{C} to get a path of length N1N-1.

Case 2. k=N2k=N-2. Pick the leftover a,ba, b outside C\mathcal{C}. It is clear that both of them have edges to the cycle and abab is also an edge (since k(Nk)=2(N2)k(N-k)=2(N-2) in this case). So starting at aa, going to bb, to some vertex of C\mathcal{C} and following along C\mathcal{C} gives us a path of length N1N-1.

The proof is complete.

## Proof 3

The idea is to prove the stronger claim by induction on N3N \geq 3: a graph on NN vertices with (N12)+2\binom{N-1}{2}+2 edges has a cycle of length NN. Deleting the extra edge will give a path of length N1N-1 through all the vertices.

The base case N=3N=3 is trivial. Suppose it holds for all kNk \leq N, we prove it for N+1N+1. Since 2(2+(N2))N+1>N2\frac{2\left(2+\binom{N}{2}\right)}{N+1}>N-2 we see that some vertex vv has degree either N1N-1 or NN.

Case 1. If degree of vv is N1N-1. Then we have an edge e=uve=uv missing among all the edges through vv. Delete vv along with all the edges through it in the graph. The induced graph has a cycle of length NN. Pick two consecutive vertices that are not uu, and append vv between them.

Case 2. If degree of vv is NN. Delete vv along with all its edges. Add an arbitrarily chosen extra edge to the graph so obtained. By induction hypothesis, this resulting graph has a cycle of length NN. If removing the extra edge does not disrupt the cycle, append vv anywhere between two consecutive vertices. If it does break the cycle, use vv to connect the vertices it joined.

The induction is complete.

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.