The audience arranges $n$ coins in a row. The sequence of heads and tails is chosen arbitrarily. The audience also chooses a number between $1$ and $n$ inclusive. Then the assistant turns one of the coins over, and the magician is brought in to examine the resulting sequence. By an agreement with the assistant beforehand, the magician tries to determine the number chosen by the audience. (a) Prove that if this is possible for some $n$, then it is also possible for $2n$. (b) Determine all $n$ for which this is possible.
Problem
Source: Tournament of Towns 2007 - Fall - Junior A-Level - P6
Tags: function, induction, combinatorics unsolved, combinatorics
20.09.2011 18:43
a) Let $A$ be the set of integers where this trick is possible. We have $2 \in A$, for example by the following strategy: if the first coin is heads, this means the number is $1$, otherwise it is $2$; it is clear that the assistant can choose the status of first coin as he wishes by either turning that coin or the second one. We now show the stronger property $m,n \in A \implies mn \in A$: A coin can be seen as an element of $\mathbb Z/2$, $0$ meaning heads and $1$ meaning tails. Then any row of $n$ coins corresponds to an element of $(\mathbb Z/2)^n$. We also use the shortcut $[N]$ for the set $\{1,2,...,N\}$. Assume the assistant is given $m \cdot n $ coins, then instead of them being arranged in a row, he can assume they are arranged in a rectangular shape of sides $m$ and $n$, i.e. the given constellation is some $(a_{i,j})_{i \in [m],j\in [n]}$ with $a_{i,j}\in \mathbb Z/2$. Let $b_i := \sum_j a_{i,j}$ and $c_j:= \sum_i a_{i,j}$. Then $(b_i)_{i\in [m]}$ and $(c_j)_{j \in [n]}$ are each an arrangement of $m$ and $n$ coins, respectively. By assumption, the magician and the assistant now can agree on some strategy that encode a given $x \in [m]$ in the coins $(b_i)$ by swapping exactly one of them, say the one with index $I$. Similiarly, he can encode an $y \in [n]$ by swapping a coin from the $(c_j)$, say the one with index $J$. Now the assistant simply swaps the coin $a_{I,J}$, which induces exactly the desired swap in the $(b_i)$ and $(c_j)$; thus the magician can revert this procedure and reconstruct the pair $(x,y) \in [m] \times [n]$. In other words, the assistant can always send him a given pair $(x,y) \in [m] \times [n]$; but fixing any bijection between $ [m] \times [n]$ and $[mn]$, this shows that the assistant can send him a number from $[mn]$ as well. b) We claim that this is only possible for powers of of $2$ (the sufficiency of this follows inductively from a)). We say that $x,y \in (\mathbb Z/2)^n$ are neighbours and write $x \sim y$ if they differe at exactly one position; in terms if rows of coins this means they differe by exactly one swap of a single coin. Now every $x$ has exactly $n$ neighbours. For the magician and the assistant to be able to do the trick, they need to define a function $f: (\mathbb Z/2)^n \to [n]$ (to be understood as: if the magician comes in and sees arrangement $x$, he proclaims that $f(x)$ is the number to be encoded) such that: for any given $x \in (\mathbb Z/2)^n$ and any $m \in [n]$ there is a $y \sim x$ with $f(y)=m$. But by every $x$ only having $n$ neighbours and there always being $n$ possible $m$ to be encoded, every $x$ must have exactly one neighbour for each $m$. Thus the following construction is well-defined: For any $x \in (\mathbb Z/2)^n$, there is exactly one neighbour $y$ such that $f(y) \equiv f(x)+1 \mod n$; we call $y=s(x)$ the successor of $x$. Note that $s$ is bijective. Now starting at any $x_0 \in (\mathbb Z/2)^n$, we get a sequence $x_i$ by $x_{i+1} := s(x_i)$. This sequence must eventually get periodic, and by bijectivity will even reach $x_0$ again. Thus there is some period $p>0$ with $x_p=x_0$. But now a trivial induction argument gives $f(x_i) \equiv i + f(x_0) \mod n$, implying $p \equiv f(x_p)-f(x_0) = 0 \mod n$, thus $p$ is divisible by $n$. Now these "cycles" divide $(\mathbb Z/2)^n$ into equivalence classes, each the size a multiple of $n$, thus implying $n|2^n$ being a power of $2$.