mbk-63-prev

33
Chapter 1 RECREATIONAL MATHEMATICS Recreational problems have survived, not because they were fostered by the textbook writers, but because of their inherent appeal to our love of mystery. Vera Sanford Before taking up the noteworthy mathematical thinkers and their memo- rable problems, a brief overview of the history of mathematical recreations may benefit the reader. For more historical details see, e.g., the books [6], [118], [133, Vol. 4], [153, Ch. VI], [167, Vol. II]. According to V. Sanford [153, Ch. VI], recreational mathematics comprises two principal divisions: those that depend on object manipulation and those that depend on com- putation. 4 9 2 3 5 7 8 1 6 Figure 1.1. The oldest magic square—lo-shu Perhaps the oldest known example of the first group is the magic square shown in the figure above. Known as lo-shu to Chinese mathematicians around 2200 b.c., the magic square was supposedly constructed during the reign of the Emperor Yii (see, e.g., [61, Ch. II], or [167, Vol. I, p. 28]). Chinese myth [27] holds that Emperor Yii saw a tortoise of divine creation 1

Upload: andreea-barac

Post on 07-Nov-2014

15 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: mbk-63-prev

Chapter 1 RECREATIONAL

MATHEMATICS

Recreational problems have survived,not because they were fostered by thetextbook writers, but because of theirinherent appeal to our love of mystery.

Vera Sanford

Before taking up the noteworthy mathematical thinkers and their memo-rable problems, a brief overview of the history of mathematical recreationsmay benefit the reader. For more historical details see, e.g., the books [6],[118], [133, Vol. 4], [153, Ch. VI], [167, Vol. II]. According to V. Sanford[153, Ch. VI], recreational mathematics comprises two principal divisions:those that depend on object manipulation and those that depend on com-putation.

4 9 2

3 5 7

8 1 6

Figure 1.1. The oldest magic square—lo-shu

Perhaps the oldest known example of the first group is the magic squareshown in the figure above. Known as lo-shu to Chinese mathematiciansaround 2200 b.c., the magic square was supposedly constructed during thereign of the Emperor Yii (see, e.g., [61, Ch. II], or [167, Vol. I, p. 28]).Chinese myth [27] holds that Emperor Yii saw a tortoise of divine creation

1

Page 2: mbk-63-prev

2 1. Recreational Mathematics

swimming in the Yellow River with the lo-shu, or magic square figure, adorn-ing its shell. The figure on the left shows the lo-shu configuration where thenumerals from 1 to 9 are composed of knots in strings with black knots foreven and white knots for odd numbers.

The Rhind (or Ahmes) papyrus,1 dating to around 1650 b.c., suggeststhat the early Egyptians based their mathematics problems in puzzle form.As these problems had no application to daily life, perhaps their main pur-pose was to provide intellectual pleasure. One of the earliest instances,named “As I was going to St. Ives”, has the form of a nursery rhyme (see[153]):

“Seven houses; in each are 7 cats; each cat kills 7 mice; each mouse would haveeaten 7 ears of spelt; each ear of spelt will produce 7 hekat. What is the total ofall of them?”2

The ancient Greeks also delighted in the creation of problems strictly foramusement. One name familiar to us is that of Archimedes, whose the cattleproblem appears on pages 41 to 43. It is one of the most famous problemsin number theory, whose complete solution was not found until 1965 by adigital computer.

The classical Roman poet Virgil (70 b.c.–19 b.c.) described in the Aeneidthe legend of the Phoenician princess Dido. After escaping tyranny in herhome country, she arrived on the coast of North Africa and asked the localruler for a small piece of land, only as much land as could be encompassedby a bull’s hide. The clever Dido then cut the bull’s hide into the thinnestpossible strips, enclosed a large tract of land and built the city of Carthagethat would become her new home. Today the problem of enclosing the max-imum area within a fixed boundary is recognized as a classical isoperimetricproblem. It is regarded as the first problem in a new mathematical disci-pline, established 17 centuries later, as calculus of variations. Jacob Steiner’selegant solution of Dido’s problem is included in this book.

Another of the problems from antiquity is concerned with a group ofmen arranged in a circle so that if every 𝑘th man is removed going aroundthe circle, the remainder shall be certain specified (favorable) individuals.This problem, appearing for the first time in Ambrose of Milan’s book ca.370, is known as the Josephus problem, and it found its way not just intolater European manuscripts, but also into Arabian and Japanese books.Depending on the time and location where the particular version of theJosephus problem was raised, the survivors and victims were sailors and

1Named after Alexander Henry Rhind (1833–1863), a Scottish antiquarian, layer and

Egyptologist who acquired the papyrus in 1858 in Luxor (Egypt).2T. Eric Peet’s translation of The Rhind Mathematical Papyrus, 1923.

Page 3: mbk-63-prev

1. Recreational Mathematics 3

smugglers, Christians and Turks, sluggards and scholars, good guys andbad guys, and so on. This puzzle attracted attention of many outstandingscientists, including Euler, Tait, Wilf, Graham, and Knuth.

As Europe emerged from the Dark Ages, interest in the arts and sciencesreawakened. In eighth-century England, the mathematician and theologianAlcuin of York wrote a book in which he included a problem that involved aman wishing to ferry a wolf, a goat and a cabbage across a river. The solu-tion shown on pages 240–242 demonstrates how one can solve the problemaccurately by using graph theory. River-crossing problems under specificconditions and constraints were very popular in medieval Europe. Alcuin,Tartaglia, Trenchant and Leurechon studied puzzles of this type. A variantinvolves how three couples should cross the river in a boat that cannot carrymore than two people at a time. The problem is complicated by the jealousyof the husbands; each husband is too jealous to leave his wife in the companyof either of the other men.

Four centuries later, mathematical puzzles appear in the third section ofLeonardo Fibonacci’s Liber Abaci, published in 1202. This medieval scholar’smost famous problem, the rabbit problem, gave rise to the unending sequencethat bears his name: the Fibonacci sequence, or Fibonacci numbers as theyare also known, 1, 1, 2, 3, 5, 8, 13, 21, 34, . . . (see pages 12–13).

Yet another medieval mathematician, ibn Khallikan (1211–1282), formu-lated a brain teaser requiring the calculation of the total number of wheatgrains placed on a standard 8× 8 chessboard. The placement of the grainsmust respect the following distribution: 1 grain is placed on the first square,2 grains on the second, 4 on the third, 8 on the fourth, and so on, doublingthe number for each successive square. The resulting number of grains is264 − 1, or 18,446,744,073,709,551,615. Ibn Khallikan presented this prob-lem in the form of the tale of the Indian king Shirham who wanted to rewardthe Grand Vizier Sissa ben Dahir for having invented chess. Sissa asked forthe number of grains on the chessboard if each successive position is the nextnumber in a geometric progression. However, the king could not fulfill Sissa’swish; indeed, the number of grains is so large that it is far greater than theworld’s annual production of wheat grains. Speaking in broad terms, ibnKhallikan’s was one of the earliest chess problems.

Ibn Kallikan’s problem of the number of grains is a standard illustra-tion of geometric progressions, copied later by Fibonacci, Pacioli, Claviusand Tartaglia. Arithmetic progressions were also used in these entertainingproblems. One of the most challenging problems appeared in Buteo’s bookLogistica (Lyons, 1559, 1560):3

3The translation from Latin is given in [153], p. 64.

Page 4: mbk-63-prev

4 1. Recreational Mathematics

“A mouse is at the top of a poplar tree 60 braccia4 high, and a cat is on theground at its foot. The mouse descends 1/2 of a braccia a day and at night itturns back 1/6 of a braccia. The cat climbs one braccia a day and goes back 1/4of a braccia each night. The tree grows 1/4 of a braccia between the cat and themouse each day and it shrinks 1/8 of a braccia every night. In how many days willthe cat reach the mouse and how much has the tree grown in the meantime, andhow far does the cat climb?”

At about the same time Buteo showed enviable knowledge of the generallaws of permutations and combinations; moreover, he constructed a combi-nation lock with movable cylinders displayed in Figure 1.2.5

Figure 1.2. Buteo’s combination lock (1559)

In 1512 Guarini devised a chessboard problem in which the goal is to effectthe exchange of two black and two white knights, with each pair placed at

the corners of a 3× 3 chessboard (see figure left),in the minimum number of moves. The solutionof this problem by using graph theory is shown onpages 274–276. People’s interest in chess problemsand the challenge they provide has lasted from theMiddle Ages, through the Renaissance and to thepresent day.

While the Italian mathematicians Niccolo Tartaglia (1500–1557) and Gi-rolamo Cardano (1501–1576) labored jointly to discover the explicit formulafor the solution of cubic algebraic equations, they also found time for recre-ational problems and games in their mathematical endeavors. Tartaglia’sGeneral Trattato (1556) described several interesting tasks; four of which,

4Braccia is an old Italian unit of length.5Computer artwork, sketched according to the illustration from Buteo’s Logistica (Ly-

ons, 1559, 1560).

Page 5: mbk-63-prev

1. Recreational Mathematics 5

the weighing problem, the division of 17 horses, the wine and water problem,and the ferryboat problem, are described on pages 20, 24, 25 and 173.

Girolamo Cardano was one the most famous scientists of his time andan inventor in many fields. Can you believe that the joint connecting thegear box to the rear axle of a rear wheel drive car is known to the presentday by a version of his name—the cardan shaft? In an earlier book, DeSubtilitate (1550), Cardano presented a game, often called the Chinese ringpuzzle (Figure 1.3), that made use of a bar with several rings on it thatremains popular even now. The puzzle’s solution is closely related to Gray’serror-correcting binary codes introduced in the 1930s by the engineer FrankGray. The Chinese ring puzzle also bears similarities to the Tower of Hanoi,invented in 1883 by Edouard Lucas (1842–1891), which is also discussed laterin the book.

Figure 1.3. Chinese ring puzzle

Many scholars consider Problems Plaisans et Delectables, by Claude Gas-par Bachet (1581–1638), to be the first book on mathematical puzzles andtricks. Most of the famous puzzles and curious problems invented before theseventeenth century may be found in Bachet’s delightful book. In additionto Bachet’s original “delectable” problems, the book contains puzzles by Al-cuin of York, Pacioli, Tartaglia and Cardano, and other puzzles of Asianorigin. Bachet’s book, first published in 1612 and followed by the secondedition published in 1624, probably served as the inspiration for subsequentworks devoted to mathematical recreation.

Other important writers on the subject include the Jesuit scholar JeanLeurechon (1591–1670), who published under the name of Hendrik van Et-ten, and Jacques Ozanam (1640–1717). Etten’s work, Mathematical Recre-ations, or a Collection of Sundry Excellent Problems Out of Ancient andModern Philosophers Both Useful and Recreative, first published in French

Page 6: mbk-63-prev

6 1. Recreational Mathematics

in 1624 with an English translation appearing in 1633, is a compilation ofmathematical problems interspersed with mechanical puzzles and experi-ments in hydrostatics and optics that most likely borrowed heavily fromBachet’s work.

Leonhard Euler (1707–1783), one of the world’s greatest mathematicianswhose deep and exacting investigations led to the foundation and develop-ment of new mathematical disciplines, often studied mathematical puzzlesand games. Euler’s results from the seven bridges of Konigsberg problem(pages 230–232) presage the beginnings of graph theory. The thirty-six offi-cers problem and orthogonal Latin squares (or Eulerian squares), discussedby Euler and later mathematicians, have led to important work in combina-torics. Euler’s conjecture on the construction of mutually orthogonal squaresfound resolution nearly two hundred years after Euler himself initially posedthe problem. These problems, and his examination of the chessboard knight’sre-entrant tour problem, are described on pages 188 and 258. A knight’s re-entrant path consists of moving a knight so that it moves successively to eachsquare once and only once and finishes its tour on the starting square. Thisfamous problem has a long history and dates back to the sixth century inIndia. P. M. Roget’s half-board solution (1840), shown in Figure 1.4, offersa remarkably attractive design.

Figure 1.4. Knight’s re-entrant path—Roget’s solution

In 1850 Franz Nauck posed another classic chess problem, the eight queensproblem, that calls for the number of ways to place eight queens on a chess-board so that no two queens attack each other. Gauss gave a solution of thisproblem, albeit incomplete in the first attempts. Further details about theeight queens problem appear on pages 269–273. In that same year, Thomas P.Kirkman (1806–1895) put forth the schoolgirls problem presented on pages

Page 7: mbk-63-prev

1. Recreational Mathematics 7

189 to 192. Several outstanding mathematicians, Steiner, Cayley and Sylve-ster among them, dealt with this combinatorial problem and other relatedproblems. Although some of these problems remain unsolved even now,the subject continues to generate important papers on combinatorial designtheory.

In 1857 the eminent Irish mathematician William Hamilton (1788–1856)invented the icosian game in which one must locate a path along the edges ofa regular dodecahedron that passes through each vertex of the dodecahedrononce and only once (see pages 234–237). As in Euler’s Konigsberg bridgesproblem, the Hamiltonian game is related to graph theory. In modern ter-minology, this task requires a Hamiltonian cycle in a certain graph and itis one of the most important open problems not only in graph theory butin the whole mathematics. The Hamiltonian cycle problem is closely con-nected to the famous traveling salesman problem that asks for an optimalroute between some places on a map with given distances.

Figure 1.5. The Tower of Hanoi

The French mathematician Francois Edouard Lucas, best known for hisresults in number theory, also made notable contributions to recreationalmathematics, among them, as already mentioned, the Tower of Hanoi (Fig-ure 1.5), which is covered on pages 196–199, and many other amusing puz-zles. Lucas’ four-volume book Recreations Mathematiques (1882–94), to-gether with Rouse Ball’s, Mathematical Recreations and Problems, publishedin 1892, have become classic works on recreational mathematics.

Page 8: mbk-63-prev

8 1. Recreational Mathematics

No discussion of recreational mathematics would be complete withoutincluding Samuel Loyd (1841–1911) and Henry Ernest Dudeney (1857–1931),two of the most renowned creators of mathematical diversions. Loyd andDudeney launched an impressive number of games and puzzles that remainas popular now as when they first appeared. Loyd’s ingenious toy-puzzlethe “15 Puzzle” (known also as the “Boss Puzzle”, or “Jeu de Taquin”) ispopular even today. The “15 Puzzle” (figure below) consists of a squaredivided into 16 small squares and holds 15 square blocks numbered from 1

to 15. The task is to start from a given initialarrangement and set these numbered blocksinto the required positions (say, from 1 to 15),using the vacant square for moving blocks. Formany years after its appearance in 1878, peo-ple all over the world were obsessed by thistoy-puzzle. It was played in taverns, factories,in homes, in the streets, in the royal palaces,even in the Reichstag (see page 2430 in [133,Vol. 4].

Martin Gardner (b. 1914 Tulsa, OK), most certainly deserves mentionas perhaps the greatest twentieth-century popularizer of mathematics andmathematical recreations. During the twenty-five years in which he wrotehis Mathematical Games column for the Scientific American, he publishedquantities of amusing problems either posed or solved by notable mathe-maticians.

Page 9: mbk-63-prev

Chapter 10 �����

In many cases, mathematics as well as chess,is an escape from reality.

Stanislaw Ulam

Chess is the gymnasium of the mind.Blaise Pascal

The chessboard is the world,the pieces are the phenomena of the Universe,

the rules of the game are what we call the laws of Nature.Thomas Huxley

Puzzles concern the chessboards (of various dimensions and differentshapes) and chess pieces have always lent themselves to mathematical recre-ations. Over the last five centuries so many problems of this kind havearisen. Find a re-entrant path on the chessboard that consists of moving aknight so that it moves successively to each square once and only once andfinish its tour on the starting square. How to place 8 queens on the 8 × 8chessboard so that no queen can be attacked by another? For many years Ihave been interested in these types of chess-math problems and, in 1997, Iwrote the book titled Mathematics and Chess (Dover Publications) [138] asa collection of such problems. Some of them are presented in this chapter.

Mathematics, the queen of the sciences, and chess, the queen of games,share an axiomatical approach and an abstract way of reasoning in solvingproblems. The logic of the rules of play, the chessboard’s geometry, and theconcepts “right” and “wrong” are reminiscent of mathematics. Some math-ematical problems can be solved in an elegant manner using some elementsof chess. Chess problems and chess-math puzzles can ultimately improveanalytical reasoning and problem solving skills.

In its nature, as well as in the very structure of the game, chess resemblesseveral branches of mathematics. Solutions of numerous problems and puz-zles on a chessboard are connected and based on mathematical facts fromgraph theory, topology, number theory, arithmetic, combinatorial analysis,geometry, matrix theory, and other topics. In 1913, Ernst Zermelo used

257

Page 10: mbk-63-prev

258 10. Chess

these connections as a basis to develop his theory of game strategies, whichis considered as one of the forerunners of game theory.

The most important mathematical challenge of chess has been how to de-velop algorithms that can play chess. Today, computer engineers, program-mers and chess enthusiasts design chess-playing machines and computer pro-grams that can defeat the world’s best chess players. Recall that, in 1997,IBM’s computer Deep Blue beat Garry Kasparov, the world champion ofthat time.

Many great mathematicians were interested in chess problems: Euler,Gauss, Vandermonde, de Moivre, Legendre. On the other hand, severalworld-class chess players have made contributions to mathematics, beforeall, Emanuel Lasker. One of the best English contemporary grandmastersand twice world champion in chess problem solving, John Nunn, received hisPh.D. in mathematics from Oxford University at the age of twenty-three.

The aim of this chapter is to present amusing puzzles and tasks thatcontain both mathematical and chess properties. We have mainly focused onthose problems posed and/or solved by great mathematicians. The readerwill see some examples of knight’s re-entrant tours (or “knight’s circles”)found by Euler, de Moivre and Vandermond. We have presented a variantof knight’s chessboard (uncrossed) tour, solved by the outstanding computerscientist Donald Knuth using a computer program. You will also find thefamous eight queens problem, that caught Gauss’ interest. An amusingchessboard problem on non-attacking rooks was solved by Euler.

None of the problems and puzzles exceed a high school level of difficulty;advanced mathematics is excluded. In addition, we presume that the readeris familiar with chess rules.

*

* *

Abraham de Moivre (1667–1754) (→ p. 304)

Pierre de Montmort (1678–1733) (→ p. 304)

Alexandre Vandermonde (1735–1796) (→ p. 305)

Leonhard Euler (1707–1783) (→ p. 305)

Knight’s re-entrant route

Among all re-entrant paths on a chessboard, the knight’s tour is doubtlessthe most interesting and familiar to many readers.

Page 11: mbk-63-prev

Knight’s re-entrant route 259

Problem 10.1. Find a re-entrant route on a standard 8 × 8 chessboardwhich consists of moving a knight so that it moves successively to each squareonce and only once and finishes its tour on the starting square.

Closed knight’s tours are often called “knight’s circles”. This remarkableand very popular problem was formulated in the sixth century in India [181].It was mentioned in the Arab, Mansubas1, of the ninth century a.d. Thereare well-known examples of the knight’s circle in the Hamid I Mansubas (Is-tanbul Library) and the Al-Hakim Mansubas (Ryland Library, Manchester).This task has delighted people for centuries and continues to do so to thisday. In his beautiful book Across the Board: The Mathematics of Chess-board Problems [181] J. J. Watkins describes his unforgettable experience ata Broadway theater when he was watching the famous sleight-of-hand artistRicky Jay performing blindfolded a knights tour on stage.

The knight’s circle also interested such great mathematicians as Euler,Vandermonde, Legendre, de Moivre, de Montmort, and others. De Mont-mort and de Moivre provided some of the earliest solutions at the beginningof the eighteenth century. Their method is applied to the standard 8 × 8chessboard divided into an inner square consisting of 16 cells surrounded by

Figure 10.1. Knight’s tour—de Moivre’s solution

an outer ring of cells two deep. If the knight starts from a cell in the outerring, it always moves along this ring filling it up and continuing into aninner ring cell only when absolutely necessary. The knight’s tour, shown in

1The Mansubas, a type of book, collected and recorded the games, as well as remark-ably interesting positions, accomplished by well-known chess players.

Page 12: mbk-63-prev

260 10. Chess

Figure 10.1, was composed by de Moivre (which he sent to Brook Taylor).Surprisingly, the first 23 moves are in the outer two rows. Although it passesall 64 cells, the displayed route is not a re-entrant route.

Even though L. Bertrand of Geneva initiated the analysis, according toMemoires de Berlin for 1759, Euler made the first serious mathematicalanalysis of this subject. In his letter to the mathematician Goldbach (April26, 1757), Euler gave a solution to the knight’s re-entrant path shown inFigure 10.2.

Figure 10.2. Euler’s knight’s circle Figure 10.3. Euler’s half-board solution

solution

Euler’s method consists of a knight’s random movement over the boardas long as it is possible, taking care that this route leaves the least possiblenumber of untraversed cells. The next step is to interpolate these untraversedcells into various parts of the circuit to make the re-entrant route. Detailson this method may be found in the books, Mathematical Recreations andEssays by Rouse Ball and Coxeter [150], Across the Board by J. J. Watkins[181] and In the Czardom of Puzzles (in Russian) [107] by E. I. Ignat’ev, thegreat Russian popularizer of mathematics. Figure 10.3 shows an example ofEuler’s modified method where the first 32 moves are restricted to the lowerhalf of the board, then the same tour is repeated in a symmetric fashion forthe upper half of the board.

Vandermonde’s approach to solving the knight’s re-entrant route uses frac-tions of the form 𝑥/𝑦, where 𝑥 and 𝑦 are the coordinates of a traversed cell.2

2L’Historie de l’Academie des Sciences for 1771, Paris 1774, pp. 566–574.

Page 13: mbk-63-prev

Knight’s re-entrant route 261

For example, 1/1 is the lower left corner square (a1) and 8/8 is the upperright corner square (h8). The values of 𝑥 and 𝑦 are limited by the dimen-sions of the chessboard and the rules of the knight’s moves. Vandermonde’sbasic idea consists of covering the board with two or more independent pathstaken at random. In the next step these paths are connected. Vandermondehas described a re-entrant route by the following fractions (coordinates):

5/5, 4/3, 2/4, 4/5, 5/3, 7/4, 8/2, 6/1, 7/3, 8/1, 6/2, 8/3, 7/1, 5/2, 6/4, 8/5,

7/7, 5/8, 6/6, 5/4, 4/6, 2/5, 1/7, 3/8, 2/6, 1/8, 3/7, 1/6, 2/8, 4/7, 3/5, 1/4,

2/2, 4/1, 3/3, 1/2, 3/1, 2/3, 1/1, 3/2, 1/3, 2/1, 4/2, 3/4, 1/5, 2/7, 4/8, 3/6,

4/4, 5/6, 7/5, 8/7, 6/8, 7/6, 8/8, 6/7, 8/6, 7/8, 5/7, 6/5, 8/4, 7/2, 5/1, 6/3.

The usual chess notation corresponding to the above fraction notation wouldbe e5, d3, b4, d5, e3, and so on.

An extensive literature exists on the knight’s re-entrant tour.3 In 1823,H. C. Warnsdorff4 provided one of its most elegant solutions. His methodis very efficient, not only for the standard chessboard but also for a general𝑛× 𝑛 board as well.

Recalling Problem 9.4 we immediately conclude that the knight’s circlesare in fact Hamiltonian cycles. There are 13,267,364,410,532 closed knight’stours, calculated in 2000 by Wegener [183]. The same number was previouslyclaimed by Brendan McKay in 1997.5 One of the ways to find a knight’s

3For instance, P. Volpicelli, Atti della Reale Accademia dei Lincei (Rome, 1872); C.F.

de Jaenisch, Applications de l’Analyse mathematique au Jeu des Echecks, 3 vols. (Pet-

rograd, 1862–63); A. van der Linde, Geschichte und Literatur des Schachspiels, vol. 2

(Berlin, 1874); M. Kraitchik, La Mathematique des Jeux (Brussels, 1930); W. W. Rouse

Ball, Mathematical Recreations and Essays, rev. ed. (Macmillan, New York 1960); E.

Gik, Mathematics on the Chessboard (in Russian, Nauka, Moscow 1976); E. I. Ignat’ev,In the Czardom of Puzzles (in Russian, Nauka, Moscow 1979); D’Hooge, Les Secrets du

cavalier (Bruxelles-Paris, 1962); M. Petkovic, Mathematics and Chess, Dover Publica-

tions, Mineola (1997); I. Wegener, Branching Programs and Binary Decision Diagrams,

SIAM, Philadelphia (2000); J. J. Watkins, Across the Board: The Mathematics of Chess-

board Problems, Princeton University Press, Princeton and Oxford (2004); N. D. Elkies,R. P. Stanley, The mathematical knight, Mathematical Intellegencer 22 (2003), 22–34; A.

Conrad, T. Hindrichs, H. Morsy, I. Wegener, Solution of the knight’s Hamiltonian path

problem on chessboards, Discrete Applied Mathematics 50 (1994), 125–134.4Des Rosselsrpunges einfachste und allgemeinste Losung, Schalkalden 1823.5A powerful computer, finding tours at a speed of 1 million tours per second, will have

to run for more than 153 days and nights to reach the number of tours reported by McKayand Wegener.

Page 14: mbk-63-prev

262 10. Chess

tour is the application of backtracking algorithms6, but this kind of searchis very slow so that even very powerful computers need considerable time.Another algorithm developed by A. Conrad et al. [40] is much faster andfinds the knight’s re-entrant tours on the 𝑛× 𝑛 board for 𝑛 ≥ 5.

An extensive study of the possibility of the knight’s re-entrant routes ona general 𝑚 × 𝑛 chessboard can be found in [181]. A definitive solutionwas given by Allen Schwenk [156] in 1991, summarized in the form of thefollowing theorem.

Theorem 10.1 (Schwenk). An 𝑚×𝑛 chessboard (𝑚 ≤ 𝑛) has a knight’stour unless one or more of the following three conditions hold:

(i) 𝑚 and 𝑛 are both odd;

(ii) 𝑚 = 1, 2, or 4; or

(iii) 𝑚 = 3 and 𝑛 = 4, 6, or 8.

One more remark. If a knight’s closed tour exists, then it is obvious thatany square on the considered chessboard can be taken as the starting point.

It is a high time for the reader to get busy and try to find the solution tothe following problem.

Problem 10.2.* Prove the impossibility of knight’s tours for 4×𝑛 boards.

The previous problem tell us that a knight’s tour on a 4 × 4 board isimpossible. The question of existence of such a tour for the three-dimensional4× 4× 4 board, consisting of four horizontal 4× 4 boards which lie one overthe other, is left to the reader.

Problem 10.3.* Find a knight’s re-entrant tour on a three-dimensional4× 4× 4 board.

Many composers of the knight’s circles have constructed re-entrant pathsof various unusual and intriguing shapes while also incorporating certainesthetic elements or other features. Among them, magic squares using aknight’s tour (not necessarily closed) have attracted the most attention.J. J. Watkins calls the quest for such magic squares the Holy Grail. TheRussian chess master and officer de Jaenisch (1813–1872) composed manynotable problems concerning the knight’s circles. Here is one of them [138,Problem 3.5], just connected with magic squares.

6A backtracking algorithm searches for a partial candidate to the solution step by step

and eliminates this candidate when the algorithm reaches an impasse, then backing up

a number of steps to try again with another partial candidate—the knight’s path in thisparticular case.

Page 15: mbk-63-prev

Magic knight’s re-entrant route 263

Problem 10.4. Let the successive squares that form the knight’s re-entrant path be denoted by the numbers from 1 to 64 consecutively, 1 beingthe starting square and 64 being the square from which the knight plays itslast move, connecting the squares 64 and 1. Can you find a knight’s re-entrant path such that the associated numbers in each row and each columnadd up to 260?

The first question from the reader could be: Must the sum be just 260?The answer is very simple. The total sum of all traversed squares of thechessboard is

1 + 2 + ⋅ ⋅ ⋅+ 64 =64 ⋅ 65

2= 2,080,

and 2,080 divided by 8 gives 260. It is rather difficult to find magic or “semi-magic squares” (“semi-” because the sums over diagonals are not taken intoaccount), so we recommend Problem 10.4 only to those readers who arewell-versed in the subject. One more remark. De Jaenisch was not the firstwho constructed the semi-magic squares. The first semi-magic knight’s tour,shown in Figure 10.4, was composed in 1848 by William Beverley, a Britishlandscape painter and designer of theatrical effects.

There are 280 distinct arithmetical semi-magic tours (not necessarilyclosed). Taking into account that each of these semi-magic tours can beoriented by rotation and reflection in eight different ways, a total number ofsemi-magic squares is 2,240 (= 280× 8).

Only a few knight’s re-entrant paths possess the required “magic” prop-erties. One of them, constructed by de Jaenisch, is given in Figure 10.5.

1 30 47 52 5 28 43 5448 51 2 29 44 53 6 2731 46 49 4 25 8 55 4250 3 32 45 56 41 26 733 62 15 20 9 24 39 5816 19 34 61 40 57 10 2363 14 17 36 21 12 59 3818 35 64 13 60 37 22 11

63 22 15 40 1 42 59 1814 39 64 21 60 17 2 4337 62 23 16 41 4 19 5824 13 38 61 20 57 44 311 36 25 52 29 46 5 5626 51 12 33 8 55 30 4535 10 49 28 53 32 47 650 27 34 9 48 7 54 31

Figure 10.4. Beverley’s tour Figure 10.5. De Jaenisch’s tour

The question of existence of a proper magic square (in which the sumsover the two main diagonals are also equal to 260) on the standard 8 × 8chessboard has remained open for many years. However, in August 2003,Guenter Stertenbrink announced that an exhaustive search of all possibilities

Page 16: mbk-63-prev

264 10. Chess

using a computer program had led to the conclusion that no such knight’stour exists (see Watkins [181]).

Our discussion would be incomplete without addressing the natural ques-tion of whether a magic knight’s tour exists on a board of any dimension𝑛 × 𝑛. Where there is magic, there is hope. Indeed, it has been proved re-cently that such magic tours do exist on boards of size 16 × 16, 20 × 20,24× 24, 32× 32, 48× 48, and 64× 64 (see [181]).

The following problem concerns a knight’s tour which is closed, but inanother sense. Namely, we define a closed knight’s route as a closed pathconsisting of knight’s moves which do not intersect and do not necessarilytraverse all squares. For example, such a closed route is shown in Figure10.13.

Problem 10.5.* Prove that the area enclosed by a closed knight’s routeis an integral multiple of the area of a square of the 𝑛×𝑛 (𝑛 ≥ 4) chessboard.

Hint: Exploit the well-known Pick’s theorem which reads: Let 𝐴 be thearea of a non-self-intersecting polygon 𝑃 whose vertices are points of a lat-tice. Assume that the lattice is composed of elementary parallelograms withthe area 𝑆. Let 𝐵 denote the number of points of the lattice on the polygonedges and 𝐼 the number of points of the lattice inside 𝑃. Then

𝐴 =(𝐼 + 1

2𝐵 − 1)𝑆. (10.1)

Many generalizations of the knight’s tour problem have been proposedwhich involve alteration of the size and shape of the board or even modi-fying the knight’s standard move; see Kraitchik [118]. Instead of using theperpendicular components 2 and 1 of the knight’s move, written as the pair(2,1), Kraitchik considers the (𝑚,𝑛)-move.

A Persian manuscript, a translation of which can be found in DuncanForbes’ History of Chess (London, 1880), explains the complete rules offourteenth-century Persian chess. A piece called the “camel”, used in Persianchess and named the “cook” by Solomon Golomb, is actually a modifiedknight that moves three instead of two squares along a row or a file, thenone square at right angles which may be written as (3,1). Obviously, thispiece can move on the 32 black squares of the standard 8 × 8 chessboardwithout leaving the black squares. Golomb posed the following task.

Problem 10.6.* Is there a camel’s tour over all 32 black squares of thechessboard in such a way that each square is traversed once and only once?

Page 17: mbk-63-prev

Non-attacking rooks 265

Leonhard Euler (1707–1783) (→ p. 305)

Non-attacking rooks

Apart from the knight’s re-entrant tours on the chessboard, shown onpages 258–264, another amusing chessboard problem caught Leonhard Eu-ler’s interest.

Problem 10.7. Let 𝑄𝑛 (𝑛 ≥ 2) be the number of arrangements of 𝑛rooks that can be placed on an 𝑛× 𝑛 chessboard so that no rook attacks anyother and no rook lies on the squares of the main diagonal. One assumesthat the main diagonal travels from the lower left corner square (1, 1) to theupper right corner square (𝑛, 𝑛). The task is to find 𝑄𝑛 for an arbitrary 𝑛.

The required positions of rooks for 𝑛 = 2 and 𝑛 = 3, for example, areshown in Figure 10.6 giving 𝑄2 = 1 and 𝑄3 = 2.

𝑛 = 2, 𝑄2 = 1 𝑛 = 3, 𝑄3 = 2

Figure 10.6. Non-attacking rooks outside the main diagonal

The above-mentioned problem is, in essence, the same one as that referredto as the Bernoulli–Euler problem of misaddressed letters appearing on page184. Naturally, the same formula provides solutions to both problems. Asour problem involves the placement of rooks on a chessboard, we will expressthe solution of the problem of non-attacking rooks in the context of thechessboard.

According to the task’s conditions, every row and every column containone and only one rook. For an arbitrary square (𝑖, 𝑗), belonging to the 𝑖throw and 𝑗th column, we set the square (𝑗, 𝑖) symmetrical to the square (𝑖, 𝑗)with respect to the main diagonal.

The rook can occupy 𝑛−1 squares in the first column (all except thesquare belonging to the main diagonal). Assume that the rook in the firstcolumn is placed on the square (𝑟, 1), 𝑟 ∈ {2, . . . , 𝑛}. Depending on thearrangement of the rooks in the remaining 𝑛−1 columns, we can distinguish

Page 18: mbk-63-prev

266 10. Chess

two groups of positions with non-attacking rooks: if the symmetrical square(1, 𝑟) (related to the rook on the square (𝑟, 1)) is not occupied by a rook, wewill say that the considered position is of the first kind, otherwise, it is ofthe second kind. For example, the position on the left in Figure 10.7 (where𝑛 = 4 and 𝑟 = 2) is of the first kind, while the position on the right is of thesecond kind.

Figure 10.7. Positions of the first kind (left) and second kind (right)

Let us now determine the number of the first kind positions. If we removethe 𝑟th row from the board and substitute it by the first row, and thenremove the first column, a new (𝑛 − 1) × (𝑛 − 1) chessboard is obtained.Each arrangement of rooks on the new chessboard satisfies the conditions ofthe problem. The opposite claim is also valid: for each arrangement of rookson the new chessboard satisfying the conditions of the problem, the uniqueposition of the first kind can be found. Hence, the number of the first kindpositions is exactly 𝑄𝑛−1.

To determine the number of second kind positions, let us remove thefirst column and the 𝑟th row, and also the 𝑟th column and the first rowfrom the 𝑛 × 𝑛 chessboard (regarding only positions of the second kind).If we join the remaining rows and columns without altering their order, anew (𝑛 − 2) × (𝑛 − 2) chessboard is formed. It is easy to check that thearrangements of rooks on such (𝑛 − 2) × (𝑛 − 2) chessboards satisfy theconditions of the posed problem. Therefore, it follows that there are 𝑄𝑛−2positions of the second kind.

After consideration of the above, we conclude that there are 𝑄𝑛−1+𝑄𝑛−2positions of non-attacking rooks on the 𝑛 × 𝑛 chessboard, satisfying theproblem’s conditions and corresponding to the fixed position of the rook—the square (𝑟, 1)—in the first column. Since 𝑟 can take 𝑛 − 1 values (=2, 3, . . . , 𝑛), one obtains

𝑄𝑛 = (𝑛− 1)(𝑄𝑛−1 +𝑄𝑛−2). (10.2)

Page 19: mbk-63-prev

Non-attacking rooks 267

The above recurrence relation derived by Euler is a difference equationof the second order. It can be reduced to a difference equation of the firstorder in the following manner. Starting from (10.2) we find

𝑄𝑛 − 𝑛𝑄𝑛−1 = (𝑛− 1)(𝑄𝑛−1 +𝑄𝑛−2)− 𝑛𝑄𝑛−1= −(𝑄𝑛−1 − (𝑛− 1)𝑄𝑛−2).

Using successively the last relation we obtain

𝑄𝑛 − 𝑛𝑄𝑛−1 = −(𝑄𝑛−1 − (𝑛− 1)𝑄𝑛−2)

= (−1)2(𝑄𝑛−2 − (𝑛− 2)𝑄𝑛−3)...

= (−1)𝑛−3(𝑄3 − 3𝑄2).

Since 𝑄2 = 1 and 𝑄3 = 2 (see Figure 10.6), one obtains the differenceequation of the first order

𝑄𝑛 − 𝑛𝑄𝑛−1 = (−1)𝑛. (10.3)

To find the general formula for 𝑄𝑛, we apply (10.3) backwards and obtain

𝑄𝑛 = 𝑛𝑄𝑛−1 + (−1)𝑛 = 𝑛((𝑛− 1)𝑄𝑛−2 + (−1)𝑛−1)+ (−1)𝑛

= 𝑛(𝑛− 1)𝑄𝑛−2 + 𝑛(−1)𝑛−1 + (−1)𝑛= 𝑛(𝑛− 1)

((𝑛− 2)𝑄𝑛−3 + (−1)𝑛−2)+ 𝑛(−1)𝑛−1 + (−1)𝑛

= 𝑛(𝑛− 1)(𝑛− 2)𝑄𝑛−3 + 𝑛(𝑛− 1)(−1)𝑛−2+ 𝑛(−1)𝑛−1 + (−1)𝑛...

= 𝑛(𝑛− 1)(𝑛− 2) ⋅ ⋅ ⋅ 3 ⋅𝑄2 + 𝑛(𝑛− 1) ⋅ ⋅ ⋅ 4 ⋅ (−1)3 + ⋅ ⋅ ⋅+ 𝑛(−1)𝑛−1 + (−1)𝑛

= 𝑛!( 1

2!− 1

3!+ ⋅ ⋅ ⋅+ (−1)𝑛

𝑛!

),

that is,

𝑄𝑛 = 𝑛!𝑛∑

𝑘=2

(−1)𝑘𝑘!

(𝑛 ≥ 2).

Page 20: mbk-63-prev

268 10. Chess

The last formula gives

𝑄2 = 1, 𝑄3 = 2, 𝑄4 = 9, 𝑄5 = 44, 𝑄6 = 265, etc.

Carl Friedrich Gauss (1777–1855) (→ p. 305)

Carl Friedrich Gauss indisputably merits a place among such illustriousmathematicians as Archimedes and Newton. Sometimes known as “thePrince of mathematicians,” Gauss is regarded as one of the most influen-tial mathematicians in history. He made a remarkable contribution to manyfields of mathematics and science (see short biography on page 305).

As a ten-year old schoolboy, Gauss was already exhibiting his formidablemathematical talents as the following story recounts. One day Gauss’ teacherMr. Buttner, who had a reputation for setting difficult problems, set hispupils to the task of finding the sum of the arithmetic progression 1 + 2 +⋅ ⋅ ⋅ + 100.7 The lazy teacher assumed that this problem would occupy theclass for the entire hour since the pupils knew nothing about arithmeticalprogression and the general sum formula. Almost immediately, however, gif-

ted young Gauss placed his slate on the table.When the astonished teacher finally looked at theresults, he saw the correct answer, 5,050, withno further calculation. The ten-year-old boy hadmentally computed the sum by arranging the ad-dends in 50 groups (1+100), (2+99), . . . , (50, 51),each of them with the sum 101, and multiplyingthis sum by 50 in his head to obtain the requiredsum 101 ⋅50 =5,050. Impressed by his young stu-dent, Buttner arranged for his assistant MartinBartels (1769–1836), who later became a mathe-matics professor in Russia, to tutor Gauss.Carl Friedrich Gauss

1777–1855

Like Isaac Newton, Gauss was never a prolific writer. Being an ardentperfectionist, he refused to publish his works which he did not consider com-plete, presumably fearing criticism and controversy. His delayed publicationof results, like the delays of Newton, led to many high profile controversiesand disputes.

7Some authors claim that the teacher gave the arithmetic progression 81,297+81,495+⋅ ⋅ ⋅+ 100,899 with the difference 198. It does not matter!

Page 21: mbk-63-prev

The eight queens problem 269

Gauss’ short dairy of only 19 pages, found after his death and publishedin 1901 by the renowned German mathematician Felix Klein, is regarded asone of the most valuable mathematical documents ever. In it he included146 of his discoveries, written in a very concise form, without any tracesof derivation or proofs. For example, he jotted down in his dairy “Heureka!num = △+△+△,” a coded form of his discovery that every positive integeris representable as a sum of at most three triangular numbers.

Many details about the work and life of Gauss can be found in G. W.Dunnington’s book, Carl Friedrich Gauss, Titan of Science [58]. Here is ashort list of monuments, objects and other things named in honour of Gauss:

– The CGS unit for magnetic induction was named Gauss in his honour,– Asteroid 1001 Gaussia,– The Gauss crater on the Moon,– The ship Gauss, used in the Gauss expedition to the Antarctic,– Gaussberg, an extinct volcano on the Antarctic,– The Gauss Tower, an observation tower in Dransfeld, Germany,– Degaussing is the process of decreasing or eliminating an unwanted

magnetic field (say, from TV screens or computer monitors).

The eight queens problem

One of the most famous problems connected with a chessboard and chesspieces is undoubtedly the eight queens problem. Although there are claimsthat the problem was known earlier, in 1848 Max Bezzel put forward thisproblem in the chess journal Deutsche Schachzeitung of Berlin:

Problem 10.8. How does one place eight queens on an 8× 8 chessboard,or, for general purposes, 𝑛 queens on an 𝑛 × 𝑛 board, so that no queen isattacked by another. In addition, determine the number of such positions.

Before we consider this problem, let us note that although puzzles involv-ing non-attacking queens and similar chess-piece puzzles may be intriguingin their right, more importantly, they have applications in industrial mathe-matics; in maximum cliques from graph theory, and in integer programming(see, e.g., [65]).

The eight queens problem was posed again by Franz Nauck in the morewidely read, Illustrirte Zeitung, of Leipzig in its issue of June 1, 1850. Fourweeks later Nauck presented 60 different solutions. In the September issuehe corrected himself and gave 92 solutions but he did not offer a proof thatthere are not more. In 1910 G. Bennett8 concluded that there are only 12

8G. Bennett, The eight queens problem, Messenger of Mathematics, 39 (1910), 19.

Page 22: mbk-63-prev

270 10. Chess

distinctly different solutions to the queens problem, that is, solutions thatcould not be obtained one from another by rotations for 90∘, 180∘ and 270∘,and mirror images; T. Gosset later proved this in 1914.9

Figure 10.8. The 8-queens problem; one fundamental solution 41582736

Each position of the non-attacking queens on the 8 × 8 board can beindicated by an array of 8 numbers 𝑘1𝑘2 ⋅ ⋅ ⋅ 𝑘8. The solution 𝑘1𝑘2 ⋅ ⋅ ⋅ 𝑘8 meansthat one queen is on the 𝑘1th square of the first column, one on the 𝑘2thsquare of the second column, and so on. Therefore, twelve fundamentalsolutions can be represented as follows:

41582736 41586372 42586137

42736815 42736851 42751863

42857136 42861357 46152837

46827135 47526138 48157263

Each of the twelve basic solutions can be rotated and reflected to yield 7other patterns (except the solution 10, which gives only 3 other patternsbecause of its symmetry). Therefore, counting reflections and rotations asdifferent, there are 92 solutions altogether. One fundamental solution givenby the first sequence 41582736 is shown in Figure 10.8.

Gauss himself also found great interest in the eight queens problem read-ing Illustrirte Zeitung. In September of 1850 he concluded that there were

9T. Gosset, The eight queens problem, Messenger of Mathematics, 44 (1914), 48.

Page 23: mbk-63-prev

The eight queens problem—Gauss’ arithmetization 271

76 solutions. Only a week later, Gauss wrote to his astronomer friend H. C.Schumacher that four of his 76 solutions are false, leaving 72 as the num-ber of true solutions. In addition, Gauss noted that there might be more,remembering that Franz Nauck did not prove his assertion that there areexactly 92 solutions. One can imagine that Gauss did not find all the solu-tions on the first attempt, presumably because at that time, he lacked thesystematic and strongly supported methods necessary for solving problemsof this kind. More details about Gauss and the eight queens problem can befound in [34] and [65].

Considering that the method of solving the eight queens problem via trailand error was inelegant, Gauss turned this problem into an arithmeticalproblem; see [34] and [86]. We have seen that each solution can be repre-sented as a permutation of the numbers 1 through 8. Such a representationautomatically confirms that there is exactly one queen in each row and eachcolumn. It was necessary to check in an easy way if any two queens occupythe same diagonal and Gauss devised such a method. We will illustratehis method with the permutation 41582736 that represents the eight-queenssolution shown in Figure 10.8.

Let us form the following sums:

4 1 5 8 2 7 3 61 2 3 4 5 6 7 8− − − − − − − −

Σ 5 3 8 12 7 13 10 14

and4 1 5 8 2 7 3 68 7 6 5 4 3 2 1− − − − − − − −

Σ 12 8 11 13 6 10 5 7

In both cases the eight sums are distinct natural numbers, which meansthat no two queens lie on the same negative diagonal ∖ (the sums above)and no two queens lie on the same positive diagonal / (the sums below). Ac-cording to these outcomes, Gauss concluded that the queens with positionsrepresented by the permutation 41582736 are non-attacking.

In 1874 J. W. Glaisher10 proposed expanding the eight queens problem tothe n-queens problem, that is, solving the queens’ puzzle for the general 𝑛×𝑛chessboard. He attempted to solve it using determinants. It was suspected

10J. W. Glaisher, On the problem of eight queens, Philosophical Magazine, Sec. 4, 48(1874), 457.

Page 24: mbk-63-prev

272 10. Chess

that exactly 𝑛 non-attacking queens could be placed on an 𝑛×𝑛 chessboard,but it was not until 1901 that Wilhelm Ahrens [2] could provide a positiveanswer. Other interesting proofs can be found in [104], [181] and[193]. Intheir paper [104] Hoffman, Loessi and Moore reduced the 𝑛-queens taskto the problem of finding a maximum internally stable set of a symmetricgraph, the vertices of which correspond to the 𝑛2 square elements of an 𝑛×𝑛matrix.

Considering the more general problem of the 𝑛 × 𝑛 chessboard, first weverify that there is no solution if 𝑛 < 4 (except the trivial case of one queenon the 1× 1 square). Fundamental solutions for 4 ≤ 𝑛 ≤ 7 are as follows:

𝑛 = 4 : 3142,

𝑛 = 5 : 14253, 25314,

𝑛 = 6 : 246135,

𝑛 = 7 : 1357246, 3572461, 5724613, 4613572, 3162574, 2574136.

The number of fundamental solutions 𝐹 (𝑛) and the number of all solutions𝑆(𝑛), including those obtained by rotations and reflections, are listed belowfor 𝑛 = 1, . . . , 12. A general formula for the number of solutions 𝑆(𝑛) when𝑛 is arbitrary has not been found yet.

𝑛 1 2 3 4 5 6 7 8 9 10 11 12

𝐹 (𝑛) 1 – – 1 2 1 6 12 46 92 341 1,784

𝑆(𝑛) 1 – – 2 10 4 40 92 342 724 2,680 14,200

Table 10.1. The number of solutions to the 𝑛× 𝑛 queens problem

Some interesting relations between magic squares and the 𝑛-queens prob-lem have been considered by Demirors, Rafraf and Tanik in [48]. The au-thors have introduced a procedure for obtaining the arrangements of 𝑛 non-attacking queens starting from magic squares of order 𝑛 not divisible by 2and 3.

The following two problems are more complicated modern variants of theeight queens problem and we leave them to the reader. In solving theseproblems, it is advisable to use a computer program.

In his Mathematical Games column, M. Gardner [79] presented a versionof the 𝑛-queens problem with constraints. In this problem a queen mayattack other queen directly (as in ordinary chess game) or by reflection fromeither the first or the (𝑛+1)-st horizontal virtual line. To put the reader atease, we shall offer the special case 𝑛 = 8.

Page 25: mbk-63-prev

The longest uncrossed knight’s tour 273

Problem 10.9.* Place 8 chess queens on the 8×8 board with a reflectionstrip in such a way that no two queens attack each other either directly orby reflection.

A superqueen (known also as “Amazon”) is a chess piece that moves like aqueen as well as a knight. This very powerful chess piece was known in somevariants of chess in the Middle Ages. Obviously, the 𝑛-superqueen problemis an extension of the 𝑛-queen problem in which new restrictions should betaken into account. So it is not strange that the 𝑛-superqueen problem hasno solution for 𝑛 < 10.

Problem 10.10.* Place 10 superqueens on the 10×10 chessboard so thatno superqueen can attack any other.

There is just one fundamental solution for the case 𝑛 = 10. Can you findthis solution?

A variation of the chess that would be worth mentioning is one in whichthe game is played on a cylindrical board. The pieces in so-called cylindricalchess are arranged as on an ordinary chessboard, and they move followingthe same rules. But the board is in a cylindrical form because its verticaledges are joined (“vertical cylindrical chess”) so that the verticals 𝑎 and ℎare juxtaposed. Also, it is possible to join the horizontal edges of the board(“horizontal cylindrical chess”) so that the first and the eighth horizontalare connected.

We have already seen that the eight queens problem on the standard 8×8chessboard has 92 solutions. The following problem on a cylindrical chess-board was considered by the outstanding chess journalist and chessmasterEdvard Gik [84].

Problem 10.11.* Solve the problem of non-attacking queens on a cylin-drical chessboard that is formed of an 8× 8 chessboard.

Donald Knuth (1938– ) (→ p. 310)

The longest uncrossed knight’s tour

On pages 258–262 we previously considered a knight’s tour over a chess-board such that all 64 squares are traversed once and only once. The difficultproblem presented below imposes certain restrictions on the knight’s tour:

Problem 10.12. Find the largest uncrossed knight’s tour on a chessboard.

Page 26: mbk-63-prev

274 10. Chess

Apparently T. R. Dawson once posed this problem, but L. D. Yardbroughlaunched the same problem again in the July 1968 Journal of RecreationalMathematics.

Figure 10.9. Knuth’s solution for the longest uncrossed knight’s tour

Donald E. Knuth wrote a “backtrack” computer program to find four fun-damental solutions for the knight’s tour. To find these tours, the computerexamined 3,137,317,289 cases. One of these solutions is shown in Figure 10.9(see, e.g., the book [138, p. 61]).

Guarini’s knight-switching problem

We end this chapter with Guarini’s classic knight-switching problem from1512, mentioned in Chapter 1. A number of mathematicians have consid-ered problems of this type, in modern times most frequently in connectionwith planar graphs. No matter how unexpected it sounds, a kind of “graphapproach” was known to al-Adli (ca. 840 a.d.) who considered in his workon chess a simple circuit that corresponds to the knight-move network on a3× 3 board.

Problem 10.13. The task is to interchange two white knights on thetop corner squares of a 3 × 3 chessboard and two black knights on the bot-tom corner squares. The white knights should move into the places occupiedinitially by the black knights—and vice versa—in the minimum number ofmoves. The knights may be moved in any order, regardless of their color.Naturally, no two of them can occupy the same square.

Page 27: mbk-63-prev

Guarini’s knight-switching problem 275

Solution. This puzzle belongs to the class of problems that can be solvedin an elegant manner using the theory of planar graphs. Possibly this prob-lem could find its place in Chapter 9 on graphs, but we regard that it is anunimportant dilemma.

The squares of the chessboard represent nodes of a graph, and the possi-ble moves of the pieces between the corresponding squares (the nodes of thegraph) are interpreted as the connecting lines of the graph. The correspond-ing graph for the board and the initial positions of the knights are shown inFigure 10.10(a).

1 2 3

4 5

6 7 8

111

2

3

4

555

6

7

88

a) b)

Figure 10.10. a) Graph to Guarini’s problem b) Equivalent simplified graph

The initial positions of the knights are indicated and all possible movesof the knights between the squares (the nodes of the graph) are marked bylines. Using Dudeney’s famous “method of unraveling a graph,”11 startingfrom any node, the graph 10.10(a) can be “unfolded” to the equivalent graph10.10(b), which is much clearer and more convenient for the analysis. Obvi-ously, the topological structure and the connectedness are preserved. To findthe solution it is necessary to write down the moves (and reproduce themon the 3× 3 board according to some correspondence), moving the knightsalong the circumference of the graph until they exchange places. The min-imum number of moves is 16 although the solution is not unique (becausethe movement of the knights along the graph is not unique). Here is onesolution:

11This “method” was described in detail by E. Gik in the journal Nauka i Zhizn 12

(1976); see also M. Gardner, Mathematical Puzzles and Diversions (New York: Penguin,1965).

Page 28: mbk-63-prev

276 10. Chess

1–5 6–2 3–7 8–4 5–6 2–8 7–1 4–31–5 8–4 6–2 3–7 5–6 7–1 2–8 4–3.

A similar problem also involves two white and two black chess knightsand requires their interchange in the fewest possible moves.

Problem 10.14.* Two white and two black knights are placed on a boardof an unusual form, as shown in Figure 10.11. The goal is to exchange thewhite and black knights in the minimum number of moves.

Figure 10.11. Knight-switching problem

Answers to Problems

10.2. Suppose that the required knight’s re-entrant route exists. Weassume that this board is colored alternately white and black (in a chessorder). The upper and lower row will be called the outer lines (𝑂), and thetwo remaining rows the middle lines (𝑀). Since a knight, starting from anyouter square, can land only on a middle square, it follows that among 4𝑛moves that should make the route, 2𝑛 moves must be played from the outerto the middle squares. Therefore, there remain exactly 2𝑛 moves that haveto be realized from the middle to the outer squares.

Since any square of the closed knight’s tour can be the starting square,without loss of generality, we can assume that we start from a “middle”square. The described tour gives an alternate sequence

𝑀(start)−𝑂 −𝑀 −𝑂 − ⋅ ⋅ ⋅ −𝑀 −𝑂 −𝑀(finish), (10.4)

ending at the starting square. We emphasize that a knight can’t dare visittwo middle squares in a row anywhere along the tour because of the following.Assume that we start with this double move𝑀−𝑀 (which is always possiblebecause these moves belong to the circuit), then we will have the sequence

Page 29: mbk-63-prev

Answers to Problems 277

𝑀 −𝑀 − (2𝑛 − 1) × (𝑂 −𝑀). In this case we have 2𝑛 + 1 𝑀 moves and2𝑛 − 1 𝑂 moves, thus each different from 2𝑛. Note further that the doublemove 𝑂 − 𝑂 in the parenthesis in the last sequence is impossible because aknight cannot jump from the outside line to the outside line.

On the other hand, the same knight’s tour alternates between white andblack squares, say,

𝑏𝑙𝑎𝑐𝑘 − 𝑤ℎ𝑖𝑡𝑒− 𝑏𝑙𝑎𝑐𝑘 − 𝑤ℎ𝑖𝑡𝑒− ⋅ ⋅ ⋅ − 𝑏𝑙𝑎𝑐𝑘 − 𝑤ℎ𝑖𝑡𝑒− 𝑏𝑙𝑎𝑐𝑘 (10.5)

(or opposite). Comparing the sequences (10.4) and (10.5) we note that allsquares of the outer lines are in one color and all squares of the middle linesare in the other color. But this is a contradiction since the board is coloredalternately. Thus, the required path is impossible.

10.3. One solution is displayed in Figure 10.12. The three-dimensional4×4×4 board is represented by the four horizontal 4×4 boards, which lie oneover the other; the lowest board is indicated by I, the highest by IV. Theknight’s moves are denoted by the numbers from 1 (starting square) to 64(ending square). The knight can make a re-entrant tour because the squares64 and 1 are connected by the knight’s moves.

57 30 47 36

48 33 58 31

29 60 35 46

34 45 32 59

42 37 56 51

55 52 43 40

38 41 50 53

49 54 39 44

27 62 15 2

14 26 63

61 28 3 16

4 13 64 25

10 7 22 17

21 18 9 6

8 11 20 23

19 24 5 12

I II III IV

Figure 10.12. Knight’s re-entrant path on the 4× 4× 4 board

10.5. Let 𝑆 be the area of a square of the 𝑛×𝑛 chessboard. Consideringformula (10.1) in Pick’s theorem, it is sufficient to prove that the number ofboundary points 𝐵 is even. Since the knight’s tour alternates between white(𝑤) and black squares (𝑏), in the case of any closed tour (the starting squarecoincides with the ending square) it is easy to observe that the number oftraversed squares must be even. Indeed, the sequence 𝑏 (start)−𝑤− 𝑏−𝑤−⋅ ⋅ ⋅ − 𝑏 − 𝑤 − 𝑏 (finish), associated to the closed knight’s path, always hasan even number of moves (= traversed squares); see Figure 10.13. Since thenumber of squares belonging to the required closed knight’s path is equal tothe number of boundary points 𝐵, the proof is completed.

Page 30: mbk-63-prev

278 10. Chess

Figure 10.13. Area of a simply closed lattice polygon

10.6. As mentioned by M. Gardner in Scientific American 7 (1967),S. Golomb solved the problem of a camel’s tour by using a transformationof the chessboard suggested by his colleague Lloyd R. Welch and shown inFigure 10.14: the chessboard is covered by a jagged-edged board consisting of32 cells, each of them corresponding to a black square. It is easy to observethat the camel’s moves over black squares of the chessboard are playableon the jagged board and turn into knight’s moves on the jagged board.Therefore, a camel’s tour on the chessboard is equivalent to a knight’s touron the jagged board. One simple solution is

1–14–2–5–10–23–17–29–26–32–20–8–19–22–9–21–18–30–27–15–3–6–11–24–12–7–4–16–28– 31–25–13.

32313029

1 2 3 4

5 6 7 8

9 10 11 12

13 14 15 16

17 18 19 20

21 22 23 24

25 26 27 28

Figure 10.14. Solution of camel’s tour by transformation

Page 31: mbk-63-prev

Answers to Problems 279

10.9. If you have not succeeded in solving the given problem, see thefollowing solutions found by Y. Kusaka [120]. Using a computer programand backtracking algorithm he established that there are only 10 solutionsin this eight queens problem with constraints (we recall that this number is92 for the ordinary case; see Table 10.1 for 𝑛 = 8):

25741863 27581463 36418572 36814752 36824175

37286415 42736815 51468273 51863724 57142863

10.10. The author of this book provided in his book Mathematics andChess [138] a computer program in the computer language C that can findall possible solutions: the fundamental one and similar ones obtained by therotations of the board and by the reflections in the mirror. The programruns for arbitrary 𝑛 and solves the standard 𝑛-queens problem as well as the𝑛-superqueens problem. We emphasize that the running time increases veryquickly if 𝑛 increases.

The fundamental solution is shown in Figure 10.15, which can be denotedas the permutation (3,6,9,1,4,7,10,2,5,8). As before, such denotation meansthat one superqueen is on the third square of the first column, one on thesixth square of the second column, and so on.

Figure 10.15. The fundamental solution of the superqueens problem for 𝑛 = 10

The three remaining solutions (found by the computer) arise from thefundamental solution, and they can be expressed as follows:

(7,3,10,6,2,9,5,1,8,4) (4,8,1,5,9,2,6,10,3,7) (8,5,2,10,7,4,1,9,6,3)

Page 32: mbk-63-prev

280 10. Chess

10.11. There is no solution of the eight queens problem on the cylindricalchessboard of the order 8. We follow the ingenious proof given by E. Gik[84].

Let us consider an ordinary chessboard, imagining that its vertical edgesare joined (“vertical cylindrical chess”). Let us write in each of the squaresthree digits (𝑖, 𝑗, 𝑘), where 𝑖, 𝑗, 𝑘 ∈ {1, . . . , 8} present column, row, and di-agonal (respectively) of the traversing square (Figure 10.16). Assume thatthere is a replacement of 8 non-attacking queens and let (𝑖1, 𝑗1, 𝑘1), . . . ,(𝑖8, 𝑗8, 𝑘8) be the ordered triples that represent 8 occupied squares. Thenthe numbers 𝑖1, . . . , 𝑖8 are distinct and belong to the set {1, . . . , 8}; there-fore,

∑𝑖𝑚 = 1+ ⋅ ⋅ ⋅+8 = 36. The same holds for the numbers from the sets

{𝑗1, . . . , 𝑗8} and {𝑘1, . . . , 𝑘8}.

Figure 10.16. Gik’s solution

We see that the sum (𝑖1 + ⋅ ⋅ ⋅ + 𝑖8) + (𝑗1 + ⋅ ⋅ ⋅ + 𝑗8) + (𝑘1 + ⋅ ⋅ ⋅ + 𝑘𝑛)of all 24 digits written in the squares occupied by the queens is equal to(1 + ⋅ ⋅ ⋅ + 8) × 3 = 108. Since the sum 𝑖𝜈 + 𝑗𝜈 + 𝑘𝜈 of the digits on each ofthe squares is divided by 8 (see Figure 10.16), it follows that the sum of thementioned 24 digits must be divisible by 8. But 108 is not divisible by 8—acontradiction, and the proof is completed, we are home free.

10.14. Although the chessboard has an unusual form, the knight-switching problem is effectively solved using graphs, as in the case of Guar-

Page 33: mbk-63-prev

Answers to Problems 281

ini’s problem 10.13. The corresponding graph for the board and the knight’smoves is shown in Figure 10.17(a), and may be reduced to the equivalent(but much simpler) graph 10.17(b).

13

1211109

876

5432

1

13

12

11

10

9

8

7

6

5

4

3

2

1

a) b)

Figure 10.17. A graph of possible moves and a simplified graph

The symmetry of the simplified graph and the alternative paths of theknights along the graph permit a number of different solutions, but theminimum number of 14 moves cannot be decreased. Here is one solution:

13–7–2 11–4–9–8 1–7–13–11 3–1–7–13 8–3 2–7–1