1: %\documentclass[12pt,reqno,fleqn]{amsart}
2: \documentclass[12pt,reqno]{amsart}
3: \usepackage{amssymb}
4: \usepackage{epsf}
5: \usepackage{amsxtra}
6: %\usepackage{eucal}
7: %\usepackage{srcltx}
8: \renewcommand{\subjclassname}{\textup{2000}
9: Mathematics Subject Classification}
10:
11: \setlength{\evensidemargin}{0cm}\setlength{\oddsidemargin}{0cm}
12: \setlength{\textwidth}{16cm}\setlength{\parskip}{0.2cm}
13: \setlength{\textheight}{8in}\setlength{\topmargin}{1.5cm}
14: \setlength{\headheight}{0.5cm}\setlength{\headsep}{1cm}
15:
16: \newcommand{\Z}{{\mathbf Z}}
17: \newcommand{\R}{{\mathbf R}}
18: \newcommand{\Q}{{\mathbf Q}}
19: \newcommand{\C}{{\mathbf C}}
20: \newcommand{\eop}{\hfill$\square$}
21:
22: \theoremstyle{plain}
23: \newtheorem{Thm}{Theorem}
24: \newtheorem{Cor}{Corollary}
25: \newtheorem{Lem}{Lemma}
26: \newtheorem{Prop}{Proposition}
27: \theoremstyle{definition}
28: \newtheorem{Def}{Definition}
29: \theoremstyle{remark}
30: \newtheorem{Rem}{Remark}
31: \newtheorem*{Notn}{Notation}
32: \newtheorem*{Ex}{Example}
33:
34:
35: \numberwithin{equation}{section}
36:
37: \begin{document}
38:
39: \title{Peg Jumping for Fun and Profit}
40:
41:
42: \date{\today}
43:
44: \author{David~M. Bradley}
45: \address{Department of Mathematics \& Statistics\\
46: University of Maine\\
47: 5752 Neville Hall
48: Orono, Maine 04469-5752\\
49: U.S.A.}
50: \email[David Bradley]{bradley@math.umaine.edu,
51: dbradley@member.ams.org}
52: \author{Hugh Thomas}
53: \thanks{The second author was
54: partially supported by a grant from the Natural Science and Engineering
55: Research Council (Canada)}
56: \address{Department of Mathematics \& Statistics\\
57: University of New Brunswick\\
58: Fredericton, NB\\
59: E3B 5A3 Canada}
60: \email[Hugh Thomas]{hugh@math.unb.ca}
61:
62:
63: \subjclass{Primary: 00A08; Secondary: 68Q17, 97A20, 97A90, 68R15}
64:
65: \keywords{Recreational mathematics, one-dimensional peg puzzle,
66: computational complexity.}
67:
68: \begin{abstract} We consider the problem of determining the
69: minimum number of moves needed to solve a certain one-dimensional
70: peg puzzle. Let $N$ be a positive integer. The puzzle apparatus
71: consists of a block with a single row of $2N+1$ equally spaced
72: holes which, apart from the central hole, are occupied by an equal
73: number $N$ of red and blue pegs. The object of the puzzle is to
74: exchange the colors of the pegs by a succession of allowable
75: moves. Allowable moves are of two types: a peg can be shifted
76: from the hole it occupies into the empty hole adjacent to it, or a
77: peg can jump over an adjacent peg into the empty hole. We exhibit
78: a sequence of $N^2+2N$ moves that solves the puzzle, and prove
79: that no solution can employ fewer moves.
80: \end{abstract}
81:
82: \maketitle
83:
84: \section{Introduction}\label{sect:Intro}
85: We are going to begin by describing a puzzle.
86: Let $N$ be a positive integer. Consider the one-dimensional peg
87: puzzle whose apparatus consists $N$ red pegs, $N$ blue pegs, and a
88: block with a single row of $2N+1$ equally spaced holes. Initially,
89: the $N$ red pegs occupy the rightmost $N$ holes, the $N$ blue pegs
90: occupy the leftmost $N$ holes, and the center hole is empty. It is
91: required to exchange the red pegs and the blue pegs so that the
92: red pegs occupy the leftmost $N$ holes, and the blue pegs occupy
93: the rightmost $N$ holes. We would also like to carry out this
94: task using as few moves as possible. Allowable moves are of two
95: types: a \emph{step}, which consists of one peg moving from an
96: occupied hole into the adjacent (necessarily unique) unoccupied
97: hole; and a \emph{jump}, which consists of one peg jumping over a
98: single adjacent peg into the empty hole.
99:
100: The puzzle as just described with $N=5$ was marketed by
101: International Games of Canada Ltd., Mississauga, Ontario, under
102: the name of ``Brainbuster,'' back in the 1970s.
103: In this paper, we provide a sequence of $N^2+2N$ moves which solves the
104: puzzle for general $N$, and we show that no shorter sequence of moves
105: is sufficient.
106:
107: Before continuing on to read our results,
108: the reader may prefer to attempt some small cases.
109: $N=2$ is pretty easy, and $N=3$ is difficult enough to give the
110: flavour of the general solution.
111:
112:
113: %\section{At Least $N^2+N$ Moves are Necessary}\label{sect:LowerBound}%
114: %
115: %As a warmup, we show that $N^2+N$ moves are certainly necessary to solve
116: %the puzzle.
117: %
118: %First, let us consider the blue pegs. At the beginning of the puzzle,
119: %the blue pegs are in the $N$ leftmost holes. At the end, they are in the
120: %$N$ rightmost holes. Thus, they have moved a total distance of $N(N+1)$
121: %units to the right. %permutation...?
122: %Similarly, the red pegs have moved a total of
123: %$N(N+1)$ steps to the left. On a given turn, only a single peg travels, and
124: %it travels a distance of at most 2 units. Thus, at least
125: %$$\frac {N(N+1)+N(N+1)}{2}=N(N+1)$$
126: %turns are certainly required.
127:
128: \section{A Solution Consisting of $N^2+2N$ Moves}\label{Sect:UpperBound}
129:
130: To describe our solution requires some notation. Encode a step to
131: the right made by a blue peg by $S$, and a step to the left made
132: by a red peg by $s$. Similarly, encode a jump to the right made
133: by a blue peg by $J$, and a jump to the left made by a red peg by
134: $j$. The solution takes a slightly different form depending on
135: the parity of $N$.
136: \begin{Thm}\label{thm:solnseq}
137: Let $n$ be a positive integer. If $N=2n$, then
138: \begin{equation}
139: \label{even}
140: \bigg(\prod_{k=1}^n Sj^{2k-1}sJ^{2k}\bigg)
141: \bigg(\prod_{k=1}^n sj^{2n-2k+1}SJ^{2n-2k}\bigg)
142: \end{equation}
143: is a sequence of $N^2+2N$ moves that solves the puzzle. If
144: $N=2n-1$, then
145: \begin{equation}
146: \label{odd}
147: \bigg(\prod_{k=1}^{n-1}Sj^{2k-1}sJ^{2k}\bigg)Sj^{2n-1}S
148: \bigg(\prod_{k=1}^{n-1}J^{2n-2k}sj^{2n-2k-1}S\bigg)
149: \end{equation}
150: is likewise a sequence of $N^2+2N$ moves that solves the puzzle.
151: \end{Thm}
152:
153: \begin{Ex} For $N=1,2,3,4,5$ we obtain the respective solution
154: sequences $SjS$, $SjsJJsjS$, $SjsJJSjjjSJJsjS$,
155: $SjsJJSjjjsJJJJsjjjSJJsjS$ and
156: \[
157: SjsJJSjjjsJJJJSjjjjjSJJJJsjjjSJJsjS.
158: \]
159: \end{Ex}
160:
161:
162: The solutions defined in the statement of Theorem~\ref{thm:solnseq}
163: can be reformulated
164: in a manner which emphasizes their symmetry.
165:
166: If $N=2n$, then ~\ref{even} can be refomulated as:
167: \begin{equation}\label{eqeven}
168: \bigg(\prod_{k=1}^{n-1}Sj^{2k-1}sJ^{2k}\bigg)
169: Sj^{2n-1}sJ^{2n}sj^{2n-1}S\prod_{k=n-1}^1
170: J^{2k}sj^{2k-1}S.
171: \end{equation}
172: If $N=2n-1$, then ~\ref{odd} can be reformulated as:
173: \begin{equation}\label{eqodd}
174: \bigg(\prod_{k=1}^{n-1}Sj^{2k-1}sJ^{2k}\bigg)
175: Sj^{2n-1}S\bigg(\prod_{k=n-1}^1 J^{2k}sj^{2k-1}S\bigg).
176: \end{equation}
177:
178:
179:
180:
181: %caps are blue
182: \noindent
183: {\bf Proof of Theorem~\ref{thm:solnseq}.}
184: We consider the case where $N=2n-1$ is odd, leaving the
185: case where $N$ is even to the reader. We provide
186: illustrations for the case $N=5$.
187: We start
188: with the position $B^NOR^N$.
189: $$\epsfbox{n91.eps}$$%mag is 75 %
190: We apply $Sj$, obtaining
191: $B^{N-1}RBOR^{N-1}$.
192: $$\epsfbox{n92.eps}$$
193: Then we apply $sJJ$, obtaining
194: $B^{N-2}0RBRBR^{N-2}=B^{N-2}O(RB)^2R^{N-2}$.
195: $$\epsfbox{n93.eps}$$
196: We have now applied the first term in the product
197: (\ref{eqodd}).
198: It is easily checked that after the application of $m$ terms of the product,
199: we obtain
200: $B^{N-2m}O(RB)^{2m}R^{N-2m}$. After all $n-1$ terms of the product, we obtain
201: $BO(RB)^{2n-2}R$:
202: $$\epsfbox{n95.eps}$$
203: We then apply $Sj^{2n-1}S$, obtaining $R(BR)^{2n-2}OB$:
204: $$\epsfbox{n96.eps}$$
205: Observe that this is the reversal of the previous result, the result of
206: applying only the first
207: product. The second product then acts in the opposite way
208: to the first product, and the final result is
209: $R^NOB^N$, as desired:
210: $$\epsfbox{n99.eps}$$
211: This completes the proof that the sequence of moves given in the statement
212: of the theorem is indeed a solution.
213:
214: Now that we have solutions to the puzzle, we can count up the number of
215: moves which they require. Using whichever of
216: (\ref{eqeven}) or (\ref{eqodd}) applies,
217: it is easy to see that $2N$ steps are used in either case, while
218: the number of jumps is
219: $$\left(\sum_{i=1}^{N-1} i \right) + N +\left(\sum_{i=1}^{N-1} i\right)
220: = \frac{N(N-1)}{2} + N + \frac{N(N-1)}2 = N^2.
221: $$
222: Thus the solutions given in the statement of the theorem
223: use a total of $N^2+2N$ moves, as desired.
224:
225: \section{$N^2+2N$ moves are necessary}
226:
227: This section is devoted to the proof of the following theorem:
228:
229: \begin{Thm}\label{thm:nec} Any solution to the peg-jumping problem requires at least
230: $N^2+2N$ moves.
231: \end{Thm}
232:
233: \noindent
234: {\bf Proof of Theorem~\ref{thm:nec}.}
235: Let us refer to the {weight} of a position as the total distance to the
236: right that the blue pegs have moved plus the total distance to the left
237: that the red pegs have moved. The weight of the initial position is zero,
238: and the weight of the final position is $2N(N+1)$.
239:
240: The weight increases by 2 if a blue peg jumps to the right, or if a
241: red peg jumps to the left. It increases by 1 if a blue peg steps to the
242: right or a red peg steps to the left. The other possible moves
243: decrease the weight.
244:
245: Since on any move, the weight increases by at most 2, clearly
246: $$\frac{2N(N+1)}2=N^2+N$$
247: moves are necessary. However, this isn't quite good enough for our purposes.
248: This bound would only be attained if all the pieces only ever jumped, and
249: no such solution is possible; in fact, it is easy to verify that, from
250: any position, no more than $N$ consecutive jumps which increase the weight
251: are possible.
252:
253: We say that a pair of pegs {\it crosses} when one jumps over the other.
254: If we pick a red peg and a blue peg, since the red peg starts to the
255: right of the blue peg and ends to its left, this pair of pegs must cross
256: an odd number of times; in particular, this pair of pegs must cross at
257: least once. Let us refer to a move as a {\it first cross} if it is a move
258: on which a red peg and a blue peg cross for the first time.
259: In any solution, there
260: must be such a cross for each such pair;
261: thus, there must be $N^2$ first crosses. These $N^2$ first crosses have
262: the total effect of increasing the weight of the position by $2N^2$, leaving
263: a weight increase of $2N$ which must be coming from other moves.
264:
265: We claim that the average increase in weight over all the moves other than
266: the first crosses is at most 1. This is sufficient to prove the theorem,
267: because it means that the remaining weight increase of $2N$ will require
268: at least $2N$ moves in addition to the first crosses to accomplish this
269: weight gain, which will establish the theorem.
270:
271:
272: So now we must prove the following lemma:
273: \begin{Lem}\label{lem:avg} In any solution to the puzzle,
274: the average weight gain over all moves
275: other than first crosses is at most 1.
276: \end{Lem}
277:
278: \noindent
279: {\bf Proof.} Our procedure will be to group the moves other than the first
280: crosses into small groups, each of which groups we show to have average
281: weight gain of at most 1.
282:
283: If a red peg $R$ jumps a blue peg $B$ other than at their first crossing,
284: group together all the crossings of these two pegs. We have already
285: argued that after removing the first crossing there will be an even number,
286: half going in one direction, half in the other, so the total weight gain
287: for all these crossings will be zero.
288:
289: A move consisting of stepping a red piece to the left by 1 can go in a group
290: by itself; it adds 1 to the weight, so it has average weight 1. We proceed
291: similarly for stepping a blue piece to the right.
292:
293: What moves which add to the weight remain? Only jumping a red piece over
294: another red piece, moving left, or jumping a blue piece over a blue piece,
295: moving to the right. Either of these moves adds 2 to the weight, so we
296: must pair them with some other moves. We will shortly describe which moves
297: we want to use.
298:
299: We pause this analysis to consider how the game looks from
300: the point of view of a single peg $P$. We consider that a peg $P$
301: only notices when it is being moved or jumped, or when someone jumps over it.
302: So on a given turn, the peg $P$ will notice one of five things:
303: \begin{itemize}
304: \item[(A)] Someone jumped over $P$ proceeding left.
305: \item[(B)] $P$ moved or stepped left.
306: \item[(C)] Someone jumped over $P$ proceeding right.
307: \item[(D)] $P$ moved or stepped right.
308: \item[(E)] Nothing.
309: \end{itemize}
310:
311: We now claim that, among turns where $P$ notices something happening,
312: turns of type (A) or (B) alternate with turns of type (C) or (D). In
313: other words, if, on one turn, either (A) or (B) happened, the next time
314: $P$ notices something happen, that event will be either (C) or (D).
315: The reason for this is that after either (A) or (B) has happened, the
316: empty hole is to the right of $P$. This will only change if (C) or
317: (D) happens, and while the empty hole remains to the right of $P$,
318: (A) and (B) are impossible. A
319: similar argument applies if we start with a move of type (C) or (D).
320:
321: We now consider how to pair up moves involving same-colour jumping.
322: We begin by describing a procedure which doesn't quite work, and then
323: we describe how to fix it so it really does work. Suppose that
324: a red peg $S$ jumps a red peg $R$, proceeding to the left. From the
325: point of view of $R$, this is a move of type (A). Thus, the next
326: move $R$ notices will be a move of type (C) or (D). Suppose it is
327: of type (C): $R$ notices someone jump to the right over him. But this
328: piece jumping to the right over him must be $S$ (since the empty hole is
329: to the right of $R$, $S$ cannot have moved since jumping $R$). We can
330: then pair up these two jumps, and the total weight gain of this pair is
331: zero.
332:
333: Suppose now that the move after $S$ jumped over $R$ is of type (D).
334: On this move, $R$ moves rightwards, i.e. in a direction which decreases
335: weight. Thus if we pair the jump of $S$ over $R$ with this backwards
336: move, the total weight increase will be at most 1 over the two moves, and
337: we are certainly satisfied.
338:
339: The problem with this way of pairing up moves
340: is that there might be some same-colour jump which we want to pair up
341: with a following move of type (C) or (D), but that following move never
342: occurs because the puzzle is solved first.
343: Thus, we need to do something
344: slightly more complicated.
345:
346: When $S$ jumps to the right over $R$, we take note of whether or not $R$ has
347: already had all the blue pegs cross it. If not, then we pair the
348: jump with the next move which $R$ sees, as described above. (As we already
349: saw, this move will consist of $R$ moving to the right
350: or else of $S$ jumping to
351: the right
352: over $R$, and since $R$ still has to see some blue peg cross it before the
353: puzzle can be solved, and this
354: can only happen {\it after} the next event $R$ sees, the puzzle cannot be
355: finished
356: before the event which we want to pair with the jump of $S$ over $R$.)
357:
358: On the other hand, if $R$ has already seen all the blue pegs cross
359: it when $S$ jumps over it to the left,
360: we pair the jump with the
361: {\it previous} move which $R$ sees. By the same argument as above,
362: this move will be either
363: $S$ jumping to the right over $R$, or else $R$ moving to the right. This
364: move occurs {\it after} the last blue peg jumped over $R$, so this move
365: is not already being paired with some other same-colour jump over $R$,
366: and thus we have paired up all the jumps of red pegs over red pegs.
367:
368: We proceed similarly with jumps of blue pegs over blue pegs.
369: The only remaining
370: moves are ones which decrease the total weight, and we do not need to
371: group them. This proves the lemma, and with it the theorem.
372: \end{document}
373: