Cover
Title page
Contents
Preface
Part 1 Problems
Chapter 1. Can a Bicycle Simulate a Unicycle?
1. Bicycle or Unicycle?
Chapter 2. Geometry
2. Trisecting to Benefit Society
3. Ten Bottles of Wine
4. Into the Woods
5. The Attraction of the Golden Ratio
6. Reflect on This
7. Skewed Pizza
8. Four-Regular Squares
9. Venn Symmetry
11. The Legacy of H. G. Wells
12. Tiling Surprise
13. A Well-Balanced Clock
14. On the Level
15. A Polyhedral Puzzle
16. Wiggle Room
17. Drink Me
18. Right-Angled Polygons
19. A Rolling Parabola
20. Rocket Science
21. The Icing on the Cake
22. More Cake
Chapter 3. Number Theory
23. Power Matching
24. Triplets
25. The Mysterious Seventeenth Divisor
26. True or False?
27. An Exponential Diophantine Problem
28. A Prime Characterization
29. Two Sums and Many Differences
30. Reciprocals to Squares
31. Nondivisibility by 11
32. Equally Powerful Splits
33. Tripling in Two Steps
34. Root Closure
35. A Double Power Leads to a Sum of Two Squares
36. Prime Subsets
37. The Incredible Shrinking Superpowers
38. Special Numbers
Chapter 4. Combinatorics
40. A Parking Puzzle
41. A Black and White Issue
42. A Choice Problem
43. Water Wave
44. An Acceptable Committee
45. A Compatible Committee
46. Using Blocks and Chains to Unlock a Safe
47. A Universal Set of Directions
48. A Competition Problem About a Competition Problem
Chapter 5. Probability
49. The Importance of Irrelevant Information
50. Creeping Ants
51. Roll the Dice
52. Conditioned Throws of a Die
53. Where Are the Rounded Powers of Two?
54. The Holy Game of Poker
55. A Shrinking Random Walk
56. BINGO!
57. How Much is a Penny Worth?
58. A Historically Interesting Truth-Teller Problem
59. Monty Hall Revisited
Chapter 6. Calculus
60. Integrating a Base Change
61. A T-Shirt Gun
62. Shooting Range
63. Convergent Rational Enumeration
64. A Functional Equation
65. Two Eerie Recursions
66. Stabilizing a Cylinder
67. ? Coincidence?
68. The Chase Is On
Chapter 7. Algorithms and Strategy
69. Where’s Bob?
70. It’s a Horse Race
72. Determine the Martian Majority
73. Majority Rules
74. Going for Gold
75. The Mensa Correctional Institute
76. Matching Hats
77. One Hat Too Many
78. The Prisoners Must Agree
79. How to Use Irrelevant Information
80. Flipping Pennies
81. Battleship Destruction
82. Real Battleship Destruction
83. A Very Local Maximum
84. Detecting a Black Hole
85. Pablito’s Solitaire
86. Are the Coins Authentic?
87. Web Site Analysis
88. Find the Car, and the Car Key
89. Magic Coins
90. Russian Cards
91. The Generous Automated Teller Machine
Chapter 8. Miscellaneous
92. A Self-Descriptive Crossword
93. Serious Implications
94. Hermione Granger and the Deadly Bottles
95. Forbidden Polynomials
96. A Polynomial Scandal
97. Pascal’s Determinant
98. Pains of Imperfect Glass
99. On the Highway
100. A Running Mystery
101. The Star of This Problem is Addition
102. Don’t Get Your Wires Crossed
103. Weight Loss Through Juggling
104. Cantor Set Arithmetic
105. The Miracle of the Colliding Blocks
Part 2 Solutions
Chapter 1. Can a Bicycle Simulate a Unicycle?
1. Bicycle or Unicycle?
Chapter 2. Geometry
2. Trisecting to Benefit Society
3. Ten Bottles of Wine
4. Into the Woods
5. The Attraction of the Golden Ratio
6. Reflect on This
7. Skewed Pizza
8. Four-Regular Squares
9. Venn Symmetry
11. The Legacy of H. G. Wells
12. Tiling Surprise
13. A Well-Balanced Clock
14. On the Level
15. A Polyhedral Puzzle
16. Wiggle Room
17. Drink Me
18. Right-Angled Polygons
19. A Rolling Parabola
20. Rocket Science
21. The Icing on the Cake
22. More Cake
Chapter 3. Number Theory
23. Power Matching
24. Triplets
25. The Mysterious Seventeenth Divisor
26. True or False?
27. An Exponential Diophantine Problem
28. A Prime Characterization
29. Two Sums and Many Differences
30. Reciprocals to Squares
31. Nondivisibility by 11
32. Equally Powerful Splits
33. Tripling in Two Steps
34. Root Closure
35. A Double Power Leads to a Sum of Two Squares
36. Prime Subsets
37. The Incredible Shrinking Superpowers
38. Special Numbers
Chapter 4. Combinatorics
40. A Parking Puzzle
41. A Black and White Issue
42. A Choice Problem
43. Water Wave
44. An Acceptable Committee
45. A Compatible Committee
46. Using Blocks and Chains to Unlock a Safe
47. A Universal Set of Directions
48. A Competition Problem About a Competition Problem
Chapter 5. Probability
49. The Importance of Irrelevant Information
50. Creeping Ants
51. Roll the Dice
52. Conditioned Throws of a Die
53. Where Are the Rounded Powers of Two?
54. The Holy Game of Poker
55. A Shrinking Random Walk
56. BINGO!
57. How Much is a Penny Worth?
58. A Historically Interesting Truth-Teller Problem
59. Monty Hall Revisited
Chapter 6. Calculus
60. Integrating a Base Change
61. A T-Shirt Gun
62. Shooting Range
63. Convergent Rational Enumeration
64. A Functional Equation
65. Two Eerie Recursions
66. Stabilizing a Cylinder
67. ? Coincidence?
68. The Chase Is On
Chapter 7. Algorithms and Strategy
69. Where’s Bob?
70. It’s a Horse Race
72. Determine the Martian Majority
73. Majority Rules
74. Going for Gold
75. The Mensa Correctional Institute
76. Matching Hats
77. One Hat Too Many
78. The Prisoners Must Agree
79. How to Use Irrelevant Information
80. Flipping Pennies
81. Battleship Destruction
82. Real Battleship Destruction
83. A Very Local Maximum
84. Detecting a Black Hole
85. Pablito’s Solitaire
86. Are the Coins Authentic?
87. Web Site Analysis
88. Find the Car, and the Car Key
89. Magic Coins
90. Russian Cards
91. The Generous Automated Teller Machine
Chapter 8. Miscellaneous
92. A Self-Descriptive Crossword
93. Serious Implications
94. Hermione Granger and the Deadly Bottles
95. Forbidden Polynomials
96. A Polynomial Scandal
97. Pascal’s Determinant
98. Pains of Imperfect Glass
99. On the Highway
100. A Running Mystery
101. The Star of This Problem is Addition
102. Don’t Get Your Wires Crossed
103. Weight Loss Through Juggling
104. Cantor Set Arithmetic
105. The Miracle of the Colliding Blocks
Bibliography
Index
Back Cover

##### Citation preview

AMS/MAA

PROBLEM BOOKS

?•

OR I

DANIEL J . VELLEMAN STAN WAGON

A Collection of Intriguing

Mathematical Puzzles

PRE___.

VOL36

• e:.

Anlmprlnt • • ofthe AMERICAN \ ~: MATHEMATICAL •.~

S0CIETY

Bicycle or Unicycle? A Collection of Intriguing Mathematical Puzzles

AMS/MAA

I PROBLEM BOOKS

VOL 36

Bicycle or Unicycle? A Collection of Intriguing Mathematical Puzzles Daniel J. Velleman Stan Wagon

••• ofthe e::• AMERICAN Anlmprlnt • ••

PRESS

4t!: MATI-IEMATICAL •:•. SOCIETY

••••

MAA Problem Books Editorial Board Gail S. Nelson, Editor Adam H. Berliner Jennifer Roche Bowen Michelle L. Ghrist Greg Oman Eric R. Westlund 2010 Mathematics Subject Classification. Primary 00A07, 00A08.

Library of Congress Cataloging-in-Publication Data Names: Velleman, Daniel J., author. | Wagon, S., author. Title: Bicycle or unicycle?: A collection of intriguing mathematical puzzles / Daniel J. Velleman, Stan Wagon. Description: Providence, Rhode Island: MAA Press, an imprint of the American Mathematical Society, [2020] | Series: Problem books; volume 36 | Includes bibliographical references and index. Identifiers: LCCN 2020003232 | ISBN 9781470447595 (paperback) | ISBN 9781470457020 (ebook) Subjects: LCSH: Mathematical recreations. | Mathematics – Problems, exercises, etc. | AMS: General – General and miscellaneous specific topics – Problem books. | General – General and miscellaneous specific topics – Recreational mathematics. Classification: LCC QA95 .V45 2020 | DDC 793.74–dc23 LC record available at https://lccn.loc.gov/202000323

Copying and reprinting. Individual readers of this publication, and nonprofit libraries acting for them, are permitted to make fair use of the material, such as to copy select pages for use in teaching or research. Permission is granted to quote brief passages from this publication in reviews, provided the customary acknowledgment of the source is given. Republication, systematic copying, or multiple reproduction of any material in this publication is permitted only under license from the American Mathematical Society. Requests for permission to reuse portions of AMS publication content are handled by the Copyright Clearance Center. For more information, please visit www.ams.org/publications/pubpermissions. Send requests for translation rights and licensed reprints to [email protected]. © 2020 by the American Mathematical Society. All rights reserved. The American Mathematical Society retains all rights except those granted to the United States Government. Printed in the United States of America. ∞ The paper used in this book is acid-free and falls within the guidelines ⃝

established to ensure permanence and durability. Visit the AMS home page at https://www.ams.org/ 10 9 8 7 6 5 4 3 2 1

25 24 23 22 21 20

Contents Preface Part 1 Problems

xiii 1

1 Can a Bicycle Simulate a Unicycle? 1 Bicycle or Unicycle?

3 3

2 Geometry 2 Trisecting to Benefit Society 3 Ten Bottles of Wine 4 Into the Woods 5 The Attraction of the Golden Ratio 6 Reflect on This 7 Skewed Pizza 8 Four-Regular Squares 9 Venn Symmetry 10 A Crosscut Quadrilateral 11 The Legacy of H. G. Wells 12 Tiling Surprise 13 A Well-Balanced Clock 14 On the Level 15 A Polyhedral Puzzle 16 Wiggle Room 17 Drink Me 18 Right-Angled Polygons 19 A Rolling Parabola 20 Rocket Science 21 The Icing on the Cake 22 More Cake

5 5 5 5 6 6 7 7 8 9 9 9 11 11 11 12 12 12 12 13 14 14

3 Number Theory 23 Power Matching

15 15 v

vi

Contents 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38

Triplets The Mysterious Seventeenth Divisor True or False? An Exponential Diophantine Problem A Prime Characterization Two Sums and Many Differences Reciprocals to Squares Nondivisibility by 11 Equally Powerful Splits Tripling in Two Steps Root Closure A Double Power Leads to a Sum of Two Squares Prime Subsets The Incredible Shrinking Superpowers Special Numbers

15 15 15 16 16 16 16 16 16 17 17 17 17 17 19

4 Combinatorics 39 Power up Your Radio 40 A Parking Puzzle 41 A Black and White Issue 42 A Choice Problem 43 Water Wave 44 An Acceptable Committee 45 A Compatible Committee 46 Using Blocks and Chains to Unlock a Safe 47 A Universal Set of Directions 48 A Competition Problem About a Competition Problem

21 21 21 22 22 22 22 23 23 24 24

5 Probability 49 The Importance of Irrelevant Information 50 Creeping Ants 51 Roll the Dice 52 Conditioned Throws of a Die 53 Where Are the Rounded Powers of Two? 54 The Holy Game of Poker 55 A Shrinking Random Walk 56 BINGO! 57 How Much is a Penny Worth? 58 A Historically Interesting Truth-Teller Problem 59 Monty Hall Revisited

25 25 25 25 26 26 26 27 27 27 28 28

Contents

vii

6 Calculus 60 Integrating a Base Change 61 A T-Shirt Gun 62 Shooting Range 63 Convergent Rational Enumeration 64 A Functional Equation 65 Two Eerie Recursions 66 Stabilizing a Cylinder 67 𝜋 Coincidence? 68 The Chase Is On

31 31 31 31 32 32 32 32 32 32

7 Algorithms and Strategy 69 Where’s Bob? 70 It’s a Horse Race 71 Your Two Best Shots 72 Determine the Martian Majority 73 Majority Rules 74 Going for Gold 75 The Mensa Correctional Institute 76 Matching Hats 77 One Hat Too Many 78 The Prisoners Must Agree 79 How to Use Irrelevant Information 80 Flipping Pennies 81 Battleship Destruction 82 Real Battleship Destruction 83 A Very Local Maximum 84 Detecting a Black Hole 85 Pablito’s Solitaire 86 Are the Coins Authentic? 87 Web Site Analysis 88 Find the Car, and the Car Key 89 Magic Coins 90 Russian Cards 91 The Generous Automated Teller Machine

33 33 33 33 34 34 34 35 35 35 36 37 37 37 38 38 38 38 39 39 40 40 40 41

8 Miscellaneous 92 A Self-Descriptive Crossword 93 Serious Implications 94 Hermione Granger and the Deadly Bottles 95 Forbidden Polynomials 96 A Polynomial Scandal

43 43 43 43 45 45

viii

Contents 97 98 99 100 101 102 103 104 105

Pascal’s Determinant Pains of Imperfect Glass On the Highway A Running Mystery The Star of This Problem is Addition Don’t Get Your Wires Crossed Weight Loss Through Juggling Cantor Set Arithmetic The Miracle of the Colliding Blocks

Part 2 Solutions

46 46 46 47 47 47 47 48 49 51

1 Can a Bicycle Simulate a Unicycle? 1 Bicycle or Unicycle?

53 53

2 Geometry 2 Trisecting to Benefit Society 3 Ten Bottles of Wine 4 Into the Woods 5 The Attraction of the Golden Ratio 6 Reflect on This 7 Skewed Pizza 8 Four-Regular Squares 9 Venn Symmetry 10 A Crosscut Quadrilateral 11 The Legacy of H. G. Wells 12 Tiling Surprise 13 A Well-Balanced Clock 14 On the Level 15 A Polyhedral Puzzle 16 Wiggle Room 17 Drink Me 18 Right-Angled Polygons 19 A Rolling Parabola 20 Rocket Science 21 The Icing on the Cake 22 More Cake

67 67 67 68 69 70 72 74 79 80 80 81 84 86 89 89 95 98 101 102 104 106

3 Number Theory 23 Power Matching 24 Triplets 25 The Mysterious Seventeenth Divisor

109 109 111 111

Contents 26 27 28 29 30 31 32 33 34 35 36 37 38

ix

True or False? An Exponential Diophantine Problem A Prime Characterization Two Sums and Many Differences Reciprocals to Squares Nondivisibility by 11 Equally Powerful Splits Tripling in Two Steps Root Closure A Double Power Leads to a Sum of Two Squares Prime Subsets The Incredible Shrinking Superpowers Special Numbers

112 113 114 114 116 117 118 122 123 124 124 125 127

4 Combinatorics 39 Power up Your Radio 40 A Parking Puzzle 41 A Black and White Issue 42 A Choice Problem 43 Water Wave 44 An Acceptable Committee 45 A Compatible Committee 46 Using Blocks and Chains to Unlock a Safe 47 A Universal Set of Directions 48 A Competition Problem About a Competition Problem

131 131 135 138 138 139 141 141 142 147 149

5 Probability 49 The Importance of Irrelevant Information 50 Creeping Ants 51 Roll the Dice 52 Conditioned Throws of a Die 53 Where Are the Rounded Powers of Two? 54 The Holy Game of Poker 55 A Shrinking Random Walk 56 BINGO! 57 How Much is a Penny Worth? 58 A Historically Interesting Truth-Teller Problem 59 Monty Hall Revisited

151 151 154 154 155 157 162 163 165 168 169 171

6 Calculus 60 Integrating a Base Change 61 A T-Shirt Gun

177 177 179

x

Contents 62 63 64 65 66 67 68

Shooting Range Convergent Rational Enumeration A Functional Equation Two Eerie Recursions Stabilizing a Cylinder 𝜋 Coincidence? The Chase Is On

182 185 188 189 190 192 194

7 Algorithms and Strategy 69 Where’s Bob? 70 It’s a Horse Race 71 Your Two Best Shots 72 Determine the Martian Majority 73 Majority Rules 74 Going for Gold 75 The Mensa Correctional Institute 76 Matching Hats 77 One Hat Too Many 78 The Prisoners Must Agree 79 How to Use Irrelevant Information 80 Flipping Pennies 81 Battleship Destruction 82 Real Battleship Destruction 83 A Very Local Maximum 84 Detecting a Black Hole 85 Pablito’s Solitaire 86 Are the Coins Authentic? 87 Web Site Analysis 88 Find the Car, and the Car Key 89 Magic Coins 90 Russian Cards 91 The Generous Automated Teller Machine

199 199 201 202 203 205 206 210 214 216 217 220 223 223 224 225 228 231 234 235 236 237 239 240

8 Miscellaneous 92 A Self-Descriptive Crossword 93 Serious Implications 94 Hermione Granger and the Deadly Bottles 95 Forbidden Polynomials 96 A Polynomial Scandal 97 Pascal’s Determinant 98 Pains of Imperfect Glass 99 On the Highway

251 251 251 252 254 256 258 260 264

Contents 100 101 102 103 104 105

A Running Mystery The Star of This Problem is Addition Don’t Get Your Wires Crossed Weight Loss Through Juggling Cantor Set Arithmetic The Miracle of the Colliding Blocks

xi 264 265 265 265 269 270

Bibliography

277

Index

283

Preface Mathematical problems can be appealing for a variety of reasons, but we are especially fond of problems that have a big surprise factor. The surprise can take different forms. Our previous problem book, Which Way Did the Bicycle Go? [82], highlighted a problem in bicycle geometry where the surprise was a bit unusual: the fact that Sherlock Holmes made a serious error in logical reasoning. The present book starts with another bicycle problem, one for which the surprise is that a bicycle can pretend to be a unicycle. We have selected the 105 problems in this collection with an eye to the surprise factor. Almost all of these problems appeared in the Problem of the Week program at Macalester College. After his retirement from Macalester, Stan Wagon kept the program going via a mailing list. The surprises come in a variety of forms. For some problems the goal is to determine an integer, but at the start one would have no idea if the size of the 100 answer is near 10, 100, or 1010 . A remarkable one of this type is a cake-slicing problem (Problem 21) that everyone who guesses at the answer gets wrong. In this case, the answer is quite different from what one would expect. Three other examples are Problems 37, 38, and 91. An important aspect of problem posing is getting the statement exactly right. A notorious probability problem (Problem 49) concerns a parent who has two children, one of whom is a son born on a Tuesday. This particular problem has generated an enormous amount of discussion, as the result appears to be paradoxical. But the key is how the problem is posed, and we have done so in a way that makes it possible to clear up the mystery. A different type of paradox, one that highlights the difference between large finite sets and infinite sets, is discussed in Problem 79. That problem shows the importance of the choice of fundamental axioms for mathematics. Two problems (Problems 90 and 96) show that contest problems can provide a big surprise to the writers of the contest, as the problems turned out to be much more delicate than the designers intended. Situations where 𝜋 appears unexpectedly have always fascinated mathematicians and the general public. There are the classics such as the Buffon needle xiii

xiv

Preface

problem with its probability of 2/𝜋 and the sum of the reciprocals of the square integers, which Euler proved to be 𝜋2 /6. For one problem in this collection 𝜋 makes an appearance that is just as, or more, surprising than the two classical examples. Problem 95, about the ways in which polynomials change as they move from left to right, shows that new discoveries can be made involving very elementary notions. As is traditional in mathematics, some problems are based on ideas from physics. Trajectories of projectiles are considered in Problems 61 and 62. Problem 66 concerns the center of mass of a partially filled glass of water, and Problem 105 deals with collisions between sliding blocks. Also, again as is traditional, problems lead to further problems. Problem 81 is a not-too-difficult problem about integers. But it leads to a much more surprising real-number version, Problem 82, whose solution uses entirely different methods. And many problems here lead naturally to open questions. Sometimes popular culture or games can lead to interesting problems. Five of that sort are related to the games of poker (Problem 54) and Bingo (Problem 56), the culture of crossword puzzles (Problems 92 and 93), and a puzzle feature of the first Harry Potter book (Problem 94). Some of our problems have short and concise solutions, while others are quite complicated. Almost all can be done by hand, but occasionally help from computers is needed, and we view such a tool as indispensable for investigations into many problems. While almost all of our problems are typical of the genre, in that the solutions use standard mathematical tools and are not overly complicated, we have included a few that really are research projects (e.g., Problem 1). In a couple of cases, a rigorous proof requires a result that might not be well known and we have included the full details.

Acknowledgments. Many readers of the Macalester Problem of the Week have contributed valuable solutions and comments over the years. Thus we are grateful to many people for their enthusiasm and insights. In particular, we thank Larry Carter, Joseph DeVincentis, Michael Elgersma, Jim Guilford, John Guilford, Witold Jarnicki, Stephen Morris, Rob Pratt, Peter Saltzman, Richard Stong, Jim Tilley, and Piotr Zielinski. And we also thank Joe Buhler for his discussions on problems and the innovative problem section he (together with the late Elwyn Berlekamp) has written for Emissary, the newsletter of the Mathematical Sciences Research Institute. Dan Velleman, Amherst College and University of Vermont [email protected] Stan Wagon, Macalester College and Silverthorne, Colorado [email protected]

Preface

xv

Notation. We use the following notation. ℕ = {0, 1, 2, . . .}, the natural numbers; ℤ = {. . . , −2, −1, 0, 1, 2, . . .}, the integers. [𝑛] denotes {1, 2, . . . , 𝑛}. A permutation is denoted as a row of numbers, such as 3 1 4 2 for ( 13 21 34 42 ), which is the cycle 1 → 3 → 4 → 2 → 1. This cycle is also denoted (1 3 4 2). An approximation to a real number is denoted by ≈, as in 𝜋 ≈ 3.142.

Part 1

Problems

1 Can a Bicycle Simulate a Unicycle? 1 Bicycle or Unicycle? The wheels of a bicycle generate two tracks. When the front wheel turns, the tracks are generally distinct, while for a nonturning bike, the track is a straight line and the rear wheel follows exactly in the track of the front wheel; in that case one cannot tell whether the track was made by a bicycle or a unicycle. Show that there can be a nonstraight bicycle track for which the rear wheel follows the front track exactly, and with the rear track overlapping the front track by at least several bike lengths. We represent a track as a continuously differentiable curve or path in the plane with derivative never being the zero vector. Assume the bicycle’s wheel base is 1 unit; then because the rear wheel does not steer, the unit tangent vector at any point of the rear path ends on the front path (Figure 1.1).

3

4

Chapter 1. Can a Bicycle Simulate a Unicycle?

Figure 1.1. Typical tracks made by the front and rear wheels of a bicycle. The unit tangent to the blue rear track determines the front track.

2 Geometry 2 Trisecting to Beneﬁt Society In 1872, Augustus DeMorgan [31, p. 258] wrote: There is one trisection which is of more importance than that of the angle. It is easy to get half the paper on which you write for margin; or a quarter; but very troublesome to get a third. Show us how, easily and certainly, to fold the paper into three, and you will be a real benefactor to society. Show how to fold a rectangular piece of paper into three congruent rectangles, without using devices such as ruler or compass. You may use standard folding operations such as matching points to points or lines to lines.

3 Ten Bottles of Wine Ten identical bottles of wine are stacked up in a bin, as shown in Figure 3.1. Show that the top bottle is centered between the sides of the bin.

4 Into the Woods After a Rip Van Winkle–like sleep, you wake up in the forest. At your feet is a signpost indicating that it is one mile to the road and you know that this road is the only one in the area and runs in a straight line. Because the signpost has fallen down, you know only the distance to the road, not its direction. One strategy 5

6

Chapter 2. Geometry

Figure 3.1. Ten bottles of wine in a bin.

for finding the road is to go a mile in any direction and then follow the radiusone circle centered at the sign; the worst-case travel distance for this method is 1 + 2𝜋 ≈ 7.28. Find a method that is guaranteed to find the road with worst-case distance quite a bit less than this.

5 The Attraction of the Golden Ratio Are there positive real numbers 𝑎 ≤ 𝑏 such that 𝑏/𝑎 is nearer to the golden ratio than (𝑎 + 𝑏)/𝑏? The golden ratio is 𝜙 = (√5 + 1) /2 ≈ 1.618.

6 Reﬂect on This Let ∠𝐴𝐵𝐶 be a 1∘ angle, with segments 𝐵𝐴 and 𝐵𝐶 equal in length. Let 𝐷 and 𝐸 be the midpoints of 𝐵𝐴 and 𝐵𝐶, respectively. Now erase segments 𝐵𝐷 and 𝐵𝐸. See Figure 6.1, where the angle has been drawn as a 10∘ angle for clarity. Imagine that the remaining segments 𝐴𝐷 and 𝐶𝐸 act as reflective mirrors. A light ray in the plane enters the opening between 𝐴 and 𝐶, reflects back and forth between the mirrors, and then exits through the opening between 𝐷 and 𝐸, as in Figure 6.2. What is the maximum possible number of reflections?

E B

D

C A

Figure 6.1. Two mirrors facing each other at a small angle.

8. Four-Regular Squares

7

E D

C A

Figure 6.2. A light ray reflecting between the mirrors.

Figure 7.1. A cut-up skewed pizza, with 𝑛 = 5.

7 Skewed Pizza A pizza is made in the shape of a convex quadrilateral. Each of the four sides of the pizza is divided into 𝑛 equal segments and straight-line cuts are made connecting corresponding division points on opposite sides. The resulting pieces are assigned the colors black and white in a checkerboard pattern, as in Figure 7.1. (a) If 𝑛 is even, then there are an equal number of black and white pieces. Suppose Alice and Bob share the pizza, with Alice eating all the black pieces and Bob eating the white pieces. Do they get the same amount of pizza? (b) If 𝑛 is odd, then there is one more piece of one color than the other. To try to make the division fair, Alice and Bob give the central piece to the dog before dividing the rest of the pizza as before. Do they get the same amount of pizza?

8 Four-Regular Squares On each side of a regular 𝑛-gon with unit-length sides, erect a unit square exterior to the polygon; these 𝑛 squares are the inner squares. Take 𝑛 more unit squares—the outer squares—and place them into the V-shaped gaps between adjacent inner squares so that each one touches both sides of the gap (Figure 8.1; we will assume 𝑛 ≥ 5). Two squares touch if their boundaries intersect but their interiors do not. Find 𝑛 for which there is such an arrangement with each outer square touching two neighboring outer squares, thus giving 2𝑛 squares, each of which touches exactly four others.

8

Chapter 2. Geometry

Figure 8.1. The inner ring of squares outside a hexagon, with six outer squares wedged into the gaps.

9 Venn Symmetry Everyone is familiar with the classic 3-circle Venn diagram for three sets 𝐴, 𝐵, 𝐶 (Figure 9.1). That diagram is rotationally symmetric in that one can take the circle for 𝐴 and rotate it around an appropriate point by 120∘ and also 240∘ to get the circles for 𝐵 and 𝐶, respectively. Such a rotationally symmetric Venn diagram generated by rotating a single curve is called simply symmetric. Find an ellipse and point of rotation such that rotating the oval four times around the point through multiples of 72∘ gives a symmetric Venn diagram for five sets.

Figure 9.1. The classic Venn diagram on three sets. The regions correspond to the eight ways of intersecting the sets and their complements.

12. Tiling Surprise

9

Figure 10.1. Bisecting the sides of a convex quadrilateral yields a smaller central quadrilateral and four corner triangles.

10 A Crosscut Quadrilateral Bisect the four sides of a convex quadrilateral and connect each midpoint to an opposite corner, choosing the first one in counterclockwise order as in Figure 10.1. Prove that the central quadrilateral has the same area as the union of the four corner triangles.

11 The Legacy of H. G. Wells Work in the usual 𝑥𝑦𝑧-coordinate system. Consider the W-shape consisting of the line segments from (1/(2√3), 0, 1/2) to (1/√3, 0, 0) and (1/√3, 0, 1), together with their reflection in the 𝑥𝑦-plane, and rotate this W-shape around the 𝑧-axis to get a 3-dimensional surface 𝑆 (Figure 11.1). Assume that the side of 𝑆 facing the 𝑧-axis consists of perfectly reflecting mirrors (angle of incidence = angle of reflection). Suppose a ray of light rises vertically from below. If its distance from the 𝑧-axis is either greater than 1/√3 or less than 1/(2√3), it will simply rise, never striking 𝑆. But suppose the vertical ray strikes 𝑆. What will happen to the ray of light?

12 Tiling Surprise One can use disconnected tiles to tile the plane. Consider a tile in an L-shape but with a gap, as in Figure 12.1, left. This tiles a rectangle, and hence the whole plane, as shown in Figure 12.1, right. One can also consider tiles that are essentially one dimensional, such as two squares separated by empty space congruent to one of the squares, as a single rigid object (Figure 12.2, left). This easily tiles an infinite line, and therefore also the plane. The tile with two squares can be described as X␣X, to indicate two squares separated by a square gap. For tilings in

10

Chapter 2. Geometry

Figure 11.1. (a) A shape in the form of a W. (b) The surface 𝑆 is obtained by rotating the W-shape in (a) around the 𝑧-axis.

Figure 12.1. The tile at left consists of three squares separated by a square. It can tile the plane by first getting a rectangle, as shown at right, and then tiling with the rectangle.

Figure 12.2. The tile X␣X can be used to tile a line by first getting an interval, as shown at right.

this context, movement can use any isometry: rotations, translation, and reflections. (a) Show how to tile the plane using XX␣XXX, the tile in Figure 12.3, top. (b) Show how to tile the plane using XX␣XX, the tile in Figure 12.3, bottom.

15. A Polyhedral Puzzle

11

Figure 12.3. The upper tile corresponds to XX␣XXX, while the lower one is XX␣XX.

13 A Well-Balanced Clock (a) Consider a standard circular 12-hour clock where the three hands have equal length and all point vertically upward at midnight. Is there a time when the ends of the three hands form an equilateral triangle? (b) Same question, but assume there are 11 hours in the full circle as opposed to 12 (but still with 60 minutes to an hour and 60 seconds to a minute).

14 On the Level Consider a trough with an isosceles triangle cross-section (symmetric, as in Figure 14.1, left), height 1, and vertex angle 120∘ . Fill it with water. What is the shape of a roof that, when placed on the trough, allows it to be rotated around its bottom edge through 30∘ in either direction so that the water height stays at 1 throughout the rotation?

Figure 14.1. Left: A trough full of water; blue indicates the water height. Right: A roof (with the front and back extended to the roof) will hold the water in as the trough tilts; the front wall is removed in this rendering.

15 A Polyhedral Puzzle Suppose 𝑃 is a convex polyhedron. Get a new polyhedron 𝑄 by cutting off a small tip from each vertex. Suppose 𝑄 has 𝑉 vertices, 𝐸 edges, and 𝐹 faces, and one of 𝑉, 𝐸, 𝐹 equals 1001. How many edges does 𝑃 have?

12

Chapter 2. Geometry

16 Wiggle Room A 3 × 3 × 3 cube is made up of 27 small unit cubes (cubies). What is the longest possible path that starts at a cubie and proceeds in straight segments to centers of adjacent cubies, never repeating a cubie and making a right-angle turn at every move?

17 Drink Me A set 𝐷 in the plane is called shrinkable if all shrunk versions of 𝐷 can fit into 𝐷. Any set that is convex or star-shaped is shrinkable. Find an example of a Jordan domain that is shrinkable but is not star-shaped. For more of a challenge, find an example that is a polygon. Details. •

A Jordan domain consists of a simple closed curve and its interior.

A set 𝐷 is star-shaped if 𝐷 contains a point 𝑃 such that for every point 𝑄 in 𝐷, the entire line segment 𝑃𝑄 is contained in 𝐷.

A shrunk version of 𝐷 is the region obtained by choosing some shrinking factor 𝑝 between 0 and 1 and using the points (𝑝𝑥, 𝑝𝑦), where (𝑥, 𝑦) is in 𝐷. The problem is about all shrinkings, that is, all possible choices of the shrinking factor.

The placement of the smaller set into 𝐷 can use any translation and rotation.

The Drink Me potion in Wonderland caused Alice to shrink to a fraction of her normal size.

18 Right-Angled Polygons It is easy to arrange six unit length segments in 3-space so that they form a hexagon with six right angles (Figure 18.1). For which positive integers 𝑛 is there an 𝑛-gon in 3-space with 90∘ angles at all vertices?

19 A Rolling Parabola Suppose the parabola 𝑦 = 𝑥2 , with focus at (0, 1/4), rolls without slipping along the 𝑥-axis (see Figure 19.1). What is the locus of the focus?

20. Rocket Science

13

Figure 18.1. A 3-dimensional rectangular hexagon.

Figure 19.1. What is the locus of the focus as the parabola rolls along the 𝑥-axis?

Figure 20.1. Three observers can measure three inclination angles from their positions to a rocket.

20 Rocket Science Can the height of a rocket be determined by three observers on the ground, each having an inclinometer? Details. You wish to place three people on the ground so that, from information you will receive from them, you can determine the maximum height of a rocket that will launch after they are placed. At its apex the rocket will emit a flash and

14

Chapter 2. Geometry

at that time each observer will measure the angle from the rocket to the ground through his or her position (Figure 20.1). That is, the observer at 𝐴 will measure ∠𝑅𝐴𝑋, where 𝑅 is the rocket’s position and 𝑋 is the point on the ground underneath 𝑅. The question is whether the observers can be placed so that, with the three angles they will provide, you can determine the height of the rocket, no matter where it is. The observers tell you no information about the bearing to the rocket; all that is known are the three inclination angles and the positions of the observers. The rocket veers in flight so that there is no information about its position except what can be deduced from the inclinations. The area around the rocket is assumed to be flat.

21 The Icing on the Cake A round cake has icing on the top but not the bottom. Cut out a piece in the usual shape (a sector of a circle with vertex at the center), remove it, turn it upside down, and replace it in the cake to restore roundness. Do the same with the next piece; i.e., take a piece with the same vertex angle, but rotated counterclockwise from the first one so that one boundary edge coincides with a boundary edge of the first piece. Remove it, turn it upside-down, and replace it. Keep doing this in a counterclockwise direction. Figure 21.1 shows the situation after two steps when the central angle is 90∘ . If 𝜃 is the central angle of the pieces, let 𝑓(𝜃) be the smallest number of steps needed so that, under the repeated cutting-and-flipping just described, all icing returns to the top of the cake, with 𝑓(𝜃) set to ∞ if this never happens. For example, 𝑓(90∘ ) = 8. (a) What is 𝑓(181∘ )? (b) What is 𝑓(1 radian)?

Figure 21.1. Two moves in the 90∘ case leave half the cake turned over.

22 More Cake The setup is as in Problem 21, but now let 𝑔(𝜃) be the smallest number of steps needed for every point in the cake to return to its initial position. What is 𝑔(7∘ )?

3 Number Theory 23 Power Matching True or False: For any even positive integer 𝑛, it is possible to divide {1, 2, . . . , 𝑛} into pairs so that the sum of each pair is one less than a power of 2.

24 Triplets Call an integer 𝑛 a triplet if 𝑛 = 𝑎 + 𝑏 + 𝑐, where 𝑎, 𝑏, and 𝑐 are positive integers such that 𝑎 < 𝑏 < 𝑐, 𝑎 divides 𝑏, and 𝑏 divides 𝑐. For example, 7 is a triplet because 1 + 2 + 4 = 7. And it is easy to see that there is no smaller triplet. How many nontriplets are there?

25 The Mysterious Seventeenth Divisor Suppose a positive integer 𝑋 has divisors 𝑑𝑖 , where 1 = 𝑑1 < 𝑑2 < 𝑑3 < ⋯ < 2 2 𝑑𝑘 = 𝑛 and 𝑑72 + 𝑑15 = 𝑑16 . What is 𝑑17 ?

26 True or False? A routine calculation verifies that for all integers 𝑛 from 1 to 100, 𝑛3 + 10 and (𝑛 + 2)3 − 9 are relatively prime. True or False: For every positive integer 𝑛, 𝑛3 +10 and (𝑛+2)3 −9 are relatively prime. 15

16

Chapter 3. Number Theory

27 An Exponential Diophantine Problem Show that there are infinitely many pairs of positive integers 𝑥 and 𝑦 such that 𝑥𝑥−𝑦 = 𝑦𝑥+𝑦 .

28 A Prime Characterization Prove that a positive integer 𝑛 is prime if and only if there is a unique pair of positive integers 𝑗 and 𝑘 such that 1 1 1 − = . 𝑗 𝑘 𝑛

29 Two Sums and Many Differences (a) Alice chooses 100 distinct real numbers, ordered so that 𝑎1 < 𝑎2 < ⋯ < 𝑎100 , and tells Bob their sum, the sum of their squares, and all the 98 differences 𝑎3 − 𝑎1 , 𝑎4 − 𝑎2 , . . . , 𝑎100 − 𝑎98 . Can Bob always determine her numbers? (b) Alice chooses 101 distinct real numbers, ordered so that 𝑎1 < 𝑎2 < ⋯ < 𝑎101 , and tells Bob their sum, the sum of their squares, and all the 99 differences 𝑎3 − 𝑎1 , 𝑎4 − 𝑎2 , . . . , 𝑎101 − 𝑎99 . Can Bob always determine her numbers?

30 Reciprocals to Squares Let 𝑎, 𝑏, 𝑐 be positive integers with no factor in common to all three such that 1/𝑎 + 1/𝑏 = 1/𝑐. Prove that 𝑎 + 𝑏, 𝑎 − 𝑐, and 𝑏 − 𝑐 are all perfect squares.

31 Nondivisibility by 11 The number 545 has the curious property that replacing the digit in any single position by an arbitrary digit (from 0 to 9; it can be a leading 0 or just the same digit), the result is not divisible by 11. Is there a positive integer with this property having an even number of digits?

32 Equally Powerful Splits Split the integers from 1 to 16 into these two sets: 𝐴 = {1, 4, 6, 7, 10, 11, 13, 16} and 𝐵 = {2, 3, 5, 8, 9, 12, 14, 15}. Then we have three remarkable equalities: ∑𝑎∈𝐴 𝑎 = 68 = ∑𝑏∈𝐵 𝑏, ∑𝑎∈𝐴 𝑎2 = 748 = ∑𝑏∈𝐵 𝑏2 , and ∑𝑎∈𝐴 𝑎3 = 9248 = ∑𝑏∈𝐵 𝑏3 . The sets have size eight, so we also have ∑𝑎∈𝐴 𝑎0 = 8 = ∑𝑏∈𝐵 𝑏0 . Find all positive integers 𝑛 such that {1, 2, . . . , 𝑛} can be split into two sets 𝐴 and 𝐵 such that ∑𝑎∈𝐴 𝑎𝑗 = ∑𝑏∈𝐵 𝑏𝑗 for 𝑗 = 0, 1, 2, 3.

37. The Incredible Shrinking Superpowers

17

33 Tripling in Two Steps Suppose that 𝑓 is a function mapping positive integers to positive integers, and for every positive integer 𝑛, (1) 𝑓(𝑛 + 1) > 𝑓(𝑛) and (2) 𝑓(𝑓(𝑛)) = 3𝑛. Find 𝑓(1000).

34 Root Closure Call a set 𝑋 of integers closed under polynomial roots if every integer root of a nonzero polynomial with coefficients in 𝑋 is also in 𝑋. For a positive integer 𝑛, let 𝑅𝑛 be the closure of {0, 𝑛} under polynomial roots; that is, 𝑅𝑛 is the smallest set containing {0, 𝑛} that is closed under polynomial roots (more precisely, it is the intersection of all closed sets containing {0, 𝑛}). If 𝐷𝑛 = {𝑑 ∈ ℤ ∶ 𝑑 = 0 or 𝑑 divides 𝑛}, then 𝐷𝑛 is closed (because any integer root must divide the polynomial’s constant term); this means that 𝑅𝑛 ⊆ 𝐷𝑛 . Is there an integer 𝑛 such that 𝑅𝑛 ≠ 𝐷𝑛 ?

35 A Double Power Leads to a Sum of Two Squares 𝑛

Prove that for every 𝑛 ∈ ℕ, 33 − 1 is a sum of two squares of integers.

36 Prime Subsets (a) Show that if 𝑎1 , 𝑎2 , . . . , 𝑎𝑛 are integers, then some consecutive subsequence 𝑎𝑘 , 𝑎𝑘+1 , . . . , 𝑎𝑚 has a sum that is divisible by 𝑛. (b) Show that if {𝑎1 , 𝑎2 , . . . , 𝑎2𝑝−1 } is a set of integers, 𝑝 prime, then there is a subset of size 𝑝 whose sum is divisible by 𝑝.

37 The Incredible Shrinking Superpowers In base 𝑏 notation, a positive integer is represented as a sum of powers of 𝑏, each multiplied by a positive integer less than 𝑏. Superbase 𝑏 notation is the same, except that each exponent in each power of 𝑏 is also written in base 𝑏, as is each exponent of an exponent, and so on, until only integers between 1 and 𝑏 remain. For example, the base 3 representation of 2692 is 10200201, which means that 2692 = 37 + 35 ⋅ 2 + 32 ⋅ 2 + 1. In superbase 3, we write 2692 = 33⋅2+1 + 33+2 ⋅ 2 + 32 ⋅ 2 + 1.

18

Chapter 3. Number Theory   

  

    



 

Figure 37.1. The first 10000 values of the sequence starting at 4 (from [99, sequence A056193]). Consider the following sequence of integers, defined from a positive integer starting value 𝑛2 = 𝑎. For 𝑛3 , write 𝑛2 in superbase 2, replace each 2 by 3, and subtract 1. For 𝑛4 , write 𝑛3 in superbase 3, replace each 3 by 4, and subtract 1. And so on. For 𝑛𝑘+1 , write 𝑛𝑘 in superbase 𝑘, replace each 𝑘 by 𝑘+1, and subtract 1. The sequence when the initial value is 𝑎 = 3 is 3, 3, 3, 2, 1, 0 as shown by these steps: 𝑛2 = 3 = 2 + 1, 𝑛3 = (3 + 1) − 1 = 3, 𝑛4 = 4 − 1 = 3, 𝑛5 = 3 − 1 = 2, 𝑛6 = 2 − 1 = 1, 𝑛7 = 1 − 1 = 0. The sequence for 𝑎 = 4 starts 4, 26, 41, 60, 83, 109, 139, 173, 211, 253, 299, 348, 401, 458, 519, . . . : 𝑛2 = 4 = 22 , 𝑛3 = 33 − 1 = 26 = 32 ⋅ 2 + 3 ⋅ 2 + 2, 𝑛4 = (42 ⋅ 2 + 4 ⋅ 2 + 2) − 1 = 41 = 42 ⋅ 2 + 4 ⋅ 2 + 1, 𝑛5 = (52 ⋅ 2 + 5 ⋅ 2 + 1) − 1 = 60 = 52 ⋅ 2 + 5 ⋅ 2, 𝑛6 = (62 ⋅ 2 + 6 ⋅ 2) − 1 = 83 = 62 ⋅ 2 + 6 + 5, 𝑛7 = (72 ⋅ 2 + 7 + 5) − 1 = 109. The first 10000 terms are shown in Figure 37.1. It is an amazing fact that this sequence, regardless of the starting value, eventually becomes 0. Let 𝐺(𝑎) be the least 𝑘 such that 𝑛𝑘 = 0 when the initial value is 𝑎. Then 𝐺(3) = 7. What is 𝐺(4)?

38. Special Numbers

19

38 Special Numbers A set 𝐴 of positive integers is special above 𝑛 if every 𝑥 ∈ 𝐴 such that 𝑥 > 𝑛 satisfies: (1) 𝑥 divides the product of all 𝑦 ∈ 𝐴 with 𝑦 < 𝑥; (2) 𝑥 does not divide any 𝑦 ∈ 𝐴 with 𝑦 > 𝑥. For example, {1, 2, 3, 6, 9} is special above 3 and {1, 2, 3, 4, 12} is special above 4 but not special above 3. (a) What is the largest size of a set that is special above 4? (b) Show that there is a special-above-5 set that has more than googolplex many 100 elements (a googolplex is 1010 ).

4 Combinatorics 39 Power up Your Radio You have eight batteries and you know that four of them are good and four are bad, but you don’t know which are which. You need two good batteries to get your radio to work. You can test them only by placing two batteries into the radio and seeing if it works. What is the smallest number of trials that will guarantee that the radio comes on?

40 A Parking Puzzle A one-way street has 𝑛 parking spaces, numbered in order from 1 to 𝑛. A sequence of 𝑛 drivers arrive one-by-one, looking for parking spaces. Each driver has a preferred parking space. These preferences can be represented by a sequence of numbers (𝑎1 , 𝑎2 , . . . , 𝑎𝑛 ), where 𝑎𝑖 is the preferred space of the 𝑖th driver. When the 𝑖th driver arrives, he or she parks in space 𝑎𝑖 if it is available; if not, the driver continues down the street to spaces 𝑎𝑖 + 1, 𝑎𝑖 + 2, . . . , 𝑛, and takes the first available space, if there is one. If not, he or she cannot park (it is a one-way street, so going back to a lower-numbered space is not allowed). The sequence (𝑎1 , 𝑎2 , . . . , 𝑎𝑛 ) is called a parking function of order 𝑛 if all drivers are able to park. How many parking functions of order 𝑛 are there? For example, when 𝑛 = 3, the sequence (3, 2, 2) is not a parking function: if drivers with these preferences try to park, the first two will take their preferred spaces 3 and 2, and then the third will bypass the empty space 1, find spaces 2 and

21

22

Chapter 4. Combinatorics

3 occupied, and fail to park. Here is a list of the 16 parking functions of order 3: (1, 1, 1), (1, 1, 2), (1, 1, 3), (1, 2, 1), (1, 2, 2), (1, 2, 3), (1, 3, 1), (1, 3, 2), (2, 1, 1), (2, 1, 2), (2, 1, 3), (2, 2, 1), (2, 3, 1), (3, 1, 1), (3, 1, 2), (3, 2, 1).

41 A Black and White Issue In a 999×999 square grid, each square is colored either black or white. Each black square not on the border has exactly five white squares among the eight squares that neighbor it either horizontally, vertically, or diagonally. Each white square not on the border has exactly four black squares among its eight neighbors. How many squares are black and how many are white?

42 A Choice Problem Suppose 𝑛 is a positive integer. Let [𝑛] = {1, 2, . . . , 𝑛}, and let 𝑆 be the set of all nonempty subsets of [𝑛]. We will say that a function 𝑓 from 𝑆 to [𝑛] is a selector function if it has the following two properties: (1) If 𝐴 ∈ 𝑆, then 𝑓(𝐴) ∈ 𝐴. (2) If 𝐴 ∈ 𝑆 and 𝐵 ∈ 𝑆, then either 𝑓(𝐴 ∪ 𝐵) = 𝑓(𝐴) or 𝑓(𝐴 ∪ 𝐵) = 𝑓(𝐵). For example, if 𝑛 = 2, then any selector function will have to map {1} to 1 and {2} to 2. It can map {1, 2} to either 1 or 2, so there are two selector functions. How many selector functions are there if 𝑛 = 5?

43 Water Wave Imagine that there is a person standing at each of the 10000 points (𝑥, 𝑦) where 𝑥 and 𝑦 are integers and 1 ≤ 𝑥, 𝑦 ≤ 100. A linear water wave flows across the plane in a straight line as indicated in Figure 43.1. If the wave is angled in such a way that the wave washes over the people one at a time, then the order in which the people get wet is a linear ordering of the set of people. How many different orderings arise in this way, considering all possible orientations and directions of motion of the wave?

44 An Acceptable Committee A university mathematics department has 12 professors, and they want to form a committee with four members. A committee is considered acceptable to a professor if it includes at least one member whom that professor likes. Assume that

46. Using Blocks and Chains to Unlock a Safe

23

Figure 43.1. A water wave washing over a grid of people.

for every pair of professors, there is at least one professor whom they both like. Prove that there must be a committee that is acceptable to all the professors. Note: Any professor might or might not like himself or herself. The committee must be acceptable to professors who are on the committee, as well as those who are not.

45 A Compatible Committee There are 100 senators in the United States Senate. One day the president announces that he wants to form a committee consisting of 34 senators. The next day he receives 100 envelopes in the mail. He opens the first to find a note from Senator Jones saying “I refuse to be on the committee if Senator Smith is on it.” When he opens the other envelopes, he finds that every senator has named exactly one other senator with whom he or she is unwilling to serve. Show that it is possible for the president to form the committee without violating the wishes of any senator.

46 Using Blocks and Chains to Unlock a Safe A hardware store sells a safe with a combination lock that has six numbered buttons—1, 2, 3, 4, 5, 6—on its face along with a start button S. The combination is some subset of {1, 2, 3, 4, 5, 6}. To open the lock, one must first press S, and then press numbers in sequence to form a subset of {1, 2, 3, 4, 5, 6}. Order is unimportant: if the subset equals the correct combination for the lock, then the safe can be opened. If it fails to open, one can press S and start over.

24

Chapter 4. Combinatorics

What is the shortest sequence of button presses that is guaranteed to open the safe, provided you try the lock after each button is pressed? For example, if the lock had only three buttons, then the sequence S12 S23 S312 is guaranteed to work. The first two numbers test the subsets {1} and {1, 2}; the next two test {2} and {2, 3}, and the last triple takes care of {3}, {1, 3}, and {1, 2, 3}. The empty set can be checked after the first S, so this sequence of length 10 covers all eight possibilities and will open the lock.

47 A Universal Set of Directions Consider the network in Figure 47.1. Think of each node being a city, with oneway streets between adjacent cities. Rome is one of the cities. Find a coloring of the arrows in two colors, red and blue, such that: (1) The two roads leading out of each vertex have different colors. (2) There is a finite sequence of colors (such as “red, red, red, blue, blue, red”) such that following these instructions from any starting vertex leaves you in Rome after executing the last instruction.

Figure 47.1. Can you color the edges so that a single set of instructions always leads to Rome?

48 A Competition Problem About a Competition Problem A class with an even number of students submitted solutions to a competition question. Grades are one of 0, 1, 2, . . . , 10 and all 11 possible scores were given. The average score was an integer 𝑋. Prove that the class can be divided into two groups of the same size so that the average in each group is exactly 𝑋.

5 Probability 49 The Importance of Irrelevant Information (a) A random parent of two children is asked, “Do you have a son?” If the answer is “Yes,” what is the probability that both children are sons? (b) A random parent of two children is asked, “Do you have a son born on a Tuesday?” If the answer is “Yes,” what is the probability that both children are sons? Assume that the boy/girl probability is 1/2, all days of the week are equally likely for births, and the genders and birth days of the two children are independent.

50 Creeping Ants At a certain time, 101 ants are placed on a one-meter stick. One of them, Alice, is placed at the exact center, and the positions of the other 100 ants are random, as are the directions they face. All ants start crawling in whatever direction they are facing, always traveling at one meter per minute. When an ant meets another ant or reaches the end of the stick, it immediately turns around and continues going in the other direction. What is the probability that after one minute Alice is at the exact center of the stick?

51 Roll the Dice What is the expected number of distinct faces seen when rolling a 6-sided die 𝑛 times? 25

26

Chapter 5. Probability

52 Conditioned Throws of a Die (a) A 3-sided die with numbers 1, 2, and 3 is thrown until a 1 appears. What is the expected number of throws (including the throw giving 1)? (b) A standard 6-sided die is thrown until a 1 appears. What is the expected number of throws (including the 1) conditioned on the event that all throws gave values 1, 2, or 3? The condition means that any string of throws with a 4, 5, or 6 does not contribute to the expected length.

53 Where Are the Rounded Powers of Two? Consider the positive integer powers of 2, and round each one to just one significant digit; in other words, round to the nearest number of the form 𝑑 ⋅ 10𝑘 , where 𝑑 is one of the digits 1 through 9. In case of a tie, round up. What is the most likely leading digit of the result? More precisely, the question should be interpreted asymptotically. For each positive integer 𝑁, one can compute the proportion of the first 𝑁 rounded positive powers of 2 that start with each of the nine digits; this gives the probability of each digit occurring as the leading digit if one of the first 𝑁 rounded powers of 2 is chosen at random. Then take the limit as 𝑁 approaches infinity. For which digit is this limiting probability the largest, and what is the limiting probability?

54 The Holy Game of Poker You and a few friends are playing stud poker (five cards dealt, no exchanging of cards) with a standard 52-card deck. It’s your lucky day and God tells you that you are guaranteed to end up with a full house, but only if you correctly choose the best full house, meaning the one with the highest probability of winning. Which full house should you choose? The ranking of poker hands, from lowest to highest, is: high card, one pair, two pair, three of a kind, straight, flush, full house, four of a kind, straight flush. Only the last three are relevant. •

a full house is a pair and triplet, such as 2 ♠, 2 ♡, 5 ♡, 5 ♣, 5 ♠;

four of a kind is a quadruplet, such as 5 ♠, 5 ♡, 5 ♣, 5 ♢, 2 ♡;

a straight flush is five in a row of the same suit, such as 2 ♠, 3 ♠, 4 ♠, 5 ♠, 6 ♠. An ace can be either the high or low card of a straight flush, so both A 2 3 4 5 and 10 J Q K A, all in the same suit, count as straight flushes.

For two full houses, the one with the higher triplet wins (ace being high).

57. How Much is a Penny Worth?

27

55 A Shrinking Random Walk Consider a random walk in the plane that starts at the origin and moves only in the positive 𝑥 and 𝑦 directions. The direction choice at each step is governed by the flip of a fair coin but the length shrinks: the length of the 𝑛th move is 2−𝑛 (so the first move has length 1/2; the second has length 1/4, and so on; see Figure 55.1). If 𝐿 is the limiting point of the random walk, what is the expected distance of 𝐿 from the origin?

Figure 55.1. A random walk that only goes east or north, with each step half the size of the preceding step.

56 BINGO! Consider a BINGO game in which every possible card is in play. Random calls are made from B1, B2, . . . , B15, I16, . . . , I30, N31, . . . , N45, G46, . . . , G60, O61, . . . , O75. What is the probability that the first win is horizontal, as opposed to vertical? Details. BINGO is played with cards such as the one in Figure 56.1, with random calls from the 75 numbers until someone in the room claims a win. A win consists of a row or column of chosen numbers. Traditional BINGO wins include the two diagonals, but we are not considering those here. Moreover, a traditional card has a “free square” at the center, but for this problem the center is just another N-number.

57 How Much is a Penny Worth? Alice tosses 99 fair coins and Bob tosses 100. What is the probability that Bob gets strictly more heads than Alice?

28

Chapter 5. Probability

Figure 56.1. A BINGO card has 25 numbers from 1 through 75, with five chosen from each successive group of 15.

58 A Historically Interesting Truth-Teller Problem Suppose Alice, Bob, Charlie, and Diane tell the truth with (independent) probability 1/3. Alice stated that Bob denied that Charlie declared that Diane lied. What is the probability that Diane told the truth? Details. We assume that Diane made a certain statement whose truth value both Charlie and Diane knew (but of course Diane lied about it with probability 2/3). Then Charlie said one of “Diane told the truth” or “Diane lied” according to what he heard and his own probability of lying. Bob heard what Charlie said, and he said one of “Charlie said that Diane told the truth” or “Charlie said that Diane lied.” And Alice heard Bob’s statement and made her assertion accordingly.

59 Monty Hall Revisited Recall the famous Monty Hall problem: Monty Hall is the host of a game show on which there are three doors, with a car behind one door and goats behind the other two. You are a contestant on the show and get to choose a door; you will receive the prize behind your chosen door. Before revealing your prize, Monty opens one of the other doors to reveal a goat, and then he offers you the chance to switch your choice to the other unopened door. Should you switch? Many people are surprised to discover that, under reasonable assumptions that we will discuss below, you should switch. For a thorough discussion of the problem, see [129, Monty Hall problem]. Now suppose there are four doors, with a car behind one door and goats behind the other three. Once again you will win the prize behind the door of your choice. After you choose, Monty will open a door you didn’t choose that hides a goat and offer you the chance to switch to a different door. Then, whether you switch or not, Monty will reveal another goat behind a door different from your

59. Monty Hall Revisited

29

choice at that time. Once again, you have a chance to switch before your prize is revealed. What should you do? We make the following assumptions: (1) Before the game begins, the prizes are distributed behind the doors at random. (2) Monty knows which door hides the car, and he always chooses to open a door hiding a goat. (3) When there is more than one door that Monty could open to reveal a goat, he chooses which to open at random. And, of course, we also assume that you would rather win a car than a goat!

https://xkcd.com/1282/

6 Calculus 60 Integrating a Base Change Define 𝑓 ∶ [0, 1] → [0, 1] by taking any 𝑥 ∈ [0, 1], writing it in base two (never using an expansion that ends in infinitely many 1s), and then reinterpreting that expression in base ten to get 𝑓(𝑥). For example, 𝑓(1/3) = 𝑓((0.010101. . .)2 ) = 1 (0.010101. . .)10 = 1/99. What is ∫0 𝑓(𝑥) 𝑑𝑥?

61 A T-Shirt Gun The stands at a stadium slope up at an 18∘ angle. You are firing a T-shirt gun from the bottom of the stands into the stands. At what angle of inclination above the ground should you fire the gun to get the shirt to land as far up the stands as possible? Ignore air resistance.

62 Shooting Range You are firing a cannon from the top of a cliff. The height of the cliff is 125 m and the cannonball leaves the cannon traveling at 35 m/sec. What should the angle of inclination of the cannon be to get the cannonball to land as far as possible from the base of the cliff? Neglect air resistance, and assume that the downward acceleration caused by gravity is 9.8 m/sec2 .

31

32

Chapter 6. Calculus

63 Convergent Rational Enumeration Can the rational numbers in the interval [0, 1] be enumerated as a sequence 𝑞1 , ∞ 𝑞2 , . . . in such a way that ∑𝑛=1 𝑞𝑛 /𝑛 converges?

64 A Functional Equation Find all twice-differentiable functions 𝑓 from the real numbers to the real numbers such that for all 𝑥, 𝑓(2𝑥) = 4𝑓(𝑥).

65 Two Eerie Recursions (a) Suppose 𝑥1 = 0, 𝑥2 = 1, and for 𝑛 ≥ 3, 𝑥𝑛 = 𝑥𝑛−1 +

𝑥𝑛−2 . 𝑛−2

What is lim𝑛→∞ 𝑛/𝑥𝑛 ? (b) Suppose 𝑦1 = 0, 𝑦2 = 1, and for 𝑛 ≥ 3, 𝑦𝑛 = 𝑦𝑛−2 +

𝑦𝑛−1 . 𝑛−2

What is lim𝑛→∞ 2𝑛/𝑦𝑛2 ?

66 Stabilizing a Cylinder How much water should a closed cylinder contain so that the center of mass of the system—liquid-plus-cylinder—is lowest? The answer should be in terms of 𝑅 (the cylinder’s radius in cm), 𝐻 (its height in cm), and 𝑚 (the cylinder mass in grams). The density of water is 1 gram/cm3 .

67 𝜋 Coincidence? Consider ⌈𝑛/𝜋⌉ and ⌈1/ sin(𝜋/𝑛)⌉, where 𝑛 is an integer and 𝑛 ≥ 2. The two sequences start as follows: ⌈𝑛/𝜋⌉: 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 8, 9, . . . , ⌈1/ sin(𝜋/𝑛)⌉: 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 8, 9, . . . . They differ when 𝑛 = 3. Are they equal for all larger 𝑛?

68 The Chase Is On A dog starts at (0, 1) and chases a rabbit who starts at (0, 0) and runs along the positive 𝑥-axis at speed 1. The dog always moves at speed 1 toward the rabbit. In the limit, how close does the dog get to the rabbit?

7 Algorithms and Strategy 69 Where’s Bob? Agent Alice is on the trail of criminal hacker Bob and knows that he is hiding in one of 17 caves. The caves form a linear array and Bob moves only at night: every night he moves from the cave he is in to one of the nearest caves on either side of it. Alice can search two caves each day, with no restrictions on her choice. For example, if Alice searches {1, 2}, {2, 3}, . . . , {16, 17}, then she will find Bob, but it might take as long as 16 days. Find a search strategy for Alice that is guaranteed to find Bob in as few days as possible.

70 It’s a Horse Race You are arranging races for 25 horses on a track that can handle only five horses at a time. How many races are needed to determine the three fastest horses, in order? The conditions are: •

Each horse always runs the distance in the same time.

The 25 times are all different.

You have no stopwatch, but can observe the finishing order in each race.

71 Your Two Best Shots A perfectly camouflaged tank occupies one square in a field that is partitioned into a 15 × 15 grid of 225 squares. Your weapon can fire shots, each of which 33

34

Chapter 7. Algorithms and Strategy

destroys one square. Two shots are necessary to destroy the tank. After the first hit, and only then, the tank, still invisible, moves to an adjacent square in the horizontal or vertical direction. What is the minimal number of shots needed to guarantee its destruction?

72 Determine the Martian Majority You have just landed on Mars where you find seven identical-looking spheres. From prior missions, you know the following: •

Each sphere is colored either red or blue on the inside; the color is not visible from the outside.

When two spheres touch each other, they glow if and only if they are the same color.

Your job is to carry out as few comparisons as possible, with the goal of identifying a sphere that you are certain has the majority color. What is the smallest number of comparisons that is guaranteed to work?

73 Majority Rules A sequence of 1000 names (not all distinct) is going to be read out to you, and you are told that one name is in the majority, that is, it occurs at least 501 times. You have a counter that starts at 0 and that you can increment or decrement whenever you hear a name. But your memory is very limited: you can remember only a single name at any given time (but when you hear a name you can remember it long enough to check if it is the same as the one in your memory, and you can then decide whether or not to replace the name in your memory with the new name). Find a strategy that, after all names are read, will allow you to declare the name of the majority person.

74 Going for Gold Charlie has 64 identical-looking gold-colored coins; all are counterfeit except one, which is pure gold. He calls Alice into his office and seats her at a table containing an 8 × 8 checkerboard. He places a coin on each square, with each one showing either a head or tail as he chooses. Charlie tells Alice which coin is made of gold. Alice may then flip one of the coins over, replacing it on its square, or do nothing. She then leaves the room and Bob enters and is seated in the same position, facing the board. He may take one of the coins. Find a joint strategy that allows Bob to always select the gold coin. Alice and Bob know the rules and can plan a strategy, but cannot communicate after Alice enters the room.

77. One Hat Too Many

35

75 The Mensa Correctional Institute Alice and Bob, prisoners at the Mensa Correctional Institute, are under the care of warden Charlie. Alice will be brought into Charlie’s office on Sunday and shown a standard deck of 52 cards, face up in a row in some arbitrary order. Alice may, if she wishes, interchange two cards. She then leaves and Charlie turns each card face down in its place. Bob is then brought in and Charlie calls out a random target card, 𝐶. Bob can turn over cards, one after another, at most 26 times as he searches for the target. If he eventually turns over 𝐶, both prisoners are freed; if he fails to find the target, they stay in prison. Alice and Bob know the rules and are allowed to plan a strategy in advance. On Sunday they cannot communicate; Alice has no idea what the target card will be. (a) Find a strategy that guarantees success for the prisoners regardless of Charlie’s choices. (b) Same setup as in (a), except that the deck has only five cards and Charlie’s initial arrangement and choice of target are both purely random; Alice can interchange any two cards, or do nothing. Alice and Bob are set free if and only if Bob finds 𝐶 by looking at only one card. Find the strategy for the prisoners that has the highest probability of success.

76 Matching Hats Alice and Bob are prisoners of warden Charlie, who will place a stack of infinitely many hats on each of their heads. Each stack of hats is numbered from bottom to top with positive integers, and each hat is colored black or white, chosen randomly with equal probability. Each prisoner will see the colors of all hats on the other prisoner, but not his or her own. On Charlie’s signal, each prisoner will write down a positive integer. Charlie will check the color of each prisoner’s hat in the location specified by his or her declared number. Alice and Bob are freed if and only if the two chosen hats are the same color. The prisoners know the rules and can plan a strategy in advance, but cannot communicate after the hats are placed. If they each make a choice independent of what they see (e.g., they both declare 1), then their probability of success is 1/2. Find a strategy that succeeds more than two-thirds of the time.

77 One Hat Too Many There are ten prisoners, Alice, Bob, Charlie, . . . , Jill. The warden will call them together and line them up in order, with Alice first. He has 11 differently colored hats—the colors are known to the prisoners—and will randomly place one hat on each prisoner’s head, discarding the unused hat. Each prisoner can see the

36

Chapter 7. Algorithms and Strategy

hats of only the prisoners in front of them: Alice sees all (except her own), Bob sees eight hats, Jill sees nothing. At some point Alice will guess her color; all the other prisoners can hear her guess. Then Bob will guess his hat color, and so on to Jill. If all prisoners correctly identify the colors of their hats, they will be freed. The prisoners know the rules in advance and can devise a strategy; no communication among them is possible once the hats are placed. Find a strategy that maximizes their probability of success.

78 The Prisoners Must Agree Alice and Bob are prisoners of warden Charlie, who has a supply of red hats and blue hats. On the appointed day, the warden will place a hat on each prisoner’s head. The hats might or might not be the same color: Charlie can place the hats any way he likes. Each prisoner will see the other prisoner’s hat, but not his or her own. After the hat placement, on Charlie’s signal, the prisoners must simultaneously shout a color. They will be freed if they shout out the same color, and at least one of them has a hat of that color. After the hats are placed but before Charlie’s signal, the prisoners can access a random number generator, which will display to both of them a random integer in some range they choose. The prisoners know the rules and can plan a strategy before the hat placement; they cannot communicate after the hats are placed and before they shout. The prisoners’ probability of success will depend on how Charlie places the hats. For example, suppose the prisoners use a random integer from {1, 2} and agree to shout “red” if the integer is 1 and “blue” if it is 2. If Charlie puts hats of different colors on their heads then their success is guaranteed, but if he gives them hats of the same color then their probability of success is only 50%. We will say that their guaranteed success rate is the minimum probability of success, over all possible hat placements. Thus, in the example just given, the guaranteed success rate is 50%. (a) Find a strategy that gives the prisoners a guaranteed success rate of more than 50%. What is the largest guaranteed success rate they can achieve? (b) Same problem for 100 prisoners, where the warden can choose from 100 hat colors for each prisoner. If the prisoners shout out the same random color, their chance of success when Charlie uses the same color for everyone is 1%. Find a strategy that gives the prisoners a guaranteed success rate of more than 50%. (As before, the prisoners must shout out the same color and the color must appear on at least one of their heads for them to be freed. The prisoners have joint access to a random number generator.)

81. Battleship Destruction

37

79 How to Use Irrelevant Information Prisoners Alice and Bob will be freed if they can pass a certain test. A room contains a countably infinite collection of boxes, each labeled with a positive integer; inside each box is a real number. On the day of the test, Alice will enter the room and open all boxes except one. She then tells the warden what she thinks is inside the closed box and leaves the room. Then the boxes are closed, and Bob enters the room and follows the identical protocol. The warden will free the prisoners if at most one of them guesses incorrectly. (a) Suppose there is a requirement that all but finitely many boxes must contain the number 0. Find strategies that Alice and Bob can follow to guarantee their freedom. (b) Suppose that there is no restriction on the numbers in the boxes. Show that, even in this case, there are strategies for Alice and Bob that guarantee their freedom. The prisoners know the rules and can plan their strategies beforehand but cannot communicate on test day. We assume that the prisoners are capable of performing actions involving infinitely many steps. For example, each prisoner is capable of opening infinitely many boxes, fully reading the real numbers in those boxes, and specifying any real number with complete precision as his or her guess. Also, the prisoners can agree on an infinite amount of information in their strategy session. A prisoner need not specify at the beginning of his or her turn which box is to remain unopened; the prisoner may open some boxes and use the numbers in those boxes to decide what further boxes to open and which box to leave unopened.

80 Flipping Pennies Consider the following penny-flipping game. We start with 𝑛 pennies arranged in a straight line, where 𝑛 ≥ 2. A move consists of choosing a penny and turning it over (from heads to tails or vice versa) and doing the same to each of its neighbors. If the penny is at one end of the line, then it has only one neighbor; otherwise, it has two. For example, if the heads-tails sequence is HHTH and you choose the third penny, then your move would result in HTHT. For which values of 𝑛 is it always possible to find a sequence of moves to bring all coins to heads, no matter what the initial state of the coins is?

81 Battleship Destruction A battleship of length 2 is moving along the real line. At time 0 its center is at point 𝑋 and it then moves with constant speed 𝑉, but both 𝑋 and 𝑉 are unknown

38

Chapter 7. Algorithms and Strategy

integers; it is also not known whether it is moving left or right. At every second you can shoot at some point on the line. Find a strategy that guarantees that you will strike the ship in finite time. Assume that the projectile you shoot takes zero time to arrive at its target.

82 Real Battleship Destruction A battleship is moving as in Problem 81, but now 𝑋 and 𝑉 are unknown real numbers. Find a strategy that guarantees that you will strike the ship in finite time.

83 A Very Local Maximum You have 55 cards arranged in a circle. On the underside of each card is a real number, all different from each other and unknown to you. You wish to find a local maximum: a card whose number is larger than the numbers on the two adjacent cards. What is the smallest number of cards that need to be turned over in order to be guaranteed of finding such a card? (The choice of which card to turn over may depend upon the results of the previous turns.)

84 Detecting a Black Hole Imagine a network of 32 nodes and a communication system that allows messages to be sent from node 𝑖 to node 𝑗 for only some of the pairs (𝑖, 𝑗). For any pair (𝑖, 𝑗) you can, with one query, learn whether direct communication from 𝑖 to 𝑗 is possible. You want to use a sequence of such queries to find, if possible, a black hole: a node such that every other node can send messages directly to it, but it cannot send messages to any other node. What is the smallest number of queries you can make that is guaranteed to either find a black hole or determine that there is none?

85 Pablito’s Solitaire Pablito’s Solitaire is played with checkers on an infinite triangular board of hexagons, as shown in Figure 85.1. The hexagon at the top forms row 1 of the board. Row 2 has two hexagons, row 3 has three hexagons, and so on. To play the game, you place any finite number of pieces at or below some row 𝑅, and you jump and remove pieces as in checkers (a piece jumps over an occupied neighboring hexagon to an open hexagon, and the jumped piece is removed). The goal is to end with a single piece in the top cell. An example with 𝑅 = 4 is shown in Figure 85.2. What is the largest value of 𝑅 for which the goal can be achieved?

87. Web Site Analysis

39

Figure 85.1. The board for Pablito’s Solitaire. The board continues downward, with infinitely many rows.

Figure 85.2. An example of playing Pablito’s Solitaire, with 𝑅 = 4. This problem is due to Pablo Guerrero-García, Malaga, Spain.

86 Are the Coins Authentic? You have ten coins. You know that at least one is authentic, but some of them may be counterfeit. Counterfeit coins have a different weight than authentic coins, but all authentic coins have the same weight and all counterfeit have the same weight. Show how to use an equal-arm balance three times so that you can determine whether there are any counterfeit coins. Note that an equal-arm balance can be used to compare two collections of coins to determine whether they weigh the same amount and, if not, which collection is heavier, but it does not tell you how much either collection of coins weighs.

87 Web Site Analysis You have just launched a web site with a ton of traffic but very little money. You want to analyze your site’s users, but you can afford to store information for only 1000 users. Therefore you decide to sample users uniformly over the lifetime of the site. You do not know how many users will ultimately appear. All users up to the thousandth must be sampled, because there might not be more than 1000 users. But once that limit is surpassed you want to sample in

40

Chapter 7. Algorithms and Strategy

such a way that each of the 𝑛 users will have an equal probability of landing in the sample. You must make a one-time decision about whether or not to sample a user the moment he or she first visits the site. If you choose to include a new user in the sample, you must delete one user currently in the sample. Find a protocol that, assuming there are 𝑛 users in all, guarantees that each of the 𝑛 people has an equal probability of being in the final sample.

88 Find the Car, and the Car Key Behind three doors labeled 1, 2, 3 are randomly placed a car, a key, and a goat. Alice and Bob win the car if Alice finds the car and Bob finds the key. First Alice (with Bob not present) opens a door; if the car is not behind it she can open a second door. If she fails to find the car, they lose. If she does find the car, then all doors are closed and Bob gets to open one of the three doors in the hope of finding the key and, if not, trying again with a second door. Alice and Bob do not communicate except to make a plan beforehand. What is their best strategy?

89 Magic Coins You are arrested in a country with an unusual judicial system. After arriving at the prison you are given eight coins. You are told that four of them are magic, but to you they all look identical. Your jailers, however, can easily distinguish the magic coins from the others. Once each day, you may choose a subset of the eight coins. If your set contains exactly two magic coins, you will be immediately released. What is the smallest 𝑅 such that you can ensure you will be released in 𝑅 days?

90 Russian Cards Charlie has seven cards numbered 1, 2, 3, 4, 5, 6, 7 and randomly deals three to Alice and three to Bob (all face down), keeping the remaining card for himself. All three people can see the values of only the cards they hold. Show how Alice can make a public statement—one that she knows to be true—so that Bob can use it to learn her cards, but Charlie does not learn the location of any card except his own. Alice and Bob have not met prior to the deal, and so cannot have agreed on any sort of code. All three know the rules and the method of dealing the cards.

91. The Generous Automated Teller Machine

41

91 The Generous Automated Teller Machine You have 𝑛 boxes: 𝐵1 , 𝐵2 , . . . , 𝐵𝑛 . Initially, 𝐵1 contains one coin and the other boxes are empty. You may make moves of the following types: •

add𝑘 : Remove a coin from 𝐵𝑘 and add two coins to 𝐵𝑘+1 . This move is allowed only if 1 ≤ 𝑘 ≤ 𝑛 − 1 and 𝐵𝑘 is nonempty.

flip𝑘 : Remove a coin from 𝐵𝑘 and switch the contents of 𝐵𝑘+1 and 𝐵𝑘+2 . This move is allowed only if 1 ≤ 𝑘 ≤ 𝑛 − 2 and 𝐵𝑘 is nonempty.

For example, if 𝑛 = 4, then applying the moves add1 , add2 , add3 , and flip2 would give the following results (the lists of numbers give the number of coins in each box): (1, 0, 0, 0) ⟶ (0, 2, 0, 0) ⟶ (0, 1, 2, 0) ⟶ (0, 1, 1, 2) ⟶ (0, 0, 2, 1). add1

flip2

(a) If 𝑛 = 5, what is the largest number of coins you can get into the boxes by using these moves? (b) Suppose 𝑛 = 6. Show how to use these moves to get more than one million coins into the boxes. Can you get 10100 coins?

8 Miscellaneous 92 A Self-Descriptive Crossword Each entry in the crossword in Figure 92.1 describes the number of times that a particular letter appears in the completed grid. For example, if the grid had a single G, then one of the entries would be ONE␣G, with a space before G. Plurals are indicated by S, as in TWELVE␣ES. Spaces are counted here, so if there were 16 spaces, then one entry would be SIXTEEN␣␣S with two spaces after the word. There is a unique solution. Find it.

93 Serious Implications Complete the logical crossword puzzle in Figure 93.1 by placing either 𝑇 (True) or 𝐹 (False) into each square. Notation: ¬ means “not”; ∨ means “or”; ⇒ means “implies.” Each of the eight clues is a formula to be applied coordinatewise to the entire row or column. For example, the first clue indicates that the vector for 𝐚 is the negation of the vector for 𝐟, which would hold for, say, 𝐚 being 𝑇𝐹𝐹𝑇 and 𝐟 being 𝐹𝑇𝑇𝐹.

94 Hermione Granger and the Deadly Bottles Near the end of J. K. Rowling’s book Harry Potter and the Sorcerer’s Stone [108, p. 285], Harry Potter and Hermione Granger find themselves in a room with two doors. One door leads forward toward the Sorcerer’s Stone, and the other leads back to the room they have just left. Unfortunately, the door going forward is 43

44

Chapter 8. Miscellaneous

Figure 92.1. Each answer counts the number of times a certain letter (or space) appears in the completed grid. 𝐞 𝐚 𝐛 𝐜 𝐝

𝐟

𝐠

𝐡

ACROSS

DOWN

𝐚. 𝐛. 𝐜. 𝐝.

𝐞. 𝐞 ⇒ 𝐛 𝐟. ¬𝐜 𝐠. ¬(𝐠 ⇒ (¬𝐠)) 𝐡. ¬¬𝐡

¬𝐟 𝐛∨𝐛 𝐛⇒𝐜 𝐚 ∨ ¬𝐡

Figure 93.1. A logical crossword puzzle. blocked by black flames, and the door going back is blocked by purple flames. In the room there is a table with a row of seven bottles on it and the following note: Danger lies before you, while safety lies behind, Two of us will help you, whichever you would find, One among us seven will let you move ahead, Another will transport the drinker back instead, Two among our number hold only nettle wine, Three of us are killers, waiting hidden in line. Choose, unless you wish to stay here forevermore, To help you in your choice, we give you these clues four: First, however slyly the poison tries to hide You will always find some on nettle wine’s left side;

96. A Polynomial Scandal

45

Second, different are those who stand at either end, But if you would move onward, neither is your friend; Third, as you see clearly, all are different size, Neither dwarf nor giant holds death in their insides; Fourth, the second left and the second on the right Are twins once you taste them, though different at first sight. Hermione studies the note and the row of bottles and comes to a definite, and correct, conclusion about which bottle will carry them forward and which will allow them to go back. What is the position of the bottle that allows them to move back?

95 Forbidden Polynomials A permutation 𝑎 𝑏 𝑐 𝑑 of 1 2 3 4 is defined by polynomials if there are polynomials 𝑓1 , 𝑓2 , 𝑓3 , and 𝑓4 and a positive number 𝜖 such that: •

for −𝜖 < 𝑥 < 0, 𝑓1 (𝑥) < 𝑓2 (𝑥) < 𝑓3 (𝑥) < 𝑓4 (𝑥);

𝑓1 (0) = 𝑓2 (0) = 𝑓3 (0) = 𝑓4 (0);

for 0 < 𝑥 < 𝜖, 𝑓𝑎 (𝑥) < 𝑓𝑏 (𝑥) < 𝑓𝑐 (𝑥) < 𝑓𝑑 (𝑥).

For example, the reversing permutation 4 3 2 1 is defined by the polynomials 2𝑥, 𝑥, −𝑥, −2𝑥 (Figure 95.1). It comes as a surprise that not all of the 24 permutations of 1 2 3 4 can arise in this way. Which ones are forbidden?

Figure 95.1. These four linear functions reverse order as they pass through the origin.

96 A Polynomial Scandal Let 𝑓(𝑥, 𝑦) be a polynomial with real coefficients in the real variables 𝑥 and 𝑦. What are the possibilities for the range of 𝑓?

46

Chapter 8. Miscellaneous

97 Pascal’s Determinant Suppose that Pascal’s triangle is written as follows: 1 1 1 1 1 ⋮

1 1 1 1 2 3 4 5 3 6 10 15 4 10 20 35 5 15 35 70 ⋮ ⋮ ⋮ ⋮

... ... ... ... ...

The first row and column consist entirely of 1s, and every other number is the sum of the number to its left and the number above. For each positive integer 𝑛, let 𝑃𝑛 denote the matrix consisting of the first 𝑛 rows and columns of this array. What is the determinant of 𝑃𝑛 ?

98 Pains of Imperfect Glass Suppose that when light shines on a pane of glass, 70% of the light is transmitted through to the other side, 20% is reflected back, and the remaining 10% is absorbed by the glass. How much of an original light source will be transmitted through three panes of glass? (We assume there is no diffusion of the light.)

99 On the Highway Alice: I was driving along a divided highway recently for one hour at a constant and very special speed. Bob: What was special about it? Alice: The number of cars that I passed was the same as the number of cars that passed me! Bob: It seems as if your speed must have been the median of the speeds of the cars on the road. Alice: Or was it the mean? Bob: Those two are often confused. Maybe it was neither. Can you help Alice and Bob out? Was Alice’s speed the median, the mean, or neither? Assume that every car on the road was driving at a constant speed. Let 𝑆 be the set of all speeds of cars on the road, measured in miles per hour. Assume that 𝑆 is finite, and for each 𝑠 ∈ 𝑆, assume that 𝑠 is an integer and that the cars driving at speed 𝑠 were spaced uniformly, with 𝑑𝑠 cars per mile, where 𝑑𝑠 is also an integer. Because each mile looked the same as any other by the uniform spacing

103. Weight Loss Through Juggling

47

assumption, we can take the mean and median to refer to the set of cars in any one-mile segment of the road at some instant.

100 A Running Mystery Alice is telling Bob about her run. “I run 8 miles per hour on level ground and 6 miles per hour going uphill,” Alice tells Bob. Then she tells him how fast she runs downhill, and she continues: “Yesterday I went for a run. I ran for a while, then turned around and retraced my path to return home. Altogether, it took me 2 hours. How far did I run?” “Well, how much of your route was on level ground, how much was uphill, and how much was downhill?” asks Bob. “Don’t I need to know that to figure it out?” “No,” says Alice, “I’ve given you all the information you need.” Alice is right: she has given Bob all the information he needs. How fast does Alice run going downhill? And how far did she run?

101 The Star of This Problem is Addition Suppose that ∗ is a binary operation on real numbers and for all real numbers 𝑎, 𝑏, and 𝑐, (𝑎∗𝑏)∗𝑐 = 𝑎+𝑏+𝑐. Prove that for all real numbers 𝑎 and 𝑏, 𝑎∗𝑏 = 𝑎+𝑏.

102 Don’t Get Your Wires Crossed You have available the three basic logic gates, and, or, and not, and wish to build a circuit that allows two signals to cross while never exiting the rectangle as shown in Figure 102.1. This can easily be done by just using wires on the two diagonals. But can you do it with a circuit arrangement that is planar: wires never cross?

Figure 102.1. Show how to use and, or, and not gates to construct a circuit inside the rectangle that switches 𝐴 and 𝐵 with no crossing of wires.

103 Weight Loss Through Juggling You are driving a truck carrying 11 heavy rocks, all weighing the same amount. Each rock is mounted on one of 11 launchers. Each launcher can throw its rock

48

Chapter 8. Miscellaneous

straight up and then catch it again. When a launcher is activated, it pushes up on the rock for one second with a force equal to twice the weight of the rock. As a result, the rock is then airborne for two seconds (air resistance is ignored) and when the launcher catches the rock, it again pushes up on the rock with a force equal to twice the weight of the rock for one second to bring it back to rest. (Of course, when the launcher is idle, the force exerted by the launcher on the rock is equal to the weight of the rock.) By Newton’s third law, not only does the launcher push up on the rock, but the rock also pushes down on the launcher. If we say that this downward force of the rock on the launcher is the “effective weight” of the rock, then the result of activating a launcher is that the effective weight of the rock is twice its normal weight for one second, then zero for two seconds, and then twice its normal weight for one second before returning to its normal weight. Once a launcher has finished catching its rock, it can be triggered again. You come to a bridge that can support the truck, you, all the launchers, and 10 rocks, but not 11 rocks. Fortunately, it takes only two seconds for the truck to cross the bridge. One second before reaching the bridge, you activate one of the launchers. During the last second before you reach the bridge, the truck’s force on the road is increased by the weight of a rock, but you are not yet on the bridge so this load increase is no problem. During the two seconds when you are on the bridge, a rock is airborne so the load does not exceed the bridge’s limit and you make it to the other side. During the first second on the other side, the launcher catches the rock, causing another harmless increase in the load. You are pleased with your cleverness in getting across this bridge with all the rocks, until you see a sign warning you that another bridge is ahead. This bridge has the same weight limit as the last one, but is longer: it will take you six seconds to get across. How can you get everything across without exceeding the weight limit of the bridge?

104 Cantor Set Arithmetic Let 𝐶 be the Cantor set. True or False: 𝐶 + 𝐶 = [0, 2]. Details. •

𝐶 consists of the real numbers in [0, 1] having a base-3 expansion that uses only the digits 0 and 2.

Working in base 3, a number such as 0.2012222. . . is the same as 0.202, and so is in 𝐶. Similarly 0.2022222. . . is in 𝐶, even though it equals 0.21.

𝐶 + 𝐶 means {𝑥 + 𝑦 ∶ 𝑥, 𝑦 ∈ 𝐶}.

105. The Miracle of the Colliding Blocks

49

1010

1 L

1 L

R

1010 R

Figure 105.1. The first collision.

105 The Miracle of the Colliding Blocks Two blocks, 𝐿 and 𝑅, are resting on a frictionless surface, with 𝐿 to the left of 𝑅. To the left of 𝐿 there is a wall. The mass of 𝐿 is 1 gram, and the mass of 𝑅 is 1010 grams. Block 𝑅 is given a push and it begins sliding to the left. It collides with 𝐿, and this collision slows 𝑅 down slightly and causes 𝐿 to slide to the left, as illustrated in Figure 105.1. Block 𝐿 then bounces off the wall, slides to the right, and collides again with block 𝑅. Block 𝐿 will continue to bounce back and forth between 𝑅 and the wall many times. How many collisions will there be, counting both collisions between 𝐿 and the wall and collisions between 𝐿 and 𝑅? Assume that the blocks slide with no friction and that all collisions between the two blocks are perfectly elastic; in other words, both the total momentum and total kinetic energy of the two blocks are conserved. When 𝐿 collides with the wall, assume that it reverses direction but maintains the same speed.

Part 2

Solutions

1 Can a Bicycle Simulate a Unicycle? 1 Bicycle or Unicycle? 1.1 An Unbounded Unibike Path. We will say that a curve—a function from an interval to the plane—is smooth if it is continuously differentiable with derivative never equal to (0, 0) (derivatives are taken to be one-sided at the interval ends). If 𝑅⃑ is a smooth curve that represents the rear track of a bicycle and 𝐹 ⃑ the front, then, because the rear wheel always points to the place where the front wheel strikes the ground, the unit tangent vector to the rear path at time 𝑡 strikes the front path at the place where the front wheel is at time 𝑡. This leads ⃑ = 𝑅(𝑡) ⃑ + 𝑇(𝑡), ⃑ ⃑ is the unit tanto the fundamental front formula: 𝐹(𝑡) where 𝑇(𝑡) ′⃑ ′⃑ gent vector 𝑅 (𝑡)/‖𝑅 (𝑡)‖; see [82]. We will present a construction based on the method of David Finn [45] of a rear path 𝑅⃑ that is not a straight line and is such ⃑ + 1) = 𝐹(𝑡). ⃑ that, for 𝐹 ⃑ given by the front formula and for all 𝑡 ≥ 0, 𝑅(𝑡 This means that the rear wheel follows the front wheel’s path one time unit later; we will use the term unibike path for a curve 𝑅⃑ satisfying the preceding conditions. For more information on unibike paths see [13, 33, 48, 88, 98, 121]. Definition 1.1. A curve 𝑅,⃑ defined on an interval 𝐼 having length greater than 1 (and possibly infinite), is a unibike path if (1) 𝑅⃑ is smooth; ⃑ + 1) − 𝑅(𝑡) ⃑ is a unit vector, called 𝑇(𝑡); ⃑ (2) whenever 𝑡 and 𝑡 + 1 lie in 𝐼, 𝑅(𝑡 53

54

Chapter 1. Can a Bicycle Simulate a Unicycle?

⃑ (3) there is a positive function 𝑣(𝑡) such that, for all 𝑡, 𝑡 + 1 ∈ 𝐼, 𝑅⃑ ′ (𝑡) = 𝑣(𝑡)𝑇(𝑡); ′ ′ ⃑ ⃑ ⃑ this implies 𝑇(𝑡) = 𝑅 (𝑡)/‖𝑅 (𝑡)‖. The conditions that 𝑅⃑ ′ is never (0, 0) and 𝑣(𝑡) is always positive are included because we wish to focus on the usual motion of a bicycle: it moves only forward and never comes to a stop or travels backward. Note that an appropriately parametrized straight line is a unibike path. We will begin by defining a smooth curve 𝑅⃑ over [0, 11/10]. We will choose 𝑅⃑ ⃑ = 𝑅(𝑡 ⃑ + 1), where 𝐹 ⃑ is as above; thus the beginning so that, for 0 ≤ 𝑡 ≤ 1/10, 𝐹(𝑡) of the front wheel path overlaps with the end of the rear wheel path, making 𝑅⃑ a unibike path on the interval [0, 11/10]. We then treat the front path as an ⃑ + 1) = 𝐹(𝑡) ⃑ extension of the original rear path. In other words, we define 𝑅(𝑡 for 0 ≤ 𝑡 ≤ 11/10. If we can show that 𝐹 ⃑ is smooth, then 𝑅⃑ will be smooth over [0, 21/10] and we can use this extension of the rear path to extend the front path to [0, 21/10]. Our plan is to repeat this process to extend the rear path forever, a unit interval at a time, yielding an infinite unibike path. Unfortunately, as is evident from Lemma 1.3’s proof, in order to prove that 𝐹 ⃑ is differentiable, we will need to have 𝑅⃑ twice differentiable. But then in order to repeat the process we will need to have 𝐹 ⃑ twice differentiable and to prove this we will need 𝑅⃑ to be three times differentiable. This leads us to Finn’s strategy; we will define the original rear path 𝑅⃑ over [0, 11/10] to be infinitely smooth, where the term infinitely smooth refers to smooth functions that are infinitely differentiable. Define 𝑓 on [0, 11/10] as follows: ⎧0, 𝑓(𝑡) = 𝐶𝑒−1/((𝑡−1/10)(1−𝑡)) , ⎨ ⎩0,

if 0 ≤ 𝑡 ≤ 1/10, if 1/10 < 𝑡 < 1, if 1 ≤ 𝑡 ≤ 11/10.

By default we will take 𝐶 to be 1, but some of the diagrams are clearer when 𝐶 is a little larger, say 𝐶 = 4. Then 𝑓 is infinitely differentiable (Lemma 1.2; 𝑓 is not analytic because all derivatives at 1/10 are 0); the graph of 𝑓 is shown in ⃑ Figure 1.2. Let 𝑅(𝑡) = (𝑡, 𝑓(𝑡)) for 0 ≤ 𝑡 ≤ 11/10 be the rear path of a bicycle. ⃑ = (𝑡, 0) and 𝑇(𝑡) ⃑ = 𝑅⃑ ′ (𝑡) = (1, 0), so Notice that for 0 ≤ 𝑡 ≤ 1/10 we have 𝑅(𝑡) ⃑ = (𝑡 + 1, 0) = 𝑅(𝑡 ⃑ + 1). Thus 𝑅⃑ is an infinitely smooth unibike path on the 𝐹(𝑡) interval [0, 11/10]. The fact that 𝑓 is infinitely differentiable follows from the following lemma about the general form of the exponential formula that defines the bump in 𝑓. Lemma 1.2. If 𝑔(𝑡) = 𝑒−1/((𝑡−𝑎)(𝑏−𝑡)) for 𝑎 < 𝑡 < 𝑏, with 𝑔 taken to be 0 at 𝑎 and 𝑏, then all derivatives of 𝑔 vanish at 𝑡 = 𝑎 and 𝑡 = 𝑏.

1. Bicycle or Unicycle?

55

Figure 1.2. The graph of the nonanalytic function 𝑓 with 𝐶 = 1, the basic building block for a unibike path. Proof. Note that the derivatives are one-sided at 𝑎 and 𝑏. Work at the left end; the other case follows by reflection. A proof by induction using basic differentiation rules shows that, for 𝑛 ≥ 0 and 𝑎 < 𝑡 < 𝑏, 𝑔(𝑡)𝑃𝑛 (𝑡) 𝑔(𝑛) (𝑡) = , ((𝑡 − 𝑎)(𝑏 − 𝑡))2𝑛 where 𝑃𝑛 is a polynomial. To finish we prove by induction that for every 𝑛, 𝑔(𝑛) (𝑎) = 0. Assuming 𝑔(𝑛) (𝑎) = 0, we want 𝑔(𝑛+1) (𝑎) = 0, which reduces to 𝑔(𝑡)𝑃𝑛 (𝑡) 𝑔(𝑡)𝑃𝑛 (𝑡) 1 − 𝑔(𝑛) (𝑎)) = lim+ = 0. ( 2𝑛 𝑡→𝑎 𝑡 − 𝑎 ((𝑡 − 𝑎)(𝑏 − 𝑡)) 𝑡→𝑎 (𝑡 − 𝑎)2𝑛+1 (𝑏 − 𝑡)2𝑛 Rewrite the last limit as 𝑔(𝑡) lim (𝑏 − 𝑡)𝑃𝑛 (𝑡). 𝑡→𝑎+ ((𝑡 − 𝑎)(𝑏 − 𝑡))2𝑛+1 It suffices to show that 𝑔(𝑡) lim = 0. 𝑡→𝑎+ ((𝑡 − 𝑎)(𝑏 − 𝑡))2𝑛+1 lim+

To compute this limit, let 𝑢 = 1/((𝑡 − 𝑎)(𝑏 − 𝑡)), and rewrite the limit in terms of 𝑢: as 𝑡 → 𝑎+ , 𝑢 → ∞, so we can compute limᵆ→∞ 𝑢2𝑛+1 /𝑒ᵆ . This is 0 by 2𝑛 + 1 applications of l’Hôpital’s rule. Now it is a simple matter to use 𝑅⃑ to get a front path (shown in Figure 1.3), which we then take to be an extension of the rear path, which in turn can be used to get another front path, and so on to get a half-infinite, nonstraight unibike path. The technical details that this works in an infinitely smooth way are in the following lemma and theorem. Lemma 1.3. Suppose 𝑏 > 𝑎 + 1. Then any infinitely smooth unibike path on [𝑎, 𝑏] can be extended to an infinitely smooth unibike path on [𝑎, 𝑏 + 1].

56

Chapter 1. Can a Bicycle Simulate a Unicycle? 0.1 0 −0.1 0

1

2

Figure 1.3. A bicycle starts with rear tire at (0, 0) and front at (1, 0). The red rear track leads to a double bump on the corresponding front track. Here 𝐶 = 4. Proof. Let 𝑅⃑ 0 be the given path, and let 𝐹0⃑ be the corresponding front path. That is, the domain of 𝐹0⃑ is [𝑎, 𝑏] and for all 𝑡 ∈ [𝑎, 𝑏], 𝐹0⃑ (𝑡) = 𝑅⃑ 0 (𝑡) + 𝑇0⃑ (𝑡), where 𝑇0⃑ (𝑡) = 𝑅⃑ ′0 (𝑡)/‖𝑅⃑ ′0 (𝑡)‖. It is clear from the formula that 𝑇0⃑ is infinitely differentiable, and it follows that 𝐹0⃑ is as well. For smoothness we require 𝐹 ⃑′ (𝑡) ≠ (0, 0). ⃑ is a unit vector in the direction of 𝑅⃑ ′ (𝑡). The We have 𝐹 ⃑′ (𝑡) = 𝑅⃑ ′ (𝑡)+𝑇⃑ ′ (𝑡). But 𝑇(𝑡) ⃑ derivative of 𝑇 is therefore perpendicular to its direction (𝑇⃑ ⋅ 𝑇⃑ = 1 ⇒ 2𝑇⃑ ′ ⋅ 𝑇⃑ = 0 ⇒ 𝑅⃑ ′ ⋅𝑇⃑ ′ = 0 ⇒ 𝑅⃑ ′ ⟂ 𝑇⃑ ′ ) and Pythagoras yields ‖𝐹 ⃑′ (𝑡)‖2 = ‖𝑅⃑ ′ (𝑡)‖2 +‖𝑇⃑ ′ (𝑡)‖2 ≥ ‖𝑅⃑ ′ (𝑡)‖2 > 0. Define 𝑅⃑ 1 (𝑡) for 𝑡 ∈ [𝑎, 𝑏 + 1] as follows: 𝑅⃑ 1 (𝑡) = {

𝑅⃑ 0 (𝑡), 𝐹0⃑ (𝑡 − 1),

if 𝑎 ≤ 𝑡 ≤ 𝑏, if 𝑏 < 𝑡 ≤ 𝑏 + 1.

Because 𝑅⃑ 0 is a unibike path, for 𝑡 ∈ [𝑎 + 1, 𝑏] we have 𝑅⃑ 1 (𝑡) = 𝑅⃑ 0 (𝑡) = 𝑅⃑ 0 (𝑡 − 1) + 𝑇0⃑ (𝑡 − 1) = 𝐹0⃑ (𝑡 − 1). Thus 𝑅⃑ 1 (𝑡) agrees with 𝑅⃑ 0 (𝑡) for 𝑡 ∈ [𝑎, 𝑏] and it agrees with 𝐹0⃑ (𝑡 − 1) for 𝑡 ∈ [𝑎 + 1, 𝑏 + 1]; it agrees with both on the overlap [𝑎 + 1, 𝑏]. Since 𝑅⃑ 1 (𝑡) = 𝑅⃑ 0 (𝑡) for 𝑎 ≤ 𝑡 ≤ 𝑏 and 𝑅⃑ 0 is infinitely smooth on [𝑎, 𝑏], 𝑅⃑ 1 is infinitely smooth on [𝑎, 𝑏]. And since 𝑅⃑ 1 (𝑡) = 𝐹0⃑ (𝑡 − 1) for 𝑎 + 1 ≤ 𝑡 ≤ 𝑏 + 1 and 𝐹0⃑ is infinitely smooth on [𝑎, 𝑏], 𝑅⃑ 1 is infinitely smooth on [𝑎+1, 𝑏+1]. Therefore 𝑅⃑ 1 is infinitely smooth on [𝑎, 𝑏+1]. Because 𝑅⃑ 1 (𝑡) = 𝐹0⃑ (𝑡−1) for 𝑎+1 ≤ 𝑡 ≤ 𝑏+1, 𝑅⃑ 1 is a unibike path. Theorem 1.4. Suppose 𝑏 > 𝑎 + 1. Then any infinitely smooth unibike path on [𝑎, 𝑏] can be extended to an infinitely smooth unibike path on [𝑎, ∞). Proof. Let 𝑅⃑ 0 be as hypothesized. Use Lemma 1.3 to extend 𝑅⃑ 0 to 𝑅⃑ 1 on [𝑎, 𝑏 + 1]. Then apply the lemma again to extend to 𝑅⃑ 2 on [𝑎, 𝑏 + 2], and so on. Theorem 1.4 shows that the path 𝑅⃑ 0 defined by (𝑡, 𝑓(𝑡)), for any value of 𝐶, leads to an infinitely smooth unibike path on [0, ∞). Figure 1.4 shows the start of this half-infinite path with 𝐶 = 4.

1. Bicycle or Unicycle?

57

Figure 1.4. A path that could have been made by a bicycle or a unicycle; it starts with a small bump and gets more convoluted as it proceeds. The path shown has 𝑡 going from 0 to 5.1 and uses 𝐶 = 4; it is flat in an interval to the right of each integer point on the 𝑥-axis.

In the definition of a unibike path, the rear tire must follow the front track exactly. One can weaken the definition, asking only for a smooth curve that could be made by either a unicycle or a bicycle but not insisting that the rear tire go where the front tire has been. There then turns out to be an elegant closed-loop solution (Figure 1.5). This approach makes sense in the context of an ambiguous path, but there are reasons for taking the stricter approach regarding the rear path. Consider a snow bike where the front wheel is making a track in deep snow; one would want the rear wheel to follow exactly in that track and not have to make a new track in the snow. The definition we gave of unibike path is the one commonly considered by mathematicians, but the weaker one is also of interest. ⃑ = (2 − 𝑡2 , (15𝑡 − 10𝑡3 + 3𝑡5 )/8) To define the ambiguous closed loop, let 𝐺(𝑡) for −1 ≤ 𝑡 ≤ 1, a curve that is symmetric in the 𝑥-axis; this is the red arc in Figure 1.5. The 𝑥-coordinate is a simple function that goes from 1 to 2 and back to 1. The 𝑦-coordinate is a scalar multiple of ∫(𝑡 − 1)2 (𝑡 + 1)2 𝑑𝑡; so it is always

58

Chapter 1. Can a Bicycle Simulate a Unicycle?

Figure 1.5. A smooth path that can be made by a unicycle or by a bicycle. The points show where a curved piece of track meets a straight segment. increasing, but very flat at 𝑡 = ±1. The full oval is given by reflecting the curve defined by 𝐺⃑ in the origin and connecting the resulting two horseshoes by linear segments of length 2. That gives the rear track (inner oval in Figure 1.5). Add the unit tangent vectors to get the front track. A unicycle can follow this composite path by starting at (1, −1), riding along the inner oval, and then switching to the outer curve after returning to (1, −1). A bicyclist can make these tracks by starting with the front wheel at (1, −1) and the rear wheel at (0, −1) and steering the front wheel around the outer track. Another interesting example is the spiral given in polar coordinates by the equation 𝑟 = √𝜃/(2𝜋). As can be seen in Figure 1.6, if we take this curve to be the rear track of a bicycle, then the corresponding front track lands very close to the spiral, but slightly outside it. Thus, an appropriate parametrization of this curve is almost a unibike path. Indeed, it can be shown that, in a sense, the deviation of the spiral from being a unibike path decreases to 0 as we follow the spiral outward. We do not know if this curve can be modified to create a spiral unibike path.

1.2 A Doubly Inﬁnite Unibike Path. The unibike path of §1.1 leads immediately to the problem of finding such a path that is infinite in both directions. Our solution in §1.1 involved using the rear path to generate the front path, and then applying this process repeatedly to extend our initial unibike path defined on [0, 11/10] to a unibike path on [0, ∞). We show in this section that we can also go in the opposite direction: we can use the front path to generate the rear path, and then iterate this process to extend our previous solution from [0, ∞) to (−∞, ∞). Figures 1.7 and 1.8 show the result of this process.

1. Bicycle or Unicycle?

59

− − −

Figure 1.6. The polar square root spiral (blue) comes very close to being a unibike path. The yellow curve is the corresponding front track, which almost coincides with the rear track. The magnified view shows that the tracks do not coincide.

Figure 1.7. When the single-bump function (red) is viewed as being a front path, a differential equation solution yields the corresponding rear path.

Unfortunately, there is a complication that can arise in this process. If the front path curves too sharply, then the rear wheel may be forced to stop and reverse direction, leading to a cusp. For the unibike path of §1.1, this happens for 𝐶 larger than 73.04; Figure 1.9 illustrates this in the case 𝐶 = 150. To deal with this issue, we first liberalize the main definition to allow the rear wheel to stop or move in the opposite direction from the front wheel.

60

Chapter 1. Can a Bicycle Simulate a Unicycle?

Figure 1.8. The central part of a likely doubly infinite unibike path.

Figure 1.9. When the front wheel turns too sharply, as it does here at the top with 𝐶 = 150, the rear wheel can stop and reverse direction, causing cusps to form with velocity vector (0, 0) at those points. This rear path is not smooth. Cusps arise when 𝐶 > 73.04.

Definition 1.5. A curve 𝑅⃑ defined on an interval 𝐼 having length greater than 1 (and possibly infinite) is a weak unibike path if (1) 𝑅⃑ is continuously differentiable;

1. Bicycle or Unicycle?

61

⃑ + 1) − 𝑅(𝑡) ⃑ is a unit vector, called 𝑇(𝑡); ⃑ (2) whenever 𝑡 and 𝑡 + 1 lie in 𝐼, 𝑅(𝑡 ⃑ (3) there is a function 𝑣(𝑡) so that, for all 𝑡, 𝑡 + 1 ∈ 𝐼, 𝑅⃑ ′ (𝑡) = 𝑣(𝑡)𝑇(𝑡). A bicycle could be rolled along a weak unibike path so that if 𝑡, 𝑡 + 1 ∈ 𝐼, then ⃑ and the front wheel is at 𝑅(𝑡 ⃑ + 1), but it might at time 𝑡, the rear wheel is at 𝑅(𝑡) not be possible to ride it along the path in the usual forward-only way, because the tires might stop and reverse direction, creating cusps. Lemma 1.6. Suppose 𝑏 > 𝑎 + 1. Then any weak unibike path on [𝑎, 𝑏] can be extended to a weak unibike path on [𝑎 − 1, 𝑏]. Furthermore, if the original path is infinitely differentiable, then the extension is as well. Proof. Let 𝑅⃑ 0 be a weak unibike path on [𝑎, 𝑏]. Then for 𝑎 ≤ 𝑡 ≤ 𝑏 − 1, 𝑇0⃑ (𝑡) = 𝑅⃑ 0 (𝑡 + 1) − 𝑅⃑ 0 (𝑡) is a unit vector, and 𝑇0⃑ is continuously differentiable on [𝑎, 𝑏 − 1] (with one-sided derivatives at 𝑎 and 𝑏 − 1). If 𝑅⃑ 0 is infinitely differentiable, so is 𝑇0⃑ . Define 𝜃0 (𝑎) so that 𝑇0⃑ (𝑎) = (cos(𝜃0 (𝑎)), sin(𝜃0 (𝑎))), and then extend 𝜃0 to a continuous function on [𝑎, 𝑏 − 1] so that 𝑇0⃑ (𝑡) = (cos(𝜃0 (𝑡)), sin(𝜃0 (𝑡))). The angle 𝜃0 (𝑡) represents the angle of inclination of 𝑇0⃑ (𝑡) to the 𝑥-axis, which is the same as the angle of inclination of the frame of the bicycle at time 𝑡. If we write 𝑇0⃑ (𝑡) = (𝑇𝑥 (𝑡), 𝑇𝑦 (𝑡)), then [𝑎, 𝑏 − 1] can be covered by open intervals on each of which 𝜃0 (𝑡) can be written in one of the two forms tan−1 (𝑇𝑦 (𝑡)/𝑇𝑥 (𝑡)) + 𝜋𝑛 or cot−1 (𝑇𝑥 (𝑡)/𝑇𝑦 (𝑡)) + 𝜋𝑛, so 𝜃0 is continuously differentiable, and if 𝑅⃑ 0 is infinitely differentiable, then 𝜃0 is also. For 𝑎 ≤ 𝑡 ≤ 𝑏 − 1, 𝑅⃑ ′0 (𝑡) is a scalar multiple of 𝑇0⃑ (𝑡). Thus, if we let 𝑣0 (𝑡) = ′⃑ 𝑅0 (𝑡) ⋅ 𝑇0⃑ (𝑡), then 𝑅⃑ ′0 (𝑡) = 𝑣0 (𝑡)𝑇0⃑ (𝑡). Let 𝑁0⃑ (𝑡) = (− sin(𝜃0 (𝑡)), cos(𝜃0 (𝑡))); this is 𝑇0⃑ (𝑡) rotated 𝜋/2 counterclockwise, so it is a unit vector normal to the bicycle frame. Then 𝑁0⃑ is continuously differentiable, and infinitely differentiable if 𝑅⃑ 0 is. It will be helpful to observe that 𝑇0⃑ ′ (𝑡) = 𝜃0′ (𝑡)(− sin(𝜃0 (𝑡)), cos(𝜃0 (𝑡))) = 𝜃0′ (𝑡)𝑁0⃑ (𝑡) and 𝑁0⃑ ′ (𝑡) = 𝜃0′ (𝑡)(− cos(𝜃0 (𝑡)), − sin(𝜃0 (𝑡))) = −𝜃0′ (𝑡)𝑇0⃑ (𝑡). For 𝑎 ≤ 𝑡 ≤ 𝑏 − 1, the position of the front wheel at time 𝑡 is 𝑅⃑ 0 (𝑡 + 1) = 𝑅⃑ 0 (𝑡) + 𝑇0⃑ (𝑡), so the front wheel velocity is 𝑅⃑ ′0 (𝑡 + 1) = 𝑅⃑ ′0 (𝑡) + 𝑇0⃑ ′ (𝑡) = 𝑣0 (𝑡)𝑇0⃑ (𝑡) + 𝜃0′ (𝑡)𝑁0⃑ (𝑡). Thus, 𝑣0 (𝑡) and 𝜃0′ (𝑡) are the components of 𝑅⃑ ′0 (𝑡+1) that are parallel and perpendicular to the bicycle frame at time 𝑡. This makes intuitive sense: the component of the front wheel velocity in the direction of the bicycle frame is the velocity of the rear wheel, and the component normal to the bicycle frame tells you how fast the bicycle frame is rotating. Therefore we have 𝜃0′ (𝑡) = 𝑅⃑ ′0 (𝑡 + 1) ⋅ 𝑁0⃑ (𝑡).

62

Chapter 1. Can a Bicycle Simulate a Unicycle?

We can now use this differential equation to work backwards. For 𝑎 − 1 ≤ 𝑡 ≤ 𝑎 let 𝜃1 (𝑡) be determined by the differential equation 𝜃1′ (𝑡) = 𝑅⃑ ′0 (𝑡 + 1) ⋅ (− sin(𝜃1 (𝑡)), cos(𝜃1 (𝑡))),

𝜃1 (𝑎) = 𝜃0 (𝑎).

(1.1)

A proof that this differential equation has a solution on [𝑎 − 1, 𝑎] is given in §1.3. For 𝑎 < 𝑡 ≤ 𝑏−1 we let 𝜃1 (𝑡) = 𝜃0 (𝑡), so the domain of 𝜃1 is [𝑎−1, 𝑏−1] and 𝜃1 extends 𝜃0 . Of course, for 𝑎−1 ≤ 𝑡 ≤ 𝑏−1, we define 𝑇1⃑ (𝑡) = (cos(𝜃1 (𝑡)), sin(𝜃1 (𝑡))) and 𝑁1⃑ (𝑡) = (− sin(𝜃1 (𝑡)), cos(𝜃1 (𝑡))), so 𝑇1⃑ and 𝑁1⃑ extend 𝑇0⃑ and 𝑁0⃑ . Notice that the differential equation solution gives us only one-sided derivatives at 𝑎 − 1 and 𝑎, but the one-sided derivative at 𝑎 matches the derivative on the other side at 𝑎, namely 𝜃0′ (𝑎) = 𝑅⃑ ′0 (𝑎 + 1) ⋅ 𝑁0⃑ (𝑎) = 𝑅⃑ ′0 (𝑎 + 1) ⋅ 𝑁1⃑ (𝑎), so 𝜃1 is differentiable at 𝑎 and the equation 𝜃1′ (𝑡) = 𝑅⃑ ′0 (𝑡 + 1) ⋅ 𝑁1⃑ (𝑡) holds for all 𝑡 ∈ [𝑎 − 1, 𝑏 − 1]. This equation gives us only one continuous derivative of 𝜃1 , but if 𝑅⃑ 0 is infinitely differentiable, then the equation tells us that 𝜃1′ is differentiable, and 𝜃1″ (𝑡) = 𝑅⃑ ″0 (𝑡 + 1) ⋅ 𝑁1⃑ (𝑡) + 𝑅⃑ ′0 (𝑡 + 1) ⋅ 𝑁1⃑ ′ (𝑡) = 𝑅⃑ ″0 (𝑡 + 1) ⋅ 𝑁1⃑ (𝑡) − 𝜃1′ (𝑡)𝑅⃑ ′0 (𝑡 + 1) ⋅ 𝑇1⃑ (𝑡). This equation then tells us that 𝜃1″ is differentiable and allows us to determine 𝜃1‴ , and the reasoning can be repeated to see that if 𝑅⃑ 0 is infinitely differentiable, then so is 𝜃1 . Now that 𝜃0 has been extended to 𝜃1 , we can use 𝜃1 to extend the weak unibike path. Define 𝑅⃑ 1 (𝑡) for 𝑡 ∈ [𝑎 − 1, 𝑏] as follows: 𝑅⃑ (𝑡 + 1) − 𝑇1⃑ (𝑡), 𝑅⃑ 1 (𝑡) = { 0 𝑅⃑ 0 (𝑡),

if 𝑎 − 1 ≤ 𝑡 < 𝑎, if 𝑎 ≤ 𝑡 ≤ 𝑏.

Notice that for 𝑎 ≤ 𝑡 ≤ 𝑏 − 1, 𝑅⃑ 1 (𝑡) = 𝑅⃑ 0 (𝑡) = 𝑅⃑ 0 (𝑡 + 1) − 𝑇0⃑ (𝑡) = 𝑅⃑ 0 (𝑡 + 1) − 𝑇1⃑ (𝑡), so the equation 𝑅⃑ 1 (𝑡) = 𝑅⃑ 0 (𝑡 + 1) − 𝑇1⃑ (𝑡) holds for 𝑎 − 1 ≤ 𝑡 ≤ 𝑏 − 1. Therefore 𝑅⃑ 1 is continuously differentiable on [𝑎 − 1, 𝑏 − 1], and infinitely differentiable if 𝑅⃑ 0 is. But also 𝑅⃑ 1 agrees with 𝑅⃑ 0 on [𝑎, 𝑏], so 𝑅⃑ 1 is continuously differentiable on [𝑎, 𝑏], and infinitely differentiable if 𝑅⃑ 0 is. Combining these facts, we conclude that 𝑅⃑ 1 is continuously differentiable on its entire domain [𝑎−1, 𝑏], and infinitely differentiable if 𝑅⃑ 0 is. Also, for 𝑎 − 1 ≤ 𝑡 ≤ 𝑏 − 1, 𝑇1⃑ (𝑡) = 𝑅⃑ 0 (𝑡 + 1) − 𝑅⃑ 1 (𝑡) = 𝑅⃑ 1 (𝑡 + 1) − 𝑅⃑ 1 (𝑡). Finally, for 𝑎 − 1 ≤ 𝑡 ≤ 𝑏 − 1 we have 𝑅⃑ ′1 (𝑡) ⋅ 𝑁1⃑ (𝑡) = (𝑅⃑ ′0 (𝑡 + 1) − 𝑇1⃑ ′ (𝑡)) ⋅ 𝑁1⃑ (𝑡) = 𝑅⃑ ′0 (𝑡 + 1) ⋅ 𝑁1⃑ (𝑡) − 𝜃1′ (𝑡)𝑁1⃑ (𝑡) ⋅ 𝑁1⃑ (𝑡) = 𝜃1′ (𝑡) − 𝜃1′ (𝑡) = 0. Thus 𝑅⃑ ′1 (𝑡) is perpendicular to 𝑁1⃑ (𝑡), so it is a scalar multiple of 𝑇1⃑ (𝑡), as required for a weak unibike path. This completes the proof.

1. Bicycle or Unicycle?

63

Theorem 1.7. Suppose 𝑏 > 𝑎 + 1. Then any weak unibike path on [𝑎, 𝑏] can be extended to a weak unibike path on (−∞, 𝑏]. Furthermore, if the original path is infinitely differentiable, then the extension is as well. Proof. Apply Lemma 1.6 repeatedly, as in the forward extension theorem (Theorem 1.4). Now let 𝑅⃑ 0 (𝑡) = (𝑡, 𝑓(𝑡)) be defined for 0 ≤ 𝑡 ≤ 11/10 as in §1.1. Use Theorems 1.4 and 1.7 to extend it to an infinitely differentiable 𝑅⃑ defined on (−∞, ∞). This will be a unibike path for positive 𝑡 and a weak unibike path for negative 𝑡 (Figure 1.8). We will next show that, if 0 ≤ 𝐶 ≤ 4, then 𝑅⃑ is in fact a unibike path for the entire domain. ⃑ = 𝑅(𝑡 ⃑ + 1) − 𝑅(𝑡), ⃑ Let 𝑇(𝑡) a unit vector and an infinitely differentiable func′ ⃑ ⃑ tion. For 𝑡 ≥ 0, 𝑇(𝑡) = 𝑅 (𝑡)/‖𝑅⃑ ′ (𝑡)‖. For 0 ≤ 𝑡 ≤ 1, let 𝜃(𝑡) = tan−1 (𝑓′ (𝑡)); then 𝑅⃑ ′ (𝑡) = (1, 𝑓′ (𝑡)) = (1, tan(𝜃(𝑡))) = sec(𝜃(𝑡))(cos(𝜃(𝑡)), sin(𝜃(𝑡))). By the definition of inverse tangent, −𝜋/2 < 𝜃 < 𝜋/2, so sec(𝜃(𝑡)) > 0 and there⃑ fore ‖𝑅⃑ ′ (𝑡)‖ = sec(𝜃(𝑡)) and 𝑇(𝑡) = (cos(𝜃(𝑡)), sin(𝜃(𝑡))). Now extend 𝜃 to be ⃑ = (cos(𝜃(𝑡)), sin(𝜃(𝑡))). a continuous function on (−∞, ∞) so that for all 𝑡, 𝑇(𝑡) As in the proof of Lemma 1.6, we can show that 𝜃 is infinitely differentiable. Let ⃑ = (− sin(𝜃(𝑡)), cos(𝜃(𝑡))) and 𝑣(𝑡) = 𝑅⃑ ′ (𝑡) ⋅ 𝑇(𝑡). ⃑ 𝑁(𝑡) Then since 𝑅⃑ ′ (𝑡) is a scalar ′ ′ ⃑ ⃑ and therefore ‖𝑅⃑ (𝑡)‖ = |𝑣(𝑡)|. multiple of 𝑇(𝑡), 𝑅⃑ (𝑡) = 𝑣(𝑡)𝑇(𝑡) Our goal now is to show that for 0 ≤ 𝐶 ≤ 4, 𝑣(𝑡) is always positive (Figure 1.9 shows that 𝑣 can be negative on an interval for large 𝐶). This will show that 𝑅⃑ ′ (𝑡) ⃑ and therefore not (0, 0), which proves that is always a positive multiple of 𝑇(𝑡) 𝑅⃑ is a unibike path on (−∞, ∞). If, as seems likely, this conclusion holds for 𝐶 = 60, then the path shown in Figure 1.8 is a doubly infinite unibike path (has no cusps). To do this, we define 𝜂(𝑡) = 𝜃(𝑡+1)−𝜃(𝑡). Since 𝜃(𝑡) is the angle of inclination of the bicycle frame at time 𝑡, and 𝜃(𝑡+1) is the angle of inclination of the velocity vector of the front wheel at time 𝑡, 𝜂(𝑡) is the angle by which the handlebars have been turned—positive for a left turn and negative for a right turn. A crucial observation is: ⃑ = (𝑅⃑ ′ (𝑡 + 1) − 𝑇⃑ ′ (𝑡)) ⋅ 𝑇(𝑡) ⃑ 𝑣(𝑡) = 𝑅⃑ ′ (𝑡) ⋅ 𝑇(𝑡) ⃑ + 1) − 𝜃′ (𝑡)𝑁(𝑡)) ⃑ ⃑ = 𝑣(𝑡 + 1)𝑇(𝑡 ⃑ + 1) ⋅ 𝑇(𝑡). ⃑ = (𝑣(𝑡 + 1)𝑇(𝑡 ⋅ 𝑇(𝑡) ⃑ ⃑ = cos(𝜂(𝑡)), which can be seen either geometrically by observing But 𝑇(𝑡+1)⋅ 𝑇(𝑡) that the dot product of unit vectors gives the cosine of the angle between them, or algebraically by writing out the dot product and using the formula for the cosine of a difference of angles. So we have 𝑣(𝑡) = 𝑣(𝑡 + 1) cos(𝜂(𝑡)). We already know

64

Chapter 1. Can a Bicycle Simulate a Unicycle?

that 𝑣(𝑡) is positive for 𝑡 ≥ 0, because 𝑅⃑ is a unibike path on [0, ∞). The only way it can become negative as 𝑡 decreases is if cos(𝜂(𝑡)) becomes negative, which would mean that the handlebars have been turned more than 𝜋/2. We will show this is impossible by showing that for 𝑡 ≤ 0, we have |𝜂(𝑡)| < 𝜋/2. By the definition of 𝜂 and the mean value theorem, we have 𝜂(𝑡) = 𝜃(𝑡 + 1) − 𝜃(𝑡) = 𝜃′ (𝑐𝑡 ) for some 𝑐𝑡 ∈ (𝑡, 𝑡 + 1). Thus we can bound |𝜂(𝑡)| for 𝑡 ≤ 0 by bounding |𝜃′ (𝑡)| for 𝑡 ≤ 1. For 0 ≤ 𝑡 ≤ 1, 𝜃(𝑡) = tan−1 (𝑓′ (𝑡)), so 𝜃′ (𝑡) = 𝑓″ (𝑡)/(1 + 𝑓′ (𝑡)2 ). Standard calculus (there are three critical points of 𝑓″ (𝑡)) shows that the maximum value of |𝑓″ (𝑡)| for 0 ≤ 𝑡 ≤ 1 occurs at 𝑡 = 11/20 and is just under 0.35𝐶. Thus, for 0 ≤ 𝑡 ≤ 1 and 0 ≤ 𝐶 ≤ 4, we have |𝑓″ (𝑡)| ≤ |𝑓″ (𝑡)| ≤ 1.4 < 𝜋/2. 1 + 𝑓′ (𝑡)2 It remains to bound |𝜃′ (𝑡)| for 𝑡 < 0. Let 𝑉 be the maximum value of |𝑣(𝑡)| for 0 ≤ 𝑡 ≤ 1. Calculation shows that 𝑉 ≤ √1 + 0.0013𝐶 2 ; for 𝐶 = 4 this is about ⃑ + 𝜃′ (𝑡)𝑁(𝑡), ⃑ 1.01035. For all 𝑡 we have 𝑅⃑ ′ (𝑡 + 1) = 𝑅⃑ ′ (𝑡) + 𝑇⃑ ′ (𝑡) = 𝑣(𝑡)𝑇(𝑡) so ′⃑ ′ |𝑣(𝑡 + 1)| = ‖𝑅 (𝑡 + 1)‖ = √𝑣(𝑡)2 + 𝜃′ (𝑡)2 . Thus |𝑣(𝑡)| ≤ |𝑣(𝑡 + 1)| and |𝜃 (𝑡)| ≤ |𝑣(𝑡 + 1)|. Applying this for −1 ≤ 𝑡 ≤ 0 we get |𝑣(𝑡)| ≤ 𝑉 and |𝜃′ (𝑡)| ≤ 𝑉. But then, restricting to 𝐶 ≤ 4 and repeating for each unit interval we find that for all 𝑡 ≤ 0, |𝜃′ (𝑡)| ≤ 𝑉 ≤ 1.02 < 𝜋/2. Thus for all 𝑡 ≤ 0, |𝜂(𝑡)| = |𝜃′ (𝑐𝑡 )| < 𝜋/2, as required. This proves the following theorem, which is apparently true for 𝐶 ≤ 73, but the proof used 𝐶 ≤ 4. |𝜃′ (𝑡)| =

Theorem 1.8. If 0 < 𝐶 ≤ 4, the doubly infinite path arising from the seed function 𝑓 of §1.1 is an infinitely smooth, nonstraight unibike path.

1.3 Solving the Differential Equation. In this section we will show that the differential equation (1.1) in the proof of Lemma 1.6 has a solution defined on the interval [𝑎 − 1, 𝑎]. This follows from the next theorem. Theorem 1.9. Suppose 𝐺⃑ ∶ [𝑎 − 1, 𝑎] → ℝ2 is continuous and 𝜃0 is a real number. Then the initial-value problem 𝜃′ (𝑡) = 𝐹(𝑡, 𝜃(𝑡)),

𝜃(𝑎) = 𝜃0 ,

(1.2)

⃑ ⋅ (− sin 𝜃, cos 𝜃), has a solution that is defined on the interval where 𝐹(𝑡, 𝜃) = 𝐺(𝑡) [𝑎 − 1, 𝑎]. Proof. We will show that the method of Picard iteration can be used to construct a solution to (1.2), leaving some details to the reader. We can rewrite (1.2) in the integral form 𝑎

𝜃(𝑡) = 𝜃0 − ∫ 𝐹(𝑢, 𝜃(𝑢)) 𝑑𝑢, 𝑡

𝑎 − 1 ≤ 𝑡 ≤ 𝑎.

(1.3)

1. Bicycle or Unicycle?

65

By the fundamental theorem of calculus, a continuous solution to (1.3) will also solve (1.2). We will need some properties of 𝐹. Because 𝐺⃑ is continuous on [𝑎 − 1, 𝑎], ⃑ we can let 𝑀 be the maximum value of ‖𝐺(𝑡)‖ for 𝑎 − 1 ≤ 𝑡 ≤ 𝑎. Then for all 𝑡 ∈ [𝑎 − 1, 𝑎] and all 𝜃, ⃑ ⋅ (− sin 𝜃, cos 𝜃)| ≤ ‖𝐺(𝑡)‖‖(− ⃑ |𝐹(𝑡, 𝜃)| = |𝐺(𝑡) sin 𝜃, cos 𝜃)‖ ≤ 𝑀

(1.4)

and |𝜕 | ⃑ ⋅ (− cos 𝜃, − sin 𝜃)| ≤ ‖𝐺(𝑡)‖‖(− ⃑ | 𝐹(𝑡, 𝜃)| = |𝐺(𝑡) cos 𝜃, − sin 𝜃)‖ ≤ 𝑀. (1.5) | | 𝜕𝜃 By the mean value theorem, it follows from (1.5) that for all 𝛼1 and 𝛼2 , |𝐹(𝑡, 𝛼1 ) − 𝐹(𝑡, 𝛼2 )| ≤ 𝑀|𝛼1 − 𝛼2 |.

(1.6)

Equation (1.6) says that 𝐹(𝑡, 𝜃) is a Lipschitz continuous function of 𝜃. We now define a sequence of approximate solutions to (1.3). Let 𝛼0 be the constant function on the interval [𝑎 − 1, 𝑎] with value 𝜃0 , and given 𝛼𝑖 , let 𝑎

𝛼𝑖+1 (𝑡) = 𝜃0 − ∫ 𝐹(𝑢, 𝛼𝑖 (𝑢)) 𝑑𝑢,

𝑎 − 1 ≤ 𝑡 ≤ 𝑎.

𝑡

Clearly all of these functions are continuous. We will show that they converge uniformly on [𝑎 − 1, 𝑎] to a continuous solution of (1.3). Note that for every positive integer 𝑁, 𝑁

𝛼𝑁 (𝑡) = 𝛼0 (𝑡) + ∑ (𝛼𝑖 (𝑡) − 𝛼𝑖−1 (𝑡)).

(1.7)

𝑖=1

It is easy to verify by induction, using (1.4) and (1.6), that for every positive integer 𝑖 and every 𝑡 ∈ [𝑎 − 1, 𝑎], |𝛼𝑖 (𝑡) − 𝛼𝑖−1 (𝑡)| ≤

𝑀 𝑖 (𝑎 − 𝑡)𝑖 , 𝑖!

which implies that |𝛼𝑖 (𝑡) − 𝛼𝑖−1 (𝑡)| ≤

𝑀𝑖 . 𝑖!

Because ∑𝑖=1 𝑀 𝑖 /𝑖! converges, the Weierstrass 𝑀-test yields that the series ∞

∑ (𝛼𝑖 (𝑡) − 𝛼𝑖−1 (𝑡)) 𝑖=1

converges uniformly on [𝑎 − 1, 𝑎]. It follows by (1.7) that 𝛼𝑁 (𝑡) converges uniformly to a continuous function 𝛼(𝑡) on [𝑎 − 1, 𝑎] as 𝑁 → ∞.

66

Chapter 1. Can a Bicycle Simulate a Unicycle?

Finally, we verify that 𝛼 is a solution to (1.3). By (1.6) 𝐹(𝑢, 𝛼𝑁 (𝑢)) converges uniformly to 𝐹(𝑢, 𝛼(𝑢)) on [𝑎 − 1, 𝑎], and therefore 𝑎

𝛼(𝑡) = lim 𝛼𝑁+1 (𝑡) = 𝜃0 − lim ∫ 𝐹(𝑢, 𝛼𝑁 (𝑢)) 𝑑𝑢 𝑁→∞

𝑁→∞

𝑡

𝑎

= 𝜃0 − ∫ lim 𝐹(𝑢, 𝛼𝑁 (𝑢)) 𝑑𝑢 𝑁→∞

𝑡 𝑎

= 𝜃0 − ∫ 𝐹(𝑢, 𝛼(𝑢)) 𝑑𝑢. 𝑡

1.4 Acknowledgments. We are grateful to Bob Bixler, Michael Elgersma, David Finn, and Serge Tabachnikov for many helpful comments on the unibike problem.

2 Geometry 2 Trisecting to Beneﬁt Society If the rectangle is 𝐴𝐵𝐶𝐷, fold the diagonal to get line 𝐴𝐶 (see Figure 2.1). Then fold 𝐵 to 𝐶 to get 𝑀, the point bisecting 𝐵𝐶. Fold to get the line 𝐷𝑀 and let 𝐸 be the intersection point of 𝐷𝑀 and 𝐴𝐶. Repeat starting with the other diagonal to get 𝐹; the line 𝐸𝐹 then trisects the paper. Alternatively, fold the paper along a line perpendicular to 𝐵𝐶 that passes through 𝐸; that line is a trisector. To prove that 𝐸𝐹 trisects, let 𝐺 and 𝐻 be the ends of line 𝐸𝐹 on the paper; then △𝐴𝐸𝐷 is similar to △𝐶𝐸𝑀; |𝐴𝐷| = 2|𝐶𝑀|, so |𝐴𝐸| = 2|𝐶𝐸|; △𝐴𝐸𝐻 is similar to △𝐶𝐸𝐺; |𝐸𝐻| = 2|𝐸𝐺|; and |𝐴𝐻| = 2|𝐶𝐺|. So both the horizontal and vertical lines through 𝐸 are trisectors. This solution is due to Macalester College student David Castro.

3 Ten Bottles of Wine The distance between the centers of any two tangent circles in Figure 3.2 is equal to the diameter of the circles. Therefore triangles 𝐴𝐵𝐸, 𝐵𝐶𝐹, and 𝐶𝐷𝐺 are isosceles. Let their base angles be 𝛼, 𝛽, and 𝛾, respectively. The quadrilateral 𝐵𝐸𝐻𝐹 is a rhombus, and therefore 𝐸𝐻 is parallel to 𝐵𝐹. Thus, the angle of inclination of 𝐸𝐻 (that is, its angle with a horizontal line) is 𝛽. Similarly, 𝐶𝐹𝐼𝐺 and 𝐹𝐻𝐽𝐼 are rhombi, so 𝐻𝐽 is parallel to 𝐶𝐺 and its angle of inclination is 𝛾. And a similar argument shows that the angles of inclination of 𝐷𝐺, 𝐺𝐼, and 𝐼𝐽 are 𝛾, 𝛽, and 𝛼, respectively. It follows that the horizontal distances from 𝐴 to 𝐽 and 𝐷 to 𝐽 are the same. Indeed, they are both 𝑑(cos 𝛼 + cos 𝛽 + cos 𝛾), where 𝑑 is the common diameter of the circles. Thus, the top bottle is centered horizontally in the bin. This problem is due to Adam Brown [16]. 67

68

Chapter 2. Geometry 















Figure 2.1. How to fold a piece of paper into thirds.

J

I

H

G

E F

A

α

α

β B

γ

β C

γ D

Figure 3.2. Connecting the centers of the wine bottles creates isosceles triangles and rhombi.

4 Into the Woods Because the signpost can be assumed to give the shortest distance to the road, the road lies along a tangent to the circle. Center the circle at the origin 𝑂, let 𝑃 = (0, 1), and let 𝑄 = (𝑥, 1), a point due east of 𝑃. Go from 𝑂 to 𝑄 and then turn right and follow a line to make a tangency at 𝐴. Continue clockwise along the circle to (−1, 0) and finish with a straight line to (−1, 1); see Figure 4.1(a). This path intersects all tangents to the circle. If 𝜃 is ∠𝑃𝑂𝑄, then 𝜃 = tan−1 𝑥,

5. The Attraction of the Golden Ratio

69

Figure 4.1. (a) A 4-stage method that will always find the road. (b) The shortest beam-detecting curve is a horseshoe shape of length 𝜋 + 2.

|𝑂𝑄| = √𝑥2 + 1, and the length of the path is √𝑥2 + 1 + 𝑥 + 3𝜋/2 − 2 tan−1 𝑥 + 1, an expression that is easily minimized by calculus. This yields that for this family of algorithms, the best choice is 𝑥 = 1/√3, for which 𝜃 = 𝜋/6 and the total length is 1 + √3 + 7𝜋/6, or 6.3972. . . miles. It is very likely that this is the shortest path that starts at 𝑂 and strikes all tangent lines, but no proof of this is known. The curve just given, for any positive value of 𝑥, strikes every tangent and it is easy to see that it therefore strikes every doubly infinite line that crosses the circle. The beam-detection problem asks for the shortest curve that strikes every such line meeting the circle. The solution to this problem arises by setting 𝑥 to 1 and ignoring the initial line to 𝑄; this yields the simple horseshoe shape in Figure 4.1(b); its length is 𝜋 + 2 and, more important, this curve has been proved to be the shortest curve that strikes all lines ([43]; see also [44, §8.11]). An unsolved problem concerns the shortest beam detector consisting of finitely many paths [42]. Some have conjectured that this shortest length—the beamsplitter constant—arises from three pieces (see [42]) and is 4.79989. . ..

5 The Attraction of the Golden Ratio There are no such numbers. Suppose 0 < 𝑎 ≤ 𝑏 and let 𝑟 = 𝑏/𝑎. Then (𝑎+𝑏)/𝑏 = (𝑎/𝑏) + 1 = (1/𝑟) + 1, and we want to compare |𝜙 − 𝑟| to |𝜙 − ((1/𝑟) + 1)|. But 𝜙 satisfies 𝜙 = (1/𝜙) + 1, so: ||𝜙 − ( 1 + 1)|| = ||( 1 + 1) − ( 1 + 1)|| = || 1 − 1 || = |𝜙 − 𝑟| < |𝜙 − 𝑟| | | | 𝜙 | |𝜙 𝑟 | 𝑟 𝑟 𝑟𝜙 because 𝜙 > 1 and 𝑟 ≥ 1.

70

Chapter 2. Geometry

Figure 5.1. Starting with a 1 × 3 rectangle (bottom left) and repeatedly adding squares to the long side leads quickly to the golden rectangle. The rectangle made up of the original one plus five squares has dimensions 29 × 18, and so has aspect ratio about 1.611; this differs from the golden ratio by less than 0.007. A familiar construction is to start with a rectangle of width 𝑎 and height 𝑏 (𝑏 ≥ 𝑎, where 𝑎 and 𝑏 are positive integers) and then cut an 𝑎 × 𝑎 square out of the rectangle. If this process is repeated until one side is 0, then the last nonzero side is the greatest common divisor of 𝑎 and 𝑏; this is the venerable Euclidean algorithm. But what if we go in the opposite direction? Start with an 𝑎 × 𝑏 rectangle (again, 𝑏 ≥ 𝑎) and add a 𝑏-square to the 𝑏-side to get an (𝑎 + 𝑏) × 𝑏 rectangle. When this operation is repeated (see Figure 5.1), the limiting shape is a golden rectangle (aspect ratio is the golden ratio 𝜙). This problem asks whether the convergence is monotone; the answer is yes, and the convergence is very fast. The golden ratio has been much studied, with many claims that it appears naturally in diverse contexts from art to architecture to biology. John Putz [103] observes that the phenomenon of this problem can lead to an incorrect conclusion about the golden ratio, his point being that, given data, if one looks at (𝑎 + 𝑏)/𝑏 instead of 𝑏/𝑎, then for purely mathematical reasons the results will be biased towards the golden ratio.

6 Reﬂect on This We will choose our unit of length so that the segments 𝐴𝐷 and 𝐶𝐸 have length 1. Draw two circles centered at the origin in the plane with radii 1 and 2. Then draw 360 radial line segments from the origin to the outer circle, spaced at 1∘ intervals, starting with a segment lying along the positive 𝑥-axis. See Figure 6.3, where as before we have used 10∘ angles, so there are only 36 segments rather than 360. We have drawn the part of each radial segment inside the inner circle as a dashed

6. Reﬂect on This

71

y

3 2 1 x

Figure 6.3. A circle of mirrors. line segment and the part between the two circles as a solid line segment. Any two adjacent solid line segments can be thought of as our pair of mirrors. Now consider a light ray crossing the outer circle between two mirrors, reflecting off these mirrors repeatedly, and then crossing into the interior of the inner circle and missing the next reflection by crossing a dashed segment. At each reflection in a mirror, the reflected ray is the mirror image of a ray that goes through the mirror and continues in a straight line. Thus, in Figure 6.3, the solid red segment is the reflection of the dashed red segment in mirror 1, the solid green segment is the reflection of the dashed green segment in first mirror 2 and then mirror 1, and so on. It follows that if we draw a ray extending the original light ray in a straight line, then the number of mirror reflections is equal to the number of solid radial line segments the ray crosses before crossing the inner circle and then crossing a dashed segment. We can therefore rephrase our question as follows: If a ray crosses from outside the outer circle to inside the inner circle and then crosses a dashed segment, what is the maximum number of solid radial line segments it can cross along the way? Consider a horizontal ray entering the outer circle from the right along the line 𝑦 = 𝑐, where sin 89∘ < 𝑐 < 1. It is not hard to see that this ray will cross all of the solid segments lying along radii that make angles with the positive 𝑥axis from 30∘ to 89∘ . It will then cross the inner circle and intersect the dashed segment lying along the positive 𝑦-axis. This ray crosses 60 solid radial segments, showing that it is possible to achieve 60 reflections.

72

Chapter 2. Geometry

P Q 2 1 60° O

Figure 6.4. A light ray tangent to the inner circle. However, it is not possible to achieve more than 60 reflections. To see why, consider a ray that crosses the outer circle at 𝑃 and is tangent to the inner circle at 𝑄, as in Figure 6.4. Let 𝑂 be the origin. Then |𝑂𝑄| = 1, |𝑂𝑃| = 2, and ∠𝑂𝑄𝑃 is a right angle, and therefore ∠𝑃𝑂𝑄 = 60∘ . It follows that if a ray crosses the outer circle at 𝑃 and then crosses into the interior of the inner circle at a point 𝑄′ , then ∠𝑃𝑂𝑄′ must be less than 60∘ . The solid radial segments that are crossed by ⃗ and 𝑂𝑄 ⃗′ , and since ∠𝑃𝑂𝑄′ < 60∘ , there the segment 𝑃𝑄′ lie between the rays 𝑂𝑃 cannot be more than 60 such radial segments. Therefore it is not possible to have more than 60 reflections. This problem appears in [24].

7 Skewed Pizza We first verify that each cut is divided into equal segments by the cuts in the other direction. To do this, we use vector methods to solve for the intersection points of the cuts. We identify each point in the plane with the vector from the origin to the point. We place one corner of the pizza at the origin, and let the other three corners be 𝑢,⃑ 𝑣,⃑ and 𝑤,⃑ as in Figure 7.2 For 1 ≤ 𝑖 ≤ 𝑛 − 1 there is a cut through the pizza from (𝑖/𝑛)𝑢⃑ to 𝑤⃑ + (𝑖/𝑛)(𝑣 ⃑ − 𝑤). ⃑ This cut lies along the line given parametrically by the function 𝑖 𝑖 𝑖 𝑖 𝑡𝑖 𝑓𝑖⃑ (𝑡) = 𝑢⃑ + 𝑡 (𝑤⃑ + (𝑣 ⃑ − 𝑤)⃑ − 𝑢)⃑ = 𝑢⃑ + 𝑡𝑤⃑ + 𝑑,⃑ 𝑛 𝑛 𝑛 𝑛 𝑛 where 𝑑 ⃑ = 𝑣 ⃑ − 𝑢⃑ − 𝑤.⃑ The functions 𝑓0⃑ and 𝑓𝑛⃑ give two opposite sides of the pizza. Similarly, the cuts in the other direction and the other two sides are given

7. Skewed Pizza

73

Figure 7.2. Representing the corners of the pizza as vectors. parametrically by the functions 𝑔𝑗⃑ (𝑡) =

𝑗 𝑗 𝑗 𝑗 𝑡𝑗 𝑤⃑ + 𝑡 (𝑢⃑ + (𝑣 ⃑ − 𝑢)⃑ − 𝑤) ⃑ = 𝑡𝑢⃑ + 𝑤⃑ + 𝑑 ⃑ 𝑛 𝑛 𝑛 𝑛 𝑛

for 0 ≤ 𝑗 ≤ 𝑛. The lines given by 𝑓𝑖⃑ and 𝑔𝑗⃑ intersect at the point 𝑗 𝑖𝑗 𝑖 𝑖 ⃑ 𝑗 𝑝 ⃑ 𝑢⃑ + 𝑤⃑ + 2 𝑑.⃑ 𝑖,𝑗 = 𝑓𝑖 ( ) = 𝑔𝑗⃑ ( ) = 𝑛 𝑛 𝑛 𝑛 𝑛 These points are the corners of the pieces of pizza. Notice that for fixed 𝑖, the ⃑ points 𝑝 ⃑ 𝑖,𝑗 are evenly spaced along the line given by 𝑓𝑖 , and for fixed 𝑗, the points 𝑝 ⃑ 𝑖,𝑗 are evenly spaced along the line given by 𝑔𝑗⃑ . In other words, as stated earlier, each cut is divided into equal segments by the cuts in the other direction. We are now ready to solve the two parts of the problem. (a) If 𝑛 is even, then we can divide the pizza into disjoint 2×2 subgrids of pizza pieces. Consider one such 2 × 2 subgrid, as shown in Figure 7.3. Because each cut is divided into equal segments by the cuts in the other direction, the segments 𝐴𝐵 and 𝐵𝐶 in the figure are the same length. Therefore Δ𝐴𝐵𝑃 and △𝐵𝐶𝑃 have the same base and altitude, so they have the same area, say 𝑎. Similarly, the other triangles come in pairs with areas 𝑏, 𝑐, and 𝑑, as shown in the figure. Now it is clear that the white area and the black area are both 𝑎 + 𝑏 + 𝑐 + 𝑑. Thus Alice and Bob get equal amounts of pizza in each 2 × 2 subgrid, and therefore equal amounts of the entire pizza. (b) For odd 𝑛, all four corners are the same color; let us assume they are black. Now consider any white piece and neighboring black pieces on either side; see Figure 7.4. As in part (a), △𝐻𝐺𝐵 and △𝐺𝐹𝐵 have the same base and altitude, and therefore the same area, and similarly △𝐵𝐶𝐹 and △𝐶𝐷𝐹 have the same area. Let 𝑎 be the area of each of the first pair of triangles, and 𝑏 the area of each of the second pair. Let 𝑐 and 𝑑 be the areas of △𝐴𝐵𝐻 and △𝐷𝐸𝐹.

74

Chapter 2. Geometry

E

F G

b D

P

d H

c

c

b

d

a

a

C

B

A

Figure 7.3. A 2 × 2 subgrid of pizza pieces.

H

a

a c

A

B

E

F

G b

b C

d D

Figure 7.4. A row of three pieces. Note that since 𝐴𝐷 = 3𝐴𝐵, the area of △𝐴𝐷𝐻 is 3𝑐, and similarly the area of △𝐻𝐸𝐷 is 3𝑑. But these two triangles together cover the entire quadrilateral 𝐴𝐷𝐸𝐻, so we have 3𝑐 + 3𝑑 = 2𝑎 + 2𝑏 + 𝑐 + 𝑑, and therefore 𝑎 + 𝑏 = 𝑐 + 𝑑. We conclude that the average of the areas of the two black pieces is (𝑎+𝑏+𝑐+𝑑)/2 = 𝑎 + 𝑏, which is the area of the white piece. Now consider the pieces along the border of the pizza. Since the area of each white piece is the average of the areas of the black pieces on either side of it, the total white area along the border is the same as the total black area. But now we can repeat the argument for the ring of pieces one piece in from the border, and those two pieces in, and so on. We conclude that Alice and Bob get equal amounts of the entire pizza. Exercise. What happens if the pizza is cut into 𝑚 pieces in one direction and 𝑛 pieces in the other direction? This problem is based on [70].

8 Four-Regular Squares This can be done if 𝑛 ≥ 25. Figure 8.2 shows the solution based on a 25-gon; it is more complicated than it appears because the outer squares do not meet vertexto-vertex (see Figure 8.3).

8. Four-Regular Squares

75

Figure 8.2. A collection of 50 unit squares around a 25-gon; each square touches four squares.

′ 

 Figure 8.3. This detail of Figure 8.2 shows the point where the rightmost outer squares just touch.

To understand the construction, let 𝜌 = 𝜋/𝑛 and orient the polygon so that its rightmost vertex 𝑉 is at (csc 𝜌)/2 on the 𝑥-axis. Let 𝑃±1 be the points that, with 𝑉, define the rightmost jaw; see Figure 8.4. Then 𝑃±1 = 𝑉 + (cos 𝜌, ± sin 𝜌). Place a square 𝑆 into the jaw so that it touches the sides of the opening and has a diagonal on the the 𝑥-axis. Let 𝑊 be the leftmost vertex of 𝑆 on the axis, and let 𝑄±1 be the vertices of 𝑆 adjacent to 𝑊. Then 𝑊 = 𝑉 + (cos 𝜌 − sin 𝜌, 0) and 𝑄±1 = 𝑊 + (√2/2, ±√2/2). Now let 𝑆′ be a square similarly placed into the next jaw counterclockwise around the polygon. Then 𝑆′ is the image of 𝑆 under ′ a counterclockwise rotation of the plane about the origin, 𝑂, by 2𝜌. Let 𝑄−1 be the image of 𝑄−1 under this rotation. ′ The points 𝑄−1 , 𝑄1 , and 𝑄−1 all lie on a circle, 𝐶, centered at 𝑂. The arc of 𝐶 from 𝑄1 to 𝑄−1 is inside 𝑆 (because the center of 𝐶 is left of 𝑊) and the rest of ′ 𝐶 is outside 𝑆. We now want to know where 𝑄−1 lies on 𝐶, so we compare the

76

Chapter 2. Geometry

′ ′- 









-

-

Figure 8.4. Here 𝑛 = 12 and the outer square 𝑆 is placed symmetrically into the jaw. The dashed arc shows part of circle 𝐶. ′ angles 𝑄−1 𝑂𝑄−1 and 𝑄1 𝑂𝑄−1 . The first is 2𝜌. The second is

𝛼 = 2 tan−1 (

𝑄1,𝑦 √2 ) = 2 tan−1 ( ). 𝑄1,𝑥 csc 𝜌 + 2 cos 𝜌 − 2 sin 𝜌 + √2

′ We claim that 2𝜌 > 𝛼 if and only if 𝑛 ≥ 25, which implies that 𝑄−1 is inside 𝑆 if and only if 𝑛 ≥ 25. To prove the claim, first note that 2𝜌 > 𝛼 is equivalent to tan 𝜌/ tan(𝛼/2) > 1. We have

sin 𝜌 csc 𝜌 + 2 cos 𝜌 − 2 sin 𝜌 + √2 tan 𝜌 = ⋅ cos 𝜌 tan(𝛼/2) √2 = = =

1 + 2 sin 𝜌 cos 𝜌 − 2 sin2 𝜌 + √2 sin 𝜌 √2 cos 𝜌 cos(2𝜌) + sin(2𝜌) + √2 sin 𝜌 √2 cos 𝜌 √2 sin(𝜋/4 + 2𝜌) + √2 sin 𝜌 √2 cos 𝜌

=

sin(𝜋/4 + 2𝜌) + sin 𝜌 . cos 𝜌

For 0 ≤ 𝜌 ≤ 𝜋/8, the numerator is an increasing function of 𝜌 and the denominator is a decreasing function, so the expression is increasing. A simple computation shows that the expression strikes 1 when 𝜌 is about 𝜋/24.45. If 𝑛 is 5, 6, or 7 the expression is greater than 1, so this proves the claim. The claim means that the squares 𝑆 and 𝑆′ overlap when 𝑛 ≥ 25; see Figure 8.5. Now consider 𝑛 = 25. The preceding argument is for the case that the first outer square is placed symmetrically around the 𝑥-axis. Consider what happens when each of the outer squares is rotated counterclockwise by 𝜃 from

8. Four-Regular Squares

77

′  ′-

 Figure 8.5. Here 𝑛 = 25 and the outer square 𝑆 is placed symmetrically into the jaw. The squares 𝑆 and 𝑆′ overlap.

′ 

  

Figure 8.6. Here 𝑛 = 25 and the outer square is rotated 𝜋/4 − 𝜋/𝑛 from its symmetric position. the symmetric orientation while continuing to touch its two neighboring inner squares. When 𝜃 = 𝜋/4 − 𝜋/𝑛 it is clear that 𝑆 and 𝑆′ will not touch (𝑄1 is strictly below the lowest point of 𝑆′ ; see Figure 8.6). Therefore, because the squares overlap when 𝜃 = 0, it follows by continuity that there is a value of 𝜃 where 𝑆 just touches 𝑆′ . Straightforward root-finding determines that this special value of 𝜃 is 0.00864. . ., or just under one-half of a degree; this value is used in Figure 8.2. One can check that when 𝑛 ≤ 24, the outer squares will not touch regardless of how they are rotated, which implies that 𝑛 = 25 is the smallest case where this 4-regular pattern of squares exists. Let’s say that an array of pairwise interior-disjoint polygons is 𝑑-touching if each one touches 𝑑 others in the sense that they have nonempty intersection. If they intersect along a nontrivial line segment, call them 𝑑-adjacent. Figure 8.2 shows a 4-touching family of 50 unit squares; in fact there is such a collection of 25 squares, discovered by Branko Grünbaum and shown in Figure 8.7 [51]. To understand the construction in detail, one needs the radius 𝑟 of the circle through the centers of the square quadruplets. That radius is 𝑟=

√2/2 + cos(𝜋/5) . sin(𝜋/5)

78

Chapter 2. Geometry

α β

Figure 8.7. Left: An array of 25 4-touching squares. Right: Closeup view.

Figure 8.8. Left: A 3-adjacent array of 14 squares. Right: A 4-adjacent array of 24 dominoes. For proof, label the points as in Figure 8.7. Then 𝛼 + 𝛽 = 𝜋/5 because ten copies of the two angles fill the circle. The right triangle 𝐴𝑂𝐵 gives sin 𝛼 = 1/𝑠 and cos 𝛼 = 𝑟/𝑠. And triangle 𝑂𝐵𝐶 gives sin 𝛽 = √2/(2𝑠). But we also have 𝜋 𝜋 𝜋 𝑟 sin(𝜋/5) cos(𝜋/5) − 𝛼) = sin( ) cos 𝛼 − cos( ) sin 𝛼 = − . 5 5 5 𝑠 𝑠 Equating the two expressions for sin 𝛽 and applying easy algebra proves the claim. Evaluating the trigonometric functions gives sin 𝛽 = sin(

𝑟=

2√2 + √5 + 1

.

√10 − 2√5 Getting a 3-touching set of squares is trivial: divide a square into four smaller squares by vertical and horizontal bisectors. But there is a 3-adjacent example, shown in Figure 8.8. If one uses 2 × 1 dominoes, then one can get a 4-adjacent family using 24 dominoes, as shown in Figure 8.8. These example are by Erich Friedman [52]. One can consider cubes. Can you find a 6-adjacent collection of 14 unit cubes (where this means that the intersection is 2-dimensional)?

9. Venn Symmetry

79

Figure 9.2. A rotationally symmetric Venn diagram on five sets based on a single ellipse. The black dot is the origin; the black oval is the ellipse (0.2, 0.5) + (sin 𝑡, 2.1 cos 𝑡). Regions involving the same count of sets and complements of sets are given the same color. For example, the ten yellow regions correspond to three of the given sets and two of the complements, such as (𝐴 ∩ 𝐵 ∩ 𝐶) ⧵ (𝐷 ∪ 𝐸).

9 Venn Symmetry A symmetric Venn diagram using ellipses was first found by Branko Grünbaum [63]. The solution can be given very concisely by just four numbers: 0.2, 0.5, 1, 2.1. That is, if one takes the ellipse given parametrically by (0.2, 0.5) + (sin 𝑡, 2.1 cos 𝑡) and rotates it around the origin, one gets the desired symmetric Venn diagram, as shown in Figure 9.2. A truly beautiful theorem is that a symmetric Venn diagram exists for 𝑛 sets if and only if 𝑛 is prime. The fact that 𝑛 must be prime was first proved by David Henderson in 1963 when he was an undergraduate. A gap in the proof was fixed by Stan Wagon and Peter Webb [126]. Branko Grünbaum was the first to find

80

Chapter 2. Geometry

an example for seven sets. In 2002 Peter Hamburger found a complicated configuration that yielded a symmetric Venn diagram for 11 sets. Then in 2004 Jerrold Griggs, Charles Killian, and Carla Savage proved that a symmetric Venn diagrams exists for 𝑛 sets whenever 𝑛 is a prime number. For more information see [109, 110].

10 A Crosscut Quadrilateral Let 𝑅 be the central quadrilateral, let 𝑆 be the union of the four corner red regions, and let 𝑇 be the union of the top and bottom quadrilaterals. Figure 10.2 shows that 𝑅 ∪ 𝑇 and 𝑆 ∪ 𝑇 each have area that is one half of the entire area. In each case the dashed line divides the quadrilateral into two triangles, and within each one the colored and white sections have equal bases and the same altitude so have the same area. Therefore 𝑅 and 𝑆 have the same area. This problem can be found in [4]; see also [89], where several variations are studied.

Figure 10.2. Moving some areas around shows that the blue and red areas are equal.

11 The Legacy of H. G. Wells The light leaves vertically at the top along the same line it started on, as shown in Figure 11.2. So this device serves as an invisibility cloak for an item inside 𝑆 (see Figure 11.3(b)). In 1897, H. G. Wells wrote a famous novel called The Invisible Man. This problem is only a small step in that direction as the object gives invisibility only when viewed directly from above (or below). We start with the general W-shape of Figure 11.2, with 𝐵 and 𝐷 at the points (𝑎, 0, ±1/2), 𝐴 and 𝐸 at (𝑎 + ℎ, 0, ±1), and 𝐶 at (𝑎 + ℎ, 0, 0). The points 𝐴′ –𝐸′ are the reflections of 𝐴–𝐸 across the 𝑧-axis. Let ∠𝐵𝐴𝐶 be 𝜃. Because of the parallel segments, it is easy to see that a ray that reflects from segment 𝐴𝐵 to 𝐵 ′ 𝐶 ′ will then go up vertically to strike 𝐶 ′ 𝐷′ , then over to 𝐷𝐸, and then straight up and

12. Tiling Surprise

81

Figure 11.2. A vertically entering ray that reflects from 𝐴𝐵 to 𝐵 ′ 𝐶 ′ will end up leaving 𝐷𝐸 vertically above the entering ray. out above the place it first contacted 𝑆. So what must be derived is the relation between 𝑎 and ℎ that guarantees that any entering ray, after striking 𝐴𝐵, hits segment 𝐵 ′ 𝐶 ′ . Consider the parallel segments 𝐴𝐵′ and 𝐵𝐶 ′ . Their slopes are −

1/2 1 =− . 2𝑎 + ℎ 4𝑎 + 2ℎ

Now consider the reflection of a vertical ray striking 𝐴𝐵. This reflection is on a line of slope − tan(90∘ − 2𝜃), or (tan 𝜃 − cot 𝜃)/2 (see Figure 11.3(a)). If this slope equals −1/(4𝑎 + 2ℎ), then the reflected ray will be parallel to 𝐴𝐵 ′ and 𝐵𝐶 ′ and so will lie between those two segments and strike 𝐵 ′ 𝐶 ′ . We have tan 𝜃 = 2ℎ from △𝐴𝐹𝐵. So the needed condition is (2ℎ−1/(2ℎ))/2 = −1/(4𝑎+2ℎ), which reduces to 8𝑎ℎ2 −2𝑎+4ℎ3 +ℎ = 0. For the W-shape given in the problem, 𝑎 = ℎ = 1/(2√3) and the equation holds (both slopes are −1/√3). More generally, the invisibility property holds whenever ℎ < 1/2 and 𝑎 = (ℎ + 4ℎ3 )/(2 − 8ℎ2 ). This invisibility construction was found by Alena Aleksenko and Alexander Plakhov [1]; see [91] for a video that simulates how this unusual lens would work.

12 Tiling Surprise Part (a) is solved by the cross shape in Figure 12.4.

82

Chapter 2. Geometry

(a)

(b)

Figure 11.3. (a) The slope of segments 𝐴𝐵 ′ and 𝐵𝐶 ′ is −1/(4𝑎 + 2ℎ). (b) Vertical rays rising from the bottom exit the top vertically at the same 𝑥𝑦location, thus rendering objects in the gray area invisible when viewed from above.

Figure 12.4. The case of XX␣XXX can be handled by making a symmetric cross, which then tiles the plane.

An alternate approach is to try to first tile a rectangle. Erich Friedman accomplished this as shown in Figure 12.5. See [50] for more about tiling rectangles with tiles like those we are considering here. Part (b) is trickier and can be solved by the method of Figure 12.6 [64]. In this case, one cannot tile a rectangle (this was shown by Juha Saukkola [50]).

12. Tiling Surprise

83

Figure 12.5. The XX␣XXX tile can be used to tile a rectangle.

Figure 12.6. The case of XX␣XX is resolved by a somewhat tricky tiling. These two problems are special cases of a remarkable general phenomenon conjectured by Adam Chalcroft in 2010 and proved by Vytautas Gruslys, Imre Leader, and Ta Sheng Tan [64] in 2015. It is most simply stated in terms of integer points. Each integer 𝑛 ∈ ℤ can be identified with the interval [𝑛, 𝑛 + 1], and one lifts such an object to higher dimensions by just taking the product with more intervals. So the interval [0, 1] becomes [0, 1] × [0, 1] in the plane, [0, 1]3 in 3space, and so on. Similarly, one can start with any subset of ℤ𝑛 and lift it to higher dimensions. Theorem (Gruslys, Leader, and Tan). For any bounded set in ℤ𝑛 , there is a dimension 𝑑 such that the set tiles ℤ𝑑 . For example, the one-dimensional set {1, 2, 4, 5} may be viewed as the collection of intervals [1, 2], [2, 3], [4, 5], [5, 6]. This cannot tile the line. But viewing the intervals as squares leads to part (b) of this problem and that set of four squares does tile the plane. Part (a) is the same, starting with {1, 2, 4, 5, 6}. These two are just the patterns XX␣XX and XX␣XXX. One can move on to XXX␣XXX. It is known that this does not tile the plane. But the tile made up of six cubes in this pattern does tile 3-space; the smallest solution known uses 196 tiles to get a shape that then tiles periodically.

84

Chapter 2. Geometry

If one starts in the plane with the shape obtained by arranging unit squares in a ring (that is, remove the central square from a 3×3 square), then the theorem says that this shape tiles some ℤ𝑑 . An explicit value of 𝑑 for which this works is not known. However, work of Stijn Cambie [21], building on results of Harry Metrebian [93], shows that any one-dimensional set of the form XX⋯X␣XX⋯X with 𝑘 𝑋s on either side of the gap tiles ℤ3 .

13 A Well-Balanced Clock (a) There is no time that yields an equilateral triangle. We measure time in hours after midnight, and work in the frame of reference of the hour hand. This is the same as imagining that the clock rotates counterclockwise at a rate of 1/12 revolution per hour. In this context, the hour hand is stationary, the minute hand rotates clockwise at 11/12 of a revolution per hour, and the second hand’s rotation rate is 719/12. To form an equilateral triangle, the minute hand must be 1/3 of the way around and the second hand 2/3, or vice versa. For the first to happen, the minute hand must make 𝑋 + 1/3 revolutions, where 𝑋 is an integer, and this happens at time (𝑋 + 1/3)/(11/12); for the second-hand condition, the second hand will have made 𝑌 + 2/3 revolutions (𝑌 an integer), and so the time must be (𝑌 + 2/3)/(719/12). Therefore 1 12 2 12 (𝑋 + ) = (𝑌 + ) , 11 3 719 3 which reduces to 33𝑌 − 2157𝑋 = 697. This cannot hold because the left side is divisible by 3 while 697 is not. The second case leads to a similar impossibility, with 1427 in place of 697. An alternative finish is to use the time equations 𝑡 = (12𝑋 + 4)/11 = (12𝑌 + 8)/719 to get 11 𝑡 = 4 + 12 𝑋 and 719 𝑡 = 8 + 12 𝑌 . Now multiply the first by 196 and the second by 3 (these values arise from the extended Euclidean algorithm, 3⋅719−196⋅11 = 1) to get 2156 𝑡 = 196(4+12 𝑋) and 2157 𝑡 = 3(8+12 𝑌 ). Subtracting then proves that 𝑡 must be an integer, which means that the minute and second hands point in the same direction, and so there is no equilateral triangle. With a little computation one can show that when the time is 9:05:25.452. . ., the three angles are very close to 120∘ , the largest error being about 1/6 of a degree, and that is the closest one can get. More precisely, the exact time for this minimization of the max-error is 𝑡 = 6536/719, or 9:05:25 plus 325/719 of a second. The three angles are then 120∘ and 120∘ ± 120∘ /719. (b) For an 11-hour clock, again working in the frame of the hour hand, the minute- and second-hand rates are 10/11 and (60 ⋅ 11 − 1)/11, or 659/11, respectively. The equilateral equation for time, with the minute hand before the second

13. A Well-Balanced Clock

85

Figure 13.1. An 11-hour clock with equal-length hands yields an equilateral triangle at two times: 3:40:00 and 7:20:00. hand in clockwise order from the hour hand, is 11 1 11 2 (𝑋 + ) = (𝑌 + ) , 10 3 659 3 or 659𝑋 = 10𝑌 − 213. This gives 9𝑋 ≡ 7 (mod 10) or, multiplying by 9, 𝑋 ≡ 3 (mod 10). Trying 𝑋 = 3 gives a solution with 𝑌 = 219. That corresponds to time (11/10)(3 + 1/3), or 11/3 hours after midnight, which in standard form is 3:40:00 (Figure 13.1). Other positive integers 𝑋 congruent to 3 (mod 10) give the same time, some multiple of 11 hours later. The case that the minute hand comes after the second hand in clockwise order from the hour hand leads to the equation (11/10)(𝑋 + 2/3) = (11/659)(𝑌 + 1/3), which gives another solution, at time 7:20:00. Lászlo Lipták characterized the equilateral clocks with three equal-length hands. Suppose there are 𝐻 hours in a half day (one revolution), 𝑀 minutes in an hour, and 𝑆 seconds in a minute. Then there is an equilateral time if and only if: (1) 𝐻 ≥ 2 and 𝑀 ≥ 2; and either (2a) 𝐻 ≡ 2 (mod 3) and 𝑀 ≡ 0 (mod 3) (e.g., 𝐻 = 11 and 𝑀 = 60), or (2b) there are positive integers 𝑎 and 𝐴, and an integer 𝑘, such that 𝐴 is not divisible by 3, 𝐻 = 1 + 𝐴3𝑎 , and 𝑀 = 𝐻 + 𝑘3𝑎+1 . Note that 𝑆 is irrelevant.

86

Chapter 2. Geometry

A much harder version of this problem appeared in [19], where the question was whether, for a standard clock, there are integer-length hands and a time such that the ends of the hands form an equilateral triangle. Such hands do exist, but the smallest solution has the lengths of the hour, minute, and second hands being integers near 10607 . This problem is due to Larry Carter and Jay-C Reyes, though Colin McGregor reports that part (a) was an exercise given to students at the University of Aberdeen in 1964.

14 On the Level The problem is essentially 2-dimensional; note that in the 3-dimensional version one has to raise both ends to the roof to avoid spilling any water. The solution has three steps: (1) investigate the geometry to learn likely properties of the roof curve; (2) use the properties to derive a formula for the roof; and (3) verify that the curve works as expected. The sides of the trough are raised at angle 30∘ , but we will use 𝜎 for this angle; this will reveal why 30∘ is the most natural choice of 𝜎. The roof turns out to be part of the trisectrix of Delanges, the polar curve 𝑟 = sec((𝜃 − 𝜎)/2) (together with its reflection across the 𝑦-axis); Figure 14.2 shows the roof and the extended part of the two-branched trisectrix curve.

Figure 14.2. Left: The roof that solves the problem. Right: The roof (dashed) is part of the trisectrix of Delanges, the thick curve with two branches. Figure 14.3 shows the trough’s cross section 𝐴𝑂𝐸 with the left half of the roof partly drawn; the sides are elevated at angle 𝜎. We do not know that the desired roof exists; assume that it does. In Figure 14.3 we are not rotating the region, but rotating gravity instead; so a counterclockwise rotation of the triangle is the same as a clockwise rotation of the direction in which gravity acts. Suppose gravity is rotated clockwise through angles 𝜌 (water line is 𝐵𝐷) and 𝜌 + Δ𝜌 (water line is 𝐵′ 𝐷′ ). Suppose 𝐵𝐷 meets 𝐵 ′ 𝐷′ at 𝑋. Then because the amount of water does not change, region 𝑋𝐵𝐵′ has the same area as triangle 𝑋𝐷𝐷′ . For small Δ𝜌, these regions appear to be well approximated by circular sectors of radius 𝐵𝑋, 𝑋𝐷, respectively; the area property and the area formula for a circular sector

14. On the Level

87

Figure 14.3. Top: Rotating gravity leads to the guess that 𝐶 bisects 𝐵𝐷. Bottom: The point on the roof, 𝐵, is the reflection of 𝐷 in its point of tangency to the unit circle. then imply that 𝐵𝑋 2 Δ𝜌/2 is close to 𝑋𝐷2 Δ𝜌/2 and so one expects that 𝐵𝑋 and 𝑋𝐷 have almost equal length. Let 𝐶 be the foot of the perpendicular from 𝑂 to 𝐵𝐷. Then it is also reasonable to expect 𝑋 to converge to 𝐶 as Δ𝜌 → 0, which leads to the guess that 𝐵𝐶 = 𝐶𝐷. These are only hunches, but we can assume that 𝐶 bisects 𝐵𝐷 and see where that leads. Thus, in Figure 14.3, bottom, we assume that line 𝑂𝐶 bisects 𝐵𝐷. The assumption about 𝐶 means that the angles labeled 𝛼 are equal. Because the water depth is to stay constant, 𝑂𝐶 = 1 and 𝑂𝐵 = sec 𝛼. Hence 𝐵’s polar coordinates are 𝑟 = sec 𝛼 and 𝜃 = 2𝛼 + 𝜎 and the curve has the polar equation 𝑟 = sec((𝜃 − 𝜎)/2). The rotation angle 𝜌 is the angle between 𝑂𝐶 and vertical, so 𝜌 + 𝛼 + 𝜎 = 𝜋/2, and from 𝜃 = 2𝛼 + 𝜎 we get 𝜃 = 𝜋 − 𝜎 − 2𝜌, which implies that 𝜃 decreases as 𝜌 increases. Because the trough rotates only until the side hits the ground, we have 0 ≤ 𝜌 ≤ 𝜎 and therefore 𝜋 − 𝜎 ≥ 𝜃 ≥ 𝜋 − 3𝜎. We’ll use ℛ for the polar curve 𝑟 = sec((𝜃 − 𝜎)/2) defined for 𝜋 − 𝜎 ≥ 𝜃 ≥ 𝜋 − 3𝜎. Then ℛ will form the left half of the roof and its reflection in the 𝑦-axis will be the right half. To make sure that ℛ stays above only the left half of the trough, we need 𝜋 − 3𝜎 ≥ 𝜋/2, or 𝜎 ≤ 𝜋/6; from now on we assume this bound on 𝜎. We now have the formula for the roof; it remains to prove that it works. In what follows, 𝜌 is an arbitrary rotation angle with 0 ≤ 𝜌 ≤ 𝜎. Let 𝐵 and 𝐷 be as in Figure 14.3, bottom; by the construction, 𝐵 has polar coordinates 𝜃 = 𝜋 − 𝜎 − 2𝜌

88

Chapter 2. Geometry

Figure 14.4. With the proper roof, the water level stays constant through rotation up to 30∘ in either direction. and 𝑟 = sec((𝜃 − 𝜎)/2). We need to prove that the region below 𝐵𝐷 and inside the trough with roof is as it appears to be. (∗) The region below 𝐵𝐷 (extended) and inside the trough with roof consists of triangle 𝐵𝑂𝐷 and the polar region 𝑂𝐴𝐵. To prove (∗), we fix gravity and allow rotation to rotate the trough and roof; let 𝐿 be the line 𝑦 = 1. All of ℛ lies in the second quadrant and that means points on the curve move only downward under counterclockwise rotation. The point 𝐵 is taken to 𝐿 by the counterclockwise rotation 𝜌, where 𝜌 = (𝜋 − 𝜎 − 𝜃)/2. Therefore, by the relation between 𝜌 and 𝜃, any points on ℛ with polar angle smaller than 𝜃 strike 𝐿 for rotations larger than 𝜌, and hence are above 𝐿 for rotation 𝜌; similarly points with larger polar angle strike 𝐿 when rotated by less than 𝜌, and so are below 𝐿 when rotated by 𝜌. This proves (∗), and also implies that ℛ is above 𝐿 when 𝜌 = 0. Knowing the shape of the region, we can compute its area. The area of triangle 𝐵𝑂𝐷 is tan 𝛼, while the area of region 𝑂𝐴𝐵 is easily handled by polar integration: 𝜋−𝜍

𝜋−𝜍

1 𝜃−𝜎 1 𝜃−𝜎 | ∫ sec2 ( ) 𝑑𝜃 = tan 𝛼 + ⋅ 2 tan( )| 2 2𝛼+𝜍 2 2 2 |2𝛼+𝜍 𝜋 = tan 𝛼 + tan ( − 𝜎) − tan 𝛼 = cot 𝜎. 2 Since the area is independent of 𝜌, it stays constant as the trough rotates, and hence the water level is 1 throughout the rotation. Figure 14.4 illustrates the rotation and the water region that stays at height 1. If 𝜎 < 𝜋/6, then ℛ ends before reaching the 𝑦-axis (𝜃 is bounded above 𝜋/2), which means that the roof has a gap near the 𝑦-axis. One could fill this gap with a straight line, or minor variation of a line, but the roof will not be unique. This Area = tan 𝛼 +

16. Wiggle Room

89

is why 𝜎 = 𝜋/6 is the most natural elevation angle for this problem: it is the only value of 𝜎 that leads to a unique roof. This problem arose from the following simple question. If one rotates (a small amount) a cylindrical glass with some water around a point on its base, does the water level rise or fall? It is easy to see that the water level rises: the instantaneous rate of change of water level is +1/2 if base diameter and water height are 1. Our presentation of this problem was enhanced by valuable discussions with Michael Elgersma.

15 A Polyhedral Puzzle The only equation that one needs is the classic Euler formula 𝑉 − 𝐸 + 𝐹 = 2. The key point is that each vertex of 𝑄 is at an intersection of three edges. From this one gets 𝐸 = 3𝑉/2. Using this in Euler’s formula gives 𝑉 = 2(𝐹 − 2) and 𝐸 = 3(𝐹 − 2). But 1001 is not divisible by 2 or 3, so we must have 𝐹 = 1001, and that gives 𝑉 = 1998 and 𝐸 = 2997. If 𝑑𝑖 is the degree of vertex 𝑣𝑖 in 𝑃, then that vertex becomes 𝑑𝑖 vertices in 𝑄; therefore 1998 = 𝑉 = ∑ 𝑑𝑖 ; but the sum of the degrees is twice the number of edges, so 𝑃 has 999 edges. The problem of determining 𝑉, 𝐸, and 𝐹 is due to Gregory Galperin, and appeared in [18, Fall 2013, problem 3]. The extension to the edge count for 𝑃 is by Jerrold Grossman.

16 Wiggle Room There is a path that visits all but two of the 27 cubies, and that is best possible. Using points from (0, 0, 0) to (2, 2, 2) for cubie centers, a solution is (1, 1, 1), (1, 0, 1), (1, 0, 0), (0, 0, 0), (0, 1, 0), (0, 1, 1), (0, 0, 1), (0, 0, 2), (1, 0, 2), (1, 1, 2), (0, 1, 2), (0, 2, 2), (1, 2, 2), (1, 2, 1), (0, 2, 1), (0, 2, 0), (1, 2, 0), (1, 1, 0), (2, 1, 0), (2, 0, 0), (2, 0, 1), (2, 1, 1), (2, 1, 2), (2, 2, 2), (2, 2, 1). More succinctly, one can start at (1, 1, 1) and move Front, Back, Left, Right, Up, Down using the sequence 𝐹𝐷𝐿𝐵 𝑈𝐹𝑈𝑅 𝐵𝐿𝐵𝑅 𝐷𝐿𝐷𝑅 𝐹𝑅𝐹𝑈 𝐵𝑈𝐵𝐷 (see Figure 16.1). Here is Larry Carter’s proof that 25 is the maximum. First, color the cubies alternately black and white, with the corners black (Figure 16.2). There are 14 black cubies and 13 white. Of the 14 blacks, eight are corner pieces and six are centers of exterior faces. These are called corner and face cubies, respectively. The remaining (white) cubies are the 12 edge cubies and one center cubie. Because the direction must change at each step, whenever the path is at a corner, the next black cubie on the path will be a face cubie. There are only six face cubies, so a

90

Chapter 2. Geometry

Figure 16.1. A path in the 3 × 3 × 3 grid that misses only two points.

Figure 16.2. An alternating coloring of the 3×3×3 cube.

path can hit at most seven of the eight corners. Thus it will hit at most 13 of the 14 black cubies. Because there are only 13 whites, the only way to exceed 25 is to hit 13 blacks and all the whites, and the blacks must start at a corner and alternate corner and face cubies. Because all whites are on the path, it must contain the center cubie. If it starts or ends at the center, then the black sequence would start or end at a face and would therefore be too short. If the path contains the center but does not start or end there, then the sequence of black cubies cannot alternate corner and face pieces: there would be two consecutive face pieces before and after the center; so again, there would not be enough blacks. The case of an 𝑛 × 𝑛 × 𝑛 cube is interesting. Let a path as in the problem be called a snake, with its length being the number of cubies it visits. The 2×2×2 case has eight cubies and it is easy to find a snake of length eight. Such a full-length snake is a Hamiltonian path, of a special type, in the grid graph having vertices for

16. Wiggle Room

91

Figure 16.3. A boustrophocycle follows the path by which an ox would plow a field; shown are such cycles for 4 × 4 and 6 × 6, which lead to Hamiltonian snakes for 8 × 8 × 8 and 12 × 12 × 12.

Figure 16.4. Two 2 × 2 × 8 pillars with slightly different top ends. the cubies and edges for adjacent cubies. A snake forming such a path is called a Hamiltonian snake. Here is a summary of results and a conjecture. •

𝑛 even: There is a Hamiltonian snake; in fact, there is a closed cycle (Larry Carter and Stan Wagon).

𝑛 = 3: The longest snake has length 25.

𝑛 = 5 or 7: There is a Hamiltonian snake (Rob Pratt and Wagon).

Conjecture: For all 𝑛 ≥ 4, there is a Hamiltonian snake.

Proof sketch for the 𝑛 = 4𝑘 case. Use 2×2×𝑛 pillars and join them, alternating the junction points from top to bottom and using a boustrophocycle on the 2𝑘 × 2𝑘 grid graph as a guide (Figures 16.3, 16.4). A boustrophocycle is the path an ox would take to plow a rectangular field (boustrophedonic writing is writing that

92

Chapter 2. Geometry

Figure 16.5. A Hamiltonian snake for the 12×12× 12 grid.

alternates right-to-left and left-to-right). One must choose the orientations of the tops and bottoms of the pillars so that the connections can be made as desired (Figure 16.5). The preceding argument works, starting with a Hamiltonian path in the (2𝑘+1)×(2𝑘+1) grid, to get a Hamiltonian snake for (4𝑘+2)×(4𝑘+2)×(4𝑘+2). But with a little more care we can get a cycle instead of a path. We first found such a cycle for 𝑛 = 6 (by computer, using integer-linear programming) and then saw how to extend it to 4𝑘 + 2. Work wall by wall, where a wall is a 2 × 𝑛 × 𝑛 segment. Start a little bit diagonally below the upper right of the front wall and use 2 × 2 structures (blocks) to get to the upper left corner. Make a bridge of blocks all the way to the back wall (yellow in Figure 16.6) and then work forward wall by wall, ending in the vicinity of the start point. For each wall except the final front wall one can use blocks, using as a guide an appropriate Hamiltonian path in the (2𝑘 + 1) × (2𝑘 + 1) grid graph with the upper left corner (the bridge) deleted. For the second wall, as one is nearing completion, there is no path using blocks from the start point to the desired finish point, so one makes a small adjustment when at upper left, and also right before closing up the cycle. The walls are shown in Figure 16.7. This construction easily extends past 10 by just adding and expanding the walls.

16. Wiggle Room

93

Figure 16.6. A 10 × 10 × 10 Hamiltonian snake. It starts at the red point, bridges to the back at upper left, and then makes its way back to the front. The paths for the 𝑛 = 5 and 7 cases were discovered by Rob Pratt and Stan Wagon using a computer search based on integer-linear programming. The following 124 instructions give the solution for 𝑛 = 5 (Figure 16.8): 𝐵𝑅𝑈𝐹𝐷𝑅𝑈𝐵𝐷𝐵𝐿𝑈𝑅𝑈𝐿𝑈𝑅𝑈𝐵𝐷𝐵𝑈𝐿𝐷𝐹𝑈𝐿𝐷𝐵𝑈𝐿𝐷𝐿𝑈𝐹𝑅𝐷𝐿𝐹𝑈𝐹 𝐷𝐹𝑈𝑅𝐷𝑅𝑈𝑅𝐷𝐵𝐷𝐹𝑅𝐵𝑈𝐹𝑈𝐵𝐿𝐵𝐿𝐹𝐿𝐵𝐷𝐹𝐷𝐿𝐹𝑅𝐷𝐿𝐷𝑅𝐵𝑈𝑅𝐹𝑈𝐵𝑈 𝐵𝐷𝐵𝐷𝐹𝐷𝐵𝐿𝐵𝐿𝐹𝑈𝑅𝐹𝐷𝐿𝐹𝑈𝐵𝑈𝑅𝐵𝐿𝐵𝐷𝑅𝑈𝑅𝐷𝑅𝐹𝑈𝐵𝑅𝐹𝐷𝐵𝐷𝐹𝐿𝐵𝐿 The solution for 𝑛 = 7 is given by the following sequence of 342 moves: 𝑅𝑈𝐿𝑈𝐵𝐷𝐵𝐷𝐹𝑅𝐵𝑈𝐵𝐷𝐵𝐿𝐹𝑈𝐵𝑈𝑅𝐷𝑅𝐹𝐷𝐵𝑅𝐹𝑅𝐵𝑈𝐹𝑅𝐵𝐷𝐹𝑅𝐵𝑈𝐹𝑈𝐵 𝑈𝐹𝑈𝐿𝐵𝑅𝑈𝐹𝐿𝐵𝑈𝑅𝐹𝐿𝐹𝑅𝐹𝐿𝐷𝑅𝐵𝐿𝐷𝐹𝑅𝐵𝐷𝐹𝐷𝐵𝐿𝐷𝐿𝑈𝐹𝑅𝐹𝐿𝐹𝐿𝐵𝐷𝐵𝐷 𝐹𝑅𝑈𝐹𝑅𝐷𝐿𝐹𝑈𝑅𝐷𝑅𝐵𝑈𝐹𝑈𝐿𝑈𝐵𝐷𝑅𝐵𝐷𝐿𝐷𝑅𝐵𝑈𝐵𝐷𝐿𝐹𝑈𝐿𝐷𝐵𝐿𝑈𝐿𝐷𝐹𝑈 𝐿𝑈𝐹𝑅𝐵𝑅𝐵𝐿𝐵𝑈𝐹𝑅𝐹𝑈𝐿𝐵𝑅𝑈𝐹𝑈𝑅𝐵𝐷𝐹𝐷𝐵𝐷𝑅𝐹𝐿𝐹𝑈𝐿𝐷𝐿𝐵𝐿𝑈𝐵𝐿𝐹𝐷𝐵 𝐷𝐵𝑅𝐹𝑈𝐵𝐿𝐵𝑅𝑈𝐹𝐿𝐵𝑈𝐹𝑈𝐵𝑅𝐹𝑅𝐵𝐷𝐿𝐹𝑅𝐷𝐵𝑅𝐹𝐷𝐵𝐿𝐷𝑅𝐷𝐹𝑈𝑅𝐵𝑅𝐹𝑈𝐵 𝐿𝐹𝑈𝐵𝑈𝐹𝑈𝐵𝐿𝐷𝐹𝑈𝐹𝐿𝐹𝐷𝐵𝐿𝑈𝐿𝐷𝐹𝑈𝑅𝐷𝐹𝑈𝐿𝐷𝐹𝑈𝐹𝐷𝑅𝐷𝐿𝐷𝑅𝐵𝐿𝐷𝐹 𝐷𝑅𝑈𝑅𝐵𝐿𝐷𝐿𝐷𝐹𝑅𝐵𝑅𝐵𝑈𝐹𝑅𝐷𝐹𝐿𝑈𝑅𝑈𝑅𝑈𝐿𝐵𝑅𝑈𝐿𝐹𝐿𝐷𝐵𝑈𝐵𝐿𝐷𝐿𝑈𝐹𝑅𝑈 𝑅𝐹𝑈𝐿𝐵𝑅𝐵𝐷𝑅𝑈𝑅𝐷𝐹𝐿𝑈𝑅𝐹𝐿𝐷𝑅𝐷𝑅𝑈𝑅𝑈𝐿𝐵𝑅𝐵𝐿𝐷𝑅𝐹𝐿𝐷𝐵𝐷𝑅𝑈𝐹𝐷𝐹𝑈

94

Chapter 2. Geometry

Figure 16.7. The five walls used to get the 10 × 10 × 10 Hamiltonian snake cycle. Blocks of size 2 × 2 are used throughout except at two places in the second wall.

There is less room to turn in the plane and computation supports the conjecture that for 𝑛 even one can cover all except 𝑛 − 2 of the 𝑛2 squares, and for 𝑛 odd and 𝑛 ≥ 3 one can cover all but 2(𝑛 − 2). This is known for 𝑛 ≤ 18 (see [99, sequence A157615]). The optimal pattern (Figure 16.9) appears to be a spiral

17. Drink Me

95

Figure 16.8. A Hamiltonian snake in the 5 × 5 × 5 grid. ×

×

Figure 16.9. Two examples of the spiral pattern leading to the likely longest snakes in an 𝑛 × 𝑛 grid. in both the even and odd case (though a boustrophedonic path works just as well in the odd case). But these have not been proved optimal in general.

17 Drink Me This problem was considered and solved by Dan Asimov in 1966. Define the curve 𝑃𝑞 to consist of the two logarithmic spirals given in polar coordinates by 𝑟 = 𝑒𝜃 and 𝑟 = 2𝑒𝜃 for −∞ < 𝜃 ≤ 𝑞, with the ends joined by a straight line and the origin added (Figure 17.1 shows 𝑃0 ). Let 𝐷𝑞 consist of 𝑃𝑞 and its interior. Each spiral arm of 𝑃𝑞 winds around the origin infinitely often. Then 𝐷0 solves the problem, since any 𝑥𝐷0 (where 0 < 𝑥 < 1) is, after a rotation by ln 𝑥, equal to

96

Chapter 2. Geometry

Figure 17.1. Shrinking 𝐷0 by 𝑥 and then rotating by ln 𝑥 gives 𝐷ln 𝑥 , a subset of 𝐷0 .

− −

Figure 17.2. Left: Rotating 𝐷 in steps of 8∘ and scaling by 𝑒−3𝜋/180 for each degree of rotation yields shrunken hexagons that all lie inside 𝐷. Right: Using steps of 1∘ shows the spirals that the points follow as they shrink and rotate. 𝐷ln 𝑥 , which is contained in 𝐷0 . This follows from the identity 𝑥𝑎𝑒𝜃 = 𝑎𝑒𝜃+ln 𝑥 . It is easy to see that 𝐷0 is not star-shaped. One can get several variations using logarithmic spirals, but a more satisfying path is to use the spirals to guide one to a shrinkable polygon that is not star-shaped. This was done using hexagons in 1993 by Dean Hickerson (and independently in 2017 by John Sullivan). Because all pentagons are star-shaped, a hexagon is the polygonal solution with the minimal number of sides (any pentagon can be triangulated by diagonals into three triangles, and there must be a vertex lying in all three). Hickerson’s hexagon (and interior) is the domain 𝐷 with vertices (−3, −2), (−4, −3), (−4, 2), (3, 2), (4, 3), (4, −2); see Figure 17.2. It is clear that 𝐷 is not star-shaped. We need to show that it is shrinkable. We will simultaneously rotate and shrink 𝐷 so that it stays within its original boundaries. We coordinate the rotating and shrinking so that when 𝐷 has rotated

17. Drink Me

97 ′

= ′

=

=

− −

Figure 17.3. The hexagon shrinks and rotates, guided by the family of spirals. clockwise through 𝑡 radians, it has shrunk by a factor of 𝑒−3𝑡 . The effect of this motion is easiest to describe in polar coordinates. If a point in 𝐷 starts at polar coordinates 𝑟 = 𝑟0 , 𝜃 = 𝜃0 , then after a clockwise rotation of 𝑡 radians it will be at the point 𝑟 = 𝑟0 𝑒−3𝑡 , 𝜃 = 𝜃0 − 𝑡. We can recognize the path of this point as a logarithmic spiral by eliminating 𝑡 to get the equation 𝑟 = 𝑟0 𝑒3(𝜃−𝜃0 ) (Figure 17.3 shows the spirals). To prove that the domain stays within its original boundaries throughout the motion, we must show that if we follow these spirals inward from the boundary, they stay inside 𝐷. To do this, we compute the velocity vectors for the motion. In Cartesian coordinates, the location after 𝑡 radians of rotation is 𝑥 = 𝑟0 𝑒−3𝑡 cos(𝑡 − 𝜃0 ),

𝑦 = −𝑟0 𝑒−3𝑡 sin(𝑡 − 𝜃0 ).

Differentiating with respect to 𝑡, we find that the velocity satisfies 𝑥′ = −3𝑥 + 𝑦, 𝑦′ = −𝑥 − 3𝑦. We want to show that at every point on 𝐷’s border, the velocity vector (−3𝑥 + 𝑦, −𝑥 − 3𝑦) points to 𝐷’s interior. This will mean that there is no point on the hexagon at which the spiral can leave 𝐷, and therefore the shrinking and rotating process places the new region inside 𝐷, as desired. So to conclude, we examine the places where 𝑥′ = 0 or 𝑦′ = 0 or 𝑦′ = 𝑥′ . These equations yield the three lines 𝑦 = 3𝑥, 𝑦 = −𝑥/3, and 𝑦 = 𝑥/2, respectively (shown in red in Figure 17.3). It follows that all velocity vectors on the border of 𝐷 point inward. On the right side of the upper border we have 𝑦′ < 𝑥′ < 0, in the middle of the right-hand border we have 𝑥′ < 𝑦′ < 0, and on the left of the upper border we have 𝑦′ < 0 < 𝑥′ . Symmetry yields similar inequalities for the other half of

98

Chapter 2. Geometry

− −

Figure 17.4. A non-star-shaped shrinkable hexagon having area 6. The red lines indicate the location of the spiral slopes corresponding to the slopes of the edges. the hexagon. Therefore on the right side of the upper border the velocity vectors point down and left with slope greater than 1, with similar assertions holding on the rest of 𝐷’s border. Sullivan found a hexagonal solution with smaller integer coordinates than 𝐷: (−1, −1), (3, −2), (1, −1), (1, 1), (−3, 2), (−1, 1). For this example, the scaling term, which was 𝑒−3𝑡 in the previous example, is instead 𝑒−2.9𝑡 . Thus each rotation by 1∘ corresponds to a shrinking by 𝑒−2.9𝜋/180 , or 95.06% (Figure 17.4). Alternatively, for each 1% of shrink one rotates by about 0.595698∘ . The area of 𝐷 is 6, and it appears to be the smallest polygonal example with integer coordinates for the vertices.

18 Right-Angled Polygons Using a staircase it is easy to get rectangular 𝑛-gons when 𝑛 = 4, 6, 8, . . . (Figure 18.2). It is not possible for 𝑛 = 3, because the angles of a triangle add to 180∘ . And we show later that it is not possible when 𝑛 = 5. But it comes as a bit of a surprise that it can be done with a 7-sided figure; this was discovered by Gerald Wildenberg [130]. To get a rectangular heptagon start with the hexagon in Figure 18.2, left, and remove the top horizontal piece. This leaves two vertical legs having unattached top ends. Spread these vertical segments apart so that the distance between their upper ends is √2. Let the legs be 𝐴𝐵 and 𝐶𝐷. Then 𝐴𝐵𝐷𝐶 is a trapezoid with

18. Right-Angled Polygons

99

Figure 18.2. A 3-dimensional rectangular hexagon (left) and decagon (right). 













 ′







Figure 18.3. The two marked angles are on opposite sides of a right angle. sides 1, 1, 1, √2. Now add two points, 𝐸 and 𝐸′ , so that they determine a square with diagonal 𝐵𝐷 lying in the same plane as the trapezoid (Figure 18.3). Then ∠𝐴𝐵𝐸 ′ < 90∘ < ∠𝐴𝐵𝐸 and so if the upper half of the square is rotated in 3-space around axis 𝐵𝐷, there must be a time when ∠𝐴𝐵𝐸 will be 90∘ . This rotation leaves the right angle at 𝐸 unchanged, and so gives a rectangular 7-gon; see Figure 18.4. To get the coordinates of the preceding solution let 𝐹 and 𝐺 be the final two points and use a coordinate system such that 𝐴 = (1/2, 0, 0), 𝐶 = (−1/2, 0, 0), 𝐹 = (1/2, 1, 0), 𝐺 = (−1/2, 1, 0). So the origin is halfway between 𝐴 and 𝐶, the 𝑥-axis contains 𝐴𝐶 and the 𝑦-axis is parallel to 𝐴𝐹. Now Pythagoras gives 𝐵=

1 (√2, 0, √2√2 + 1) , 2

𝐷=

1 (−√2, 0, √2√2 + 1) . 2

100

Chapter 2. Geometry

Figure 18.4. A rectangular 7-gon.

Letting 𝐸 = (0, 𝑦, 𝑧), the conditions on the length of 𝐴𝐸 (which is √2) and the right angle at 𝐵 (this is (𝐴 − 𝐵) ⋅ (𝐸 − 𝐵) = 0) lead to 𝑦2 + 𝑧2 = 7/4 and 2𝑧√2√2 + 1 = √2 + 3. These are easily solved to give 𝐸=

1 2√7

(0, 2 − 4√2, √16√2 + 13) ,

thus giving the coordinates of all the points in Figure 18.4. If the 𝑦-coordinate of 𝐸 is multiplied by −1, then a second solution arises. It is simple to get similar 𝑛-gons for 𝑛 = 9, 11, 13, . . . by attaching a staircase to the bottom of the heptagon. There are other solutions in the case of 𝑛 = 7. In fact, there are two families of solutions, each family containing a 1-parameter set of solutions. For an animation that shows the two families, see [27]. See also [65], where connections to molecular models are discussed, and [28], where the problem is considered for angles other than right angles. Note that it is an open question to prove that any rectangular regular heptagon belongs to one of the two aforementioned families. Finally, we show that there is no regular pentagon with five right angles. Suppose 𝐴𝐵𝐶𝐷𝐸 is such a pentagon with all sides of unit length. Then any three consecutive vertices form a triangle with sides 1, 1, √2. We may assume 𝐴 = (0, 1, 0), 𝐵 = (0, 0, 0), 𝐶 = (1, 0, 0). Because 𝐶𝐷 ⟂ 𝐵𝐶, 𝐷 must lie in the plane 𝑥 = 1; but |𝐴𝐷| = √2 = |𝐵𝐷|, so 𝐷 must lie in the plane 𝑦 = 1/2 and 𝐷 = (1, 1/2, 𝑑). From |𝐶𝐷| = 1 one gets 𝐷 = (1, 1/2, ±√3/2). Similar reasoning gives 𝐸 = (1/2, 1, ±√3/2). Then |𝐷𝐸| is either √2/2 or √14/2, and not 1. This elegant proof is by Bernard Collignon [122].

19. A Rolling Parabola

101

19 A Rolling Parabola Suppose the parabola is rolled until the point 𝑃 = (𝑥, 𝑥2 ) touches the 𝑥-axis. The arc length 𝐿 of the parabola between the origin and 𝑃 is 𝑥

∫ √1 + 4𝑡2 𝑑𝑡 = 0

1 (2𝑥√1 + 4𝑥2 + sinh−1 (2𝑥)) . 4

We can break down the rolling motion into a rotation followed by a translation. We must rotate enough so that the tangent at 𝑃 becomes horizontal (see Figure 19.2). Because the parabola’s slope at 𝑃 is 2𝑥, the amount of rotation is − tan−1 (2𝑥). Thus, to get the effect of the rolling motion, we translate 𝑃 to the origin, rotate about the origin, and then translate rightward to (𝐿, 0). Therefore the new location of the focus (0, 1/4) is the following, where 𝜃 = tan−1 (2𝑥) and the rotation by −𝜃 is effected by the usual rotation matrix: (

cos 𝜃 − sin 𝜃

sin 𝜃 0 𝑥 𝐿 ) ⋅ [( ) − ( 2 )] + ( ) . cos 𝜃 1/4 𝑥 0

θ

/

Figure 19.2. We must rotate the parabola clockwise so that the tangent at 𝑃 becomes horizontal. Using cos 𝜃 = 1/√4𝑥2 + 1 and sin 𝜃 = 2𝑥/√4𝑥2 + 1, the new location of the focus is (𝑋, 𝑌 ), where √4𝑥2 + 1 sinh−1 (2𝑥) , 𝑌= . 4 4 From the first equation we get 𝑥 = sinh(4𝑋)/2; substituting into the second gives 𝑋=

√sinh2 (4𝑋) + 1 cosh(4𝑋) = , 4 4 which defines a catenary. Figure 19.3 shows the rolling motion and the catenary. This problem appeared in [37] and [17, p. 134]. The methods of this solution are exactly what is needed to show that the road along which a square wheel 𝑌=

102

Chapter 2. Geometry

Figure 19.3. The locus of the focus is the catenary, shown as a dashed curve.

Figure 19.4. When a square rolls on a sequence of catenaries, the center of the square stays on a horizontal line.

rolls smoothly is a series of linked inverted catenaries [106, 124]; see Figure 19.4. Another rolling curiosity related to parabolas (due to Gerson Robison [106]) is that, for the parabola 𝑦 = 𝑥2 − 1/4, the appropriate road along which it will roll so that its focus stays horizontal is 𝑦 = −𝑥2 − 1/4.

20 Rocket Science Take the ground to be the 𝑥𝑦-plane in 3-space. We assume throughout that the rocket height is nonzero (otherwise the angles seen are all 0). An observer at 𝐴 measures the angle 𝜃 to 𝑅, which means that the rocket lies on a right circular cone of inclination 𝜃 centered at 𝐴. Two observers will never be adequate because the intersection of two cones is a curve with varying 𝑧-coordinate. It is a bit surprising that the only general solution is to place the three observers in a straight line. Assume the observers are at 𝑃1 , 𝑃2 , 𝑃3 in a line, in order. We choose the location of the axes and the unit of distance so that their positions are (0, 0, 0), (𝑠, 0, 0), and (1, 0, 0), where 0 < 𝑠 < 1. If the inclination angle measured by the observer at 𝑃𝑖 is 𝜃𝑖 , let 𝑚𝑖 = cot2 (𝜃𝑖 ). Now suppose (𝑥, 𝑦, 𝑧) is a point that is a rocket position

20. Rocket Science

103

/ /

/

/

Figure 20.2. The three observers are the triangle’s vertices. The six circles are the contours for two 𝑧values for each of the three cones determined by the angles to the lower white point. The upper white point represents a rocket that is higher than the one at the lower white point.

consistent with the three measurements. Then 𝑚1 𝑧2 = 𝑥2 + 𝑦2 , 𝑚2 𝑧2 = (𝑥 − 𝑠)2 + 𝑦2 , 𝑚3 𝑧2 = (𝑥 − 1)2 + 𝑦2 . Multiplying the equations by 1 − 𝑠, −1, and 𝑠, respectively, and adding gives ((1 − 𝑠)𝑚1 − 𝑚2 + 𝑠𝑚3 ) 𝑧2 = 𝑠(1 − 𝑠). If the coefficient of 𝑧2 is 0, then there is no solution, contradicting the fact that the rocket’s actual position yields a solution. Therefore the coefficient is nonzero and 𝑧2 has the unique value 𝑠(1 − 𝑠)/((1 − 𝑠)𝑚1 − 𝑚2 + 𝑠𝑚3 ); that is, the rocket’s height is uniquely determined. One can take 𝑠 = 1/2, which gives 𝑧 = 1/√2𝑚1 − 4𝑚2 + 2𝑚3 . Note that if the rocket is not in the 𝑥𝑧-plane, there are two possible locations because if (𝑥, 𝑦, 𝑧) is a solution, so is (𝑥, −𝑦, 𝑧). This problem was raised by Clifford Stoll in the context of real rocket launches and measurements [47]. While one can use more sophisticated instruments to determine the height, Stoll observed that the cost of three protractors is very small. In [47] it is shown that placing the observers on a line is the only way to solve this problem. See Figure 20.2, which shows how two different heights can arise if the three observers are not in a straight line. In that figure the observers are at (0, 0), (1, 0), and (1/2, 7/10) and the rocket could be at either (3/5, 1/2, 1/2) (the lower white point) or (4259/5780, 5489/5780, 37√2/68).

104

Chapter 2. Geometry

21 The Icing on the Cake The solution to (a) is, surprisingly, 𝑓(181∘ ) = 4. Figure 21.2 shows how a sequence of four steps returns the icing to the top when 𝜃 = 190∘ ; the geometry is essentially the same for any 𝜃 such that 180∘ < 𝜃 < 360∘ . Note that in the 190∘ case (also 181∘ ) the final state is not the same as the initial state in terms of every crumb of cake; the blue dot in the figure is at a new point after four steps. Note also that it never happens that all the icing is on the bottom.

Figure 21.2. Here 𝜃 = 190∘ and after four steps the icing is back on top. Four steps suffices for any 𝜃 between 180∘ and 360∘ . The path of the blue dot in the 190∘ case shows that the cake has not returned to its exact initial state. The small wedge containing the blue dot corresponds to the angle 𝛽 of the proof of the general case. Part (b) is most easily handled by finding a formula that works for all 𝜃, the central angle of each piece (measured in radians). The general formula for 𝑓(𝜃) is the following: If 2𝜋/𝜃 is an integer 𝑛, then 𝑓(𝜃) = 2𝑛; otherwise 𝑓(𝜃) = 2𝑛(𝑛+1), where 𝑛 = ⌊2𝜋/𝜃⌋. This means 𝑓(1) = 2 ⋅ 6 ⋅ 7 = 84. As noted, 𝑓 defines the first time the icing returns to the top; this is not the same thing as asking that the entire cake be returned to its initial position. This value is counterintuitive; because 1 is not a rational multiple of 𝜋, most people would think that 𝑓(1) would be infinite. The key to the discrepancy between intuition and truth is the realization that when a piece is inverted, not only are the top and bottom switched, but also left and right are switched. If 2𝜋/𝜃 is an integer 𝑛, then 𝑛 flips put all the icing on the bottom, and 𝑛 more flips returns it all to the top; so 𝑓(𝜃) = 2𝑛. Otherwise let 𝑛 = ⌊2𝜋/𝜃⌋. Then 2𝜋 = 𝑛𝜃 + 𝛼, where 0 < 𝛼 < 𝜃. Let 𝛽 = 𝜃 − 𝛼, so 𝛼 + 𝛽 = 𝜃. Cut 𝑛 consecutive pieces with angle 𝜃 (these are the first 𝑛 pieces to be flipped, leaving a piece with angle 𝛼). Then cut each of the 𝑛 pieces into two pieces of angle 𝛼 and 𝛽 (see Figure 21.3). Reading counterclockwise, you now have pieces of width 𝛼, 𝛽, 𝛼, 𝛽, . . . , 𝛼, 𝛽, 𝛼. (The last 𝛼 is adjacent to the first.) Let 𝐴𝑖 , 𝑖 = 1, 2, . . . , 𝑛 + 1, list the pieces with angle 𝛼, and 𝐵𝑖 , 𝑖 = 1, 2, . . . , 𝑛, the ones with angle 𝛽. You may now discard the knife; no further cutting is necessary. It is easiest to understand the solution if we imagine that the cake is on a rotating cake plate, as is common for true cake icing situations, and we rotate

21. The Icing on the Cake

105

θ

β

α α

Figure 21.3. Here 𝜃 is 1 radian and six pieces have been cut and labeled, as well as the leftover slice 𝐴7 . Here 𝛼 = 2𝜋−6 ≈ 16∘ and 𝛽 = 1−𝛼 = 7−2𝜋 ≈ 41∘ .

the cake plate clockwise through an angle of 𝜃 after each piece is flipped. Thus, instead of moving the cake server counterclockwise to flip the next piece, we keep the server fixed and rotate the cake plate to bring the next piece to be flipped to the location of the server. In the first step, we flip the piece consisting of 𝐴1 and 𝐵1 and then rotate the plate clockwise. Piece 𝐴1 ends up upside down in the original location of piece 𝐴𝑛+1 , and 𝐵1 ends up upside down in the original location of piece 𝐵𝑛 . All other pieces simply rotate clockwise without being flipped, so for 2 ≤ 𝑖 ≤ 𝑛 + 1, 𝐴𝑖 moves to the original location of 𝐴𝑖−1 , and for 2 ≤ 𝑖 ≤ 𝑛, 𝐵𝑖 moves to the original location of 𝐵𝑖−1 . At the end of this operation the cuts are in the same positions they were in originally; the net effect of one step is simply to permute the 𝐴 and 𝐵 pieces, with one of each being flipped. It is now clear that after 𝑛 steps the 𝐵 pieces have completed a full rotation, with each piece being flipped once, so they are back in their original positions upside down, and after another 𝑛 steps they are in their original positions rightside up again. Similarly, it takes 2(𝑛 + 1) steps for all the 𝐴 pieces to return to right-side up, in their original positions. It follows that 𝑓(𝜃) is the least common multiple of 2𝑛 and 2(𝑛+1), which is 2𝑛(𝑛+1). The situation for 1 radian is shown in Figures 21.4 and 21.5.

106

Chapter 2. Geometry

Figure 21.4. The first six steps when 𝜃 = 1; after each step the cake is rotated one radian clockwise.

Figure 21.5. Every sixth step of the first 42 steps for the 1-radian case. Here the 𝐵-icing alternates bottom and top, and so after 42 steps, all the 𝐵-icing is on the bottom. At this point, all the 𝐴-pieces have the icing on the top. So the next 42 steps restore the 𝐵-icing to the top and preserve the 𝐴-icing, completing the icing restoration in 84 steps. This problem appeared as problem 31.2.8.3 in the 1968 Moscow Math Olympiad [87] in a slightly different form. The variant given here is in [132, pp. 111, 115–118].

22 More Cake We assume the notation and results from Problem 21. We will work in degrees throughout; in other words, in the expressions 𝑓(𝜃) and 𝑔(𝜃) we let 𝜃 denote the

22. More Cake

107

number of degrees in the central angle of each cake piece. The derivation in Problem 21 shows that the cake returns to its original state after 𝑓(𝜃) steps if we change the process by rotating the cake plate at each step rather than moving the cake server. That change didn’t matter in Problem 21, since we were concerned only with returning the icing to the top. But it matters in this problem and we must compensate for it. Over the entire process the cake plate was rotated clockwise by 𝜃𝑓(𝜃) degrees, so we need to rotate it counterclockwise by the same amount at the end of the process. Our conclusion is that, if we move the cake server as requested in the problem rather than rotating the cake plate, then after 𝑓(𝜃) steps the cake ends up rotated counterclockwise by 𝜃𝑓(𝜃) degrees from its initial state. So to get back to the initial state, we must repeat the process 𝑘 times, where 𝑘 is the smallest positive integer such that 𝑘𝜃𝑓(𝜃) is a multiple of 360. Because 𝑓(𝜃) is an integer, such a 𝑘 exists if and only if 𝜃 is rational; if 𝜃 is not rational, then the cake will never return to its initial position. Now suppose 𝜃 is an integer between 1 and 360 that does not divide 360. Then as before 𝑓(𝜃) = 2𝑛(𝑛 + 1), where 𝑛 = ⌊360/𝜃⌋. Thus 𝑔(𝜃) = 2𝑛(𝑛 + 1)𝑘, where 𝑘 is the smallest positive integer such that 2𝑛(𝑛 + 1)𝜃𝑘 is a multiple of 360, which means 𝑘 = 360/gcd(2𝑛(𝑛 + 1)𝜃, 360) = 180/gcd(𝑛(𝑛 + 1)𝜃, 180). When 𝜃 = 7, we have 𝑛 = 51 and 𝑘 = 15, so 𝑔 (7) = 2 ⋅ 51 ⋅ 52 ⋅ 15 = 79560, solving the stated problem. More generally, suppose 𝜃 = 𝑝/𝑞, where 𝑝/𝑞 is a rational in lowest terms and 0 < 𝑝/𝑞 < 360. If 360/𝜃 is an integer 𝑛, then the cake returns to the initial state after 2𝑛 steps. Otherwise, by imitating the technique used for 7∘ we can show that the needed number of steps is 2𝑛(𝑛 + 1)𝑘, where 𝑛 = ⌊360/𝜃⌋ and 𝑘 = 180𝑞/gcd(𝑛(𝑛 + 1)𝑝, 180𝑞).

3 Number Theory 23 Power Matching The assertion is true. Two examples of the desired matchings are shown in Figure 23.1. We will prove a more general form of the assertion. Suppose, instead of the set of numbers 1 less than a power of 2, we consider a general target set 𝑇. The next theorem shows that if 𝑇 has certain properties, then the desired matching exists.







































 

 





 



Figure 23.1. Examples of the desired matchings when 𝑛 = 12 (left) and 𝑛 = 18 (right); dashed lines show other pairs that sum to one less than a power of two. 109

110

Chapter 3. Number Theory

Theorem. Suppose 𝑇 is a set of positive integers with the following properties: (1) All elements of 𝑇 are odd. (2) 3 ∈ 𝑇. (3) For all 𝑠 ∈ 𝑇, there is some 𝑡 ∈ 𝑇 such that 𝑠 + 1 ≤ 𝑡 ≤ 2𝑠 + 1. Then for every even positive integer 𝑛, the numbers from 1 to 𝑛 can be paired up so that each pair adds up to an element of 𝑇. Proof. By (strong) induction on 𝑛. The base case, 𝑛 = 2, follows from 1 + 2 = 3 ∈ 𝑇. Now suppose 𝑛 is even, 𝑛 ≥ 4, and the theorem holds for smaller 𝑛. By (2), there is at least one element of 𝑇 that is less than 𝑛. Let 𝑠 be the largest element of 𝑇 that is less than 𝑛. By (3), there is some 𝑡 ∈ 𝑇 with 𝑠 + 1 ≤ 𝑡 ≤ 2𝑠 + 1. Because of the definition of 𝑠, we have 𝑛 ≤ 𝑡; but 𝑛 is even and 𝑡 is odd, so in fact 𝑛 < 𝑡. Therefore 𝑠 + 1 ≤ 𝑛 < 𝑡 ≤ 2𝑠 + 1. Let 𝑚 = 𝑡 − 𝑛, so 𝑚 + 𝑛 = 𝑡. Then 𝑚 ≤ (2𝑠 + 1) − (𝑠 + 1) = 𝑠 < 𝑛, so we can pair 𝑚 with 𝑛. And because 𝑡 is odd, we can pair 𝑚 + 1 with 𝑛 − 1, 𝑚 + 2 with 𝑛 − 2, and so on up to ((𝑡 − 1)/2, (𝑡 − 1)/2 + 1), whose sum is 𝑡. This exhausts the interval [𝑚, 𝑛]. Because 𝑡 is odd and 𝑛 is even, 𝑚 − 1 is even and we finish by applying the inductive hypothesis to 𝑚 − 1 in the case that 𝑚 > 1. This solves the given problem because the three conditions hold for the target set; (3) holds because 2 ⋅ (2𝑞 − 1) + 1 = 2𝑞+1 − 1 is the next element of the target set after 2𝑞 − 1. There is also a version of this problem for odd 𝑛, but there the underlying set is taken to be {0, 1, 2, . . . , 𝑛} and the pairing must match 0 to one of the other numbers. The theorem holds in that case too, provided condition (2) is changed to 1 ∈ 𝑇. The proof is essentially the same. The matchings as in the problem are unique, in both the even and odd cases. The proof is by induction. Using 𝑥′ for the integer that gets matched to 𝑥, there is no choice for 𝑛′ . To prove this, let 𝑞 be the smallest integer such that 𝑛 ≤ 2𝑞 − 1. Then 2𝑞−1 − 1 < 𝑛 ≤ 𝑛 + 𝑛′ < 2𝑛 ≤ 2 (2𝑞 − 1) = 2𝑞+1 − 2 < 2𝑞+1 − 1. Because 𝑛 + 𝑛′ is in the target set, the only possibility is 𝑛 + 𝑛′ = 2𝑞 − 1, so 𝑛′ = 2𝑞 − 1 − 𝑛. Similarly there is no choice for 𝑥′ for any 𝑥 between 𝑛′ and 𝑛. Now we are left with the integers up to 𝑛′ − 1 and the induction hypothesis implies uniqueness for the matching of those. The base case is either 1 + 2 = 3 or 0 + 1 = 1. The theorem applies to various other target sets. For example, 𝑇 could be the set of numbers of the form 2𝑞 + 1. A more interesting example arises by letting 𝑇 be the set of odd primes (adding 1 to the target set in the odd case). Then, as first proved in [80, p. 78], the Bertrand–Chebyshev theorem that for any integer 𝑚 there is always a prime 𝑝 such that 𝑚 < 𝑝 < 2𝑚 yields condition (3) of the theorem, and so the matchings exist for any 𝑛. When the target set is the set of squares, the problem was resolved in [66]. Matchings exist in all cases except 𝑛 = 2, 4, 6, 10, 11, 12, 20, 22; this is proved by induction in [66].

25. The Mysterious Seventeenth Divisor

111

For investigating problems about matchings, the famous blossom algorithm is an important tool. This is an extremely fast method that determines the largest matching (set of pairwise disjoint edges) in any graph. It is included in Mathematica as the FindIndependentEdgeSet function.

24 Triplets The only numbers that are not triplets are 1, 2, 3, 4, 5, 6, 8, 12, and 24. Observe first that every odd 𝑛 with 𝑛 ≥ 7 is a triplet by 𝑛 = 1 + 2 + (𝑛 − 3). And if 𝑛 is a triplet by 𝑎, 𝑏, 𝑐, then 2𝑛 is a triplet by 2𝑎, 2𝑏, 2𝑐. For numbers up to 24 this leaves only 1, 2, 3, 4, 5, 6, 8, 10, 12, 16, 20, 24. One can check that these are nontriplets except for 10 = 1 + 3 + 6, 16 = 1 + 5 + 10, and 20 = 2 + 6 + 12. Checking all but 24 is easy; for 24 the largest summand must be composite and larger than 12, so must be one of 14, 15, 16, 18, 20, 21, or 22. But checking the divisors of these for the middle summand shows there is no triplet representation. Note that 48 is a triplet by 3 + 9 + 36. Now, beyond 24, we can treat 48 as a special case and then call on the odd and even results to prove by induction that all integers beyond 24 are triplets. So there are only nine nontriplets. This solution is due to Erfan Azer. This problem appeared on the Indian National Olympiad in 2011.

25 The Mysterious Seventeenth Divisor We need this fact: For any Pythagorean triple, at least one of the three is divisible by 3, at least one is divisible by 4, and at least one is divisible by 5. This uses the well-known representation of triples as (2𝑚𝑛, 𝑚2 − 𝑛2 , 𝑚2 + 𝑛2 ), where 𝑚 and 𝑛 are positive integers and 𝑚 > 𝑛. For 3, if 𝑚 or 𝑛 is divisible by 3, then so is 2𝑚𝑛; otherwise the squares are 1 (mod 3) and the middle term is 0 (mod 3). We leave the other two cases as exercises. For our problem, this means that 𝑋 is divisible by 60. Hence the divisors of 𝑋 include 1, 2, 3, 4, 5, 6, 10, 12, 15, and 20. Therefore 𝑑7 must be one of 10, 9, 8, or 7. We will show that the first three cannot occur. 𝑑7 = 10: We have (𝑑16 − 𝑑15 )(𝑑16 + 𝑑15 ) = 𝑑72 = 100. The factors 𝑑16 − 𝑑15 and 𝑑16 + 𝑑15 have the same parity and so must be 2 and 50, respectively, which means 𝑑15 = 24. But then 8 divides 𝑋, contradicting 𝑑7 = 10. 𝑑7 = 9: We have 𝑑16 + 𝑑15 ≥ 16 + 15 = 31, and from (𝑑16 − 𝑑15 )(𝑑16 + 𝑑15 ) = 𝑑72 = 81 we get that 𝑑15 + 𝑑16 divides 81, so the two factors must be 1 and 81. But then 𝑑15 = 40 and 8 divides 𝑋, contradicting 𝑑7 = 9. 𝑑7 = 8: Because 7 does not divide 𝑋, 𝑑15 ≥ 16 and 𝑑16 ≥ 17. So 𝑑15 +𝑑16 ≥ 33. But then (𝑑16 − 𝑑15 )(𝑑16 + 𝑑15 ) = 64 implies that the two factors are 1 and 64, which is impossible as they must have the same parity. So we have proved that 𝑑7 = 7. This means that (𝑑16 − 𝑑15 )(𝑑16 + 𝑑15 ) = 49; the factors must be 1 and 49, from which we get 𝑑15 = 24 and 𝑑16 = 25. So now

112

Chapter 3. Number Theory

the divisor set includes: 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 15, 20, 21, 24, 25. If any of 9, 11, 13, 16, 17, 18, 19, 22, or 23 divided 𝑋, 𝑑15 could not be 24. And 26 and 27 cannot be divisors (because 13 and 9 are not). So we know the divisor sequence starts with 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 15, 20, 21, 24, 25, 28 and 𝑑17 = 28. The smallest example is the least common multiple of the known divisors, which is 4200. This problem appeared on the Indian Mathematical Olympiad Team Selection Test in 2006.

26 True or False? One way to begin investigating this problem is to check more values of 𝑛. If you check all 𝑛 up to 1000, or up to 10000, you will find that 𝑛3 + 10 and (𝑛 + 2)3 − 9 are always relatively prime, and this might lead you to guess that the statement is true. In fact, it is false, but the smallest counterexample is 𝑛 = 19583. To see why, we’ll determine gcd(𝑛3 + 10, (𝑛 + 2)3 − 9) for all values of 𝑛. We begin with the fact that (210𝑛2 + 1032𝑛 + 1993)(𝑛3 + 10) − (210𝑛2 − 228𝑛 + 841)((𝑛 + 2)3 − 9) = 20771. (26.1) We’ll see later how one might discover this equation, but for the moment we simply observe that it is easy to verify that it is true. It follows that for any 𝑛, if a positive integer divides both 𝑛3 + 10 and (𝑛 + 2)3 − 9, then it must divide 20771. But 20771 is prime, so its only divisors are 1 and itself. Therefore the only possible values for gcd(𝑛3 + 10, (𝑛 + 2)3 − 9) are 1 and 20771. If 20771 divides both 𝑛3 + 10 and (𝑛 + 2)3 − 9, then their gcd is 20771, and if not, then they are relatively prime. The only remaining question is whether there are any values of 𝑛 for which 𝑛3 + 10 and (𝑛 + 2)3 − 9 are both divisible by 20771. Notice that if 𝑛1 ≡ 𝑛2 (mod 20771), then 𝑛31 + 10 ≡ 𝑛32 + 10 (mod 20771) and (𝑛1 + 2)3 − 9 ≡ (𝑛2 + 2)3 − 9 (mod 20771). Therefore we need only check integers from 1 to 20771. A computer check shows that the only value of 𝑛 in this range for which 𝑛3 + 10 and (𝑛 + 2)3 − 9 are both divisible by 20771 is 19583. We conclude that for every positive integer 𝑛, if 𝑛 ≡ 19583 (mod 20771), then gcd(𝑛3 + 10, (𝑛 + 2)3 − 9) = 20771, and otherwise gcd(𝑛3 + 10, (𝑛 + 2)3 − 9) = 1. How might one discover equation (26.1)? One approach is to use the Euclidean algorithm to find the greatest common divisor (or gcd) of the two polynomials 𝑛3 + 10 and (𝑛 + 2)3 − 9. The gcd of two polynomials (with rational coefficients) is the monic polynomial of maximum degree that divides both of the polynomials. It can be computed by using the Euclidean algorithm, which also produces an expression for the gcd as a linear combination of the two polynomials. In the case of our polynomials 𝑛3 + 10 and (𝑛 + 2)3 − 9, the gcd is the

27. An Exponential Diophantine Problem

113

constant polynomial 1, and the Euclidean algorithm produces the equation (

210𝑛2 + 1032𝑛 + 1993 210𝑛2 − 228𝑛 + 841 ) ⋅ (𝑛3 + 10) − ( ) ⋅ ((𝑛 + 2)3 − 9) = 1. 20771 20771

Multiplying through by 20771 to clear the denominators gives (26.1). (The number 20771 is the resultant of the polynomials (𝑛 + 2)3 − 9 and 𝑛3 + 10.) The Euclidean algorithm could also be used to compute our smallest counterexample 19583. Since 20771 is prime, the integers mod 20771 form a field 𝐹20771 . We can regard the polynomials 𝑛3 + 10 and (𝑛 + 2)3 − 9 as elements of the ring 𝐹20771 [𝑛] of polynomials with coefficients in this field, and use the Euclidean algorithm to find the gcd of these polynomials in 𝐹20771 [𝑛]. This calculation shows that the gcd is 𝑛 − 19583, and therefore 𝑛3 + 10 ≡ (𝑛 + 2)3 − 9 ≡ 0 (mod 20771) if and only if 𝑛 ≡ 19583 (mod 20771).

27 An Exponential Diophantine Problem We will find all positive integer solutions to the equation. Suppose 𝑥 and 𝑦 are positive integers and 𝑥𝑥−𝑦 = 𝑦𝑥+𝑦 . Let 𝑝 be a prime number that divides 𝑦. Then 𝑝 ∣ 𝑦𝑥+𝑦 , so 𝑝 ∣ 𝑥𝑥−𝑦 , and therefore 𝑝 ∣ 𝑥. Let 𝑖 and 𝑗 be the exponents of 𝑝 in the prime factorizations of 𝑥 and 𝑦, respectively. Then equating the exponents of 𝑝 in 𝑥𝑥−𝑦 and 𝑦𝑥+𝑦 we get 𝑖(𝑥 − 𝑦) = 𝑗(𝑥 + 𝑦), so 𝑖 > 𝑗. This holds for every prime 𝑝 that divides 𝑦, so 𝑦 ∣ 𝑥. Thus, we may write 𝑥 = 𝑚𝑦 for some positive integer 𝑚. Substituting into the equation 𝑥𝑥−𝑦 = 𝑦𝑥+𝑦 we get (𝑚𝑦)(𝑚−1)𝑦 = 𝑦(𝑚+1)𝑦 . Therefore (𝑚𝑦)𝑚−1 = 𝑦𝑚+1 , so 𝑚𝑚−1 = 𝑦2 . There are two ways that 𝑚𝑚−1 can be a square: either 𝑚 is odd or 𝑚 is a square. This will give us two infinite families of solutions to the equation. Consider first the case in which 𝑚 is odd; say 𝑚 = 2𝑛 − 1. Then 𝑦 = 𝑚(𝑚−1)/2 = (2𝑛 − 1)𝑛−1 and 𝑥 = 𝑚𝑦 = (2𝑛 − 1)𝑛 . It is easy to verify that for every positive integer 𝑛 these formulas give a solution to the equation; we have 𝑥 − 𝑦 = (2𝑛−1)𝑛 −(2𝑛−1)𝑛−1 = 2(𝑛−1)(2𝑛−1)𝑛−1 and 𝑥+𝑦 = (2𝑛−1)𝑛 +(2𝑛−1)𝑛−1 = 2𝑛(2𝑛 − 1)𝑛−1 , so 2(𝑛−1)(2𝑛−1)𝑛−1

𝑥𝑥−𝑦 = ((2𝑛 − 1)𝑛 )

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

2𝑛(2𝑛−1)𝑛−1

= 𝑦𝑥+𝑦 .

The second possibility is that 𝑚 is a square; say 𝑚 = 𝑛2 . Then 𝑦 = 𝑚(𝑚−1)/2 = 2 𝑛 and 𝑥 = 𝑚𝑦 = 𝑛𝑛 +1 . Once again, for every positive integer 𝑛 these 2 2 2 formulas give a solution, since 𝑥 − 𝑦 = 𝑛𝑛 +1 − 𝑛𝑛 −1 = (𝑛2 − 1)𝑛𝑛 −1 and 2 2 2 𝑥 + 𝑦 = 𝑛𝑛 +1 + 𝑛𝑛 −1 = (𝑛2 + 1)𝑛𝑛 −1 , and therefore 𝑛2 −1

𝑥

𝑥−𝑦

𝑛2 +1

= (𝑛

(𝑛2 −1)𝑛𝑛

)

2 −1

𝑛2 −1

= (𝑛

(𝑛2 +1)𝑛𝑛

)

2 −1

= 𝑦𝑥+𝑦 .

114

Chapter 3. Number Theory

28 A Prime Characterization First note that if 1/𝑗 − 1/𝑘 = 1/𝑛, then 1/𝑗 > 1/𝑛, so 𝑗 < 𝑛. It follows that if 𝑛 = 1, then there can be no positive integer solutions for 𝑗 and 𝑘. For 𝑛 ≥ 2, it is easy to verify that 𝑗 = 𝑛 − 1, 𝑘 = 𝑛(𝑛 − 1) is a solution. If 𝑛 = 𝑎𝑏, where 1 < 𝑎, 𝑏 < 𝑛, then 𝑗 = 𝑎(𝑏 − 1), 𝑘 = 𝑎𝑏(𝑏 − 1) also works, so 𝑗 and 𝑘 are not unique. Now suppose 𝑛 is prime and 1/𝑗 − 1/𝑘 = 1/𝑛. Then 𝑛(𝑘 − 𝑗) = 𝑗𝑘, so 𝑛 ∣ 𝑗𝑘, and since 𝑛 is prime, it follows that either 𝑛 ∣ 𝑗 or 𝑛 ∣ 𝑘. But we have already observed that 𝑗 < 𝑛, so we must have 𝑛 ∣ 𝑘. Say 𝑘 = 𝑛𝑎. Then 𝑛(𝑛𝑎 − 𝑗) = 𝑗𝑛𝑎 and 𝑛𝑎 − 𝑗 = 𝑗𝑎, so (𝑎 + 1)(𝑛 − 𝑗) = 𝑛. But since 𝑛 is prime, this can happen only if 𝑎 + 1 = 𝑛 and 𝑛 − 𝑗 = 1. Therefore 𝑗 = 𝑛 − 1 and 𝑘 = 𝑛𝑎 = 𝑛(𝑛 − 1), so our original solution was unique. This problem appeared on the 12th University of Michigan Undergraduate Mathematics Competition in 1995.

29 Two Sums and Many Differences (a) The answer is yes for any even integer 𝑛 used in place of 100. Suppose {𝑎𝑖 } and {𝑏𝑖 } are two sorted sets of 𝑛 distinct real numbers (𝑛 even) with the same sum, sum of squares, and differences as in the problem statement. We may assume 𝑏2 ≥ 𝑎2 . The assertion about differences easily yields constants 𝑟 and 𝑞, with 𝑟 ≥ 0, so that 𝑏𝑖 − 𝑎𝑖 = 𝑟 whenever 𝑖 is even, and 𝑏𝑖 − 𝑎𝑖 = 𝑞 whenever 𝑖 is odd. This yields that 0 = ∑𝑖 𝑏𝑖 − ∑𝑖 𝑎𝑖 = (𝑛/2)𝑟 + (𝑛/2)𝑞, whence 𝑞 = −𝑟. From the sum of squares, one gets 0 = ∑ 𝑏𝑖2 − ∑ 𝑎2𝑖 𝑖

𝑖 2

2

= (𝑎1 − 𝑟) + (𝑎3 − 𝑟) + ⋯ + (𝑎𝑛−1 − 𝑟) 2

2

2 2

+ (𝑎2 + 𝑟) + (𝑎4 + 𝑟) + ⋯ + (𝑎𝑛 + 𝑟) − ∑ 𝑎2𝑖 , 𝑖

which simplifies to 0 = 𝑛𝑟2 + 2𝑟 (−𝑎1 − 𝑎3 − ⋯ − 𝑎𝑛−1 + 𝑎2 + 𝑎4 + ⋯ + 𝑎𝑛 ) . Suppose 𝑟 > 0. Then 𝑛𝑟 + 2 (−𝑎1 − 𝑎3 − ⋯ − 𝑎𝑛−1 + 𝑎2 + 𝑎4 + ⋯ + 𝑎𝑛 ) = 0. Therefore 𝑟 = (−2/𝑛) (𝑎2 − 𝑎1 + 𝑎4 − 𝑎3 + ⋯ + 𝑎𝑛 − 𝑎𝑛−1 ) which, by the sorted hypothesis, is negative, a contradiction. Therefore 𝑟 = 0, and also 𝑞 = −𝑟 = 0, so 𝑎𝑖 = 𝑏𝑖 for each 𝑖 and there is only one solution. To find the solution Bob first solves the rank 𝑛 − 1 linear system using the sum and differences. This will have one free variable, the value of which can be

29. Two Sums and Many Differences

115

found from the square-sum equation. There might be two solutions for that, but the proof that the numbers are recoverable means that only one of them will give a sorted list. (b) The answer is no for any odd 𝑛 ≥ 3 used in place of 101. To see why, we imitate the algebra from part (a). We seek two 𝑛-sets {𝑎𝑖 }, {𝑏𝑖 }, in sorted order, with the same sum, sum of squares, and differences, and with 𝑏2 ≥ 𝑎2 . As in part (a), to get the differences to match we must have constants 𝑟 ≥ 0 and 𝑞 with 𝑏𝑖 − 𝑎𝑖 = 𝑟 whenever 𝑖 is even and 𝑏𝑖 − 𝑎𝑖 = 𝑞 whenever 𝑖 is odd. To get the sums to match, we need 𝑛−1 𝑛+1 𝑟+ 𝑞, 0 = ∑ (𝑏𝑖 − 𝑎𝑖 ) = 2 2 𝑖 so

𝑛−1 𝑟. 𝑛+1 To deal with the sums of squares, it will be convenient to introduce some new notation. Let 𝑚1 be the average of the odd-indexed 𝑎𝑖 , and let 𝑚2 be the average of the even-indexed 𝑎𝑖 ; let Δ = 𝑚2 − 𝑚1 . To get the sums of squares to match, we need 𝑞=−

0 = ∑ 𝑏𝑖2 − ∑ 𝑎2𝑖 = ∑ (𝑎𝑖 + 𝑞)2 + ∑ (𝑎𝑖 + 𝑟)2 − ∑ 𝑎2𝑖 𝑖

𝑖

𝑖 odd

𝑖 even

𝑖

= 2𝑞 ∑ 𝑎𝑖 + 2𝑟 ∑ 𝑎𝑖 + ∑ 𝑞2 + ∑ 𝑟2 𝑖 odd

𝑖 even

𝑖 odd

𝑖 even

𝑛+1 2 𝑛−1 2 = 𝑞(𝑛 + 1)𝑚1 + 𝑟(𝑛 − 1)𝑚2 + 𝑞 + 𝑟 . 2 2 Solving this last equation after replacing 𝑞 by −[(𝑛 − 1)/(𝑛 + 1)]𝑟 yields 𝑟=−

𝑛+1 Δ, 𝑛

and then

𝑛−1 Δ. 𝑛 Using similar notation, our conclusion in part (a) could have been phrased 𝑞=

as 𝑎2 + 𝑎4 + ⋯ + 𝑎𝑛 𝑎1 + 𝑎3 + ⋯ + 𝑎𝑛−1 − ) = −(𝑚2 − 𝑚1 ) = −Δ. 𝑛/2 𝑛/2 For even 𝑛, Δ is always positive, which leads to the contradiction 𝑟 < 0 in part (a). But when 𝑛 is odd, Δ can be positive, negative, or 0. We can get a solution for odd 𝑛 by choosing Δ negative and relatively small; making Δ small will make 𝑟 and 𝑞 small, which will ensure that the 𝑏𝑖 list will be ordered properly. One approach is to start with 𝑎𝑖 = 𝑖, which gives Δ = 0, and then make a small adjustment to get a negative Δ. We define 𝑎𝑖 to be 𝑖 for 1 ≤ 𝑖 ≤ 𝑛 − 1, but let 𝑎𝑛 = 𝑛 + 1/2. For this set, Δ = −1/(𝑛 + 1), so we use 𝑟 = 1/𝑛 and 𝑟 = −(

116

Chapter 3. Number Theory

𝑞 = −(𝑛 − 1)/(𝑛(𝑛 + 1)). These values determine numbers 𝑏𝑖 with the same differences, sum, and sum of squares as the 𝑎𝑖 . We must also verify that the 𝑏𝑖 are strictly increasing. This follows from 𝑎𝑖+1 −𝑎𝑖 ≥ 1 and |𝑟|+|𝑞| = 2/(𝑛+1) < 1. This method shows that when 𝑛 is odd (and 𝑛 ≥ 3), {1, 2, 3, . . . , 𝑛 − 1, 𝑛 + 1/2} is never uniquely recoverable from the 𝑛 parameters in the problem. For example, if 𝑛 = 5 these parameters are the same for the sets {1, 2, 3, 4, 11/2} and {13/15, 11/5, 43/15, 21/5, 161/30}, where the latter is {1, 2, 3, 4, 11/2}+{−2/15, 1/5, −2/15, 1/5, −2/15}. This problem is due to Dirk Laurie, Stellenbosch Univ., South Africa.

30 Reciprocals to Squares Multiply the given equation by 𝑎𝑏𝑐 to get 𝑏𝑐 + 𝑎𝑐 = 𝑎𝑏.

(30.1)

Let 𝑢 = gcd(𝑎, 𝑏), 𝑣 = gcd(𝑎, 𝑐), and 𝑤 = gcd(𝑏, 𝑐). Then the assumption about no common factor means that 𝑢, 𝑣, and 𝑤 are pairwise relatively prime. If 𝑝𝑟 is a prime power divisor of 𝑎, then (30.1) implies that 𝑝𝑟 divides 𝑏𝑐. But because 𝑎, 𝑏, and 𝑐 have no common factor, 𝑝 cannot be a factor of both 𝑏 and 𝑐. Therefore either 𝑝𝑟 divides 𝑏 or 𝑝𝑟 divides 𝑐. It follows that either 𝑝𝑟 divides 𝑢 or 𝑝𝑟 divides 𝑣, so 𝑝𝑟 divides 𝑢𝑣. Conversely, if 𝑝𝑟 divides 𝑢𝑣, then, because 𝑢 and 𝑣 are relatively prime, either 𝑝𝑟 divides 𝑢 or 𝑝𝑟 divides 𝑣, so 𝑝𝑟 divides 𝑎. Therefore 𝑎 = 𝑢𝑣. The same argument applied to a prime power divisor of 𝑏 yields 𝑏 = 𝑢𝑤, and the same argument one more time shows that 𝑐 = 𝑣𝑤. Using (30.1) we find: 𝑢𝑣𝑤2 + 𝑢𝑣2 𝑤 = 𝑢2 𝑣𝑤. Divide by 𝑢𝑣𝑤 to get 𝑤 + 𝑣 = 𝑢. Therefore 𝑎 + 𝑏 = 𝑢𝑣 + 𝑢𝑤 = 𝑢(𝑣 + 𝑤) = 𝑢2 , 𝑎 − 𝑐 = 𝑣(𝑢 − 𝑤) = 𝑣2 , 𝑏 − 𝑐 = 𝑤(𝑢 − 𝑣) = 𝑤2 . Note that this simple analysis gives a characterization of all solutions of the equation 1/𝑎 + 1/𝑏 = 1/𝑐 in positive integers 𝑎, 𝑏, 𝑐 with gcd(𝑎, 𝑏, 𝑐) = 1. Namely, the solutions correspond exactly to pairs of coprime positive integers 𝑣 and 𝑤; given such a pair, one lets 𝑎 = 𝑣(𝑣 + 𝑤), 𝑏 = 𝑤(𝑣 + 𝑤), and 𝑐 = 𝑣𝑤. For example 𝑣 = 3, 𝑤 = 7 yields 𝑎 = 30, 𝑏 = 70, and 𝑐 = 21: 1/30 + 1/70 = 1/21. A related question relates to the harmonic mean; recall that the harmonic mean of 𝑎 and 𝑏 is 2/(1/𝑎 + 1/𝑏). Which pairs of positive integers have an integer as their harmonic mean? It is not hard to see that a positive integer pair 𝐴, 𝐵 has an integer harmonic mean if and only if there is a positive integer 𝑘 and a pair (𝑎, 𝑏) arising from a triple in this problem such that (2𝐴, 2𝐵) = (𝑘𝑎, 𝑘𝑏). This problem is due to Glenn Engebretsen [39].

31. Nondivisibility by 11

117

Table 31.1. The first 13 solutions having an even number of digits, including leading zeros. 𝑁 12 12 12 12 12 12 12 12 12 12 34 34 34

solution 090909090909 181818181818 272727272727 363636363636 454545454545 545454545454 636363636363 727272727272 818181818181 909090909090 0909090909090909090909090909090909 1818181818181818181818181818181818 2727272727272727272727272727272727

31 Nondivisibility by 11 This solution is by Jim and John Guilford. Suppose 𝑥 is an 𝑁-digit number, and let 𝑥 ≡ 𝑏 (mod 11), where 0 ≤ 𝑏 ≤ 10. Let (𝑝𝑖 ) and (𝑛𝑖 ) be the odd and even digits counting from the right (so 𝑝1 is the units digit and 𝑛1 is the tens digit). Then, because powers of 10 alternate ±1 (mod 11), 𝑏 ≡ 𝑥 ≡ ∑𝑖 𝑝𝑖 − ∑𝑖 𝑛𝑖 (mod 11). Consider the result of changing one of the digits. If any 𝑝𝑖 ≥ 𝑏, then we can replace one such 𝑝𝑖 by 𝑝𝑖 − 𝑏 to get a number divisible by 11. If any 𝑝𝑖 ≤ 𝑏 − 2, we can replace one such 𝑝𝑖 by 𝑝𝑖 + 11 − 𝑏 to again get a number divisible by 11. Thus, if 𝑥 is to have the property in the problem, then the only possibility for any 𝑝𝑖 is 𝑏 − 1, which rules out 𝑏 = 0. Furthermore, if every 𝑝𝑖 is 𝑏 − 1, then no change in a 𝑝𝑖 will result in a number divisible by 11. A similar argument shows that each 𝑛𝑖 must be 10 − 𝑏, and with this value no change in any 𝑛𝑖 will lead to a number divisible by 11. Note that 𝑝𝑖 + 𝑛𝑗 = 9 for any 𝑖 and 𝑗. Suppose that 𝑁 is even; say 𝑁 = 2𝑚. Then we must have 𝑏 ≡ ∑𝑖 𝑝𝑖 −∑𝑖 𝑛𝑖 = 𝑚(𝑏−1−(10−𝑏)) ≡ 2𝑚𝑏 (mod 11). This is equivalent to (2𝑚−1)𝑏 ≡ 0 (mod 11). Because 1 ≤ 𝑏 ≤ 10, 2𝑚 − 1 must be divisible by 11. Say 2𝑚 − 1 = 11𝑦; it follows that 𝑦 is odd. So the possibilities for 𝑁 are 12, 34, 56, 78, . . . and the digits can be any pair summing to 9. This gives the complete solution set as in Table 31.1. Note that a leading 0 gives a true digit count that is odd; 181818181818 is therefore the smallest solution to the problem. We can also solve the problem for odd digit counts. Suppose 𝑁 = 2𝑚 + 1. Then there is an additional digit 𝑏−1 and 𝑏 ≡ 2𝑚𝑏+𝑏−1 (mod 11). This means 2𝑚𝑏 ≡ 1 (mod 11), so 𝑏 is the mod-11 inverse of 2𝑚 and 2𝑚 is not divisible by

118

Chapter 3. Number Theory Table 31.2. The first 13 solutions having an odd number of digits, including leading zeros.

𝑁

𝑚

3 5 7 9 11 13 15 17 19 21 25 27 29

1 2 3 4 5 6 7 8 9 10 12 13 14

2𝑚 (mod 11) 2 4 6 8 10 1 3 5 7 9 2 4 6

𝑏 = (2𝑚)−1 (mod 11) 6 3 2 7 10 1 4 9 8 5 6 3 2

𝑏−1 5 2 1 6 9 0 3 8 7 4 5 2 1

solution 545 27272 1818181 636363636 90909090909 0909090909090 363636363636363 81818181818181818 7272727272727272727 454545454545454545454 5454545454545454545454545 272727272727272727272727272 18181818181818181818181818181

11. So in this case the digits in a solution depend on the length of the number and the pattern is shown in Table 31.2, where again a leading 0 means that the number-length is really even. This problem is due to Mike Boshernitzan and appeared in [18, Spring 2017, problem 2].

32 Equally Powerful Splits Let [𝑛] denote {1, . . . , 𝑛} and say that 𝑛 is 𝑘-equipowerful if there is a splitting of [𝑛] into two sets such that the power sums for exponents 0 to 𝑘 inclusive are equal (the sets are called 𝑘-equipowerful for 𝑛 when this happens). For 𝐴 ⊆ [𝑛], we use 𝐴𝑐𝑛 for [𝑛] ⧵ 𝐴, the complement of 𝐴 in [𝑛]. For any real number 𝑠, 𝑠 + 𝐴 denotes {𝑠 + 𝑎 ∶ 𝑎 ∈ 𝐴} (similarly for 𝑠 − 𝐴). The 3-equipowerful numbers are those 𝑛 such that 𝑛 ≥ 16 and 𝑛 is a multiple of 8. We first show that the divisibility condition is essential. The 0th power equality means that 𝑛 is even, say 𝑛 = 2𝑞. Then for the sums of first powers to be equal, the sum of all the integers in [𝑛], 2𝑞(2𝑞 + 1)/2, must be even. But then 𝑞 is even, so 𝑛 is divisible by 4. Now, suppose 𝐴 is 3-equipowerful for 𝑛. Then we also have ∑𝑎∈𝐴 (𝑎3 − 𝑎) equaling the same for 𝐴𝑐𝑛 . But 𝑦3 − 𝑦 ≡ 2 (mod 4) when 𝑦 ≡ 2 (mod 4) and is 0 in the other three cases. Therefore [𝑛] must contain an even number of these 2mod-4 numbers, because each of 𝐴 and 𝐴𝑐𝑛 must contain the same parity of these

32. Equally Powerful Splits

119

numbers. When 𝑛/4 is odd, there are an odd number of these less than or equal to 𝑛. Therefore 𝑛/4 must be even and so 8 divides 𝑛. A check of the 35 quadruples from [8] that contain 1 shows that 8 is not 3-equipowerful. So the only possibilities for 𝑛 are 16, 24, 32, 40, . . . . It takes only a couple of seconds for a computer search to find a 3-equipowerful subset of [24]: 𝐴 = {1, 3, 7, 8, 9, 11, 14, 16, 17, 18, 22, 24}. We will next show that all the possibilities just given are 3-equipowerful. The key is showing that if 𝑛 is 3-equipowerful, then so is 𝑛 + 16. We will do 𝑘 this via some general rules. We use the notation 𝐴 = 𝐵 to mean that ∑𝑎∈𝐴 𝑎𝑖 = ∑𝑏∈𝐵 𝑏𝑖 for 𝑖 = 0, 1, . . . , 𝑘. 𝑘

Polynomial Rule. If 𝐴 = 𝐵 and 𝑝 is a polynomial of degree at most 𝑘, then ∑𝑎∈𝐴 𝑝(𝑎) = ∑𝑏∈𝐵 𝑝(𝑏). Proof. Apply the power-sum identity to each term of the polynomial. 𝑘

𝑘

Shift Rule. If 𝐴 = 𝐵 and 𝑠 ∈ ℝ, then 𝑠 + 𝐴 = 𝑠 + 𝐵. Proof. Suppose 0 ≤ 𝑗 ≤ 𝑘 and let 𝑝(𝑥) = (𝑠 + 𝑥)𝑗 . Then ∑ 𝑎𝑗 = ∑ 𝑝(𝑎) = ∑ 𝑝(𝑏) = ∑ 𝑏𝑗 . 𝑎∈𝑠+𝐴

𝑎∈𝐴

𝑏∈𝐵

𝑏∈𝑠+𝐵 𝑘

Union Rule. Suppose 𝐴1 and 𝐴2 are disjoint, and 𝐵1 and 𝐵2 are disjoint. If 𝐴1 =𝐵1 𝑘 𝑘 and 𝐴2 = 𝐵2 , then 𝐴1 ∪ 𝐴2 = 𝐵1 ∪ 𝐵2 . Proof. The proof of this is straightforward. Addition Rule. If 𝑛 and 𝑚 are 𝑘-equipowerful, then so is 𝑛 + 𝑚. Proof. Let 𝐴 be 𝑘-equipowerful for 𝑛, and let 𝐵 be 𝑘-equipowerful for 𝑚. Then 𝑘 𝑘 𝑘 𝑐 𝑐 𝐴 = 𝐴𝑐𝑛 and 𝐵 = 𝐵𝑚 . By the shift rule, 𝑛 + 𝐵 = 𝑛 + 𝐵𝑚 . Therefore by the union rule, 𝑘 𝑘 𝑐 𝑐 𝐴 ∪ (𝑛 + 𝐵) = 𝐴𝑐𝑛 ∪ (𝑛 + 𝐵𝑚 ). So if we let 𝐶 = 𝐴 ∪ (𝑛 + 𝐵), then 𝐶 = 𝐶𝑛+𝑚 . Now starting from 16 and 24 and repeatedly using the addition rule to add 16 gives all multiples of 8 (except 8). That is, let 𝐴16 and 𝐴24 be the 3-equipowerful sets for 16 and 24 already found, and define 𝐴𝑛 inductively by 𝐴𝑛 = 𝐴𝑛−16 ∪ ((𝑛 − 16) + 𝐴16 ). For example, 𝐴32 = {1, 4, 6, 7, 10, 11, 13, 16, 17, 20, 22, 23, 26, 27, 29, 32}, showing that 32 is 3-equipowerful. This completes the solution for 3-equipowerful numbers. There are some other construction rules that are useful in an investigation of higher powers. The rules below show how a 𝑘-equipowerful set can be turned into one that is (𝑘 + 1)-equipowerful.

120

Chapter 3. Number Theory

Doubling Rule. If 𝐴 is 𝑘-equipowerful for 𝑛, then 𝐵 = 𝐴 ∪ (𝑛 + 𝐴𝑐𝑛 ) is (𝑘 + 1)equipowerful for 2𝑛. Proof. The proof of the addition rule shows that 𝐵 is 𝑘-equipowerful for 2𝑛. For the additional power, let 𝑝(𝑥) = (𝑛 + 𝑥)𝑘+1 − 𝑥𝑘+1 , a polynomial of degree 𝑘. Then (𝑛 + 𝑥)𝑘+1 = 𝑥𝑘+1 + 𝑝(𝑥), so ∑ 𝑏𝑘+1 = ∑ 𝑎𝑘+1 + ∑ (𝑛 + 𝑎)𝑘+1 𝑏∈𝐵

𝑎∈𝐴𝑐𝑛

𝑎∈𝐴

= ∑ 𝑎𝑘+1 + ∑ 𝑎𝑘+1 + ∑ 𝑝(𝑎) 𝑎∈𝐴𝑐𝑛

𝑎∈𝐴

𝑎∈𝐴𝑐𝑛

= ∑ 𝑎𝑘+1 + ∑ 𝑎𝑘+1 + ∑ 𝑝(𝑎) 𝑎∈𝐴𝑐𝑛

𝑎∈𝐴 𝑘+1

= ∑ 𝑎

+ ∑ (𝑛 + 𝑎)

𝑎∈𝐴𝑐𝑛

= ∑ 𝑏

𝑎∈𝐴 𝑘+1

𝑎∈𝐴 𝑘+1

.

𝑐 𝑏∈𝐵2𝑛

Definition 32.1. 𝐴 ⊆ [𝑛] is symmetric if 𝐴 = 𝑛 + 1 − 𝐴; 𝐴 ⊆ [𝑛] is antisymmetric if 𝐴𝑐𝑛 = 𝑛 + 1 − 𝐴. Symmetry Rules. (a) If 𝑘 is even and 𝐴 ⊆ [𝑛] is symmetric and 𝑘-equipowerful for 𝑛, then 𝐴 is (𝑘+1)equipowerful for 𝑛. (b) If 𝑘 is odd and 𝐴 ⊆ [𝑛] is antisymmetric and 𝑘-equipowerful for 𝑛, then 𝐴 is (𝑘 + 1)-equipowerful for 𝑛. Proof. (a) Let 𝑠 = (𝑛 + 1)/2. Then −𝑠 + 𝐴 becomes symmetric around 0, which means, because 𝑘 + 1 is odd, that ∑𝑎∈𝐴 (−𝑠 + 𝑎)𝑘+1 = 0. The same holds for 𝐴𝑐𝑛 , and so the shift rule now proves that the extra power rule holds for 𝐴. (b) We use the same shift as in the preceding case. Now the antisymmetry property means that for every 𝑎 ∈ −𝑠 + 𝐴, we have that −𝑎 ∈ −𝑠 + 𝐴𝑐𝑛 , and vice versa. Because 𝑘 + 1 is even, this gives the next power equality, as claimed. A very short computer search will find the unique antisymmetric 1-equipowerful set for 12: {1, 3, 7, 8, 9, 11}. The second symmetry rule then shows that this is a 2-equipowerful set for 12, and doubling then gives 𝐴24 , the 3-equipowerful set shown at the start of the solution.

32. Equally Powerful Splits

121

Studying the 1-equipowerful and 2-equipowerful cases is instructive. Any 1-equipowerful number must be a multiple of 4. While 4 does not admit an antisymmetric 1-equipowerful set, all larger multiples of 4 do. We omit the details, but the following simple formula proves it: if 𝑛 is a multiple of 8, let 𝐴 = {𝑎 ∶ 1 ≤ 𝑎 ≤ 𝑛 and 𝑎 ≡ 1, 4, 6, or 7 (mod 8)}; if 𝑛 ≡ 4 (mod 8), let 𝐴 = {𝑎 ∶ 1 ≤ 𝑎 ≤ 𝑛 and 𝑎 ≡ 0, 1, 2, or 7 (mod 8)}, but change the 2 in the set to a 3 and change 𝑛 − 2 to 𝑛 − 1. The second symmetry rule then implies that these numbers (8, 12, 16, . . . ) are all 2-equipowerful. But then we can use the doubling rule to turn each such 2-equipowerful set into a 3-equipowerful set, the integers becoming 16, 24, 32, . . . . So this is another way to show that all multiples of 8 that are 16 or larger are 3-equipowerful; moreover, all the 3-equipowerful sets arising in this way are symmetric. We showed earlier, using the translation rule, that 32 is 3-equipowerful. But if we instead use the doubling rule starting with 𝐴16 , we get a set that is 4-equipowerful for 32. Similarly, 𝐴24 gives a 4-equipowerful set for 𝑛 = 48. Computer searching shows that 16 and 24 are not 4-equipowerful. Then use of the translation rule, together with the discovery of 4-equipowerful sets for 𝑛 = 40 and 56 (using integer-linear programming), means that the 4-equipowerful numbers are all multiples of 8 larger than 32. The two new sets are 𝐴40 = {1, 2, 8, 9, 10, 11, 13, 14, 17, 20, 22, 23, 25, 26, 29, 34, 35, 36, 37, 38}, 𝐴56 = {1, 3, 6, 9, 10, 12, 13, 15, 16, 18, 21, 25, 26, 28, 30, 33, 34, 35, 37, 38, 40, 43, 46, 49, 50, 52, 53, 55}. These techniques also show that the 5-equipowerful numbers are all multiples of 8 larger than 64, together with 48. The 6-equipowerful numbers are all multiples of 8 that are 192 or greater, together with 96, 128, 144, 160, and 176. The 7-equipowerful numbers are known to be 144 and all multiples of 16 that are greater than or equal to 192. For more information, see [20]. The characterization of 3-equipowerful numbers is due to David Boyd. Repeatedly applying the doubling rule to {1}, a 0-equipowerful subset of {1, 2}, means that 4 is 1-equipowerful, 8 is 2-equipowerful, 16 is 3-equipowerful, and so on. In fact, the application of the rule leads to a single sequence, 1, 4, 6, 7, 10, 11, 13, 16, 18, 19, 21, 24, 25, 28, 30, 31, 34, . . . , such that the entries less than or equal to 2𝑘 give a (𝑘 − 1)-equipowerful set for 2𝑘 . This sequence is identical to the sequence obtained by adding 1 to the evil numbers, where a number is evil if, in base 2, it has an even number of 1s. For a proof by induction, observe that if 𝐴 is (𝑘 − 1)-equipowerful for 2𝑘 , then a new element in the doubling of 𝐴 has the form 2𝑘 + 𝑥, where 𝑥 − 1 is not evil because 𝑥 ∉ 𝐴. But then 2𝑘 + 𝑥 − 1 is evil because of the leftmost 1-bit introduced by 2𝑘 . For more on the evil numbers and the related Thue–Morse–Hedlund sequence, see [71, §17].

122

Chapter 3. Number Theory

33 Tripling in Two Steps Surprisingly, the conditions in the problem uniquely determine 𝑓. The unique function 𝑓 satisfying the conditions can be described as follows. To compute 𝑓(𝑛), first write 𝑛 in base 3. Then, if the first nonzero digit is a 1, change it to a 2; if it is a 2, change it to a 1 and add a 0 at the end. In other words, for all nonnegative integers 𝑎 and 𝑏, if 0 ≤ 𝑏 < 3𝑎 , then (a) 𝑓(3𝑎 + 𝑏) = 2 ⋅ 3𝑎 + 𝑏; (b) 𝑓(2 ⋅ 3𝑎 + 𝑏) = 3𝑎+1 + 3𝑏. It is not hard to see that this function satisfies the required conditions. To see that it is the only function satisfying the conditions, we assume that 𝑓 satisfies the conditions and prove (a) and (b). We begin by proving (a) and (b) in the case 𝑏 = 0. In other words, we prove that for all 𝑎 ≥ 0, 𝑓(3𝑎 ) = 2 ⋅ 3𝑎 and 𝑓(2 ⋅ 3𝑎 ) = 3𝑎+1 . The proof is by induction. The base case is 𝑎 = 0. We must find 𝑓(30 ) = 𝑓(1) and 𝑓(2 ⋅ 30 ) = 𝑓(2). If 𝑓(1) = 1, then 𝑓(𝑓(1)) = 𝑓(1) = 1, contradicting the requirement that 𝑓(𝑓(1)) = 3. Therefore 𝑓(1) > 1. But if 𝑓(1) ≥ 3, then 𝑓(𝑓(1)) ≥ 𝑓(3) > 𝑓(1) ≥ 3, which again contradicts 𝑓(𝑓(1)) = 3. Thus the only possible value for 𝑓(1) is 2. But then 𝑓(2) = 𝑓(𝑓(1)) = 3. Thus, 𝑓(30 ) = 𝑓(1) = 2 = 2 ⋅ 30 , 𝑓(2 ⋅ 30 ) = 𝑓(2) = 3 = 30+1 , as required. For the induction step, suppose 𝑓(3𝑎 ) = 2 ⋅ 3𝑎 and 𝑓(2 ⋅ 3𝑎 ) = 3𝑎+1 . Then 𝑎+1 𝑓(3 ) = 𝑓(𝑓(2 ⋅ 3𝑎 )) = 3 ⋅ (2 ⋅ 3𝑎 ) = 2 ⋅ 3𝑎+1 and 𝑓(2 ⋅ 3𝑎+1 ) = 𝑓(𝑓(3𝑎+1 )) = 3 ⋅ 3𝑎+1 = 3𝑎+2 . Next we prove (a) and (b) when 𝑏 > 0. We have already shown that 𝑓(3𝑎 ) = 𝑎 2⋅3 = 3𝑎 +3𝑎 and 𝑓(2⋅3𝑎 ) = 3𝑎+1 = 2⋅3𝑎 +3𝑎 . Condition (1) now implies that for 3𝑎 ≤ 𝑛 ≤ 2⋅3𝑎 , 𝑓(𝑛) = 𝑛+3𝑎 . So for 0 ≤ 𝑏 < 3𝑎 , 𝑓(3𝑎 +𝑏) = 3𝑎 +𝑏+3𝑎 = 2⋅3𝑎 +𝑏, which is (a). And now (b) follows, because 𝑓(2 ⋅ 3𝑎 + 𝑏) = 𝑓(𝑓(3𝑎 + 𝑏)) = 3 ⋅ (3𝑎 + 𝑏) = 3𝑎+1 + 3𝑏. Now that we have determined the function 𝑓, we can solve the problem: 𝑓(1000) = 𝑓(36 + 271) = 2 ⋅ 36 + 271 = 1729. This problem is based on a problem from the 1992 British Mathematical Olympiad. The sequence of values of 𝑓 can be found at [99, sequence A003605].

34. Root Closure

123

34 Root Closure Observe first that, if 𝑀𝑛 denotes {0, 1, −1, 𝑛, −𝑛}, then 𝑅𝑛 always contains 𝑀𝑛 ; get −1, 1, −𝑛 from, in this order, 𝑛𝑥 + 𝑛, −𝑥𝑛 − 𝑥𝑛−1 − ⋯ − 𝑥 + 𝑛, 𝑥 + 𝑛. Other simple observations: (1) If 𝑘 ∈ 𝑅𝑛 , then so is −𝑘. (Use 𝑥 + 𝑘.) (2) If 𝑛 is even, 2 ∈ 𝑅𝑛 . (Use the base-2 form of 𝑛; e.g., to get 2 ∈ 𝑅100 , write 100 = 26 + 25 + 22 and observe that 2 is a root of 𝑥6 + 𝑥5 + 𝑥2 − 100.) (3) If 𝑛 is divisible by 3, then 3 ∈ 𝑅𝑛 by the same argument as in (2), using coefficients 0, 1, and −1 in the base-3 expansion of 𝑛. (4) If 𝑐, 𝑑 ∈ 𝑅𝑛 and 𝑐 divides 𝑑, then 𝑑/𝑐 ∈ 𝑅𝑛 . (Use 𝑐𝑥 − 𝑑, calling on (1).) (5) If 𝑎𝑚 ∈ 𝑅𝑛 (𝑚 a positive integer), then 𝑎 ∈ 𝑅𝑛 . (Use 𝑥𝑚 − 𝑎𝑚 .) Say that an integer 𝑛 is maximal if 𝑅𝑛 = 𝐷𝑛 and minimal if 𝑅𝑛 = 𝑀𝑛 . Then the preceding rules suffice to show that 𝑅𝑛 is maximal for any 𝑛 ≤ 34 (this can be checked by hand, but is easier by computer). Therefore 35 is the smallest candidate to be nonmaximal. And indeed it is nonmaximal because 𝑅35 = 𝑀35 . To prove this we will show that 𝑀35 is closed. If not, then one of ±5, ±7 is a root of a polynomial with coefficients in {0, ±1, ±35}. Consider the case of 5. Choose the witnessing polynomial 𝑎𝑚 𝑥𝑚 + ⋯ + 𝑎1 𝑥 + 𝑎0 having minimal degree 𝑚; then 𝑎0 ≠ 0, for otherwise division by 𝑥 contradicts minimality. Now, from 𝑎𝑚 5𝑚 + ⋯ + 𝑎1 5 + 𝑎0 = 0 we get that 5 divides 𝑎0 , and so 𝑎0 is one of ±35. But 25 divides 𝑎𝑚 5𝑚 + ⋯ + 𝑎2 52 and so 25 must also divide 𝑎1 5 + 𝑎0 , which it does not when 𝑎1 is 0, ±35, or ±1, a contradiction. The other three cases (−5, −7, 7) are essentially the same. The preceding proof generalizes. If 𝑛 = 𝑝𝑞, where 𝑝 and 𝑞 are distinct primes such that neither prime is congruent to ±1 modulo the other, then 𝑛 is minimal. Checking up to 200, this shows that 35, 65, 77, 85, 115, 119, 133, 143, 161, 185, and 187 are minimal. But the condition is not necessary: 55 does not meet the condition, but 55 is minimal, as can be shown by a similar argument, but using division by 53 and 113 . These arguments are due to Jerry Grossman, Eddie Cheng, and László Lipták (Oakland University, Michigan). Another interesting question asks for integers that are neither maximal nor minimal. The smallest example is 154 (found by the Michigan group and Stephen Morris). Because 154 = 2 ⋅ 7 ⋅ 11, its divisors are 1, 2, 7, 11, 14, 22, 77, 154. We have 2 ∈ 𝑅154 , so 154 is not minimal. To show that 𝑅154 = {0, ±1, ±2, ±77, ±154} consider the case of 7. The same cubic argument mentioned in the proof that 55 is minimal shows that 7 ∉ 𝑅154 , and it works the same way for −7, ±11, ±14, and ±22. The set of such examples under 500 is {154, 231, 266, 322, 357, 374}.

124

Chapter 3. Number Theory

35 A Double Power Leads to a Sum of Two Squares We will need the classic fact that if each of 𝑥 and 𝑦 is a sum of two squares, then so is 𝑥 ⋅ 𝑦. An elegant proof uses complex numbers, which play a prominent role in the study of sums of squares. If 𝑥 = 𝑐2 + 𝑑2 and 𝑦 = 𝑒2 + 𝑓2 , then 𝑥 = |𝑐 + 𝑑𝑖|2 and 𝑦 = |𝑒 + 𝑓𝑖|2 . Therefore 𝑥𝑦 = |(𝑐 + 𝑑𝑖)(𝑒 + 𝑓𝑖)|2 = |𝑐𝑒 − 𝑑𝑓 + 𝑖(𝑐𝑓 + 𝑑𝑒)|2 , which gives the representation 𝑥𝑦 = (𝑐𝑒 − 𝑑𝑓)2 + (𝑐𝑓 + 𝑑𝑒)2 . Now we can use induction on 𝑛. The base case is 31 − 1 = 2 = 12 + 12 . Use 𝑚 to denote 3𝑛 and assume 3𝑚 − 1 is a sum of two squares. Using the identity 𝑛+1 𝑥3 − 1 = (𝑥 − 1)(𝑥2 + 𝑥 + 1), we get 33 − 1 = (3𝑚 − 1)(32𝑚 + 3𝑚 + 1). By the product fact, it suffices to show that the second factor is a sum of two squares. That is done as follows: 32𝑚 + 3𝑚 + 1 = 32𝑚 − 2 ⋅ 3𝑚 + 1 + 3 ⋅ 3𝑚 2

2

2

= (3𝑚 − 1) + 3𝑚+1 = (3𝑚 − 1) + (3(𝑚+1)/2 ) . This problem is due to Jeremy Rouse; it follows from work in [32].

36 Prime Subsets For (a), let 𝐴𝑖 be the sum of the first 𝑖 elements of the set. Then the 𝐴𝑖 , reduced modulo 𝑛, give 𝑛 residues. If any of them is 0, we are done. But if not, then two of them are the same; their difference, which is the sum of a consecutive subsequence, is 0 (mod 𝑛) and so is divisible by 𝑛. Part (a) is fairly simple. Part (b) is of interest because it sounds like it should be similar to (a), but the solution is quite tricky. Further, the result is true even if 𝑝 is not prime; for the details of the reduction of the general case to the prime case see [2]. An elegant approach to the solution combines some polynomial algebra with Fermat’s little theorem. A natural place to start is to look at all the sums of the subsets of size 𝑝. If any such sum is divisible by 𝑝, we have our conclusion, so from now on assume that each sum is not divisible by 𝑝. Then Fermat’s little theorem tells us that the (𝑝 − 1)th power of the sum will be 1 (mod 𝑝). So all such modular powers will be 1 (mod 𝑝). It is natural to now look at 𝑆, the sum of all those powers; if the conclusion is false, 𝑆 will be ( 2𝑝−1 𝑝 ) (mod 𝑝). But (

(2𝑝 − 1)(2𝑝 − 2) ⋯ (𝑝 + 1) 2𝑝 − 1 . )= 𝑝 (𝑝 − 1)(𝑝 − 2) ⋯ 1

The numerator is congruent to (𝑝−1)! (mod 𝑝) and so is not divisible by 𝑝, which means that 𝑆 is not divisible by 𝑝. But there is another way of computing 𝑆 which shows that 𝑆 must be divisible by 𝑝.

37. The Incredible Shrinking Superpowers

125

To illustrate the method, consider the case 𝑝 = 3. Then 𝑆 = (𝑎1 + 𝑎2 + 𝑎3 )2 + (𝑎1 + 𝑎2 + 𝑎4 )2 + (𝑎1 + 𝑎2 + 𝑎5 )2 + (𝑎1 + 𝑎3 + 𝑎4 )2 + (𝑎1 + 𝑎3 + 𝑎5 )2 + (𝑎1 + 𝑎4 + 𝑎5 )2 + (𝑎2 + 𝑎3 + 𝑎4 )2 + (𝑎2 + 𝑎3 + 𝑎5 )2 + (𝑎2 + 𝑎4 + 𝑎5 )2 + (𝑎3 + 𝑎4 + 𝑎5 )2 = 6𝑎21 + 6𝑎22 + 6𝑎23 + 6𝑎24 + 6𝑎25 + 6𝑎1 𝑎2 + 6𝑎1 𝑎3 + 6𝑎1 𝑎4 + 6𝑎1 𝑎5 + 6𝑎2 𝑎3 + 6𝑎2 𝑎4 + 6𝑎2 𝑎5 + 6𝑎3 𝑎4 + 6𝑎3 𝑎5 + 6𝑎4 𝑎5 . Note that each coefficient is divisible by 3. There is a reason for that: consider the term 6𝑎2 𝑎5 . The 6 arises from the three unexpanded terms (𝑎1 + 𝑎2 + 𝑎5 )2 , (𝑎2 + 𝑎3 + 𝑎5 )2 , and (𝑎2 + 𝑎4 + 𝑎5 )2 . Each of these terms contributes 2 to the coefficient of the monomial 𝑎2 𝑎5 . But the number of these terms is 3, which in 5−2 = 3 = 3. The 2 is subtracted because two entries this case arises from ( 3−2 ) (1) are fixed (𝑎2 and 𝑎5 ), so there is only one choice from three possibilities for the third member. Returning to the general case, consider the analogous expansion of 𝑆, the sum of the (𝑝 − 1)th powers of the sums of the subsets of size 𝑝. Any particular monomial has 𝑗 positive exponents for some 𝑗 with 1 ≤ 𝑗 ≤ 𝑝 − 1; these will arise from ( 2𝑝−1−𝑗 𝑝−𝑗 ) subsets of size 𝑝; the subtraction of 𝑗 is because 𝑗 entries are fixed. Each set contributes the same amount (it is the multinomial coefficient (𝑝 − 1)! / ∏ 𝑒𝑖 !, where the 𝑒𝑖 are the positive exponents), so the coefficient will be divisible by 𝑝 if ( 2𝑝−1−𝑗 𝑝−𝑗 ) is divisible by 𝑝. But (

(2𝑝 − 1 − 𝑗)! 2𝑝 − 1 − 𝑗 , )= 𝑝−𝑗 (𝑝 − 𝑗)! (𝑝 − 1)!

and 𝑝 divides the numerator but not the denominator. (Note that this is true because 𝑗 ≥ 1; if 𝑗 = 0 the binomial coefficient is not divisible by 𝑝, as shown earlier.) So we have that 𝑝 divides 𝑆. This contradicts the earlier conclusion that 𝑝 does not divide 𝑆. The result of part (b) is due to Paul Erdős, Abraham Ginzburg, and Abraham Ziv [41]. The proof presented here is due to several people independently; see [2].

37 The Incredible Shrinking Superpowers It takes a very long time—over 10100000000 steps—but the sequence does reach 0. To be precise, 𝐺(4) = 3 ⋅ 23⋅2

27 +27

− 1 = 3 ⋅ 2402653211 − 1 ≈ 7 ⋅ 10121210694 .

It is clear from the first few steps of the sequence with 𝑎 = 4 that for every 𝑘 we have 𝑛𝑘 = 𝑘2 ⋅ 𝑝 + 𝑘 ⋅ 𝑞 + 𝑟 for some nonnegative integers 𝑝, 𝑞, and 𝑟 that are less than 𝑘. In such a representation, let’s call 𝑝, 𝑞, and 𝑟 the coordinates of

126

Chapter 3. Number Theory

𝑛𝑘 , and write 𝑐𝑘 = (𝑝, 𝑞, 𝑟). Thus, 𝑐2 = (1, 0, 0), 𝑐3 = (2, 2, 2), 𝑐4 = (2, 2, 1), and so on. Furthermore, starting with 𝑘 = 3, all exponents on 𝑘 are less than 𝑘, so they don’t change when we replace 𝑘 with 𝑘 + 1 in going from 𝑛𝑘 to 𝑛𝑘+1 . This allows us to prove some lemmas about how the coordinates change for 𝑘 ≥ 3. Lemma 37.1. If 𝑘 ≥ 3, 𝑐𝑘 = (𝑝, 𝑞, 𝑟), and 𝑟 > 0, then 𝑐𝑘+1 = (𝑝, 𝑞, 𝑟 − 1). Proof. We have 𝑛𝑘+1 = ((𝑘 + 1)2 ⋅ 𝑝 + (𝑘 + 1) ⋅ 𝑞 + 𝑟) − 1 = (𝑘 + 1)2 ⋅ 𝑝 + (𝑘 + 1) ⋅ 𝑞 + (𝑟 − 1). Lemma 37.2. If 𝑘 ≥ 3 and 𝑐𝑘 = (𝑝, 𝑞, 𝑟), then 𝑐𝑘+𝑟 = (𝑝, 𝑞, 0). Proof. Apply Lemma 37.1 𝑟 times. More formally, we can prove that for 𝑖 = 0, 1, . . . , 𝑟, 𝑐𝑘+𝑖 = (𝑝, 𝑞, 𝑟 − 𝑖); the case 𝑖 = 𝑟 gives the lemma. The proof is by induction on 𝑖, with Lemma 37.1 giving us the induction step. Lemma 37.3. If 𝑘 ≥ 3, 𝑐𝑘 = (𝑝, 𝑞, 0), and 𝑞 > 0, then 𝑐2𝑘+1 = (𝑝, 𝑞 − 1, 0). Proof. We have 𝑛𝑘 = 𝑘2 ⋅ 𝑝 + 𝑘 ⋅ 𝑞, so 𝑛𝑘+1 = (𝑘 + 1)2 ⋅ 𝑝 + (𝑘 + 1) ⋅ 𝑞 − 1 = (𝑘 + 1)2 ⋅ 𝑝 + (𝑘 + 1) ⋅ (𝑞 − 1) + 𝑘, and therefore 𝑐𝑘+1 = (𝑝, 𝑞 − 1, 𝑘). Now by Lemma 37.2 we get 𝑐2𝑘+1 = (𝑝, 𝑞 − 1, 0). Lemma 37.4. If 𝑘 ≥ 3 and 𝑐𝑘 = (𝑝, 𝑞, 0), then 𝑐2𝑞 (𝑘+1)−1 = (𝑝, 0, 0). Proof. We show that for 𝑖 = 0, 1, . . . , 𝑞, 𝑐2𝑖 (𝑘+1)−1 = (𝑝, 𝑞 − 𝑖, 0); the case 𝑖 = 𝑞 gives the lemma. The proof is by induction on 𝑖. The case 𝑖 = 0 is clear. For the induction step apply Lemma 37.3. We can now compute coordinates by applying these lemmas: 𝑐3 = (2, 2, 2), 𝑐5 = (2, 2, 0)

(Lemma 37.2),

𝑐22 ⋅6−1 = 𝑐23 = (2, 0, 0)

(Lemma 37.4).

Therefore 𝑛23 = 232 ⋅ 2, so 𝑛24 = 242 ⋅ 2 − 1 = 242 + 24 ⋅ 23 + 23, and we can continue: 𝑐24 = (1, 23, 23), 𝑐47 = (1, 23, 0) 𝑐223 ⋅48−1 = 𝑐3⋅227 −1 = (1, 0, 0)

(Lemma 37.2), (Lemma 37.4).

38. Special Numbers

127 2

2

Therefore 𝑛3⋅227 −1 = (3 ⋅ 227 − 1) , so 𝑛3⋅227 = (3 ⋅ 227 ) − 1 = (3 ⋅ 227 ) ⋅ (3 ⋅ 227 − 1) + (3 ⋅ 227 − 1), and again we can continue: 𝑐3⋅227 = (0, 3 ⋅ 227 − 1, 3 ⋅ 227 − 1) , 𝑐3⋅227 +3⋅227 −1 = (0, 3 ⋅ 227 − 1, 0)

(Lemma 37.2),

𝑐23⋅227 −1 (3⋅228 )−1 = (0, 0, 0) 27

(Lemma 37.4). 27

We conclude that 𝐺(4) = 23⋅2 −1 ⋅ 3 ⋅ 228 − 1 = 3 ⋅ 23⋅2 +27 − 1 = 3 ⋅ 2402653211 − 1. Reuben Goodstein proved in 1944 that, regardless of the initial value, the sequence eventually strikes 0. The proof is not hard using the basics of ordinal numbers: replace each 𝑘 in the superbase 𝑘 representation of 𝑛𝑘 by the first infinite ordinal 𝜔. This transforms (𝑛𝑘 ) into a decreasing sequence of ordinals, and such must be finite. For 𝑎 = 4, the sequence begins 𝜔𝜔 , 𝜔2 ⋅ 2 + 𝜔 ⋅ 2 + 2, 𝜔2 ⋅ 2 + 𝜔 ⋅ 2 + 1, 𝜔2 ⋅ 2 + 𝜔 ⋅ 2, 𝜔2 ⋅ 2 + 𝜔 + 5. However, it is known that Goodstein’s theorem cannot be proved from the Peano axioms for the natural numbers; this was proved by Laurie Kirby and Jeff Paris [81]; see also [115].

38 Special Numbers Let 𝑓(𝑛) be the largest size of a set that is special above 𝑛. It is known that for every 𝑛 there is such a largest size (proof later). Then 𝑓(4) = 9. The sequence of values of 𝑓 can be found at [99, sequence A323457]. Here is a proof that 𝑓(4) ≤ 9. Suppose 𝐴 is special above 4. Because the only prime factors that occur in 1 through 4 are 2 and 3, an induction proof using (1) shows that every element of 𝐴 has the form 2𝑥 3𝑦 ; we will use (𝑥, 𝑦) to denote 2𝑥 3𝑦 to describe numbers in 𝐴. The first number in 𝐴 larger than 4 must divide 1 ⋅ 2 ⋅ 3 ⋅ 4 and so is a divisor of 24 and has the form (𝑥0 , 𝑦0 ), where 𝑥0 ≤ 3 and 𝑦0 ≤ 1. By property (2), all larger 𝐴-elements (𝑥, 𝑦) must have either 𝑥 < 𝑥0 ≤ 3 or 𝑦 < 𝑦0 ≤ 1. Therefore (𝑥, 𝑦) has one of the forms (2, 𝑧), (1, 𝑧), (0, 𝑧), or (𝑧, 0). But each such form can contribute only one entry, as two of the same type would have the smaller dividing the larger, in violation of property (2); this means that 𝐴 has at most four elements smaller than (𝑥0 , 𝑦0 ) and at most four larger, and therefore 𝑓(4) ≤ 4 + 1 + 4 = 9. To find a set of size 9, start with {1, 2, 3, 4, 24} and then greedily add the smallest number that works; that yields {1, 2, 3, 4, 24, 32, 36, 54, 81}. A computer search shows that there are 40 special-above-4 sets of size 9. The lexicographically last is {1, 2, 3, 4, 24, 36, 162, 512, 6561}. It is easy to check that, for 𝑛 = 1, 2, and 3, the largest special-above-𝑛 sets are {1}, {1, 2}, and {1, 2, 3, 6, 9}, respectively. Nothing about the values up to 𝑓(4) = 9 prepares one for the unfathomable 233

size of 𝑓(5). As shown by Jim Henle, this value is larger than 22 , or about 2500000000 1010 . The enormous numbers appearing in this problem are most easily

128

Chapter 3. Number Theory

described using Knuth’s uparrow notation, in which 𝑎 ↑ 𝑏 means 𝑎𝑏 and 𝑎 ↑↑ 𝑏 means 𝑎 ↑ (𝑎 ↑ (⋯ ↑ 𝑎)), with 𝑏 many 𝑎s. In this notation, 𝑓(5) is larger than 2 ↑↑ 6. To present this large special-above-5 set 𝐴 we’ll write (𝑎, 𝑏, 𝑐) to represent 2𝑎 3𝑏 5𝑐 . So we start with 1, 2, 3, 4, 5 and then take 5!, or (3, 1, 1) as the sixth element of 𝐴. Next comes (6, 0, 2), where 𝑏 has been decremented (thus causing (2) to hold) while 𝑎 and 𝑐 are set to the largest possible values such that (1) holds: the sums of the corresponding exponents in the preceding entries. We can then continue as shown in Table 38.1, where the exponents are changed at each step so that property (2) holds and the magnitude of the numbers in 𝐴 increases at each step. For convenience we do not always use the largest possible new exponent. 233

The final batch of changes uses 22 doubling steps, so 𝐴 has slightly more than this many elements. A critical point in the study of these sets is the fact that, for each 𝑛, there is an upper bound on the size of a special-above-𝑛 set, and so 𝑓(𝑛) is defined. We now prove that. Theorem (Harvey Friedman [53]). For any 𝑛, the sizes of the special-above-𝑛 sets are bounded, and so 𝑓(𝑛) is defined. Proof. The finite special-above-𝑛 sets form a tree 𝑇 as follows. If 𝐴 is a node in 𝑇, then its immediate descendants are the special-above-𝑛 sets of the form 𝐴 ∪ {𝑘}, where 𝑘 is larger than all elements of 𝐴. Then condition (1) implies that there only finitely many possibilities for 𝑘, so 𝑇 is finitely branching. If 𝑇 has finitely many nodes, then there is a largest special-above-𝑛 set and 𝑓(𝑛) is defined. Otherwise König’s tree lemma implies that 𝑇 has an infinite branch. The lemma states that every finitely branching infinite tree has an infinite branch and the proof is easy: one builds the branch recursively by choosing, at each stage, a node that has infinitely many descendants. But an infinite branch in 𝑇 leads to 𝐴∞ , an infinite set that is special above 𝑛; we next show that such a set cannot exist. Any number in 𝐴∞ is divisible only by primes occurring up to and including 𝑛, so we will represent 𝐴∞ as a table of the powers of the primes up to 𝑛. Look down the first column of this table: the powers of 2. Either this first column is bounded or it is unbounded. If it is bounded, pick an infinite subsequence of the entries in which the first column is constant. If it is unbounded, pick an infinite subsequence in which the first column entries are strictly increasing. In either case, we have a subsequence in which the entries are nondecreasing. From now on, we work only with this subsequence. Move to the second column and, similarly, get a subsequence that is nondecreasing in this column. Continue to get an infinite subsequence of 𝐴∞ that is nondecreasing in every column. But then any entry in the subsequence divides all later entries, a contradiction.

38. Special Numbers

129

Table 38.1. A sequence that shows 𝑓(5) > 22 exponent of 2 0 1 0 2 0 3 6 5 4 3 2 2 ⋮ 2 1 1 ⋮ 1 0 0 ⋮ 0

exponent of 3 0 0 1 0 0 1 0 0 0 0 2 4 ⋮ 232 233 33 2 −1 ⋮ 1 2 4 ⋮ 22

2 4 ⋮ ≈ 2 ↑↑ 7

233 −1

2 22

2

22

33

33

⋮ 0

−1

exponent of 5 0 0 0 0 1 1 2 4 8 16 32 31 ⋮ 1 2 22 ⋮ 233 2 33 22 33 22 − 1 ⋮

number in set

233

.

size of current batch

1 2 3 4 5 120 1600 20000 6250000 1220703125000 ≈ 1024

5

1 4

32

≈ 102049220187 ⋮

233

22 − 1

33

2 0 0 ⋮ 0

⋮ ≈ 2 ↑↑ 8

233

1 + 22

≈ 2 ↑↑ 6

4 Combinatorics 39 Power up Your Radio You need seven trials to be sure of getting the radio working. To do it with seven trials, first partition the collection of eight batteries into two sets of three and one set of two. Since there are four good batteries, one of the sets in this partition must contain at least two good batteries. Thus, it suffices to try all pairs in each set of the partition. This results in three trials for each of the two sets of three batteries and one more for the set of two, for a total of seven trials. To see that this is optimal, consider any sequence of six trials. Since there are only eight batteries, some battery is used in more than one trial. Suppose first that there is some battery, say battery 𝑎, that is used in at least three trials; we may assume that it is used in the first three trials. Let 𝑏, 𝑐, and 𝑑 be three other batteries that include at least one from each of the last three trials. Then every trial involves one of the four batteries 𝑎, 𝑏, 𝑐, and 𝑑. It follows that if these four batteries are the four bad batteries, then the sequence of trials will fail to find a working pair of batteries. Next, suppose that no battery is used in three trials. Then we can let 𝑎 be a battery that is used in exactly two trials. The remaining four trials involve only the other seven batteries, and therefore one of those batteries, call it battery 𝑏, is used in two of those four trials. That leaves only two trials, and we can let 𝑐 and 𝑑 be two more batteries that include at least one from each. Once again every trial involves one of 𝑎, 𝑏, 𝑐, and 𝑑, and therefore if these are the bad batteries, then the trials will fail. Thus no sequence of six trials is guaranteed to find a working pair of batteries.

131

132

Chapter 4. Combinatorics

Now let’s generalize. We continue to assume that the radio needs two good batteries, but we assume that you have 𝑛 batteries and you know that 𝑔 of them are good, where 2 ≤ 𝑔 ≤ 𝑛. Consider any collection of pairs of batteries to be tried. To see if these trials are adequate to get the radio working, we construct a simple graph with one vertex for each battery and with an edge connecting vertices 𝑥 and 𝑦 if and only if the pair of batteries {𝑥, 𝑦} is not one of the pairs to be tried. Suppose this graph has a 𝑔-clique; that is, a collection of 𝑔 vertices every two of which are connected by an edge. Then these vertices represent a collection of 𝑔 batteries such that no pair of them gets tried. If these 𝑔 batteries are the good ones, then the set of trials will fail to find a good pair. On the other hand, if the graph has no 𝑔-cliques, then, in particular, the set of 𝑔 vertices representing the good batteries is not a clique. Therefore some pair of these batteries gets tried and makes the radio work. Thus, we can find a minimal set of battery trials that is guaranteed to get the radio working by finding a graph on 𝑛 vertices with no 𝑔-cliques that has the largest possible number of edges; the pairs of vertices in this graph that are not connected determine a minimal set of battery trials that is guaranteed to succeed. Fortunately, there is a theorem of graph theory that solves this problem for us. According to Turán’s theorem, to construct a 𝑔-clique-free graph on 𝑛 vertices with the largest possible number of edges, we can partition the vertices into 𝑔 − 1 sets whose sizes are as close to equal as possible and then connect two vertices if and only if they are in different sets of the partition. More precisely, let 𝑞 and 𝑟 be the quotient and remainder when 𝑛 is divided by 𝑔 − 1; thus, 𝑛 = 𝑞(𝑔 − 1) + 𝑟 and 𝑟 < 𝑔 − 1. Then we can partition the 𝑛 vertices into 𝑔 − 1 sets, with 𝑟 of the sets having size 𝑞 + 1 and the remaining 𝑔 − 1 − 𝑟 having size 𝑞, and then connect all pairs of vertices that come from different pieces of the partition. The resulting graph is called a Turán graph and is denoted 𝑇(𝑛, 𝑔 − 1). The unconnected pairs of vertices in 𝑇(𝑛, 𝑔−1) represent the pairs of batteries to be tried. Each of the 𝑟 sets of size 𝑞 + 1 has ( 𝑞+1 ) unconnected pairs and each 2 𝑞 of the 𝑔 − 1 − 𝑟 sets of size 𝑞 has ( 2 ) unconnected pairs, so the total number of unconnected pairs is 𝑛(𝑞 − 1) + 𝑟(𝑞 + 1) 𝑞+1 𝑞 𝑟( . ) + (𝑔 − 1 − 𝑟)( ) = 2 2 2 This is the minimum number of battery trials that is guaranteed to get the radio working. In the original problem we have 𝑛 = 8 and 𝑔 = 4, and dividing 𝑛 = 8 by 𝑔 − 1 = 3 gives a quotient of 𝑞 = 2 and a remainder of 𝑟 = 2, so the minimum number of battery trials is 𝑛(𝑞 − 1) + 𝑟(𝑞 + 1) 8⋅1+2⋅3 = = 7, 2 2 in agreement with our earlier reasoning.

133

For completeness, we now give a proof of Turán’s theorem. Suppose 𝐺 is a 𝑔-clique-free graph on 𝑛 vertices with the largest possible number of edges. If 𝑥 and 𝑦 are vertices of 𝐺, then we write 𝑥 ∼ 𝑦 if 𝑥 and 𝑦 are not connected by an edge. Clearly ∼ is reflexive and symmetric. We claim that it is also transitive. To prove this, assume that 𝑥 ∼ 𝑦 and 𝑦 ∼ 𝑧 but 𝑥 ≁ 𝑧. Thus, there is an edge connecting 𝑥 to 𝑧, but no edge from 𝑥 to 𝑦 or 𝑦 to 𝑧. Let 𝑁𝑥 be the set of vertices connected by edges to 𝑥, and let 𝑑(𝑥) be the number of elements of 𝑁𝑥 ; in other words, 𝑁𝑥 is the set of vertices adjacent to 𝑥 and 𝑑(𝑥) is its degree. Similarly, let 𝑁𝑦 and 𝑁𝑧 be the sets of vertices adjacent to 𝑦 and 𝑧 and let 𝑑(𝑦) and 𝑑(𝑧) be their degrees. (Notice in particular that 𝑧 ∈ 𝑁𝑥 and 𝑥 ∈ 𝑁𝑧 , but 𝑦 ∉ 𝑁𝑥 , 𝑦 ∉ 𝑁𝑧 , 𝑥 ∉ 𝑁𝑦 , and 𝑧 ∉ 𝑁𝑦 .) Case 1. 𝑑(𝑥) > 𝑑(𝑦). Remove the edges connecting 𝑦 to elements of 𝑁𝑦 and replace them with edges connecting 𝑦 to all elements of 𝑁𝑥 to get a new graph 𝐺′ ; since 𝑑(𝑥) > 𝑑(𝑦), 𝐺′ has more edges than 𝐺. Suppose 𝐶 is a 𝑔-clique in 𝐺′ . If 𝑦 ∉ 𝐶, then 𝐶 is a 𝑔-clique in 𝐺, which is a contradiction. Now suppose 𝑦 ∈ 𝐶. Since there is no edge connecting 𝑥 to 𝑦 in 𝐺′ , 𝑥 ∉ 𝐶. But then 𝐶 ⧵ {𝑦} ∪ {𝑥} is a 𝑔-clique in 𝐺, another contradiction. Thus 𝐺′ has no 𝑔-cliques, which contradicts the maximality of 𝐺. Case 2. 𝑑(𝑧) > 𝑑(𝑦). An argument similar to the one in case 1 leads to a contradiction. Case 3. 𝑑(𝑦) ≥ 𝑑(𝑥) and 𝑑(𝑦) ≥ 𝑑(𝑧). Remove the edge between 𝑥 and 𝑧, as well as the 𝑑(𝑥) − 1 edges from 𝑥 to the other elements of 𝑁𝑥 and the 𝑑(𝑧) − 1 edges from 𝑧 to the other elements of 𝑁𝑧 , and replace them with edges from 𝑥 and 𝑧 to all elements of 𝑁𝑦 to get a graph 𝐺′ . The number of edges removed is 𝑑(𝑥) + 𝑑(𝑧) − 1 and the number of edges added is 2𝑑(𝑦), so since 𝑑(𝑦) ≥ 𝑑(𝑥) and 𝑑(𝑦) ≥ 𝑑(𝑧), 𝐺′ has more edges than 𝐺. Suppose 𝐶 is a 𝑔-clique in 𝐺′ , and note that 𝐶 can contain at most one of 𝑥, 𝑦, and 𝑧. If it contains neither 𝑥 nor 𝑧, then it is a 𝑔-clique in 𝐺; if it contains 𝑥, then 𝐶 ⧵ {𝑥} ∪ {𝑦} is a 𝑔-clique in 𝐺; and if it contains 𝑧, then 𝐶 ⧵ {𝑧} ∪ {𝑦} is a 𝑔-clique in 𝐺, all of which are contradictions. Thus once again we have a contradiction to the maximality of 𝐺. This completes the proof that ∼ is transitive, and therefore an equivalence relation. Suppose there are 𝑘 equivalence classes. By the definition of ∼, for any vertices 𝑥 and 𝑦, there is an edge from 𝑥 to 𝑦 in 𝐺 if and only if they lie in different equivalence classes; thus, 𝐺 is a complete 𝑘-partite graph. If 𝑘 ≥ 𝑔, then a set consisting of one element from each of 𝑔 different equivalence classes would be a 𝑔-clique, which is impossible; therefore 𝑘 < 𝑔. And if 𝑘 < 𝑔 − 1, then we can split an equivalence class into two pieces, adding edges connecting vertices in the two pieces to construct a complete (𝑘 + 1)-partite graph 𝐺′ , and 𝐺′ would be a 𝑔-clique-free graph with more edges than 𝐺, again a contradiction. Therefore 𝑘 = 𝑔 − 1. Finally, suppose 𝐶1 and 𝐶2 are two equivalence classes such that 𝐶1 has at least two more elements than 𝐶2 . Let 𝑥 be any element of 𝐶1 , and

134

Chapter 4. Combinatorics

let 𝐶1′ = 𝐶1 ⧵ {𝑥} and 𝐶2′ = 𝐶2 ∪ {𝑥}. Then removing the edges connecting 𝐶1 and 𝐶2 and replacing them with edges connecting 𝐶1′ to 𝐶2′ gives a complete 𝑘-partite graph 𝐺′ with more edges than 𝐺. Since 𝐺′ is also 𝑔-clique free, this contradicts the maximality of 𝐺. We conclude that 𝐺 must be the Turán graph 𝑇(𝑛, 𝑔 − 1). Note that this proof shows not only that 𝑇(𝑛, 𝑔 − 1) is a 𝑔-clique-free graph on 𝑛 vertices with the largest possible number of edges, but also that it is the only such graph. It follows that our solution to the original problem with eight batteries is the only solution. Another natural generalization is to consider a radio that needs more than two batteries. Exercise. Suppose that as before you have eight batteries and only four are good, but now your radio requires three batteries. Show that you can get the radio working in 20 trials. To generalize even further, suppose our radio requires 𝑟 batteries and we have 𝑛 batteries of which 𝑔 are good, where 𝑟 ≤ 𝑔 ≤ 𝑛. Imitating our earlier reasoning, we can translate the problem of making the radio work into a problem about hypergraphs. An 𝑟-uniform hypergraph is a pair (𝑉, 𝐸), where 𝑉 is the set of vertices of the hypergraph and 𝐸 is a set of 𝑟-element subsets of 𝑉, called the hyperedges of the hypergraph. The hypergraph is complete if every set of 𝑟 vertices is a hyperedge, and the complete 𝑟-uniform hypergraph with 𝑔 vertices is denoted 𝐾𝑔𝑟 . A 𝑔-clique in a hypergraph is a collection of 𝑔 vertices such that every set of 𝑟 vertices in the collection is a hyperedge; in other words, the subhypergraph induced by the collection of vertices is the complete hypergraph 𝐾𝑔𝑟 . We can represent a collection of battery trials with an 𝑟-uniform hypergraph by letting 𝑉 be the set of batteries and letting 𝐸 contain all sets of 𝑟 batteries that are not tried. As before, the battery trials are guaranteed to get the radio working if and only if the corresponding hypergraph has no 𝑔-clique, and therefore the problem of finding a minimal successful collection of battery trials is equivalent to the problem of finding a maximal 𝑟-uniform hypergraph on 𝑛 vertices with no 𝑔-clique. The number of hyperedges in such a maximal hypergraph is denoted ex(𝑛, 𝐾𝑔𝑟 ). Since the battery trials correspond to the nonhyperedges, the minimal number of trials guaranteed to get the radio working is ( 𝑛𝑟 ) − ex(𝑛, 𝐾𝑔𝑟 ). Unfortunately, very little is known about these numbers, so we cannot give a general formula for the solution. For more on this topic, see [54, 75, 96]. The values of ex(𝑛, 𝐾43 ) are known for 𝑛 ≤ 13 (see [117]), and in particular the value for 𝑛 = 8 confirms that in the exercise above, 20 is the smallest number of trials guaranteed to make the radio work. This problem appeared on the Brazilian Mathematical Olympiad, 2005.

40. A Parking Puzzle

135

40 A Parking Puzzle The answer is (𝑛+1)𝑛−1 . We begin with a beautiful proof of this fact due to Henry O. Pollak. Imagine that there is a second street that the drivers can take to loop around from the end of the one-way street back to the beginning. Along this second street there is one more parking space, which is numbered 𝑛 + 1. Now a driver who reaches the end of the one-way street without finding a parking space must take this second street, parking in space 𝑛+1 if it is available, and if not, then returning to the beginning of the one-way street and continuing to look for an empty space. We allow drivers to express a preference for space 𝑛 + 1. The parking preferences of the drivers can now be represented by a sequence (𝑎1 , 𝑎2 , . . . , 𝑎𝑛 ) of integers between 1 and 𝑛 + 1. It is clear that for every preference sequence the drivers will all succeed in parking, leaving one space empty. Consider what happens when drivers with a particular sequence of preferences arrive and try to park under these new rules. If the preference sequence includes the number 𝑛+1, then space 𝑛+1 will be occupied, since the first driver who prefers it will park there if it is not already occupied. Now suppose the preference sequence does not include 𝑛 + 1. If the sequence is a parking function, then all drivers will succeed in parking on the one-way street, and space 𝑛+1 will be the empty space. If the sequence is not a parking function, then the first driver who is unable to park on the one-way street will take the second street and park in space 𝑛 + 1. We conclude that the parking functions of order 𝑛 are precisely the preference sequences that result in space 𝑛 + 1 being the empty space. We can think of the 𝑛 + 1 parking spaces as being arranged in a circle, with each driver entering the circle at his or her preferred space and then continuing around the circle to the first empty space. Since all parking spaces are treated the same way in this description, each space will be left empty for the same number of preference sequences. Thus the fraction of all preference sequences that leave space 𝑛 + 1 empty is 1/(𝑛 + 1). Since the number of preference sequences is (𝑛 + 1)𝑛 , the number of parking functions of order 𝑛 is 1 ⋅ (𝑛 + 1)𝑛 = (𝑛 + 1)𝑛−1 . 𝑛+1 An interesting observation is that in the original problem (with no second street and no space 𝑛 + 1), if the drivers choose their preferred spaces randomly, then for large 𝑛 the probability that they will all be able to park is (𝑛 + 1)𝑛−1 1 1 𝑛 𝑒 = ⋅ + . ) ≈ (1 𝑛𝑛 𝑛+1 𝑛 𝑛+1 Pollak’s proof can be modified to solve a more general problem. Suppose there are 𝑘 drivers trying to park in 𝑛 spaces, with preferred parking spaces (𝑎1 , 𝑎2 , . . . , 𝑎𝑘 ). As before, each driver tries to park in his or her preferred space, and

136

Chapter 4. Combinatorics

then goes on to higher-numbered spaces if necessary. We will say that the sequence (𝑎1 , 𝑎2 , . . . , 𝑎𝑘 ) is an 𝑛-parking function of length 𝑘 if all drivers succeed in parking. How many 𝑛-parking functions of length 𝑘 are there? The original problem is the case 𝑘 = 𝑛. Note that we will include the case 𝑘 = 0. In that case, the only preference sequence is the empty sequence, and it is an 𝑛-parking function of length 0, since it is vacuously true that all drivers are accommodated. Let 𝑓(𝑛, 𝑘) be the number of 𝑛-parking functions of length 𝑘. Of course, if 𝑘 > 𝑛, then there are not enough spaces to accommodate all drivers, so 𝑓(𝑛, 𝑘) = 0. Now suppose 𝑘 ≤ 𝑛. Once again, to compute 𝑓(𝑛, 𝑘) we add a second street with parking space 𝑛 + 1 and allow drivers to prefer space 𝑛 + 1. All drivers will now be accommodated, with 𝑛 + 1 − 𝑘 spaces left empty, and as before the 𝑛parking functions of length 𝑘 are the preference sequences that result in space 𝑛 + 1 being empty. There are (𝑛 + 1)𝑘 preference sequences, and each leaves 𝑛 + 1 − 𝑘 spaces empty, so if we add up the number of spaces left empty for all possible preference sequences, then the total is (𝑛+1−𝑘)(𝑛+1)𝑘 . But there is a second way to compute this total: for each space, we can count up how many preference sequences leave that space empty, and then add those numbers for all spaces. The sequences that leave space 𝑛 + 1 empty are the 𝑛-parking functions of length 𝑘, and there are 𝑓(𝑛, 𝑘) of them. But as before, by symmetry the number is the same for every space, so when we add these numbers for all spaces the total will be (𝑛+1)𝑓(𝑛, 𝑘). We conclude that (𝑛 + 1 − 𝑘)(𝑛 + 1)𝑘 = (𝑛 + 1)𝑓(𝑛, 𝑘), and therefore 𝑓(𝑛, 𝑘) =

(𝑛 + 1 − 𝑘)(𝑛 + 1)𝑘 = (𝑛 + 1 − 𝑘)(𝑛 + 1)𝑘−1 . 𝑛+1

(40.1)

Of course, when 𝑘 = 𝑛 we get our original answer 𝑓(𝑛, 𝑛) = (𝑛 + 1)𝑛−1 . Equation (40.1) can also be proven by induction on 𝑛. More precisely, we can prove by induction on 𝑛 that for all 𝑘 ≤ 𝑛, (40.1) holds. Surprisingly, the inductive proof does not seem to work to solve directly the original problem in which 𝑘 = 𝑛; one needs to generalize to make the inductive approach work. Our inductive proof will make use of the fact that every permutation of a parking function is also a parking function. To see why this is true, consider two drivers who park consecutively, Alice and Bob. Suppose Alice takes parking space 𝑎, and then Bob is the next driver to arrive and he takes space 𝑏. What would happen if Bob parked before Alice? The outcome would be exactly the same unless in the original ordering Bob preferred space 𝑎, but found it occupied by Alice and was forced to move on to the next empty space, which was 𝑏. In that case, if Bob parked first he would take space 𝑎, and then Alice, finding that space occupied, would take space 𝑏. Our conclusion is that if Alice and Bob trade places in the parking order, they will end up taking the same two spaces, although they may end up trading who takes which space. Repeating this argument, we conclude that any permutation of an 𝑛-parking function of length 𝑘 is

40. A Parking Puzzle

137

another 𝑛-parking function of length 𝑘, and in fact the permuted sequence will result in exactly the same set of spaces being occupied, although not necessarily by the same drivers. It follows that when determining whether or not a preference sequence is a parking function, we may permute the sequence if this makes the analysis easier. Exercise. Show that a sequence (𝑎1 , 𝑎2 , . . . , 𝑎𝑘 ) of integers between 1 and 𝑛 is an 𝑛-parking function of length 𝑘 if and only if for 𝑖 = 1, 2, . . . , 𝑛, the number of entries in the sequence that are greater than 𝑛 − 𝑖 is at most 𝑖. We are now ready to give our inductive proof of equation (40.1). For the base case of the induction, observe that the only 1-parking function of length 0 is the empty sequence, and the only 1-parking function of length 1 is (1), so 𝑓(1, 0) = 𝑓(1, 1) = 1. It is easy now to verify that (40.1) gives the correct values for 𝑛 = 1. For the induction step, suppose (40.1) holds for 𝑛, and consider a sequence of 𝑘 drivers trying to park in 𝑛 + 1 spaces, where 𝑘 ≤ 𝑛 + 1. It will be convenient to assume that the spaces are numbered from 0 to 𝑛 rather than 1 to 𝑛 + 1. Thus, the drivers’ preferences will be represented by a sequence of 𝑘 integers between 0 and 𝑛. Of course, this change will have no effect on the number of preference sequences that lead to successful parking. We first count how many such sequences allow all drivers to park and have exactly 𝑗 terms equal to 0, where 0 ≤ 𝑗 ≤ 𝑘. There are ( 𝑘𝑗 ) possibilities for the positions of the terms equal to 0. All other positions will be filled by integers between 1 and 𝑛. Since we are free to permute the terms when determining whether or not the drivers can park, we may assume that the 0s occupy the last 𝑗 positions, and it is the first 𝑘 − 𝑗 positions that are to be filled with integers between 1 and 𝑛. The first 𝑘 − 𝑗 drivers will all skip over space 0, so the preference assignments for these drivers that lead to them all parking successfully are just the 𝑛-parking functions of length 𝑘 − 𝑗, and there are 𝑓(𝑛, 𝑘 − 𝑗) of these. Once the first 𝑘 − 𝑗 drivers have parked successfully, the last 𝑗 are guaranteed to succeed, since they prefer space 0 and therefore don’t skip over any empty spaces. Thus, the number of preference sequences that allow all drivers to park and that have exactly 𝑗 terms equal to 0 is ( 𝑘𝑗 ) 𝑓(𝑛, 𝑘 − 𝑗). Summing over all possibilities for 𝑗, we get 𝑘

𝑘 𝑓(𝑛 + 1, 𝑘) = ∑ ( )𝑓(𝑛, 𝑘 − 𝑗). 𝑗 𝑗=0

(40.2)

We can now complete the proof by using our inductive hypothesis to evaluate this summation. The algebraic details are left to the reader. Parking functions were introduced by Alan Konheim and Benjamin Weiss [83]. Pollak’s proof can be found in [105]. Much more information about parking functions can be found in [134].

138

Chapter 4. Combinatorics

41 A Black and White Issue Since 999 = 3 ⋅ 333, we can divide the 999 × 999 grid into 3332 = 110889 3 × 3 subgrids. Each of these subgrids consists of a central square surrounded by its eight neighbors. If the central square of one of these subgrids is black, then since by assumption five of the neighbors are white, the subgrid consists of four black squares and five white squares. If the central square is white, then four of the neighbors are black, and so again the subgrid contains four black squares and five white squares. Thus every 3 × 3 subgrid consists of four black squares and five white squares, and therefore the total number of black squares is 110889⋅4 = 443556 and the number of white squares is 110889 ⋅ 5 = 554445. Although the problem doesn’t ask the question, it is natural to wonder if it is possible to color the squares of a 999×999 grid in such a way that the requirements of the problem are satisfied. Indeed it is possible. Figure 41.1 shows one way to color a 9 × 9 grid so that the requirements are satisfied, and the pattern in the figure can be extended to a grid of any size.

Figure 41.1. A 9 × 9 grid satisfying the requirements. This problem is based on a problem from the Estonian Mathematical Olympiads, 1996–97.

42 A Choice Problem We will show that for any 𝑛, there are 𝑛! selector functions. In particular, if 𝑛 = 5, then there are 120 selector functions. Suppose that 𝜋 = 𝑎1 𝑎2 ⋯ 𝑎𝑛 is a permutation of 1 2 ⋯ 𝑛. We define a function 𝑓𝜋 from 𝑆 to [𝑛] as follows: for any 𝐴 ∈ 𝑆, let 𝑓𝜋 (𝐴) = 𝑎𝑖 , where 𝑖 is the smallest index such that 𝑎𝑖 ∈ 𝐴. It is easy to verify that 𝑓𝜋 is aselector function.

43. Water Wave

139

Now suppose 𝜎 = 𝑏1 𝑏2 ⋯ 𝑏𝑛 is a different permutation, and let 𝑖 be the least index such that 𝑎𝑖 ≠ 𝑏𝑖 . Then 𝑓𝜋 ({𝑎𝑖 , 𝑏𝑖 }) = 𝑎𝑖 and 𝑓𝜍 ({𝑎𝑖 , 𝑏𝑖 }) = 𝑏𝑖 , so 𝑓𝜋 ≠ 𝑓𝜍 . Thus, the selector functions for different permutations are different, and therefore we have found 𝑛! different selector functions. We claim now that these are the only selector functions, so the number of selector functions is 𝑛!, as stated earlier. To prove this claim, let 𝑓 be any selector function. Let 𝐴1 = [𝑛], and let 𝑎1 = 𝑓(𝐴1 ). If 𝑛 ≥ 2, then let 𝐴2 = 𝐴1 ⧵ {𝑎1 } and 𝑎2 = 𝑓(𝐴2 ). In general, if 𝑖 < 𝑛, then once we have defined 𝐴1 , 𝐴2 , . . . , 𝐴𝑖 and 𝑎1 , 𝑎2 , . . . , 𝑎𝑖 , we let 𝐴𝑖+1 = 𝐴𝑖 ⧵ {𝑎𝑖 } = [𝑛] ⧵ {𝑎1 , 𝑎2 , . . . , 𝑎𝑖 } and 𝑎𝑖+1 = 𝑓(𝐴𝑖+1 ). This process defines a permutation 𝜋 = 𝑎1 𝑎2 ⋯ 𝑎𝑛 of [𝑛]. Notice that for each 𝑖, 𝐴𝑖 = {𝑎𝑖 , 𝑎𝑖+1 , . . . , 𝑎𝑛 }. To complete the proof, we now show that 𝑓 = 𝑓𝜋 . Toward this end, let 𝐴 be any nonempty subset of [𝑛], and suppose 𝑓𝜋 (𝐴) = 𝑎𝑖 . Then 𝑖 is the smallest index such that 𝑎𝑖 ∈ 𝐴, so 𝐴 ⊆ {𝑎𝑖 , 𝑎𝑖+1 , . . . , 𝑎𝑛 } = 𝐴𝑖 . If 𝐴 = 𝐴𝑖 , then 𝑓(𝐴) = 𝑓(𝐴𝑖 ) = 𝑎𝑖 = 𝑓𝜋 (𝐴). If not, then by clause (2) in the definition of a selector function, either 𝑓(𝐴𝑖 ) = 𝑓(𝐴) or 𝑓(𝐴𝑖 ) = 𝑓(𝐴𝑖 ⧵ 𝐴). But 𝑓(𝐴𝑖 ) = 𝑎𝑖 ∉ 𝐴𝑖 ⧵ 𝐴, so the second case is not possible. Therefore once again we have 𝑓(𝐴) = 𝑓(𝐴𝑖 ) = 𝑎𝑖 = 𝑓𝜋 (𝐴). This shows that 𝑓 and 𝑓𝜋 have the same value at every 𝐴 ∈ 𝑆, so 𝑓 = 𝑓𝜋 . This problem appeared on the Turkish International Mathematical Olympiad Team Selection Test in 1998.

43 Water Wave The wave must strike one corner of the grid first, and by symmetry the same number of orderings arise from waves that strike each of the four corners first. We will count the orderings determined by waves that strike the upper left corner first and then multiply by four to get the total number. Thus, we consider waves that have a slope 𝑚 > 0 and travel from the top of the grid down, as in Figure 43.1 in the statement of the problem. Consider any two people in the grid. If they have the same 𝑥-coordinate, then since the wave moves down, the one with the larger 𝑦-coordinate will be hit by the wave first. Now suppose they have different 𝑥-coordinates; say they are located at (𝑥1 , 𝑦1 ) and (𝑥2 , 𝑦2 ), where 𝑥1 < 𝑥2 . If 𝑦1 ≥ 𝑦2 , then the person at (𝑥1 , 𝑦1 ) will be hit first, since the wave has slope 𝑚 > 0. Now suppose 𝑦1 < 𝑦2 , and let 𝑠 = (𝑦2 − 𝑦1 )/(𝑥2 − 𝑥1 ). Then which person is hit first is determined by whether 𝑚 > 𝑠 or 𝑚 < 𝑠, as shown in Figure 43.2 (our assumption that the wave hits people one at a time rules out 𝑚 = 𝑠). Thus, the ordering arising from a wave with slope 𝑚 is entirely determined by the relationship between 𝑚 and all rational numbers of the form (𝑦2 − 𝑦1 )/(𝑥2 − 𝑥1 ), where 1 ≤ 𝑥1 < 𝑥2 ≤ 100 and 1 ≤ 𝑦1 < 𝑦2 ≤ 100.

140

Chapter 4. Combinatorics

(x2, y2) (x2, y2)

(x1, y1) (x1, y1) (a)

(b)

Figure 43.2. If 𝑚 < 𝑠, as in (a), then the wave strikes the person at (𝑥2 , 𝑦2 ) first, but if 𝑚 > 𝑠, as in (b), then it strikes the person at (𝑥1 , 𝑦1 ) first.

Let 𝑅 = {(𝑦2 − 𝑦1 )/(𝑥2 − 𝑥1 ) ∶ 1 ≤ 𝑥1 < 𝑥2 ≤ 100, 1 ≤ 𝑦1 < 𝑦2 ≤ 100} = {𝑝/𝑞 ∶ 1 ≤ 𝑝, 𝑞 ≤ 99}, and let |𝑅| be the number of elements of 𝑅. The numbers in 𝑅 divide the interval (0, ∞) into |𝑅| + 1 subintervals, and the ordering determined by a wave of slope 𝑚 depends on which of these subintervals 𝑚 belongs to. Thus there are |𝑅| + 1 orderings determined by waves that strike the upper left corner of the grid first, and therefore 4(|𝑅| + 1) orderings in all. Thus, all that remains to solve the problem is to find |𝑅|. It is tempting to think that |𝑅| = 992 , since there are 99 possible values for both the numerator and denominator of each fraction. But this counts some rational numbers multiple times. To avoid this multiple counting, we consider only fractions in lowest terms. Let 𝑃 = {(𝑝, 𝑞) ∶ 1 ≤ 𝑝 ≤ 𝑞 ≤ 99 and gcd(𝑝, 𝑞) = 1}. Then each pair (𝑝, 𝑞) ∈ 𝑃 determines two elements of 𝑅, 𝑝/𝑞 and 𝑞/𝑝, except that the pair (1, 1) determines only the one element 1/1 = 1. Thus |𝑅| = 2|𝑃| − 1, so the number of orderings is 4(|𝑅| + 1) = 8|𝑃|. To find |𝑃|, we use Euler’s totient function 𝜙(𝑞), which counts the number of positive integers 𝑝 ≤ 𝑞 such that gcd(𝑝, 𝑞) = 1. This leads to the conclusion that the number of orderings is 99

8|𝑃| = 8 ∑ 𝜙(𝑞) = 8 ⋅ 3004 = 24032. 𝑞=1

Note that the elements of {0}∪{𝑝/𝑞 ∶ (𝑝, 𝑞) ∈ 𝑃} are the terms of the Farey sequence of order 99. Thus this problem essentially reduces to counting the number of elements in this sequence. This problem is based on problem 339 in [58].

45. A Compatible Committee

141

44 An Acceptable Committee We consider two cases. Suppose first that some professor, say Prof. Smith, likes four or fewer professors. Then we can form a committee that includes all the professors whom Prof. Smith likes. Since every other professor must like some professor whom Prof. Smith likes, the committee will be acceptable to everyone. Now suppose that every professor likes at least five professors. Then each professor dislikes at most seven professors, so the number of committees unacceptable to him or her is at most ( 47 ) = 35. Therefore the number of committees unacceptable to at least one professor is at most 12 ⋅ 35 = 420. But the number of possible committees is ( 12 4 ) = 495, so some committee must be acceptable to everyone. This problem is based on a problem from the 63rd St. Petersburg Mathematical Olympiad.

45 A Compatible Committee We make a directed graph having 100 vertices, one for each senator, with an edge from vertex 𝐴 to vertex 𝐵 if Senator 𝐴 refuses to serve with Senator 𝐵. We seek an independent set of 34 vertices; that is, a set of vertices no two of which are connected by an edge. The existence of such a set can be deduced from the following theorem. Theorem. In any simple directed graph with 3𝑛 + 1 vertices in which each vertex has out-degree at most one, there is an independent set of 𝑛 + 1 vertices. (Note that a simple directed graph has no loops; that is, no edges from a vertex to itself.) Proof. We proceed by induction on 𝑛. If 𝑛 = 0, then our graph must consist of a single vertex and no edges, and the set containing this single vertex is independent. Now suppose the theorem holds for graphs with 3𝑛 + 1 vertices, and consider a simple graph with 3(𝑛 + 1) + 1 = 3𝑛 + 4 vertices in which each vertex has out-degree at most one. The sum of the in-degrees of the vertices is the same as the sum of the out-degrees, which is at most 3𝑛 + 4, so there must be some vertex 𝐴 with in-degree at most one. Let 𝐵 be the unique vertex such that there is an edge from 𝐵 to 𝐴, if such a vertex exists. Otherwise, let 𝐵 be any vertex other than 𝐴. Let 𝐶 be the unique vertex different from 𝐵 such that there is an edge from 𝐴 to 𝐶, if such a vertex exists. Otherwise, let 𝐶 be any vertex other than 𝐴 and 𝐵. If we remove the vertices 𝐴, 𝐵, and 𝐶 from our graph, along with any edges incident to them, we obtain a graph with 3𝑛 + 1 vertices in which all vertices have out-degree at most one, so by the inductive hypothesis this graph has an independent set 𝐼 with 𝑛 + 1 elements. But then 𝐼 ∪ {𝐴} is an independent set in the original graph with 𝑛 + 2 elements, as required.

142

Chapter 4. Combinatorics

Note that the conclusion of the theorem does not necessarily hold for graphs with 3𝑛 vertices. For example, consider a graph consisting of 𝑛 disjoint 3-cycles. Each vertex has out-degree one, and an independent set can contain at most one element from each cycle, and therefore at most 𝑛 elements altogether. Thus, in a senate with 99 members one could not guarantee the existence of a compatible committee of 34 senators. This problem is based on a problem from the 13th University of Michigan Undergraduate Mathematics Competition in 1996.

46 Using Blocks and Chains to Unlock a Safe The shortest sequence that is guaranteed to break the lock has length 102. We prove first that one cannot beat 102. A minimal sequence of button pushes that is guaranteed to open the lock must have the form “S (number string) S (number string) . . . ,” where each number string is a sequence of distinct elements of {1, 2, 3, 4, 5, 6}. We treat this as a sequence of blocks of the form “S (number string).” If a block’s number string has 𝑗 numbers it is called a 𝑗-block. Each 𝑗-block tests exactly one possible combination of each size up to 𝑗. An unlocking sequence must include a 6-block. Another 6-block would not help, because its last entry contributes nothing new and can therefore be deleted while still guaranteeing that the lock will be opened. So a minimal unlocking sequence has only one 6-block. There are six 5-sets and one is taken care of by the 6-block, so five 5-blocks are needed. As before, a sixth 5-block would not help, so a minimal sequence will have five. There are fifteen 4-sets. At most six are handled above, so we need at least nine 4-blocks. Suppose there are 𝑏 4-blocks, where 𝑏 ≥ 9.There are 20 3-sets, and at most 𝑏+6 are already covered, so we need at least 14 − 𝑏 3-blocks. This shows that a lower bound on the total length, taking into account the necessary S-presses, is 1⋅7+5⋅6+𝑏⋅5+(14−𝑏)⋅4 = 93+𝑏 ≥ 102. There are several ways to get an unlocking sequence of length 102. Somewhat surprisingly, a greedy approach works. Start a block with the shortest combination that hasn’t been tested yet, using lexicographic order to break ties, and then continue to add numbers that test new combinations, always choosing the smallest such number. When there is no such number, declare the block complete and start a new block. So we start with 1 and go all the way to 6, getting S123456. Now the smallest uncovered singleton is {2}, so start there and move up in the same way to get S23456. Similarly one gets the other 5-blocks: S31456, S41256, S51236, S61234. Now all singletons and all pairs {1, 𝑥} are covered as is {2, 3}, so start with S24 which can be extended to S2456; because {1, 2, 4} and {2, 3, 4} are already covered, we move from S24 to S245, and similarly to S2456. Continuing in this way gives S2536, S2634, S3456, S3516, S3614, S4516, S4612, S5612. At this point all triplets are covered except those leading to the blocks

46. Using Blocks and Chains to Unlock a Safe

143

S246, S256, S346, S356, S456. Including them leads to the final 102-move unlocking sequence S123456 S23456 S31456 S41256 S51236 S61234 S2456 S2536 S2634 S3456 S3516 S3614 S4516 S4612 S5612 S246 S256 S346 S356 S456. We can answer the question in the general case as well, with a shortest possible sequence. We use [𝑛] for {1, 2, . . . , 𝑛} and 𝑚 for ⌊𝑛/2⌋. Consider a lock with buttons from [𝑛] and a start button S. The lower bound argument given for 𝑛 = 6 extends to give the general lower bound 1 𝑛 𝐿(𝑛) = 2𝑛−1 + ( )(𝑛 + 1). 2 𝑚 This sequence of numbers, starting with 𝑛 = 1, is 2, 5, 10, 23, 46, 102, 204, 443, 886, 1898, . . . (see [99, sequence A191386]). Moreover, there is always an unlocking sequence whose length equals 𝐿(𝑛). Theorem. Any unlocking sequence for the 𝑛-number lock has length at least 𝐿(𝑛). Proof. The proof mimics the argument given for 𝐿(6) = 102. As in that argument, we treat the sequence of button pushes as a sequence of blocks of the form “S (number string).” For 𝑚 ≤ 𝑘 ≤ 𝑛, let 𝑏𝑘 be the number of blocks of button sequences of the form “S (number string)” in which there are at least 𝑘 numbers. To make sure that all possible combinations of size 𝑘 are covered, we must have 𝑏𝑘 ≥ ( 𝑛𝑘 ). Because the numbers in a block cannot repeat, the longest number sequences have length 𝑛. Therefore 𝑏𝑛 is the number of blocks with 𝑛 numbers. With the S, this gives 𝑛 + 1 presses in each such block, so the total number of button presses in these blocks is 𝑏𝑛 (𝑛 + 1). The number of blocks with exactly 𝑛−1 numbers is 𝑏𝑛−1 −𝑏𝑛 , so the number of button presses contributed by these blocks is (𝑏𝑛−1 − 𝑏𝑛 ) 𝑛 = 𝑏𝑛−1 𝑛 − 𝑏𝑛 𝑛. We continue in this way down to the halfway point: 𝑏𝑛−2 (𝑛 − 1) − 𝑏𝑛−1 (𝑛 − 1), ⋮ 𝑏𝑚 (𝑚 + 1) − 𝑏𝑚+1 (𝑚 + 1). Adding and simplifying, the total number of button presses is at least 𝑛

𝑛

𝑛 𝑛 𝑏𝑚 (𝑚 + 1) + ∑ 𝑏𝑖 ≥ ( )(𝑚 + 1) + ∑ ( ). 𝑖 𝑚 𝑖=𝑚+1 𝑖=𝑚+1 We can simplify the lower bound in the preceding equation by considering the even and odd cases separately. Suppose 𝑛 is even, so 𝑚 = 𝑛/2. Then the lower

144

Chapter 4. Combinatorics

bound yields 𝐿(𝑛) as follows, where the last step uses the well-known fact that the sum of row 𝑛 of Pascal’s triangle is 2𝑛 : 𝑛

𝑛

𝑛 𝑛 𝑛 1 1 𝑛 𝑛 ( )(𝑚 + 1) + ∑ ( ) = ( ) (𝑚 + ) + [ ( ) + ∑ ( )] 𝑚 𝑖 𝑚 2 2 𝑚 𝑖 𝑖=𝑚+1 𝑖=𝑚+1 𝑛

𝑛 𝑛+1 1 𝑛 =( ) + ∑( ) 𝑚 2 2 𝑖=0 𝑖 =

1 𝑛 ( )(𝑛 + 1) + 2𝑛−1 = 𝐿(𝑛). 2 𝑚

The odd case reduces to 𝐿(𝑛) in a similar way. Notice that an unlocking sequence will achieve the lower bound if and only if there are no blocks whose number string has length less than 𝑚 and for 𝑚 ≤ 𝑘 ≤ 𝑛, 𝑏𝑘 = ( 𝑛𝑘 ). Next we show how to construct a lock-opening sequence of length 𝐿(𝑛). The key to our construction is the concept of a chain of subsets of [𝑛]. We will say that a sequence of sets 𝑋𝑝 , 𝑋𝑝+1 , . . . , 𝑋𝑞 , where 0 ≤ 𝑝 ≤ 𝑚 ≤ 𝑞 ≤ 𝑛, is a chain if 𝑋𝑝 ⊆ 𝑋𝑝+1 ⊆ ⋯ ⊆ 𝑋𝑞 ⊆ [𝑛] and for 𝑝 ≤ 𝑖 ≤ 𝑞, |𝑋𝑖 | = 𝑖. In our construction that follows we will use a collection 𝒞 of chains such that every subset of [𝑛] belongs to exactly one chain in 𝒞. One can consider the 2𝑛 subsets of [𝑛] as a graph, as shown in Figure 46.1 for 𝑛 = 4; edges go from each set to any set that contains it and has one more element. The figure shows how the 16 sets are covered by six disjoint chains, two of which are just single vertices. For the moment we will simply assume that for every 𝑛 there is a collection 𝒞 of disjoint chains covering [𝑛]; we will prove the existence of such a collection later. Partitions of the graph of all subsets into disjoint chains have been used in various previous investigations; see, for example, [61]. Our lock-opening sequence will have one block “S (number string)” for each element of 𝒞. Suppose 𝑋𝑝 , 𝑋𝑝+1 , . . . , 𝑋𝑞 is a chain in 𝒞. The block of button presses associated with this chain will consist of an S followed by the elements of 𝑋𝑞 , listed in a sequence so that every set in the chain is an initial segment of the sequence. In other words, the number string consists of the elements of 𝑋𝑝 (in any order), followed by the one element of 𝑋𝑝+1 ⧵𝑋𝑝 , followed by the one element of 𝑋𝑝+2 ⧵ 𝑋𝑝+1 , and so on. This sequence of button presses will open the lock if the combination is any set in the chain. Because every subset of [𝑛] belongs to a chain in 𝒞, the sequence of blocks, one for each element of 𝒞, will open the lock no matter what the combination is. For example, the chains of Figure 46.1 lead to the unlocking sequence S1234 S234 S314 S412 S24 S34. Notice that the length of the number string in the block associated with a chain 𝑋𝑝 , 𝑋𝑝+1 , . . . , 𝑋𝑞 is 𝑞, the number of elements in 𝑋𝑞 . Because 𝑞 ≥ 𝑚,

46. Using Blocks and Chains to Unlock a Safe

145

φ

Figure 46.1. A covering of the 16 subsets of {1, 2, 3, 4} by six chains, two of which are just singletons.

there are no blocks whose number string has length less than 𝑚. For any 𝑘 with 𝑚 ≤ 𝑘 ≤ 𝑛, let 𝑏𝑘 be the number of blocks “S (number string)” in which the number string has length at least 𝑘. There is one such block for each chain 𝑋𝑝 , 𝑋𝑝+1 , . . . , 𝑋𝑞 in 𝒞 with 𝑞 ≥ 𝑘. But any such chain must have 𝑝 ≤ 𝑚 ≤ 𝑘 ≤ 𝑞, and therefore it must contain a subset of [𝑛] with 𝑘 elements, namely 𝑋𝑘 ; and every subset of [𝑛] with 𝑘 elements is contained in exactly one such chain. Therefore the number of such chains is the number of subsets of [𝑛] with 𝑘 elements; in other words, 𝑏𝑘 = ( 𝑛𝑘 ). As we observed after the proof of the theorem, it follows that this sequence of button pushes achieves the lower bound, and is therefore optimal. We next turn to the proof of the existence of 𝒞, the desired collection of chains. Suppose 𝑋 ⊆ [𝑛]. The walk determined by 𝑋 is the sequence 𝑠0 , 𝑠1 , . . . , 𝑠𝑛 defined recursively as follows: 𝑠0 = 0, 𝑠 + 1, 𝑠𝑖+1 = { 𝑖 𝑠𝑖 − 1,

if 𝑖 + 1 ∈ 𝑋, if 𝑖 + 1 ∉ 𝑋.

It is not hard to check by induction that 𝑠𝑖 = 2 |𝑋 ∩ [𝑖]| − 𝑖.

146

Chapter 4. Combinatorics

Let 𝑀 be the maximum of the numbers 𝑠0 , 𝑠1 , . . . , 𝑠𝑛 . Let 𝑎 be the smallest index for which this value is achieved, and let 𝑏 be the largest index. In other words, 𝑠𝑎 = 𝑠𝑏 = 𝑀, and if either 𝑖 < 𝑎 or 𝑏 < 𝑖, then 𝑠𝑖 ≤ 𝑀 − 1. We will say that 𝑋 is extendible if 𝑏 < 𝑛. Suppose 𝑋 is extendible. If 𝑏 + 1 ∈ 𝑋, then 𝑠𝑏+1 = 𝑠𝑏 + 1 = 𝑀 + 1, contradicting the maximality of 𝑀; therefore 𝑏 + 1 ∉ 𝑋. We define 𝑓(𝑋) = 𝑋 ∪ {𝑏 + 1}. We say that 𝑋 is contractible if 𝑎 > 0. If 𝑋 is contractible, then similar reasoning implies that 𝑎 ∈ 𝑋, and we define 𝑔(𝑋) = 𝑋 ⧵ {𝑎}. Notice that if |𝑋| < 𝑚, then 𝑠𝑛 = 2 |𝑋| − 𝑛 < 0 = 𝑠0 ≤ 𝑀, so 𝑏 < 𝑛, which means that 𝑋 is extendible. A similar argument shows that if |𝑋| > 𝑚, then 𝑋 is contractible. Of course, [𝑛] is not extendible and ∅ is not contractible. Suppose 𝑋 is extendible, and let 𝑋 ′ = 𝑓(𝑋) = 𝑋 ∪ {𝑏 + 1}. Let 𝑠′0 , 𝑠1′ , . . . , 𝑠′𝑛 be the walk determined by 𝑋 ′ , let 𝑀 ′ be the largest number in this walk, and let 𝑎′ and 𝑏′ be, respectively, the smallest and largest indices where this maximum is achieved. For 0 ≤ 𝑖 ≤ 𝑏 we have 𝑋 ′ ∩ [𝑖] = 𝑋 ∩ [𝑖], and therefore 𝑠′𝑖 = 𝑠𝑖 , and for 𝑏 + 1 ≤ 𝑖 ≤ 𝑛 we have 𝑋 ′ ∩ [𝑖] = (𝑋 ∩ [𝑖]) ∪ {𝑏 + 1}, so 𝑠′𝑖 = 𝑠𝑖 + 2. Therefore: •

for 𝑖 ≤ 𝑏, 𝑠′𝑖 = 𝑠𝑖 ≤ 𝑀,

for 𝑖 ≥ 𝑏 + 1, 𝑠′𝑖 = 𝑠𝑖 + 2 ≤ (𝑀 − 1) + 2 = 𝑀 + 1, and

𝑠′𝑏+1 = 𝑠′𝑏 + 1 = 𝑠𝑏 + 1 = 𝑀 + 1.

It follows that 𝑀 ′ = 𝑀 + 1 and 𝑎′ = 𝑏 + 1. Therefore 𝑋 ′ is contractible, and 𝑔(𝑓(𝑋)) = 𝑔 (𝑋 ′ ) = 𝑋 ′ ⧵ {𝑎′ } = (𝑋 ∪ {𝑏 + 1}) ⧵ {𝑏 + 1} = 𝑋. Similar reasoning shows that if 𝑋 is contractible, then 𝑔(𝑋) is extendible and 𝑓(𝑔(𝑋)) = 𝑋. We conclude that 𝑓 is a bijection mapping extendible sets to contractible sets, and 𝑔 is its inverse. We can now define 𝒞 to be the collection of all sequences of sets 𝑋𝑝 , 𝑋𝑝+1 , . . . , 𝑋𝑞 , where 0 ≤ 𝑝 ≤ 𝑞 ≤ 𝑛, such that: •

|𝑋𝑝 | = 𝑝,

for 𝑝 ≤ 𝑖 < 𝑞, 𝑋𝑖 is extendible and 𝑓 (𝑋𝑖 ) = 𝑋𝑖+1 ,

𝑋𝑝 is not contractible, and

𝑋𝑞 is not extendible.

Notice that these conditions imply that 𝑋𝑝 ⊆ 𝑋𝑝+1 ⊆ ⋯ ⊆ 𝑋𝑞 . Also, since 𝑋𝑝 is not contractible, 𝑝 ≤ 𝑚, and similarly 𝑞 ≥ 𝑚. Thus, every sequence in 𝒞 is a chain. It is not hard to see that every subset of [𝑛] belongs to exactly one chain in 𝒞. To construct the unique chain in 𝒞 containing 𝑋, start with 𝑋, apply 𝑔 repeatedly until you reach a set that is not contractible, and apply 𝑓 repeatedly until you reach a set that is not extendible. Figure 46.2 shows the 15 chains for 𝑛 = 6. Note that the lock-opening sequence derived from these chains is the same as the one found earlier by the

47. A Universal Set of Directions

147

φ

Figure 46.2. A covering of the 64 subsets of [6] by 20 chains. This leads to an unlocking sequence of length 102. greedy method. One can show that the greedy method always produces the sequence derived from the chains constructed by the extendible and contractible set method, and hence always leads to an optimal solution of the lock problem. The combination lock problem is due to John Guilford.

47 A Universal Set of Directions Call Rome number 0 and number the other cities 1–10, in counterclockwise order. Color both roads between 0 and 1 red, both roads between 1 and 2 blue, and

148

Chapter 4. Combinatorics

Figure 47.2. The instructions blue, red, blue, red, blue, red, blue, red, blue, red always leave you at Rome.

Figure 47.3. The sequence blue, blue, blue, blue, blue, red, red, red, red, red always leaves you at Rome. continue around the cycle alternating colors in this way. Then make just one change, turning 0 → 1 blue (see Figure 47.2). Then the 10-move sequence blue, red, blue, red, blue, red, blue, red, blue, red always leaves you at Rome. Ten is the shortest such instruction sequence because a shorter even-length sequence could not get from 10 to Rome, and a shorter odd-length sequence could not get from Rome back to Rome.

48. A Competition Problem About a Competition Problem

149

An alternate solution colors edge 0 → 10 red and colors the other edges red if they point in the direction of the shortest path to Rome, and blue otherwise (see Figure 47.3). Then the sequence blue, blue, blue, blue, blue, red, red, red, red, red does the job. The given solutions work for any odd number of cities. If there are an even number of cities, then the network is a bipartite graph: the vertices split into two sets 𝐶1 (the odd-numbered cities) and 𝐶2 (the even-numbered cities) and every edge that starts in 𝐶1 ends in 𝐶2 and vice versa. Thus any even-length instruction list will end up in the same part one starts in, whereas any odd-length sequence will end up in the other part; therefore no sequence can be universal. The same impossibility exists if the vertices can be partitioned into sets 𝐶1 ∪ ⋯ ∪ 𝐶𝑘 (with 𝑘 ≥ 2) so that each edge out of a vertex in 𝐶𝑖 goes into 𝐶𝑖+1 (mod 𝑘). A graph with such a partition is called periodic. Let’s use the term road graph for a directed graph where each vertex has exactly two edges leading out of it and there is a path from any vertex to any other vertex. And call a road graph resolvable if there is a vertex 𝑣 and a coloring of the edges with two colors such that the edges leading out of every vertex have distinct colors and there is a sequence of color instructions that ends up at 𝑣 no matter where one starts. Note that the choice of 𝑣 is immaterial, because one could always tack on a sequence of instructions getting from 𝑣 to another vertex 𝑢 (using the fact that the graph is strongly connected). So cycles of odd length are resolvable and even cycles are not. If a road graph is resolvable, then the graph is aperiodic (i.e., not periodic). The main conjecture in this area, from 1970, was that every aperiodic road graph is resolvable. This was proved in 2009 by Avraham Trahtman [120].

48 A Competition Problem About a Competition Problem Observe first that 𝑇, the sum of all the scores, is even. Sort the students in order from low score to high. All scores were given, so any two adjacent students in this list have scores that differ by 0 or 1. Now split them into two groups by going through the list in order, taking two students at a time and putting one in one set and the other in the other set. You can do this in such a way that, throughout the process, the total scores of the two sets differ by at most 1. More precisely, if the total scores are the same, place the two arbitrarily; if they are different, place the two to either balance them or keep the difference at 1. At the end, the total scores of the two groups must be the same, because 𝑇 is even. And this means that each group has average 𝑋. Whenever the total score is even, the preceding proof works. If the total score is odd, then an evenly balanced splitting cannot exist; for example, if 12 students have scores 0 through 10, with one extra 0, then the total is 55. This problem was Problem A4 on the December 2017 Putnam Competition.

5 Probability 49 The Importance of Irrelevant Information For (a), if we list the elder child first, then, before we hear the answer to the question, the possibilities are 𝑀𝑀, 𝑀𝐹, 𝐹𝑀, or 𝐹𝐹 with equal probability (where 𝑀 is male and 𝐹 female). But the parent’s answer means that 𝐹𝐹 is impossible, and so the chance of 𝑀𝑀 is 1/3. Surprisingly, the answer to (b) is 13/27. There are 14 possibilities (𝑀Monday – 𝑀Sunday and 𝐹Monday –𝐹Sunday ) for the elder child, and similarly 14 for the younger. So there are 142 = 196 possibilities in all. Of those, 27 meet the condition that one is a boy born on Tuesday: (𝑀Tuesday , anything) gives 14 as does (anything, 𝑀Tuesday ), but the case (𝑀Tuesday , 𝑀Tuesday ) is counted twice, so the total is 27. Of these, 14 involve a girl—(𝑀Tuesday , 𝐹anything ) and (𝐹anything , 𝑀Tuesday )—leaving 13 cases where both children are male and giving the final answer of 13/27. An alternate approach uses conditional probability. Let 𝐴 be the event that both children are male, and 𝐵 the event that there is at least one male born on a Tuesday; we seek the value of 𝑃(𝐴 ∣ 𝐵). We have 13 2 27 169 = , ) =1− 14 196 196 1 6 2 13 𝑃(𝐴 ∧ 𝐵) = 𝑃(𝐴) − 𝑃(𝐴 ∧ ¬𝐵) = − ( ) = . 4 14 196 𝑃(𝐵) = 1 − 𝑃(¬𝐵) = 1 − (

Therefore, because 𝑃(𝐴 ∣ 𝐵) = 𝑃(𝐴∧𝐵)/𝑃(𝐵), the conditional probability is 13/27. 151

152

Chapter 5. Probability

This argument extends easily to the case where “born on Tuesday” is instead “has property 𝑆” where 𝑆 has probability 𝑝 of occurring. The answer is then (2 − 𝑝)/(4 − 𝑝). So if one gets an affirmative answer to: “Do you have a son born on Christmas Day?”, then the probability of two sons is very close to 1/2. If the day of the question is posed as “a day with the letter u in it,” then the two-male probability is exactly halfway between 1/3 and 1/2. Problem (b) is due to Gary Foshee and it (along with (a)) has generated a lot of discussion, since the probability can be dependent on the exact wording and conditions underlying how the knowledge is obtained. If the problem is phrased as: “A parent tells you that she has two children and at least one is a boy born on a Tuesday,” then the listener might well ask how the parent was chosen and how she chose what to say, and the answer depends on this background information. For one example, suppose a random parent of two children is asked to pick a child at random and announce the child’s gender. The parent says, “The child I chose is a boy.” What is the probability that the other child is also a boy? Even though this seems very similar to problem (a), the answer is not 1/3 but rather 1/2. Notice that it is important that the parent made a random choice. If the parent is allowed to choose the child however she wants, then the answer could be completely different. For example, suppose we know that the parent prefers girls, and when asked to choose a child, would choose a girl if possible. In that case, if the parent says, “The child I chose is a boy,” then the other child could not be a girl, for the parent would have chosen her. So the probability that the other child is also a boy is 1! One can find detailed discussions of the various issues at [77, 131]. One reason the problem generates controversy is that it seems like the Tuesday fact should be irrelevant. After all, everyone is born on some day. What difference can it make knowing that that day is Tuesday for one male child? But in fact the Tuesday knowledge has a large impact, changing the answer from, roughly, 33% to 48%. Things are clarified by considering a more extreme case. Suppose you ask a random parent of two children: “Do you have at least one son born on January 1?” and the answer is “Yes.” You had to be very lucky to have selected a parent of such an unusual child. Having one or two sons is not so rare, but having one with such a special birthdate is. The chance of her having such a special son is much greater if she has two sons, as opposed to just one. It is this that makes the two-son probability rise when some special information is known. One can work out the details as follows, where 𝑆 denotes the special property (such as a Tuesday birth), which we assume has probability 𝑝 of occurring among all children. Let 𝐴 refer to the occurrence of two males, let 𝐵 be the event that there is at least one male having property 𝑆, and let 𝐶 be the event that the two

49. The Importance of Irrelevant Information

153

children have opposite gender. Then 𝑃(𝐴 ∧ 𝐵) 𝑃(𝐴 ∧ 𝐵) = 𝑃(𝐵) 𝑃(𝐵 ∧ 𝐴) + 𝑃(𝐵 ∧ 𝐶) 1 1 1 = = = . 𝑃(𝐵∧𝐶) 𝑃(𝐵∣𝐶)/2 𝑃(𝐵∣𝐶) 1+ 1+ 1+2

𝑃(𝐴 ∣ 𝐵) =

𝑃(𝐵∧𝐴)

𝑃(𝐵∣𝐴)/4

𝑃(𝐵∣𝐴)

This shows that the conditional probability as in problem (b) is determined by the ratio 𝑃(𝐵 ∣ 𝐶)/𝑃(𝐵 ∣ 𝐴). This ratio compares the probability of event 𝑆 given it has only one chance (𝐶) as opposed to two chances (𝐴): its reciprocal tells us how much the chance of a boy with property 𝑆 goes up when we have two boys rather than just one. If property 𝑆 is rare, the ratio will be about 1/2 and the conditional probability 𝑃(𝐴 ∣ 𝐵) will be about 1/2. For a common property, the ratio will be close to 1 and the conditional probability will be about 1/3. To express the ratio in terms of 𝑝, use 𝑃(𝐵 ∣ 𝐶) = 𝑝 and 𝑃(𝐵 ∣ 𝐴) = 2𝑝 − 𝑝2 , where 𝑝2 accounts for the case that both boys have property 𝑆. Then 1 𝑃(𝐵 ∣ 𝐶) = 2−𝑝 𝑃(𝐵 ∣ 𝐴) and we see that for small 𝑝, this is close to 1/2, while for large 𝑝, it is close to 1. When 𝑝 = 1/7 this approach gives 𝑃(𝐴 ∣ 𝐵) = 13/27. Note that in some puzzles (e.g., the ace of spades puzzle we present later), the correction term of 𝑝2 would be left out. Another way of understanding the relevance of the seemingly irrelevant fact of a Tuesday birth is as follows. First consider the following simple principle of probability. Let 𝐵1 and 𝐵2 be disjoint events, let 𝐵 be their union, and let 𝐴 be any other event. Then 𝑃(𝐴 ∣ 𝐵) is a weighted average of 𝑃(𝐴 ∣ 𝐵1 ) and 𝑃(𝐴 ∣ 𝐵2 ). In particular, if 𝑃(𝐴 ∣ 𝐵1 ) = 𝑃(𝐴 ∣ 𝐵2 ) = 𝑝, then 𝑃(𝐴 ∣ 𝐵) = 𝑝. This applies equally well for more than two disjoint events. Let 𝐴 be the event “Both children are boys”; let 𝐵𝑖 be “At least one child is a boy born on the 𝑖th day of the week”; and let 𝐵 be the union of 𝐵1 through 𝐵7 , which is the event “At least one child is a boy.” Problem (b) asks for 𝑃(𝐴 ∣ 𝐵2 ), but of course the same reasoning applies to any day of the week, so we have 𝑃(𝐴 ∣ 𝐵1 ) = 𝑃(𝐴 ∣ 𝐵2 ) = ⋯ = 𝑃(𝐴 ∣ 𝐵7 ) = 𝑝, say. It is tempting to think that the events 𝐵1 through 𝐵7 are disjoint: after all, a child can only be born on one day. If they are disjoint, then the probability principle above gives 𝑝 = 𝑃(𝐴 ∣ 𝐵) = 1/3, by part (a). In other words, the principle seems to imply that the Tuesday information is irrelevant. The mistake here is that the events 𝐵𝑖 are not disjoint, because there can be two boys born on different days. If 𝐵𝑖 were “The older child is a boy born on the 𝑖th day of the week,” then the events would be disjoint. But with “at least one child” rather than “the older child,” they are not.

154

Chapter 5. Probability

Problem (b) is a variation on a problem about dealing aces that illustrates the same points in a more transparent probabilistic context. We leave these as exercises. For two cards dealt from a standard shuffled deck, what is the probability that they are both aces? What is the probability of two aces, given that at least one card is an ace? What is the probability of two aces, given that at least one card is the ace of spades? The form of problems (a) and (b) given here avoids the uncertainties due to context; it was presented by Tanya Khovanova in [77] and Peter Winkler in [131].

50 Creeping Ants We ignore the possibility of two ants starting at the same location, which is a zeroprobability event. Imagine that each ant is carrying a flag. When ants bump into each other, they not only reverse direction, they also exchange their flags. Then the trajectories of the ants are complicated, but the trajectories of the flags are easy: they just go to the end of the stick and then reverse direction. So the position of each flag after one minute is just the mirror image of its starting position. But each flag is being carried by an ant, so the set of ant positions after one minute is the mirror image of the set of ant positions at the beginning. The left-to-right order of the ants never changes, because they don’t pass each other, so if Alice was the 𝑖th ant from the left originally, then her position after one minute is the mirror image of the original position of the 𝑖th ant from the right. This is the center if and only if 𝑖 = 51. So to find the answer we must compute the probability that Alice is ant number 51. There are 2100 possibilities for the set of ants that are placed to the left of Alice, and all are equally likely. The number of these possibilities that make Alice ant number 51 is ( 100 50 ). Thus the probability that Alice is at the center after one minute is ( 100 50 ) ≈ 0.0796. 2100 Note that, after two minutes, all ants return to their original positions, so the probability that Alice is at the center is 1. This problem is due to John Guilford; it appeared in [18, Spring 2004, problem 1]. Similar problems have appeared in a number of places, including [118, Ants on a Stick] and [132, pp. 35–43].

51 Roll the Dice The answer is 6(1 − (5/6)𝑛 ). The number of distinct faces seen must be between 1 6 and 6, and by definition the expected number is ∑𝑗=1 𝑗𝑝𝑗 , where 𝑝𝑗 is the probability that the number of distinct faces seen is 𝑗. Unfortunately, the computation

52. Conditioned Throws of a Die

155

of the numbers 𝑝𝑗 is somewhat complicated. We present two alternative ways of computing the expected value, both based on the use of indicator variables. For our first solution, for 1 ≤ 𝑖 ≤ 𝑛 we let 𝑋𝑖 be an indicator variable that is 1 if the result of the 𝑖th roll is different from the results of all later rolls and 0 otherwise. Since each result that occurs must have a last occurrence, the number 𝑛 of distinct faces seen is ∑𝑖=1 𝑋𝑖 , and therefore by the linearity of expected values the expected number of distinct faces seen is 𝑛

𝑛

𝐸 ( ∑ 𝑋𝑖 ) = ∑ 𝐸(𝑋𝑖 ). 𝑖=1

𝑖=1

For each 𝑖, no matter what the outcome of the 𝑖th roll is, the probability that any later roll of the die will have a different outcome than the 𝑖th roll is 5/6. Since there are 𝑛 − 𝑖 rolls after the 𝑖th roll, 𝐸(𝑋𝑖 ) = 𝑃(𝑋𝑖 = 1) = (5/6)𝑛−𝑖 . Applying the formula for the sum of a finite geometric series we find that the expected number of distinct faces seen is 𝑛

𝑛−1

𝑛

5 𝑘 1 − (5/6)𝑛 5 𝑛 5 𝑛−𝑖 ∑ 𝐸(𝑋𝑖 ) = ∑ ( ) = ∑ ( ) = = 6 (1 − ( ) ) . 6 6 1 − 5/6 6 𝑘=0 𝑖=1 𝑖=1 For our second solution, we use a different family of indicator variables. For 1 ≤ 𝑗 ≤ 6, let 𝑌𝑗 be an indicator variable that is 1 if 𝑗 occurs as the result of at least 6

one roll of the die, and 0 if not. The number of distinct faces seen is ∑𝑗=1 𝑌𝑗 , so the expected number of distinct faces seen is 6

6

𝐸 ( ∑ 𝑌𝑗 ) = ∑ 𝐸(𝑌𝑗 ). 𝑗=1

𝑗=1

For each 𝑗, the probability that 𝑗 never occurs as the result of any roll is (5/6)𝑛 , and therefore 𝐸(𝑌𝑗 ) = 𝑃(𝑌𝑗 = 1) = 1 − (5/6)𝑛 . Thus the expected number of distinct faces seen is 6

6

5 𝑛 5 𝑛 ∑ 𝐸(𝑌𝑗 ) = ∑ (1 − ( ) ) = 6 (1 − ( ) ) . 6 6 𝑗=1 𝑗=1 This problem and many others involving rolling dice can be found in [26].

52 Conditioned Throws of a Die (a) Let 𝐿 be the random variable that gives the length of the sequence of throws, and let 𝐸(𝐿) denote its expected value. The definition of expected value is 𝐸(𝐿) = ∞ ∑𝑖=1 𝑖𝑃(𝐿 = 𝑖), where 𝑃 denotes probability. Therefore ∞

2 𝑖−1 1 𝐸(𝐿) = ∑ 𝑖 ( ) ( ) = 3, 3 3 𝑖=1

156

Chapter 5. Probability ∞

where the sum follows from the identity ∑𝑖=1 𝑖𝑟𝑖−1 = 1 /(1 − 𝑟)2 (when −1 < 𝑟 < 1). Alternatively, 𝐸(𝐿) = (1/3)1 + (2/3)(1 + 𝐸(𝐿)), which gives 𝐸(𝐿) = 3. (b) It is tempting to think the answer is 3, as in (a), because the fact that 4, 5, and 6 are disallowed makes it seem as if the problems are identical. But they are not. It turns out that the chance that 1 is the length of the throw sequence in (b) is 2/3, as opposed to the 1/3 from (a). And the expected length in (b) is 3/2. To understand the subtlety in the conditional probability, consider these two versions: (1) Toss until you get a 1, but if you ever get a 4, 5, or 6, then discard the entire sequence so far and start over. What’s the expected length of the final sequence ending in 1? (2) Toss until you get a 1, but if you ever get a 4, 5, or 6 then discard that toss (only that single result, not the entire sequence) and throw again. What’s the expected length of the final sequence? Problem (1) is equivalent to (b). While it is natural to think that (2) is also equivalent to (b), it is not; in fact, (2) is equivalent to (a). The difference between “discard any toss of 4, 5, or 6” of (2) and “discard the entire sequence if a 4, 5, or 6 arises” of (1) is critical. The latter results in some 2s or 3s (but not 1) getting discarded, but the former doesn’t. To get the expected value in (b), again let 𝐿 be the length of the sequence, but now in the probability calculations we condition on the event 𝐴: all throws give ∞ 1, 2, or 3. The probability of 𝐴 is ∑𝑖=1 (2/6)𝑖−1 (1/6) = 1/4. Therefore the conditional expected value of 𝐿 is as follows, where we use the definition of conditional probability as a quotient: ∞

𝐸(𝐿 ∣ 𝐴) = ∑ 𝑖𝑃(𝐿 = 𝑖 ∣ 𝐴) = ∑ 𝑖 𝑖=1

𝑖=1

𝑃(𝐿 = 𝑖 ∧ 𝐴) (2/6)𝑖−1 (1/6) 3 = . = ∑𝑖 1/4 2 𝑃(𝐴) 𝑖=1

Here is an alternative solution (due to Paul Cuff) that avoids the need to compute conditional probabilities. The question can be rephrased as: Toss a die until the first time the result is 1, 4, 5, or 6 and let 𝐿 denote the length of the sequence of tosses. What is the expected value of 𝐿, conditioned on the last toss being 1? But this is the same as the unconditioned expected value of 𝐿, because this unconditioned expected value is the average of the four expected values conditioned on the four possibilities for the last throw, and these four conditional expected values are the same. Therefore the answer is the unconditioned expected value ∞ of 𝐿, which is ∑𝑖=1 𝑖(1/3)𝑖−1 (2/3) = 3/2. This problem is due to Eichanan Mossel [72].

53. Where Are the Rounded Powers of Two?

157

% % %

%

Figure 53.1. Proportion of the first 𝑁 rounded powers of 2 that start with each digit, for 𝑁 ≤ 3000. The order of likelihood is 2, 1, 3, 4, 5, 6, 7, 8, 9. The proportions are shown in a logarithmic scale.

53 Where Are the Rounded Powers of Two? According to Benford’s law for powers of 2, the asymptotic proportion of powers of 2 with leading digit 𝑑 (no rounding) is log[(𝑑 + 1)/𝑑] (where throughout this discussion log denotes log10 ). Thus the leading digit 1 occurs about 30.1% of the time, and 1 is by far the most likely leading digit for a power of 2. This surprising digit behavior is found not only in the powers of 2 but also in many other collections of numbers. For more about Benford’s law, see [12, 94]. However, a little computation suggests that the situation for rounded powers of 2 is different. Figure 53.1 shows the proportion of the first 𝑁 rounded powers of two that start with each digit, for 𝑁 up to 3000, and it appears that 2, not 1, is the most likely digit. What is the explanation for this? Our method will be to imitate the proof of Benford’s law for powers of 2, but make adjustments for the rounding. The key to the proof of Benford’s law for powers of 2 is the equidistribution theorem. For any real number 𝑥, let {𝑥} denote the fractional part of 𝑥; in other words, {𝑥} = 𝑥 − ⌊𝑥⌋, where ⌊𝑥⌋ is the greatest integer less than or equal to 𝑥. For any positive integer 𝑁, let [𝑁] = {1, 2, 3, . . . , 𝑁}. Intuitively, the equidistribution theorem says that for any irrational number 𝑥, the numbers {𝑛𝑥} for positive integers 𝑛 are uniformly distributed in the interval [0, 1). Here is the precise statement. Equidistribution Theorem. Suppose 𝑥 is an irrational number and 0 ≤ 𝑐 < 𝑑 ≤ 1. Let 𝐿 = 𝑑 − 𝑐. Then lim

𝑁→∞

|{𝑛 ∈ [𝑁] ∶ {𝑛𝑥} ∈ [𝑐, 𝑑)}| = 𝐿. 𝑁

158

Chapter 5. Probability

The equidistribution theorem was first proven in 1909 and 1910 independently by Hermann Weyl, Wacław Sierpiński, and Piers Bohl. It is often proven using methods of ergodic theory or Fourier analysis. However, it is also possible to give a completely elementary proof. We will give such an elementary proof later, but first we see how the theorem can be used both to prove Benford’s law for powers of 2 and to solve our problem. We will apply the equidistribution theorem to the irrational number log 2. To see that this number is irrational, suppose it is rational; say log 2 = 𝑝/𝑞 for some positive integers 𝑝 and 𝑞. Then 10𝑝/𝑞 = 2, so 10𝑝 = 2𝑞 . But the left side is divisible by 5 and the right side is not, so this is impossible. Suppose 𝑛 is a positive integer, and let 𝑘 = ⌊log 2𝑛 ⌋. Then log 2𝑛 = ⌊log 2𝑛 ⌋ + {log 2𝑛 } = 𝑘 + {𝑛 log 2}, so 2𝑛 = 10{𝑛 log 2} ⋅ 10𝑘 . Note that 0 ≤ {𝑛 log 2} < 1, and therefore 1 ≤ 10{𝑛 log 2} < 10. For 𝑑 = 1, 2, . . . , 9, the leading digit of 2𝑛 will be 𝑑 if and only if 𝑑 ≤ 10{𝑛 log 2} < 𝑑 +1, or equivalently log 𝑑 ≤ {𝑛 log 2} < log(𝑑 + 1). Thus, for any positive integer 𝑁, the proportion of the first 𝑁 positive powers of 2 that start with the digit 𝑑 is |{𝑛 ∈ [𝑁] ∶ {𝑛 log 2} ∈ [log 𝑑, log(𝑑 + 1))}| . 𝑁 According to the equidistribution theorem, as 𝑁 → ∞ this proportion approaches log(𝑑 + 1) − log 𝑑 = log(

𝑑+1 ), 𝑑

which proves Benford’s law for powers of 2. To solve our problem, we must take the rounding into account before applying the equidistribution theorem. Once again we write 2𝑛 = 10{𝑛 log 2} ⋅10𝑘 , where 𝑘 = ⌊log 2𝑛 ⌋. To round 2𝑛 to one significant digit, we can round 10{𝑛 log 2} to the nearest integer. For 𝑑 = 2, 3, . . . , 9, the leading digit after rounding will be 𝑑 if and only if 𝑑 − 1/2 ≤ 10{𝑛 log 2} < 𝑑 + 1/2, or in other words log(𝑑 − 1/2) ≤ {𝑛 log 2} < log(𝑑 + 1/2). We conclude that for any positive integer 𝑁, the proportion of the first 𝑁 rounded positive powers of 2 that start with 𝑑 is |{𝑛 ∈ [𝑁] ∶ {𝑛 log 2} ∈ [log(𝑑 − 1/2), log(𝑑 + 1/2))}| , 𝑁 and by the equidistribution theorem, as 𝑁 → ∞ this proportion approaches 1 1 2𝑑 + 1 log(𝑑 + ) − log(𝑑 − ) = log( ). 2 2 2𝑑 − 1 However, 𝑑 = 1 is different, because the leading digit will be 1 if 10{𝑛 log 2} rounds to either 1 or 10, which means {𝑛 log 2} belongs to either [0, log 3/2) or

53. Where Are the Rounded Powers of Two?

159

Table 53.1. Limiting probabilities for leading digits of rounded powers of 2, and counts for each leading digit among first 10000 rounded powers of 2. Digit 1 2 3 4 5 6 7 8 9

Limiting Probability 0.1984 0.2218 0.1461 0.1091 0.08715 0.07255 0.06215 0.05436 0.04830

First 10000 1983 2220 1461 1091 872 725 621 544 483

[log 19/2, 1). By the equidistribution theorem, the limiting probability of a leading 1 is therefore 19 19 3 log( ) + 1 − log( ) = 1 − log( ) . 2 2 3 The limiting probabilities for all digits are shown in Table 53.1. The table also shows that these limiting probabilities predict very accurately how often each leading digit occurs among the first 10000 rounded powers of 2. The table confirms that the most likely leading digit is 2. All of these ideas work just as well to study rounded powers of 2 in any base that is not itself a power of 2. David Broadhurst (Open University, UK) made the surprising discovery that in base 5, the limiting probabilities of the leading digits 1 and 2 are exactly equal; both are 1 − log5 3. For base 3 the most likely leading digit is 1, while for bases greater than 5 that are not powers of 2 the most likely leading digit is 2. Finally, we turn to the proof of the equidistribution theorem. We will often use the fact that if two numbers differ by an integer, then their fractional parts are the same. For example, for any real numbers 𝑥 and 𝑦 and any integers 𝑠 and 𝑡, {𝑠𝑥 + 𝑡𝑦} = {𝑠{𝑥} + 𝑡{𝑦}}. Note also that if 0 ≤ 𝑥 < 1, then {𝑥} = 𝑥. We begin with two lemmas. The first can easily be extended to show that for irrational 𝑥, the numbers {𝑛𝑥} are dense in the interval [0, 1). However, we will not need this extension. Lemma 53.1. Suppose 𝑥 is irrational and 𝜖 > 0. Then there is some positive integer 𝑛 such that 0 < {𝑛𝑥} < 𝜖. Proof. We may assume that 𝜖 < 1. Choose a positive integer 𝑁 large enough that 1/𝑁 ≤ 𝜖, and divide the interval [0, 1) into 𝑁 equal subintervals [0, 1/𝑁),

160

Chapter 5. Probability

[1/𝑁, 2/𝑁), . . . , [1 − 1/𝑁, 1). By the pigeonhole principle there must be positive integers 𝑗 and 𝑘 with 𝑗 < 𝑘 such that {𝑗𝑥} and {𝑘𝑥} belong to the same subinterval, and therefore |{𝑘𝑥}−{𝑗𝑥}| < 1/𝑁 ≤ 𝜖. Let 𝛿 = {𝑘𝑥}−{𝑗𝑥} and 𝑚 = 𝑘−𝑗. Note that −𝜖 < 𝛿 < 𝜖, 𝑚 is a positive integer, and {𝑚𝑥} = {𝑘𝑥 − 𝑗𝑥} = {{𝑘𝑥} − {𝑗𝑥}} = {𝛿}. If 𝛿 = 0, then {𝑚𝑥} = {0} = 0, which means that 𝑚𝑥 is an integer. But this contradicts the fact that 𝑥 is irrational. Therefore either 𝛿 > 0 or 𝛿 < 0. Case 1. 𝛿 > 0. Then 0 < 𝛿 < 𝜖 < 1 and {𝑚𝑥} = {𝛿} = 𝛿, so 0 < {𝑚𝑥} < 𝜖. Case 2. 𝛿 < 0. Then −1 < −𝜖 < 𝛿 < 0. Adding 1 to this inequality gives us 0 < 1 − 𝜖 < 1 + 𝛿 < 1, so {𝑚𝑥} = {𝛿} = {1 + 𝛿} = 1 + 𝛿. Choose a positive integer 𝑡 such that 1 + (𝑡 + 1)𝛿 ≤ 0 < 1 + 𝑡𝛿. Then 0 < 1 + 𝑡𝛿 ≤ −𝛿 < 𝜖 < 1 and {𝑡𝑚𝑥} = {𝑡{𝑚𝑥}} = {𝑡(1 + 𝛿)} = {𝑡 + 𝑡𝛿} = {1 + 𝑡𝛿} = 1 + 𝑡𝛿, so 0 < {𝑡𝑚𝑥} < 𝜖. In our proof of the equidistribution theorem we will need to consider numbers of the form {𝑎 + 𝑛𝑦} for fixed 𝑎 ∈ [0, 1) and 𝑦 > 0, rather than {𝑛𝑥} for irrational 𝑥. Our next lemma says that for small 𝑦 these numbers come close to being uniformly distributed in [0, 1). Lemma 53.2. Suppose 𝑦 > 0, 0 ≤ 𝑎 < 1, and 0 ≤ 𝑐 < 𝑑 ≤ 1. Let 𝐿 = 𝑑 − 𝑐. Then for all sufficiently large 𝑁, |{𝑛 ∈ [𝑁] ∶ {𝑎 + 𝑛𝑦} ∈ [𝑐, 𝑑)}| 𝐿 − 2𝑦 < < 𝐿 + 2𝑦. 𝑁 Proof. For every integer 𝑘, let 𝐵𝑘 = {𝑛 ∈ ℤ ∶ ⌊𝑎 + 𝑛𝑦⌋ = 𝑘 and {𝑎 + 𝑛𝑦} ∈ [𝑐, 𝑑)} = {𝑛 ∈ ℕ ∶ 𝑘 + 𝑐 ≤ 𝑎 + 𝑛𝑦 < 𝑘 + 𝑑}. These sets form a partition of {𝑛 ∈ ℤ ∶ {𝑎 + 𝑛𝑦} ∈ [𝑐, 𝑑)}. Notice that for 𝑗 < 𝑘, all elements of 𝐵𝑗 are less than all elements of 𝐵𝑘 . Now we estimate the number of elements in each set 𝐵𝑘 . Since 𝑦 > 0, there are integers 𝑛1 and 𝑛2 such that 𝑎 + 𝑛1 𝑦 < 𝑘 + 𝑐 ≤ 𝑎 + (𝑛1 + 1)𝑦,

𝑎 + 𝑛2 𝑦 < 𝑘 + 𝑑 ≤ 𝑎 + (𝑛2 + 1)𝑦,

so 𝐵𝑘 = {𝑛 ∈ ℤ ∶ 𝑛1 +1 ≤ 𝑛 ≤ 𝑛2 } and therefore |𝐵𝑘 | = 𝑛2 −𝑛1 . By the definitions of 𝑛1 and 𝑛2 , we have 𝐿 = (𝑘 + 𝑑) − (𝑘 + 𝑐) < (𝑎 + (𝑛2 + 1)𝑦) − (𝑎 + 𝑛1 𝑦) = (𝑛2 − 𝑛1 + 1)𝑦, 𝐿 = (𝑘 + 𝑑) − (𝑘 + 𝑐) > (𝑎 + 𝑛2 𝑦) − (𝑎 + (𝑛1 + 1)𝑦) = (𝑛2 − 𝑛1 − 1)𝑦. Therefore

𝐿 𝐿 − 1 < |𝐵𝑘 | = 𝑛2 − 𝑛1 < + 1. 𝑦 𝑦 Now consider any positive integer 𝑁. We wish to determine how many elements of {𝑛 ∈ ℤ ∶ {𝑎 + 𝑛𝑦} ∈ [𝑐, 𝑑)} belong to [𝑁]. Let 𝐾 = ⌊𝑎 + 𝑁𝑦⌋, and assume that 𝑁 is large enough that 𝐾 ≥ 2. For every 𝑛 ∈ [𝑁] we have 0 = ⌊𝑎⌋ ≤ ⌊𝑎 + 𝑛𝑦⌋ ≤ ⌊𝑎 + 𝑁𝑦⌋ = 𝐾,

53. Where Are the Rounded Powers of Two?

161

and therefore 𝐵1 ∪ 𝐵2 ∪ ⋯ ∪ 𝐵𝐾−1 ⊆ {𝑛 ∈ [𝑁] ∶ {𝑎 + 𝑛𝑦} ∈ [𝑐, 𝑑)} ⊆ 𝐵0 ∪ 𝐵1 ∪ ⋯ ∪ 𝐵𝐾 . Applying our estimate for the size of each 𝐵𝑘 , we get (𝐾 − 1) (

𝐿 𝐿 − 1) ≤ |{𝑛 ∈ [𝑁] ∶ {𝑎 + 𝑛𝑦} ∈ [𝑐, 𝑑)}| ≤ (𝐾 + 1) ( + 1) . 𝑦 𝑦

(53.1)

This gives us bounds on the numerator of the proportion in the lemma. For the denominator, by the definition of 𝐾 we have 𝐾 ≤ 𝑎+𝑁𝑦 < 𝐾+1, and therefore 𝐾−1 𝐾−𝑎 𝐾+1−𝑎 𝐾+1 < ≤𝑁< ≤ . 𝑦 𝑦 𝑦 𝑦

(53.2)

Combining (53.1) and (53.2), we get |{𝑛 ∈ [𝑁] ∶ {𝑎 + 𝑛𝑦} ∈ [𝑐, 𝑑)}| 𝐾 + 1 𝐾−1 ⋅ (𝐿 − 𝑦) < < ⋅ (𝐿 + 𝑦). 𝐾+1 𝑁 𝐾−1 Finally, observe that for sufficiently large 𝐾, 𝐾−1 ⋅ (𝐿 − 𝑦) ≥ 𝐿 − 2𝑦, 𝐾+1 Therefore, for sufficiently large 𝑁, 𝐿 − 2𝑦
0. By Lemma 53.1 we can let 𝑀 be a positive integer such that 0 < {𝑀𝑥} < 𝜖/2. Let 𝑦 = {𝑀𝑥}, so 0 < 𝑦 < 𝜖/2. We now break up the sequence ({𝑛𝑥}) into 𝑀 subsequences, as follows: {𝑥}, {(𝑀 + 1)𝑥}, {(2𝑀 + 1)𝑥}, . . . {2𝑥}, {(𝑀 + 2)𝑥}, {(2𝑀 + 2)𝑥}, . . .

(53.3)

⋮ {𝑀𝑥}, {2𝑀𝑥}, {3𝑀𝑥}, . . . . For 𝑘 = 1, 2, . . . , 𝑀, consider row 𝑘 of (53.3). Let 𝑎𝑘 = {(𝑘 − 𝑀)𝑥} ∈ [0, 1). For every positive integer 𝑛, the 𝑛th entry in row 𝑘 is {((𝑛 − 1)𝑀 + 𝑘)𝑥} = {(𝑘 − 𝑀)𝑥 + 𝑛𝑀𝑥} = {{(𝑘 − 𝑀)𝑥} + 𝑛{𝑀𝑥}} = {𝑎𝑘 + 𝑛𝑦}. In other words, row 𝑘 of (53.3) is the sequence {𝑎𝑘 + 𝑦}, {𝑎𝑘 + 2𝑦}, {𝑎𝑘 + 3𝑦}, . . . . Now suppose 𝑁 is a positive integer, 𝑁 ≥ 𝑀, and consider the numbers {𝑛𝑥} for 𝑛 ∈ [𝑁]. These numbers comprise initial segments of all of the rows in (53.3).

162

Chapter 5. Probability

For 𝑘 = 1, 2, . . . , 𝑀, let 𝑁𝑘 be the number of entries in this initial segment of row 𝑘; it is not hard to see that 0 ≤ 𝑁/𝑀 − 1 < 𝑁𝑘 < 𝑁/𝑀 + 1. Then 𝑀

|{𝑛 ∈ [𝑁𝑘 ] ∶ {𝑎𝑘 + 𝑛𝑦} ∈ [𝑐, 𝑑)}| ∑ |{𝑛 ∈ [𝑁] ∶ {𝑛𝑥} ∈ [𝑐, 𝑑)}| = 𝑘=1 𝑁 𝑁 𝑀

𝑁𝑘 |{𝑛 ∈ [𝑁𝑘 ] ∶ {𝑎𝑘 + 𝑛𝑦} ∈ [𝑐, 𝑑)}| . ⋅ 𝑁 𝑁𝑘 𝑘=1

= ∑

In other words, the proportion of the numbers {𝑛𝑥} for 𝑛 ∈ [𝑁] that belong to the interval [𝑐, 𝑑) is a weighted average of the proportions for those numbers that come from each row of (53.3). By Lemma 53.2, if 𝑁𝑘 is sufficiently large, then 𝐿 − 𝜖 < 𝐿 − 2𝑦
0 for −𝜋 < 𝛽 < 𝜋, so the maximum must occur where −𝜋 < 𝛽 < 𝜋 and 𝑓′ (𝛽) = 0. So we must solve 𝑣2 sin 𝛽 cos 𝛽 − 2𝑔ℎ sin 𝛽 = 0. 𝑓′ (𝛽) = 𝑣 cos 𝛽 + √𝑣2 sin2 𝛽 + 4𝑔ℎ(cos 𝛽 + 1) This is equivalent to the equation 𝑣 cos 𝛽 √𝑣2 sin2 𝛽 + 4𝑔ℎ(cos 𝛽 + 1) = 2𝑔ℎ sin 𝛽 − 𝑣2 sin 𝛽 cos 𝛽.

(62.2)

Squaring both sides and simplifying, we get 𝑣2 (cos3 𝛽 + cos2 𝛽) = 𝑔ℎ sin2 𝛽 − 𝑣2 sin2 𝛽 cos 𝛽. Rewriting sin2 𝛽 as 1 − cos2 𝛽 and simplifying leads to a quadratic equation in cos 𝛽: (𝑣2 + 𝑔ℎ) cos2 𝛽 + 𝑣2 cos 𝛽 − 𝑔ℎ = 0. Fortunately, the quadratic factors: (cos 𝛽 + 1)((𝑣2 + 𝑔ℎ) cos 𝛽 − 𝑔ℎ) = 0. We have two solutions to our quadratic equation: cos 𝛽 = −1 or cos 𝛽 = 𝑔ℎ/(𝑣2 + 𝑔ℎ). But we are looking for a solution with −𝜋 < 𝛽 < 𝜋, so the first solution can be eliminated. The second gives us two possibilities for 𝛽: 𝛽 = ± cos−1 (𝑔ℎ/(𝑣2 + 𝑔ℎ)). However, only one of these is a solution to (62.2). Substituting 𝑔ℎ/(𝑣2 + 𝑔ℎ) for cos 𝛽 in (62.2) and simplifying, we get 𝑣2

4𝑔ℎ(𝑣2 + 2𝑔ℎ) 𝑣 = sin 𝛽. 𝑣2 sin2 𝛽 + + 2𝑔ℎ √ 𝑣2 + 𝑔ℎ

Therefore sin 𝛽 > 0, so the negative solution for 𝛽 can be ruled out, and the only solution is 𝛽 = cos−1 (𝑔ℎ/(𝑣2 + 𝑔ℎ)). (It is not surprising that the solution for 𝛽 must be positive, since a negative value for 𝛽 corresponds to angling the cannon downward, and it is intuitively clear that this will not maximize the range of the

63. Convergent Rational Enumeration

185

cannon. But it is nice to see this intuition confirmed by our calculations.) Finally, this gives us the optimal angle of elevation for the cannon: 𝑔ℎ 𝛽 1 𝛼 = = cos−1 ( 2 (62.3) ). 2 2 𝑣 + 𝑔ℎ In the case of the stated problem, we have ℎ = 125 m, 𝑣 = 35 m/sec, and 𝑔 = 9.8 m/sec2 , so the optimal angle is 𝜋 1 1 𝛼 = cos−1 ( ) = . 2 2 6 Thus, the cannon should be angled up 30∘ from the horizontal to maximize the range. It is interesting to observe what happens as we vary the parameters of the problem. Equation (62.3) can be rewritten as 𝛼=

𝑔(ℎ/𝑣2 ) 1 cos−1 ( ). 2 1 + 𝑔(ℎ/𝑣2 )

Thus, for fixed 𝑔, the optimal angle of elevation is determined by the ratio ℎ/𝑣2 . If ℎ = 0, then we get 𝛼 = 𝜋/4, confirming the well-known fact that on level ground, a cannon should be fired at a 45∘ angle to maximize its range. As ℎ/𝑣2 → ∞, we find that 𝛼 → 0. Thus, when the height of the cliff is very large compared to the square of the velocity, you should fire the cannon almost horizontally. We can also compute how far the cannonball will go when the cannon is fired at the optimal angle. Substituting cos(2𝛼) = 𝑔ℎ/(𝑣2 + 𝑔ℎ) into (62.1) and simplifying, we find that the distance from the base of the cliff to the point where the cannonball lands is 𝑣√𝑣2 + 2𝑔ℎ/𝑔. In the specific case in the problem, this distance is 125√3 m.

63 Convergent Rational Enumeration We will answer a more general question. Let 𝑎1 , 𝑎2 , . . . be a sequence of positive real numbers. We consider series of the form ∞

∑ 𝑞𝑛 𝑎𝑛 ,

(∗)

𝑛=1

where 𝑞1 , 𝑞2 , . . . is an enumeration of the rational numbers in [0, 1]. Of course, the stated problem is the case 𝑎𝑛 = 1/𝑛. Suppose first that the sequence (𝑎𝑛 ) is bounded away from 0; that is, there is some 𝜖 > 0 such that for all 𝑛, 𝑎𝑛 > 𝜖. Then no matter what enumeration (𝑞𝑛 ) we use, infinitely many terms of the series (∗) will be larger than 𝜖/2, so the series must diverge. We assume from now on that the sequence (𝑎𝑛 ) is not bounded away from 0. Then we can choose a subsequence 𝑎𝑛1 , 𝑎𝑛2 , . . . such that for every 𝑘, 𝑎𝑛𝑘 ≤ 1/2𝑘 ,

186

Chapter 6. Calculus

making sure to leave infinitely many terms of (𝑎𝑛 ) out of the subsequence. Let 𝑚1 , 𝑚2 , . . . enumerate the infinitely many positive integers other than 𝑛1 , 𝑛2 , . . . , and choose distinct rational numbers 𝑞𝑚1 , 𝑞𝑚2 , . . . from [0, 1] small enough that for every 𝑘, 𝑞𝑚𝑘 𝑎𝑚𝑘 ≤ 1/2𝑘 , making sure to leave infinitely many rationals out of this list. Let 𝑞𝑛1 , 𝑞𝑛2 , . . . enumerate the remaining rational numbers in [0, 1]. Then ∞

∑ 𝑞𝑛 𝑎𝑛 = ∑ 𝑞𝑛𝑘 𝑎𝑛𝑘 + ∑ 𝑞𝑚𝑘 𝑎𝑚𝑘 , 𝑛=1

𝑘=1

𝑘=1

and in both series on the right-hand side, the 𝑘th term is at most 1/2𝑘 , so both series converge. Thus (∗) converges, which shows that the answer to the stated question is yes. But we can do more; we can show exactly what values are possible for the ∞ ∞ series (∗). Suppose first that the series ∑𝑛=1 𝑎𝑛 diverges. Then either ∑𝑛=1 𝑎2𝑛 ∞ or ∑𝑛=1 𝑎2𝑛−1 must diverge; suppose, without loss of generality, that it is the first. Let 𝑞2 , 𝑞4 , . . . enumerate the rationals in the interval [1/2, 1], and let 𝑞1 , 𝑞3 , ∞ . . . enumerate the rationals in [0, 1/2). Then ∑𝑛=1 𝑞2𝑛 𝑎2𝑛 diverges, and therefore (∗) diverges. So there is an enumeration (𝑞𝑛 ) for which (∗) diverges. We claim that for every positive real number 𝑥, there is an enumeration for which (∗) converges to 𝑥. To see why, let 𝑟1 , 𝑟2 , . . . be any enumeration of the rationals in [0, 1]. We will construct the required enumeration 𝑞1 , 𝑞2 , . . . recursively. Since (𝑎𝑛 ) is not bounded away from 0, we can choose a positive integer ∞ 𝑗1 so that 𝑟1 𝑎𝑗1 < 𝑥. Let 𝑞𝑗1 = 𝑟1 . Since ∑𝑛=1 𝑎𝑛 diverges, we can choose 𝑘1 > 𝑗1 so that 𝑘1

𝑞𝑗1 𝑎𝑗1 + ∑ 𝑎𝑛 > 𝑥. 𝑛=1 𝑛≠𝑗1

Let 𝑠 and 𝑡 be real numbers such that 𝑘

1 1 𝑞𝑗1 𝑎𝑗1 + 𝑠 ∑ 𝑎𝑛 = 𝑥 − , 2 𝑛=1

𝑘1

𝑞𝑗1 𝑎𝑗1 + 𝑡 ∑ 𝑎𝑛 = 𝑥.

𝑛≠𝑗1

𝑛=1 𝑛≠𝑗1

It is not hard to see that max(0, 𝑠) < 𝑡 < 1. Now let 𝑞1 , 𝑞2 , . . . , 𝑞𝑗1 −1 , 𝑞𝑗1 +1 , . . . , 𝑞𝑘1 be distinct rationals in the interval (max(0, 𝑠), 𝑡) that are all different from 𝑞𝑗1 . Then 𝑘

𝑥−

1 1 < ∑ 𝑞𝑛 𝑎𝑛 < 𝑥. 2 𝑛=1

We can use similar reasoning to extend our sequence 𝑞1 , 𝑞2 , . . . , 𝑞𝑘1 to a sequence 𝑞1 , 𝑞2 , . . . , 𝑞𝑘2 of distinct rationals in [0, 1] that includes both 𝑟1 and 𝑟2 and

63. Convergent Rational Enumeration

187

that satisfies 𝑘

2 1 < ∑ 𝑞𝑛 𝑎𝑛 < 𝑥. 4 𝑛=1

𝑥−

To do this, first choose 𝑗2 > 𝑘1 so that 𝑘1

∑ 𝑞𝑛 𝑎𝑛 + 𝑟2 𝑎𝑗2 < 𝑥. 𝑛=1

If 𝑟2 does not occur among 𝑞1 , 𝑞2 , . . . , 𝑞𝑘1 , then let 𝑞𝑗2 = 𝑟2 . Otherwise, let 𝑞𝑗2 be any rational in the interval [0, 𝑟2 ) that is distinct from 𝑞1 , 𝑞2 , . . . , 𝑞𝑘1 . Next, choose 𝑘2 > 𝑗2 large enough that 𝑘1

𝑘2

∑ 𝑞𝑛 𝑎𝑛 + 𝑞𝑗2 𝑎𝑗2 +

∑ 𝑎𝑛 > 𝑥, 𝑛=𝑘1 +1 𝑛≠𝑗2

𝑛=1

and then choose unused rationals 𝑞𝑘1 +1 , 𝑞𝑘1 +2 , . . . , 𝑞𝑗2 −1 , 𝑞𝑗2 +1 , . . . , 𝑞𝑘2 so that 𝑘

2 1 < ∑ 𝑞𝑛 𝑎𝑛 < 𝑥. 4 𝑛=1

𝑥−

We continue in this manner. After 𝑖 steps, we will have a sequence 𝑞1 , 𝑞2 , . . . , 𝑞𝑘𝑖 of distinct rationals in [0, 1] that includes 𝑟1 , 𝑟2 , . . . , 𝑟𝑖 and that satisfies 𝑘

𝑥−

𝑖 1 ∑ < 𝑞 𝑎 < 𝑥. 2𝑖 𝑛=1 𝑛 𝑛

This construction produces the required enumeration. ∞ Finally, we consider the case in which the series ∑𝑛=1 𝑎𝑛 converges, say to 𝑆. Clearly for every enumeration (𝑞𝑛 ), the series (∗) converges to some number between 0 and 𝑆. We claim that for every 𝑥 in the interval (0, 𝑆), there is an enumeration for which (∗) converges to 𝑥. The proof is very similar to the previous one. At stage 𝑖 of the construction, we will have a sequence 𝑞1 , 𝑞2 , . . . , 𝑞𝑘𝑖 of distinct rationals in [0, 1] that includes 𝑟1 , 𝑟2 , . . . , 𝑟𝑖 and that satisfies ∞

𝑘𝑖

𝑥 − ∑ 𝑎𝑛 < ∑ 𝑞𝑛 𝑎𝑛 < 𝑥. 𝑛=𝑘𝑖 +1

𝑛=1

∞ ∑𝑛=𝑘 +1 𝑖

Since 𝑎𝑛 → 0 as 𝑖 → ∞, this will suffice to guarantee that (∗) converges to 𝑥. To get from stage 𝑖 to stage 𝑖 + 1, we choose 𝑗𝑖+1 > 𝑘𝑖 such that ∞

𝑘𝑖

𝑘𝑖

𝑥 − ∑ 𝑎𝑛 < ∑ 𝑞𝑛 𝑎𝑛 < ∑ 𝑞𝑛 𝑎𝑛 + 𝑟𝑖+1 𝑎𝑗𝑖+1 < 𝑥. 𝑛=𝑘𝑖 +1 𝑛≠𝑗𝑖+1

𝑛=1

𝑛=1

188

Chapter 6. Calculus

If 𝑟𝑖+1 does not occur among 𝑞1 , 𝑞2 , . . . , 𝑞𝑘𝑖 , then we let 𝑞𝑗𝑖+1 = 𝑟𝑖+1 ; otherwise, we let 𝑞𝑗𝑖+1 be a smaller unused nonnegative rational number. Note that 𝑘𝑖

∑ 𝑞𝑛 𝑎𝑛 + 𝑞𝑗𝑖+1 𝑎𝑗𝑖+1 + ∑ 𝑎𝑛 > 𝑥, 𝑛=𝑘𝑖 +1 𝑛≠𝑗𝑖+1

𝑛=1

so we can choose 𝑘𝑖+1 > 𝑗𝑖+1 so that 𝑘𝑖+1

𝑘𝑖

∑ 𝑞𝑛 𝑎𝑛 + 𝑞𝑗𝑖+1 𝑎𝑗𝑖+1 + ∑ 𝑎𝑛 > 𝑥. 𝑛=𝑘𝑖 +1 𝑛≠𝑗𝑖+1

𝑛=1

Finally, we choose unused rationals 𝑞𝑘𝑖 +1 , . . . , 𝑞𝑗𝑖+1 −1 , 𝑞𝑗𝑖+1 +1 , . . . , 𝑞𝑘𝑖+1 such that ∞

𝑘𝑖+1

𝑥 − ∑ 𝑎𝑛 < ∑ 𝑞𝑛 𝑎𝑛 < 𝑥. 𝑛=𝑘𝑖+1

𝑛=1

Our methods can easily be modified to handle the case in which we require (𝑞𝑛 ) to be an enumeration of the rationals in the interval [0, ∞) rather than [0, 1]. As before, if (𝑎𝑛 ) is bounded away from 0, then the series (∗) must diverge. If not, ∞ then regardless of whether ∑𝑛=1 𝑎𝑛 converges or diverges, we can find enumerations (𝑞𝑛 ) for which (∗) either diverges or converges to any positive real number. This problem appeared on the 17th University of Michigan Undergraduate Mathematics Competition in 2000.

64 A Functional Equation For every real number 𝑎, the function 𝑓(𝑥) = 𝑎𝑥2 has the required properties. We claim that these are the only such functions. In fact, the full strength of the assumption that 𝑓 is twice differentiable is not needed. We will show that if 𝑓 satisfies the functional equation 𝑓(2𝑥) = 4𝑓(𝑥) and 𝑓″ (0) is defined, then for all 𝑥, 𝑓(𝑥) = 𝑎𝑥2 , where 𝑎 = 𝑓″ (0)/2. To prove this, suppose that 𝑓 satisfies the functional equation and 𝑓″ (0) is defined. Let 𝑎 = 𝑓″ (0)/2. For every 𝑥 we have 𝑓(𝑥) = 𝑓(2(𝑥/2)) = 4𝑓(𝑥/2), and applying this equation repeatedly we find that for every positive integer 𝑛, 𝑥 𝑓(𝑥) = 4𝑛 𝑓 ( 𝑛 ) . (∗) 2 Since 𝑓″ (0) is defined, there is some open interval 𝐼 containing 0 such that 𝑓 is differentiable on 𝐼. Differentiating (∗) we find that for 𝑥 ∈ 𝐼, 𝑓′ (𝑥) = 2𝑛 𝑓′ (𝑥/2𝑛 ). In the case 𝑥 = 0 this tells us that 𝑓′ (0) = 0. If 𝑥 ∈ 𝐼 and 𝑥 ≠ 0, then 𝑓′ (𝑥/2𝑛 ) − 𝑓′ (0) 𝑓′ (𝑥) 𝑓′ (𝑥) 2𝑛 𝑓′ (𝑥/2𝑛 ) = lim = , = lim 𝑥/2𝑛 𝑥 𝑥 𝑥 𝑛→∞ 𝑛→∞ 𝑛→∞

𝑓″ (0) = lim

65. Two Eerie Recursions

189

so 𝑓′ (𝑥) = 𝑓″ (0)𝑥 = 2𝑎𝑥. Integrating, we find that for all 𝑥 ∈ 𝐼, 𝑓(𝑥) = 𝑎𝑥2 + 𝐶 for some constant 𝐶. But (∗) implies that 𝑓(0) = 0, so 𝐶 = 0. So far we have only shown that 𝑓(𝑥) = 𝑎𝑥2 holds for 𝑥 ∈ 𝐼. But if 𝑥 ∉ 𝐼, then we can choose 𝑛 sufficiently large that 𝑥/2𝑛 ∈ 𝐼, and then by (∗) we have 𝑥 𝑥 2 ) = 4𝑛 𝑎 ( 𝑛 ) = 𝑎𝑥2 . 𝑛 2 2 If we drop the assumption that 𝑓″ (0) is defined, then there are more functions. For example, the function 𝑓(𝑥) = 4𝑛 𝑓 (

𝑥2 sin(2𝜋 log2 |𝑥|), if 𝑥 ≠ 0, 𝑓(𝑥) = { 0, if 𝑥 = 0, satisfies the functional equation and is continuously differentiable everywhere, but 𝑓″ (0) is undefined.

65 Two Eerie Recursions The recursions are eerie because the very small differences in the question change the answer from 𝑒 to 𝜋. Computations help one discover the patterns; the initial terms of the sequences leave little doubt as to the limits. The convergence of the 𝑦-sequence is slow, so we look at the terms with 𝑛 = 10, 100, 1000, . . .: 𝑛 ( ) = 0, 2, 3, 2.6667, 2.7273, 2.7170, 2.7185, 2.71826, 2.718284, . . . , 𝑥𝑛 2 ⋅ 10𝑚 ( 2 ) = 3.3024, 3.1573, 3.1431, 3.1418, 3.14161, 3.141594, . . . . 𝑦10𝑚 (a) The limit is 𝑒. Let 𝑋𝑛 = 𝑥𝑛 /𝑛, so 𝑋1 = 0, 𝑋2 = 1/2, and for 𝑛 ≥ 3, 𝑥 𝑥 𝑥 𝑥𝑛−2 𝑥 1 𝑋𝑛 = 𝑛 = (𝑥𝑛−1 + 𝑛−2 ) = 𝑛−1 − ( 𝑛−1 − ) 𝑛 𝑛 𝑛−2 𝑛−1 𝑛(𝑛 − 1) 𝑛(𝑛 − 2) 𝑋 − 𝑋𝑛−2 = 𝑋𝑛−1 − 𝑛−1 . 𝑛 Therefore 𝑋𝑛 − 𝑋𝑛−1 = − (𝑋𝑛−1 − 𝑋𝑛−2 ) /𝑛. For 𝑛 ≥ 2 let 𝑑𝑛 = 𝑋𝑛 − 𝑋𝑛−1 ; then 𝑑2 = 1/2 and for 𝑛 ≥ 3, 𝑑𝑛 = −𝑑𝑛−1 /𝑛. Therefore 𝑑𝑛 = (−1)𝑛 /𝑛!. Because 𝑋𝑛 = 𝑛 𝑛 ∑𝑖=2 𝑑𝑖 , we have that 𝑋𝑛 = ∑𝑖=2 (−1)𝑖 /𝑖!; this is a partial sum of the Maclaurin series for 𝑒𝑡 with 𝑡 = −1 and so converges to 1/𝑒. We want the limit of 1/𝑋𝑛 , which is 𝑒. (b) The limit is 𝜋. The proof will use the Wallis product: 2⋅2 4⋅4 6⋅6 8⋅8 𝜋 ⋅ ⋅ ⋅ ⋯= ; 1⋅3 3⋅5 5⋅7 7⋅9 2 see [127] for an elegant proof of this classic result.

190

Chapter 6. Calculus

A first observation is that the 𝑦-values, which start 0, 1, 1, 3/2, 3/2, 15/8, 15/8, 35/16, change only at the even indices; that is, if 𝑞 ≥ 1, then 𝑦2𝑞+1 = 𝑦2𝑞 . Using the convention that empty products equal 1, we can derive the following formula for 𝑦𝑛 when 𝑛 ≥ 2: 3 ⋅ 5 ⋯ (2𝑞 − 1) 𝑦2𝑞 = 𝑦2𝑞+1 = . 2 ⋅ 4 ⋯ (2𝑞 − 2) The proof is by induction. The formula holds for the cases 𝑦2 and 𝑦3 . And the following use of the induction hypothesis proves it in general: 𝑦2𝑞−1 3 ⋅ 5 ⋯ (2𝑞 − 3) 3 ⋅ 5 ⋯ (2𝑞 − 3) 1 𝑦2𝑞 = 𝑦2𝑞−2 + = + ⋅ 2𝑞 − 2 2 ⋅ 4 ⋅ ⋅ ⋅ (2𝑞 − 4) 2 ⋅ 4 ⋯ (2𝑞 − 4) 2𝑞 − 2 3 ⋅ 5 ⋯ (2𝑞 − 3) 2𝑞 − 1 , ⋅ = 2 ⋅ 4 ⋯ (2𝑞 − 4) 2𝑞 − 2 𝑦2𝑞 𝑦2𝑞 3 ⋅ 5 ⋯ (2𝑞 − 3) 𝑦2𝑞+1 = 𝑦2𝑞−1 + = + 2𝑞 − 1 2 ⋅ 4 ⋅ ⋅ ⋅ (2𝑞 − 4) 2𝑞 − 1 2𝑞 − 2 1 + = 𝑦2𝑞 ( ) = 𝑦2𝑞 . 2𝑞 − 1 2𝑞 − 1 The formula gives 2𝑞 2𝑞 22 ⋅ 42 ⋯ (2𝑞 − 2)2 ⋅ , = 2 1 ⋅ 3 ⋅ 3 ⋅ 5 ⋯ (2𝑞 − 3)(2𝑞 − 1) 2𝑞 − 1 𝑦2𝑞 which converges to 𝜋/2 because the first factor is the general term of the Wallis product and the second approaches 1. The odd case follows thus: 2𝑞 + 1 2𝑞 + 1 2𝑞 2𝑞 + 1 𝜋 = = 2 ( )→ , 2 2 2𝑞 2 𝑦2𝑞+1 𝑦2𝑞 𝑦2𝑞 and so the requested limit is 𝜋. This problem is due to Benoit Cloitre [60]; see also [44, p. 19].

66 Stabilizing a Cylinder Consider the center of the base to be the origin. By symmetry, the center of mass is a point 𝑧 ̄ on the 𝑧-axis. Intuition suggests that removing a small amount of water when the cylinder is full will lower the center of mass, as will adding a small amount of water when it is empty, so any minimum must occur when there is some water and some empty space in the cylinder. Let 𝑊 be the height of water in the cylinder. We will show that the lowest center of mass occurs when 𝑊 = (√𝜇2 + 𝜇 − 𝜇)𝐻, where 𝜇 is 𝑚/(𝜋𝑅2 𝐻), the ratio of the mass of the cylinder to the mass of the water when the container is full of water. For a specific example using the dimensions of a soda can, take 𝑅 = 3.5 cm, 𝐻 = 13 cm, and 𝑚 = 50 grams. The optimal water height is then about 3.01 cm, 23% of the height.

66. Stabilizing a Cylinder

191

/

/ °

Figure 66.1. Left: The three dots are the centers of mass for, from top to bottom, the cylinder, the entire system, and the water. This is the optimal state, where 𝑧 ̄ is at the water upper surface. Right: At a certain tilt angle the system’s center of mass is directly above the contact point; any additional tilt will cause a crash (but this diagram, based on the soda can dimensions, applies only to frozen water).

A key fact is that the center of mass of a system consisting of masses 𝑚1 and 𝑚2 with centers of mass at 𝑧1 and 𝑧2 , respectively, is the weighted average (𝑚1 𝑧1 + 𝑚2 𝑧2 )/(𝑚1 + 𝑚2 ). This fact implies that 𝑧 ̄ is lowest when 𝑊 exactly equals 𝑧 ̄ (as in Figure 66.1). To see why, suppose 𝑊 < 𝑧.̄ If we add a small amount of water, then the new center of mass will be a weighted average of 𝑧 ̄ and the center of mass of the added water, which is less than 𝑧,̄ so the center of mass will decrease. A similar argument shows that if 𝑊 > 𝑧,̄ then removing a bit of water will again lower the center of mass. So to minimize 𝑧,̄ 𝑊 must equal 𝑧.̄ When 𝑊 = 𝑧,̄ the total mass is 𝑀 = 𝑚 + 𝜋𝑅2 𝑧.̄ The center of mass formula then leads to 𝑧 ̄ = (𝑚(𝐻/2) + (𝜋𝑅2 𝑧)( ̄ 𝑧/2))/𝑀. ̄ Solving this quadratic equation for 2 2 𝑧 ̄ gives 𝑧 ̄ = (√𝑚(𝑚 + 𝜋𝑅 𝐻) − 𝑚)/(𝜋𝑅 ), which reduces to the claimed formula in 𝜇. A consequence of this analysis is that the minimum is unique. For an empty cylinder, the water level is 0 and 𝑧 ̄ = 𝐻/2; as one adds water, the water level rises and 𝑧 ̄ shrinks; when they meet the center of mass will be at its lowest point. One can also solve the problem using calculus. The center of mass is given by the formula (𝜋𝑅2 𝑊 2 + 𝑚𝐻)/(2𝜋𝑅2 𝑊 + 2𝑚). Setting the derivative (with respect to 𝑊) of this to 0 leads to the quadratic equation 𝜋𝑅2 𝑊 2 + 2𝑚𝑊 − 𝑚𝐻 = 0, which gives the same optimal value of 𝑊 as the previous method One might think that in the soda can example, the can will not fall over so long as the tilt angle is at most tan−1 (3.5/3.01), or 49.3∘ . This would be true if the

192

Chapter 6. Calculus

°

Figure 66.2. For liquid water, the water’s motion means that the most stable situation requires more water than for ice. For a soda can the maximum tipping angle is only 41.8∘ . Here the lowest white dot is the center of mass of the water, the highest dot is the center of the can, and the middle white dot is the center of mass of the system. water were frozen. But liquid water moves as the can tilts, maintaining a horizontal upper surface; the problem of maximizing the critical angle—the smallest tilt angle that leads to the can falling—is quite different and more complicated. This more realistic situation is analyzed in detail in [38]; for the dimensions of our example, the largest critical angle is 41.8∘ (well under the critical angle for ice), and it arises when the can is filled to a height of 3.91 cm (Figure 66.2). So if you are sitting in a car with a cup of coffee nearby and are approaching a rough road, try to arrange for the cup to be about 30% full. In this liquid water situation there is also a surprising geometrical property that characterizes the optimal water level: when the critical angle is maximized and the cylinder is tilted at the critical angle, the line from the lowest point of the cylinder through the center of mass strikes the intersection of the water surface with the central axis (dashed in Figure 66.2). This observation is true in some, but not all cases; for more detail see [38].

67 𝜋 Coincidence? A simple search starting at 𝑛 = 4 will find that the sequences differ at 𝑛 = 80143857, but there is a much faster way to get this value. The main idea is to realize that for the sequences to differ, one needs a very good rational approximation to 𝜋. The connection was pointed out by Jonathan Lee [86]. Because sin(𝜋/𝑛) < 𝜋/𝑛, we have 𝑛/𝜋 < 1/ sin(𝜋/𝑛). For the ceilings to differ,

67. 𝜋 Coincidence?

193

there must be an integer 𝑘 with 𝑛/𝜋 ≤ 𝑘 < 1/ sin(𝜋/𝑛). This is equivalent to 𝑛/𝑘 ≤ 𝜋 < 𝑛 sin−1 (1/𝑘). For 0 < 𝑥 ≤ 1, all terms of the Maclaurin series for sin−1 𝑥 are positive, so sin−1 𝑥 is greater than its Maclaurin cubic approximation 𝑥 + 𝑥3 /6. Thus 1 𝑛 1 1 𝑛 𝑛 sin−1 ( ) > 𝑛 ( + 3 ) = + 3 . 𝑘 𝑘 6𝑘 𝑘 6𝑘 Therefore it will suffice to find a rational 𝑛/𝑘 such that 𝑛 𝑛 𝑛 (67.1) ≤ 𝜋 ≤ + 3. 𝑘 𝑘 6𝑘 If 𝑛 and 𝑘 satisfy (67.1), then the 𝑛th terms of the two sequences will differ. Note that 𝑛 = 3 and 𝑘 = 1 satisfy (67.1), which is rather weak in this case: 3 ≤ 𝜋 ≤ 3 + 1/2. To find another solution to (67.1), we use the continued fraction for 𝜋, which is 1 𝜋=3+ . 1 7+ 1 15 + 1 1+ 292 + ⋯ The numbers 3, 7, 15, 1, 292, . . . appearing in this continued fraction can be computed very quickly by a method that is similar to the Euclidean algorithm. By taking more and more terms in the continued fraction, we get a sequence of rational numbers that converge to 𝜋: 1 1 333 22 𝑐0 = 3, 𝑐1 = 3 + = = , 𝑐2 = 3 + , ... . 1 7 7 106 7+ 15

The numbers 𝑐𝑖 are called the convergents of the continued fraction, and they are, in a sense, the best rational approximations to 𝜋. One measure of how good these approximations are is that one in every consecutive pair of convergents is a rational number 𝑛/𝑘 satisfying |𝜋 − 𝑛 | < 1 (67.2) | 𝑘 | 2𝑘2 (see [15, Exercise 7.10], [68, Theorem 183]). Inequality (67.2) implies that 𝑛 1 𝑛 𝑛 3 𝑛 𝑛 𝜋< + 2 = + 3 ⋅ ≤ + 3, 𝑘 2𝑘 𝑘 6𝑘 𝑛/𝑘 𝑘 6𝑘 since every convergent is greater than or equal to 3. Thus we know that there are infinitely many convergents that satisfy the second part of (67.1). But we also need the first part, which says that the convergent must be less than 𝜋. The convergents alternate around 𝜋, so we care only about the even-indexed 𝑐𝑖 . A numerical check shows that 𝑛 80143857 𝑐12 = = 𝑘 25510582

194

Chapter 6. Calculus

works: 𝑐12 < 𝜋 < 𝑐12 + 𝑛/(6𝑘3 ). And indeed 𝑛 ≈ 25510581.99999999529 𝜋

and

1 ≈ 25510582.00000000183. sin(𝜋/𝑛)

In fact, 𝑐𝑖 works for even 𝑖 between 12 and 50 inclusive, but then the desired approximation fails for 52, 54, and 56. It appears to work for most convergents, so it is something of a coincidence that it fails for the first few, yielding the rather large value of 𝑛 > 3 for which the sequences differ. One cannot conclude from this that 80143857 is the first example beyond 3, but a computation through all smaller values shows that it is.

68 The Chase Is On Use 𝑅 for the position of the rabbit and 𝐷 for the dog. Let 𝐷 = (𝑥, 𝑦); the rabbit’s motion means that 𝑅 = (𝑡, 0). Let 𝑧 = 𝑡 − 𝑥, and let 𝑠 be the distance between 𝑅 and 𝐷; by the distance formula, 𝑠 = √𝑧2 + 𝑦2 , so 𝑠2 = 𝑧2 + 𝑦2 . Here 𝑥, 𝑦, 𝑧, and 𝑠 are functions of 𝑡; we use 𝑥′ and similar to refer to differentiation with respect to 𝑡. Because 𝐷′ is a unit vector in the direction of 𝑅 − 𝐷, which is (𝑧, −𝑦), we have (𝑥′ , 𝑦′ ) = (𝑧/𝑠, −𝑦/𝑠). Note that if the dog were to ever catch the rabbit, he would reach (𝑡, 0) in time 𝑡, which is impossible because the straight-line distance from (0, 1) to that point has length greater than 𝑡, while the dog’s speed is 1. Therefore 𝑠 will never be 0. We have 𝑧′ = (𝑡 − 𝑥)′ = 1 − 𝑥′ = 1 − 𝑧/𝑠. If we differentiate the quadratic relation for 𝑠, we get (𝑦2 + 𝑧2 ) 𝑦 𝑧 2𝑠𝑠′ = 2𝑧𝑧′ + 2𝑦𝑦′ = 2𝑧 (1 − ) + 2𝑦 (− ) = 2𝑧 − 2 = 2𝑧 − 2𝑠, 𝑠 𝑠 𝑠 so 𝑠′ = 𝑧/𝑠 − 1. These equations imply 𝑠′ = −𝑧′ , a simple relationship that is the key to the solution. At first it seems like a miracle that the rate of decrease in the distance between 𝑅 and 𝐷 exactly equals the rate of increase of the distance from 𝑅 to 𝐷 in the 𝑥-direction. But in fact this relationship follows from simple vector geometry as in Figure 68.1. Integrating 𝑠′ = −𝑧′ and using the initial condition 𝑠(0) = 1 gives 𝑧 = 1 − 𝑠. Substituting into the equation 𝑠2 = 𝑧2 + 𝑦2 and simplifying, we conclude that 𝑠 = (𝑦2 + 1)/2 ≥ 1/2. If we knew that 𝑦 → 0, we could conclude that 𝑠 → 1/2; but we do not know that 𝑦 approaches 0, so we will prove that 𝑠 approaches 1/2 in a different way. Because 𝑧 ≤ 𝑠, the equation 𝑠′ = 𝑧/𝑠 − 1 implies that 𝑠′ ≤ 0 and so 𝑠 is nonincreasing. We also get a differential equation for 𝑠: 𝑠′ =

𝑧 1−𝑠 1 −1= − 1 = − 2. 𝑠 𝑠 𝑠

68. The Chase Is On

195

Figure 68.1. The horizontal blue arrow is the 𝑥component of 𝐷’s velocity. The red and blue triangles are congruent. Therefore the angled red arrow (the component of 𝑅’s velocity in the direction away from 𝐷) has length equal to that of 𝑥′ . It follows that 𝑠′ = 𝑥′ − 1 because the change in 𝑠 is the difference of the speed at which 𝑅 moves away from 𝐷 and the speed at which 𝐷 moves toward 𝑅. A nonincreasing function that is bounded from below has a limit, so the limiting value 𝑠∞ (as 𝑡 → ∞) exists and 1/2 ≤ 𝑠∞ ≤ 1. We also have lim𝑡→∞ 𝑠′ = 1/𝑠∞ − 2 (by the differential equation for 𝑠), and this limit of the derivative must be 0, since any other value implies that 𝑠 → ±∞. Then 0 = 1/𝑠∞ − 2 gives 𝑠∞ = 1/2. The preceding argument solves the problem, but we can now derive several relationships and so get a formula for the pursuit curve. In (2), 𝑊 is Lambert’s 𝑊-function [128]. (1) 𝑡 = (2 − 2𝑠 − ln(2𝑠 − 1))/4. (2) 𝑥 = (𝑊(𝑒1−4𝑡 ) + 2𝑡 − 1)/2 and 𝑦 = √𝑊(𝑒1−4𝑡 ). (3) 𝑥 = (𝑦2 − 1 − 2 ln 𝑦)/4.

196

Chapter 6. Calculus

Figure 68.2. The curve shows the path the dog will follow as it chases the rabbit. Formula (2) represents the motion in terms of a classic special function and (3) gives a very simple formula for the curve that the dog follows. Here are proofs of these formulas: (1) Recall that 𝑠 = (𝑦2 + 1)/2 ≥ 1/2. For 𝑠 > 1/2, the differential equation 𝑠 = 1/𝑠 − 2 becomes 𝑠/(1 − 2𝑠) 𝑑𝑠 = 𝑑𝑡, which is easily integrated; the condition 𝑠(0) = 1 then gives (1). This implies that 𝑡 → ∞ as 𝑠 → 1/2+ , so 𝑠(𝑡), which is nonincreasing, cannot be 1/2 at a finite value of 𝑡. (2) Inverting (1) gives 𝑠 = (1 + 𝑊(𝑒1−4𝑡 ))/2. Then, using 𝑧 = 1 − 𝑠, we get 𝑥 = 𝑠 + 𝑡 − 1 = (𝑊(𝑒1−4𝑡 ) + 2𝑡 − 1)/2. We have 𝑠 = (𝑦2 + 1)/2, and 𝑦 = 0 implies 𝑠 = 1/2, contradicting 𝑠 > 1/2, so 𝑦 can never be 0. Since it starts out positive, it must always be positive. This means 𝑦 = √2𝑠 − 1, and now the formula just given for 𝑠 in terms of 𝑊 gives the formula for 𝑦. (3) Start with 𝑥 = 𝑠 + 𝑡 − 1, eliminate 𝑡 using (1), and replace 𝑠 with (𝑦2 + 1)/2. ′

These formulas make it easy to plot the dog’s path, as in Figure 68.2. Figure 68.3 shows what the dog’s path looks like from the point of view of the rabbit, who is assumed to be stationary at the origin. In this frame of reference the dog simply follows the parabola 𝑥 = (𝑦2 − 1)/2 to the point (−1/2, 0); this follows easily from (2), after subtracting the rabbit’s motion (𝑡, 0) from (𝑥, 𝑦). These methods allow one to show that if 𝐷 starts at (𝑥, 𝑦), then its limiting distance from 𝑅 is (√𝑥2 + 𝑦2 − 𝑥)/2. If 𝑦 = 0 and 𝑥 < 0, then this is −𝑥; if 𝑦 = 0 and 𝑥 ≥ 0, this is 0, as 𝐷 crashes into 𝑅. Pursuit problems have a long history (see [97], [129, Radiodrome]). The particular case studied here was raised by Sergiu Hart [69, 73].

68. The Chase Is On

197 





∞ -/

 

Figure 68.3. From the point of view of a rabbit, who can be considered stationary at the origin, the dog’s pursuit curve is part of a parabola, with limit point (−1/2, 0).

7 Algorithms and Strategy 69 Where’s Bob? As a warmup, consider how Alice can catch Bob if she can search only one cave per day. The key idea is that if Bob is in an even-numbered cave on one day, then he must be in an odd-numbered cave on the next day, and the same from odd to even. A geometric view is provided by the checkerboard pattern in Figure 69.1. If Bob starts in an even cave (number 6 in Figure 69.1) on day 1, then he starts in a black square on the bottom row and he must then always be on a black square as time marches upward. Call any path through a checkerboard as in Figure 69.1 a Bob-path. Now it is easy to see how Alice can capture Bob: search caves 2, 3, 4, . . . , 16 on the first 15 days. This will find Bob if he starts in an even cave. Repeating the sequence from days 16 to 30 finds him if he started in an odd cave. See Figure 69.2, which shows the same strategy in the case of five caves; a black dot in row 𝑖, column 𝑗 means that on day 𝑖, Alice searches cave 𝑗. It is evident that this method, in the first half of the search, blocks all black Bob-paths and then blocks white Bob-paths in the second phase. The checkerboard interpretation leads to the optimal solution to the given problem. The search strategy shown in Table 69.1 works in 10 days, which is the best possible. Viewing the 10-day strategy in the checkerboard (Figure 69.3) makes it clear why it works. If Bob starts in an even cave Alice finds him in the first five days, while an odd start leads to his capture in the last five days. Here is a geometric proof that Alice cannot succeed in nine days. We will prove that if a checkerboard (with white at lower left) having 17 columns (and 199

200

Chapter 7. Algorithms and Strategy

Figure 69.1. A possible sequence of caves that Bob can occupy over 10 days.

Figure 69.2. If Alice can search only one cave per day, then, if there are five caves, she can find Bob in 6 days by using the six dots in the figure. Table 69.1. The 10-day method by which Alice can trap Bob. day caves

1 2 2 5 4 7

3 8 10

4 5 11 14 13 16

6 7 2 5 4 7

8 8 10

9 10 11 14 13 16

any number of rows) has at most nine black dots on black squares, no more than two in any row, then there is a Bob-path on black squares that avoids all of the dots. As a consequence, Alice must carry out at least 10 searches represented by dots on black squares, and the same follows for white squares, since shifting

70. It’s a Horse Race

201

Figure 69.3. A 10-day strategy for Alice to find Bob by searching two caves per day.

any blocking configuration on white squares up one row would give a blocking configuration on black squares. Suppose there are at most nine dots on black squares, with no more than two in any row; there are then at least eight empty columns. If there are two adjacent empty columns, then Bob can zigzag to infinity in those two columns; so suppose there are no two adjacent empty columns. Then the seven gaps between successive empty columns must each contain at least one dot on a black square. With only nine dots total on the black squares, only two of these gaps (whether they consist of one or more columns) can contain more than one dot. Thus there must be at least one of these gaps, other than the first and last gap, that contains exactly one dot and so is a single column; call it 𝐶 and let its one dot be 𝑥. Then there are at least two columns to 𝐶’s left and right. Let 𝐴𝐵𝐶𝐷𝐸 be the five columns centered around 𝐶, where 𝐵 and 𝐷 are empty. One of 𝐴 or 𝐸 must be empty at point 𝑦, at the same height as 𝑥, because any row has at most two dots. Suppose it is 𝐴. Bob can then follow a zigzag black path in columns 𝐵 and 𝐶, but when he gets to 𝑥, he avoids it by a detour through 𝑦 (see Figure 69.4). This gets him past the only possible blockage.

70 It’s a Horse Race The top three horses can be determined in seven races, but not six. Run the horses in five disjoint heats of five horses each. Run the five heat winners in race 6 and let 𝑃, 𝑄, 𝑅, 𝑆, 𝑇 be the finishing order. Then 𝑃 is fastest overall. At this point all horses are eliminated from being one of the top three except 𝑃, 𝑄, 𝑅, 𝑋, 𝑌 , and 𝑍, where 𝑋 and 𝑌 are the runnerup and third-placer in the heat containing 𝑃, and 𝑍 is the runnerup to 𝑄 in the heat containing 𝑄. So because 𝑃 is known to be

202

Chapter 7. Algorithms and Strategy

Figure 69.4. A zigzag Bob-path with a detour at 𝑦 allows Bob to escape. the fastest horse, place 𝑄, 𝑅, 𝑋, 𝑌 , 𝑍 in race 7 and have the top two join 𝑃 on the podium. To see that seven races are necessary, suppose there are only six races. After five races, regardless of how they are structured, at most 20 horses have lost. So there are at least five undefeated horses. All undefeated horses must race in the sixth race, since any one of them could be the fastest horse, so there must be only five undefeated horses, and therefore there must be 20 horses that have lost. Suppose the horses that have lost are horses 1–20, and the undefeated horses are 21–25. Consider any ordering of horses 1–20 that is consistent with the outcomes of the first five races (there must be such an ordering), and suppose horse 1 is fastest in that ordering. Then horse 1 could be second-fastest overall, and this cannot be discovered in the sixth race, so the method fails. One can now ask what can be deduced if one has only six races available. Several possibilities are discussed in [95]. One surprising version concerns an algorithm that can, using six races, identify the top two horses, not in order, with over 91% probability of success. This method, however, does not tell whether or not one has successfully identified the top two; it simply does so 91% of the time. If one requires not only identification of the top two but also knowledge that one is correct, then the best rate is 347917/1151150, about 30.2%, which can be proved optimal by a backtracking search.

71 Your Two Best Shots Imagine that the field’s squares are colored black or white, as in a checkerboard, with white at the corners. The strategy is to first shoot at the 112 black squares, then at the 113 white squares, and finally at all the black squares again. This specifies 337 shots, and two of them will strike the tank, destroying it. To show

72. Determine the Martian Majority

203

this is best, cover the grid with 112 dominoes, leaving one square uncovered, and imagine the tank to be restricted to never leave the domino it is on. Each domino can be studied independently and requires at least three shots. The single uncovered square requires a shot. So the lower bound is 3 ⋅ 112 + 1 = 337.

72 Determine the Martian Majority The minimal number of comparisons is four. Imagine putting the spheres into seven bins, one to a bin. Each bin has two compartments, and the sphere is put into one compartment, leaving the other empty. Select two bins and compare the two spheres that they contain. Then merge the contents of the two bins into one, placing both spheres in the same compartment of the bin if the test showed that they are the same color and one sphere in each compartment if they are different. Now select two bins that have an empty compartment and that contain the same number of spheres in their nonempty compartments. Take a sphere from each bin, compare the spheres, and merge the contents of the bins as before, placing the spheres from the two bins in the same compartment if the tested spheres match and into different compartments if they don’t. Continue until all bins with an empty compartment contain different numbers of spheres (see Figure 72.1). Notice that at every stage, the number of spheres in any bin is a power of two, all spheres in the same compartment of a bin are the same color, all spheres in different compartments of the same bin are different colors, and when there are spheres in both compartments of a bin, the two compartments contain the same number of spheres. At the end of the process, a sphere from the fullest bin with an empty compartment has the majority color. There is always such a bin, because the number of spheres in a bin with neither compartment empty is even. The numbers of spheres in bins that have an empty compartment are distinct powers of two, so a sphere from the fullest of these bins is a majority color among the spheres in these bins. But because the bins with neither compartment empty are balanced, the selected sphere is a majority for all of them. The preceding argument works for 𝑛 spheres for any odd 𝑛. To count the maximum number of steps the algorithm might take, which is four when there are seven spheres, we can just as easily work in the case of general odd 𝑛; the maximum step-count is then 𝑛 − 𝑏(𝑛), where 𝑏(𝑛) is the number of 1s in the base-2 expansion of 𝑛. As noted, the bin sizes are always powers of 2, and every step decreases the bin count by 1. Suppose that at the end there are 𝑗 bins, so that 𝑛 is a sum of 𝑗 powers of 2; we started with 𝑛 bins, so this means that the number of steps was 𝑛 − 𝑗. Now notice that 𝑗 ≥ 𝑏(𝑛), so 𝑛 − 𝑗 ≤ 𝑛 − 𝑏(𝑛) as claimed. The reason is that if the powers of two are distinct, then these powers correspond to the 1s in the binary representation of 𝑛, so 𝑗 = 𝑏(𝑛). If not, then we can simply

204

Chapter 7. Algorithms and Strategy

Figure 72.1. Starting from the seven colored spheres pictured at top, the bin algorithm can use four steps as shown to end with a single red in a bin with an empty compartment. That sphere therefore indicates the majority. combine equal-sized powers until all the powers are different, at which point the number of powers of two will be 𝑏(𝑛), implying that 𝑗 > 𝑏(𝑛). For the given problem one can examine all possible methods to show that the majority cannot be determined in three comparisons. But instead we will give an argument that can be generalized to show optimality of 𝑛 − 𝑏(𝑛) in the general case [3]. Suppose 𝜎 is a method that works, in all cases, in three steps, and assume that 𝜎 never asks a question for which the answer is known. We can keep track of what we learn in the course of applying 𝜎 by keeping the spheres in bins. As before, we place the spheres in the bins so that spheres in the same compartment of a bin are known to have the same color, and spheres in different compartments of the same bin are known to have different colors; nothing is known about how the colors of spheres from different bins compare. We start with no knowledge, and so the seven spheres are in seven different bins. Each test must be between spheres from two different bins, because the outcome of a test of spheres from the same bin would be known; the information

73. Majority Rules

205

learned from the test allows us to merge the two bins into one. If at some point there are 𝑗 bins, then there are 2𝑗 colorings consistent with the information we have, because the spheres in each bin can be colored in two ways, and the spheres in different bins can be colored independently. Since each test results in two bins being merged into one, it cuts down the number of possible colorings by a factor of two, and therefore it breaks the possibilities exactly in half. Because 𝜎 takes three steps, and each step involves a test with two possible outcomes, there are eight possible sequences of outcomes, each leading to a final state with the spheres in four bins. There are 27 = 128 possible colorings, with 16 colorings leading to each final state. Consider a fixed sphere 𝑆, and for each final state count the number of colorings leading to that state that give 𝑆 the majority color. At any final state, 𝜎 can identify a sphere of the majority color; in other words, it can identify a nonempty compartment 𝐶 of some bin such that the spheres in 𝐶 must have the majority color. If 𝑆 is in compartment 𝐶, then all 16 colorings leading to that final state give 𝑆 the majority color. If 𝑆 is in the other compartment of the bin containing 𝐶, then there are 0 colorings for which 𝑆 has the majority color. And if 𝑆 is in a different bin from 𝐶, then exactly half of the colorings give 𝑆 the majority color (because the colorings of the spheres in different bins are independent of each other), so there are eight that give it the majority color. Adding over all final states, the number of colorings for which 𝑆 has the majority color must be a multiple of eight. But in fact the number of such colorings is 6 6 6 6 2 (( ) + ( ) + ( ) + ( )) = 84, 0 1 2 3 not a multiple of eight; this is a contradiction. This problem and the general solution are due to Michael Saks and Michael Werman [111]. For the general proof that the count 𝑛 − 𝑏(𝑛) is sharp, as well as a discussion of the case that 𝑛 is even, see [3].

73 Majority Rules Memorize the first name you hear and increment the counter. Then compare every name you hear to the memorized name; increment the counter if they agree and decrement if not. If the counter ever gets to 0, start over: memorize the next name you hear, increment the counter, and continue as before. The name you have memorized at the end is the majority name. To prove that this works, first note that if the counter never gets back to 0, the memorized name is clearly the majority. If it does return to 0, then no name has a majority so far, because the memorized name has occurred exactly half the time and each of the other names occurred no more than half the time. So

206

Chapter 7. Algorithms and Strategy

whatever name has a majority overall will have a majority in the remainder of the list. That’s why starting over works. To be more precise, this process consists of a sequence of rounds. A round ends when the counter returns to 0; the next round starts with the next name. At the beginning of each round, the majority name must have a majority in the remainder of the list. One can prove this by induction on the number of rounds that have passed. Now, apply this fact to the last round. The majority name must have a majority in the last round. Therefore when the process ends the counter will be positive and the memorized name must be the majority name. The algorithm produces the majority value if such a value exists. If it is not known that the set contains a majority element, the algorithm still terminates, but one must check by counting whether the final value is a majority value; it might not be. This algorithm was discovered in 1980 by Robert Boyer and J. Strother Moore [14], but not published by them until 1991. It was also discovered by Michael Fischer and Steven Salzberg [46].

74 Going for Gold Define an operation ⊕ on ℕ as follows: 𝑎 ⊕ 𝑏 is the number whose binary representation has a 1 in position 𝑖 if and only if the binary representations of 𝑎 and 𝑏 differ in position 𝑖. For example, 61 ⊕ 15 = 50 because 61 = 1111012 , 15 = 11112 = 0011112 , these two representations differ in positions (counting from the right) 2, 5, and 6, and 1100102 = 50. This operation is the same as bitwise exclusive or of bit strings, or base-2 addition without carries. It is easy to see that ⊕ is commutative and associative and, for all 𝑎, 0 ⊕ 𝑎 = 𝑎 and 𝑎 ⊕ 𝑎 = 0. Number the squares from 0 to 63. Each arrangement of coins on the board can be represented by a string of bits 𝑏 = (𝑏0 , . . . , 𝑏63 ), where 𝑏𝑖 = 0 if and only if the coin on square 𝑖 is heads. For such a sequence 𝑏, let 63

ˆ 𝑏 = (𝑏0 ⋅ 0) ⊕ (𝑏1 ⋅ 1) ⊕ ⋯ ⊕ (𝑏63 ⋅ 63) =

𝑏𝑖 ⋅ 𝑖.

𝑖=0

Notice that if 𝑏𝑖 = 0, then the 𝑖th term drops out of this expression, and if 𝑏𝑖 = 1, then 𝑏𝑖 ⋅ 𝑖 = 𝑖. So an equivalent definition is ˆ 𝑏 = ⨁𝑏 =1 𝑖. Because 𝑖 ˆ {0, 1, . . . , 63} is closed under ⊕, 0 ≤ 𝑏 ≤ 63. If the arrangement of coins that Bob sees is coded by the bit string 𝑐 (heads → 0, tails → 1, as before), then Bob takes the coin on square ˆ𝑐 . Here is how Alice ensures that Bob is correct. Suppose the bit string 𝑏 encodes the arrangement of coins she sees and the gold coin is on square 𝑔. She computes 𝑘 = ˆ 𝑏 ⊕𝑔 and flips the coin on square 𝑘. The bit string 𝑐 is then the same as 𝑏, except that 𝑐𝑘 = 1−𝑏𝑘 .

74. Going for Gold

207

Because 0 ⊕ 𝑘 = 𝑘 and 𝑘 ⊕ 𝑘 = 0, 𝑐𝑘 ⋅ 𝑘 = (1 − 𝑏𝑘 ) ⋅ 𝑘 = (𝑏𝑘 ⋅ 𝑘) ⊕ 𝑘. Therefore 63

ˆ𝑐 =

63

𝑐 ⋅𝑖 =( 𝑏 ⋅ 𝑖) ⊕ 𝑘 = ˆ 𝑏 ⊕(ˆ 𝑏 ⊕ 𝑔) = ( ˆ 𝑏 ⊕ˆ 𝑏 ) ⊕ 𝑔 = 0 ⊕ 𝑔 = 𝑔. ⨁ 𝑖 ⨁ 𝑖 𝑖=0

𝑖=0

For example, suppose the coins on squares 0, 1, and 63 are tails, the rest are heads, and the gold coin is on square 𝑔 = 17. Then 𝑏 = (1, 1, 0, . . . , 0, 1), ˆ 𝑏 = 0 ⊕ 1 ⊕ 63 = 0000002 ⊕ 0000012 ⊕ 1111112 = 1111102 = 62, and 𝑘= ˆ 𝑏 ⊕ 𝑔 = 1111102 ⊕ 0100012 = 1011112 = 47. Alice flips the coin on square 47 from heads to tails, so 𝑐 = (1, 1, 0, . . . , 1, . . . , 0, 1). Bob computes ˆ𝑐 = 0 ⊕ 1 ⊕ 47 ⊕ 63 = 0000002 ⊕ 0000012 ⊕ 1011112 ⊕ 1111112 = 0100012 = 17. Graph theory is an appropriate setting for this problem. Define the hypercube graph 𝑄𝑚 to have as vertices all bit strings of length 𝑚, with an edge connecting two strings that differ in exactly one position; 𝑄3 is the familiar 3-dimensional cube. As a warmup, consider the given problem arising from a 2 × 2 board. The pattern Alice sees will be coded by a string of four bits, so the 16 possible patterns correspond to the vertices of the graph 𝑄4 . Her possible moves, if she chooses to flip a coin, correspond to edges of 𝑄4 (Figure 74.1). A dominating set in a graph 𝐺 is a set of vertices 𝐷 such that every vertex not in 𝐷 is adjacent to one in 𝐷. The minimum size of a dominating set is the domination number of 𝐺, 𝛾(𝐺). The domatic number of 𝐺, denoted 𝑑(𝐺), is the maximum number of pairwise disjoint dominating sets in 𝐺; we have the upper bound 𝑑(𝐺) ≤ ⌊𝑉(𝐺)/𝛾(𝐺)⌋, where 𝑉 is the vertex count. In the cube 𝑄3 , a pair of diagonally opposite vertices is a dominating set; there are four such pairwise disjoint sets. We can view the hypercube 𝑄4 as consisting of two copies of 𝑄3 with edges connecting copies of the same vertex. Then the diagonally opposite dominating sets in 𝑄3 lead to four pairwise-disjoint dominating sets in 𝑄4 , as shown in Figure 74.2; that is, 𝑑(𝑄4 ) = 4 (it is easy to see that there are not five disjoint dominating sets). If these four dominating sets in 𝑄4 are 𝐷0 , 𝐷1 , 𝐷2 , and 𝐷3 and coin 𝑔 is made of gold, then Alice can transform the pattern she sees into an element of 𝐷𝑔 by flipping at most one coin, and Bob can then see which dominating set his pattern is in, thus learning 𝑔. Similar reasoning shows that in general, solving the problem with 𝑚 coins, in which Alice must communicate the identity of the gold coin by flipping at most one coin, is equivalent to finding a family of 𝑚 pairwise disjoint dominating sets in 𝑄𝑚 , and therefore a solution exists if and only if 𝑑(𝑄𝑚 ) ≥ 𝑚.

208

Chapter 7. Algorithms and Strategy

Figure 74.1. Alice’s moves correspond to edges in the cube graph 𝑄4 .

Figure 74.2. The domatic number of the 4dimensional hypercube is 4: each of the four colors represents a dominating set. Moving to the case at hand, 𝑄64 and its 264 vertices, here is how to get 64 pairwise disjoint dominating sets, showing that 𝑑(𝑄64 ) ≥ 64. Let 𝐷𝑖 = {𝑏 ∶ ˆ 𝑏 = 𝑖}. To get into 𝐷𝑔 from string 𝑏, just follow the edge determined by flipping 𝑏𝑘 , where 𝑘 = ˆ 𝑏 ⊕ 𝑔. The preceding construction shows that Alice can communicate any one of 64 numbers by flipping one of 64 coins. Here is a proof that she cannot communicate any one of 65 numbers by flipping one (or none) of 64 coins. Because any vertex in 𝑄64 has 64 neighbors, we have that 𝛾+64𝛾 ≥ 264 ; this gives 𝛾 ≥ ⌈264 /65⌉ > 264 /65 (because 65 does not divide 264 ). So 𝑑(𝑄64 ) ≤ ⌊264 /𝛾⌋ ≤ 264 /𝛾 < 264 /(264 /65) =

74. Going for Gold

209

Table 74.1. Values of the domatic and domination numbers of the hypercube graph 𝑄𝑚 . The last row is the upper bound ⌊𝑉(𝑄𝑚 )/𝛾(𝑄𝑚 )⌋ on 𝑑(𝑄𝑚 ). 𝑚 𝑑(𝑄𝑚 ) 𝛾(𝑄𝑚 ) ⌊

2𝑚 𝛾(𝑄𝑚 )

1 2 1

2 2 2

3 4 2

4 4 4

5 4 7

6 5 12

7 8 16

8 8 32

9 8 62

2

2

4

4

4

5

8

8

8

15 16

16 16

31 32

32 32

63 64

64 64

65, and the strict inequality therefore implies that the domatic number is at most 64. Therefore 𝑑(𝑄64 ) = 64. Suppose we forbid Alice from flipping the coin on square 0. Then the prob63 lem is still solvable, because in the first solution above we have ˆ 𝑏 = ⨁𝑖=0 𝑏𝑖 ⋅ 𝑖 and the value of 𝑏0 has no relevance as it is multiplied by 0. Thus Alice can leave 𝑏0 alone when she is supposed to flip it, with no effect on Bob’s action. This shows that 𝑑(𝑄63 ) = 64. The solution to this problem generalizes to show that for every positive integer 𝑛, 𝑑(𝑄2𝑛 ) ≥ 2𝑛 , while the arguments just given tell us that 𝑑(𝑄2𝑛 −1 ) = 𝑑(𝑄2𝑛 ) = 2𝑛 . Table 74.1 shows what is known about 𝑑 and 𝛾 for the hypercube graph [99, sequences A157887, A000983]. Note that the domatic number equals the upper bound in the known cases. Because the computation of 𝛾 for cubes is difficult, the bounds are known only up to dimension 9. Here is a variation whose solution is quite a bit simpler than the preceding one. This problem is due to Peter Saltzman, Jim Tilley, and Stan Wagon. The setup is as before, except that Charlie has 128 coins (one of which is gold) and he places them on two side-by-side 8 × 8 boards. Alice can then flip at most four coins, replacing them on their squares, but her moves must all be on the first row of the left-hand board. Once again, we seek a strategy that allows Bob to always select the gold coin. If Alice could invert up to seven coins, then she could arrange the first seven squares of the left board’s first row to be any of 27 = 128 numbers. This problem shows that it can be done in only four flips. To solve the problem, we number the 128 squares from 0 to 127. The eight bits of the left-hand board’s first row encode a number from 0 to 255. Alice can, in four or fewer moves, turn this row into one of (0 or 255), (1 or 254), (2 or 253), . . . , (127 or 128). Bob chooses the smaller of the pair Alice encodes in this way and that tells him 𝑔, the gold coin’s position. Here is the reason Alice can always get to one of 𝑔, 255 − 𝑔: If she cannot get to 𝑔 with four flips, then, viewing 𝑔 as an 8-bit string, at least five of the eight bits are wrong. She can then make at most three flips to get all eight to be wrong, which means the number encoded is the complement, 255 − 𝑔.

210

Chapter 7. Algorithms and Strategy

The subject of this problem is considered part of coding theory [25, 116] and has been extensively studied in the case that Alice can flip 𝑘 coins.

75 The Mensa Correctional Institute (a) Identify the cards with the integers from 1 to 52. The key to the solution is the fact that the numbers from 1 to 52 play two distinct roles: they identify the cards, and they also identify the locations that the cards can occupy in the linear array presented by Charlie. We will refer to the location that a card occupies in the array as the address of the card. The array determines a permutation of the numbers from 1 to 52 by the rule that if the card at address 𝑖 is 𝑗, then the permutation maps 𝑖 to 𝑗; e.g., in the case of six cards, the array 3 4 6 2 5 1 corresponds to the permutation 1 → 3, 2 → 4, and so on. Any permutation splits into cycles; the preceding example splits into (1 → 3 → 6 → 1)(2 → 4 → 2)(5 → 5). We’ll use the traditional short form for cycles: (1 3 6)(2 4)(5). Alice starts by examining the cycles in the initial array. If the largest cycle has length 26 or smaller she does nothing. Otherwise she finds the longest cycle that occurs, say (𝑐1 𝑐2 ⋯ 𝑐𝐿 ). Then she switches cards 𝑐1 and 𝑐⌊𝐿/2⌋+1 . This splits the long cycle into two cycles whose lengths differ by at most one. Because at most one cycle has length 27 or greater, her action means that Bob will face a permutation having no cycle longer than 26. For example, the array might be 1 3 4 ⋯ 52 2, which is the single 51-cycle (2 3 4 ⋯ 52). She would transpose cards 2 and 27 to get the array 1 3 4 ⋯ 26 2 28 29 ⋯ 52 27. In cycle notation, this array corresponds to the permutation (1)(2 3 4 ⋯ 26)(27 28 29 ⋯ 52), which has two cycles of lengths 25 and 26. Now Bob enters the room and learns the target 𝐶. He flips the card at address 𝐶 and sees card 𝑈. If he is lucky and 𝑈 = 𝐶, they win immediately. Otherwise, Bob flips the card at address 𝑈. (This is an example of a pointer-following strategy.) If 𝑉 is the card he then sees, either 𝑉 = 𝐶 and they win (the permutation would have the 2-cycle (𝐶 𝑈)), or he moves on to address 𝑉. He continues in this way until he is about to flip the card at address 𝐶, which will happen when he reaches the end of the cycle he has been following; but that can happen only when he is looking at card 𝐶. Thanks to Alice, no cycle is longer than 26, so success is guaranteed. The problem is solved in exactly the same way if the deck has 𝑛 cards: Bob can find the target after examining ⌈𝑛/2⌉ cards. But the following problem is unsolved. Open Problem. Is there an 𝑛 for which the problem has a 100% successful solution where Bob is allowed to examine only ⌈𝑛/2⌉ − 1 cards?

75. The Mensa Correctional Institute

211

See [22] for a full discussion of this problem and many variations. For example, what is a strategy that will minimize the expected number of cards Bob has to examine, where it is assumed that Charlie’s original placement and target choice are random? (b) If Alice were unavailable, Bob’s choice would be no better than random and the chance of success would be 20%. But they can use the approach that worked so well in (a), assuming the cards are numbered 1 through 5. Have Bob flip the card at address 𝐶. To optimize things for Bob, Alice will examine the cycle structure as in (a). She checks whether the initial permutation has a 2cycle. If it does, she chooses one such and switches the two cards. If not, either it is the identity, which she leaves untouched, or it has a 3-, 4-, or 5-cycle, denoted (𝑐1 𝑐2 ⋯ 𝑐𝐿 ). In this case she splits it into a fixed point and an (𝐿 − 1)-cycle by swapping cards 𝑐1 and 𝑐2 . The success probability for this basic strategy is 47 1⁄3%, which is the same as saying that over the 5 ⋅ 5! things that Charlie controls, the number of successes is 284 (proof to follow). A strategy is simply a rule that tells Bob what to do upon hearing the target 𝐶. The preceding basic strategy is ⟨1, 2, 3, 4, 5⟩, where the 𝐶th entry tells Bob the address of the card to be flipped on hearing 𝐶; this number is called 𝐶’s preferred address. This strategy (or any permutation of it) is the only one that actually flips all cards, and one might think that a strategy that leaves some cards forever unflipped would not be useful. Certainly such an unflipped-card approach would fail if Bob had to find the target in all cases; but that is not required. This leads one to look at other possible strategies, and Carter and Wagon [22] discovered, to their surprise, that the basic strategy ⟨1, 2, 3, 4, 5⟩ is not the best. While there are 55 = 3125 strategy vectors, there are essentially only seven different strategies. To see why, we introduce some notation. For any strategy 𝜎, let 𝜎diff be the number of distinct entries in 𝜎, and let 𝜏(𝜎) be the multiset of the frequencies with which these distinct entries occur in 𝜎. For example, if 𝜎 = ⟨1, 1, 2, 2, 3⟩, then 𝜎diff = 3 and 𝜏(𝜎) = {2, 2, 1}. It turns out that when analyzing the performance of any strategy, only the frequency multiset 𝜏(𝜎) matters. For example, ⟨4, 5, 5, 1, 4⟩ also has frequency multiset {2, 2, 1}, so its performance is identical to that of 𝜎 = ⟨1, 1, 2, 2, 3⟩. The possible frequency multisets correspond to the partitions of 5, and there are only seven of them; see Table 75.1. Let 𝜎 be any strategy. For any permutation 𝜋, call a card good if Bob will find the card using strategy 𝜎. For card 𝑖, this means 𝜋(𝜎(𝑖)) = 𝑖; in other words, card 𝑖 is at its preferred address. Call 𝜋 ideal if the number of good cards in 𝜋 is 𝜎diff , which is the maximum possible. Let 𝐼𝜍 be the number of ideal permutations for 𝜎. For example, 𝜎 = ⟨1, 1, 3, 4, 5⟩ admits two ideal permutations: the identity 1 2 3 4 5 (for which 1, 3, 4, and 5 are good) and 2 1 3 4 5 (for which cards 2, 3, 4, and 5 are good). There is a simple formula for the ideal count for any strategy. Proposition. The ideal count 𝐼𝜍 is (5 − 𝜎diff ) ! ∏ 𝜏(𝜎).

212

Chapter 7. Algorithms and Strategy Table 75.1. Summary of the seven strategies for the one-card game. The second one is the best.

strategy 𝜎 ⟨1, 2, 3, 4, 5⟩ ⟨𝟏, 𝟏, 𝟐, 𝟑, 𝟒⟩ ⟨1, 1, 2, 2, 3⟩ ⟨1, 1, 1, 2, 3⟩ ⟨1, 1, 1, 2, 2⟩ ⟨1, 1, 1, 1, 2⟩ ⟨1, 1, 1, 1, 1⟩

frequencies 𝜏(𝜎) {1, 1, 1, 1, 1} {𝟐, 𝟏, 𝟏, 𝟏} {2, 2, 1} {3, 1, 1} {3, 2} {4, 1} {5}

𝐼𝜍 1 2 8 6 36 24 120

𝑆𝜍 45 48 48 42 36 24 0

𝑁𝜍 284 286 280 276 240 240 120

probability of success, % 47 1/3 𝟒𝟕 𝟐/𝟑 46 2/3 46 40 40 20

Proof. A permutation is ideal if and only if it has 𝜎diff good cards; the other cards are unrestricted, yielding the factorial term. The product of the elements of 𝜏(𝜎) is the number of ways of choosing a card to be at its preferred address for each of the addresses appearing in 𝜎. This formula yields the ideal counts in Table 75.1. Call a move by Alice strong (or {𝑖, 𝑗}-strong) if the move increases the good count by two (by switching cards 𝑖 and 𝑗); in other words, a permutation admits an {𝑖, 𝑗}-strong move if card 𝑖 is at card 𝑗’s preferred address and card 𝑗 is at card 𝑖’s preferred address. Let 𝑆𝜍 be the number of permutations for which Alice has a strong move. Now, regardless of strategy, among all 5! permutations, the number of good cards before Alice’s intervention is 5!; this is because each card is good in 4! permutations, so there are 5 ⋅ 4! good cards in all. For any nonideal permutation, there is always a move for Alice that will increase the number of good cards by one. This contributes 5! −𝐼𝜍 additional good cases. But for permutations that admit a strong move, there is an additional increase of one to the good count, because Alice has a move that increases the good count by two, not one. Therefore, for any strategy 𝜎, the total count of good cards after Alice’s best switch, which we denote by 𝑁𝜍 , is 5! +(5! −𝐼𝜍 ) + 𝑆𝜍 = 240 − 𝐼𝜍 + 𝑆𝜍 , and the probability of success is 𝑁𝜍 /(5 ⋅ 5! ). We next evaluate 𝑁𝜍 in each of the seven cases, which will reveal the best strategy. In each case, we will analyze a particular strategy, but the same reasoning would apply to any strategy with the same frequency multiset. We start with the basic strategy 𝜎 = ⟨1, 2, 3, 4, 5⟩. There are 10 card pairs {𝑖, 𝑗}, and for each of them, there are 3! = 6 permutations that admit an {𝑖, 𝑗}-strong move, since the addresses of 𝑖 and 𝑗 are fixed and the other three can be permuted arbitrarily. This gives a total of 10 ⋅ 6 = 60 strong moves. But this is not 𝑆𝜍 , because a few permutations admit two different strong moves, so they have been doubly counted. For example, there is exactly one permutation that admits both a {1, 3}-strong move and a {4, 5}-strong move, namely 3 2 1 5 4. In fact, for all distinct 𝑖, 𝑗, 𝑘, 𝑙 there is

75. The Mensa Correctional Institute

213

exactly one permutation that admits both an {𝑖, 𝑗}-strong move and a {𝑘, 𝑙}-strong move. There are 15 possibilities for {{𝑖, 𝑗}, {𝑘, 𝑙}}, so 𝑆𝜍 = 60 − 15 = 45. Therefore 𝑁𝜍 = 240 − 1 + 45 = 284, for a success rate of 47 1/3%. Case 𝜎 = ⟨1, 1, 2, 3, 4⟩. The preferred addresses for 1 and 2 are the same, so there can be no {1, 2}-strong moves. For each of the other nine pairs {𝑖, 𝑗}, there are six permutations that admit an {𝑖, 𝑗}-strong move, so that’s 9 ⋅ 6 = 54 strong moves. But again we have some double counting. If 𝑖 is either 1 or 2 and 𝑗 is either 3, 4, or 5, then there is exactly one permutation that admits both an {𝑖, 𝑗}-strong move and one other strong move, and those are all the permutations that admit multiple strong moves. So there are six permutations that have been double counted, and 𝑆𝜍 = 54 − 6 = 48. Therefore 𝑁𝜍 = 240 − 2 + 48 = 286, two greater than for the basic strategy. The success rate is 47 2/3%, and this strategy turns out to be the best possible. Case 𝜎 = ⟨1, 1, 2, 2, 3⟩. There are two pairs {𝑖, 𝑗} for which {𝑖, 𝑗}-strong moves are impossible, namely {1, 2} and {3, 4}. For each of the other eight pairs, there are six permutations admitting an {𝑖, 𝑗}-strong move, for a total of 8⋅6 = 48 strong moves. This time there is no double counting, so 𝑆𝜍 = 48 and 𝑁𝜍 = 240−8+48 = 280. Case 𝜎 = ⟨1, 1, 1, 2, 3⟩. There are three pairs {𝑖, 𝑗} for which {𝑖, 𝑗}-strong moves are impossible. For the other seven, there are six permutations admitting an {𝑖, 𝑗}strong move, for a total of 7⋅6 = 42. Again there is no double counting, so 𝑆𝜍 = 42 and 𝑁𝜍 = 240 − 6 + 42 = 276. Case 𝜎 = ⟨1, 1, 1, 1, 2⟩ or ⟨1, 1, 1, 2, 2⟩. In both cases the ideal count equals the strong count. For the first, a permutation is ideal if 5 is at address 2 and it admits a strong move if 5 is at address 1. The second case is similar. This equality means that 𝑁𝜍 = 240 and in both cases the probability of success is 40%. Case 𝜎 = ⟨1, 1, 1, 1, 1⟩. Every permutation is ideal and there are no strong moves, so 𝑁𝜍 = 240 − 120 + 0 = 120 and the probability of success is 20%. In this case, Alice never switches cards, and Bob achieves the same success rate he would achieve by making a random choice, with no help from Alice. Note the gigantic increase in the success rate provided by Alice’s help when using the best strategy: from 20% to almost 48%. For a standard 52-card deck, the basic strategy increases the success rate from 1/52 or 1.9% to 4.6%; the strategy ⟨1, 1, 3, 4, 5, . . . , 52⟩ increases it only a little more, by about 10−38 . For more details, including a conjecture as to what the best strategy is for any number of cards, see [22]. Part (a) appeared in [18, Fall 2015, problem 5].

214

Chapter 7. Algorithms and Strategy

76 Matching Hats We use 𝐵 for black and 𝑊 for white. A useful starting point is the first-black strategy, where a prisoner writes down the location of the first black he or she sees (choosing 1 if there are no blacks). If each prisoner uses this strategy, the success rate is 2/3. For each level there is an ordered pair specifying the colors of the two hats at that level. This strategy succeeds if and only if the 𝐵𝐵 pair precedes the first 𝐵𝑊 and 𝑊𝐵 pairs, or 𝐵𝐵 follows the first 𝐵𝑊 and 𝑊𝐵 pairs. With probability one all four pairs occur, and the pairs are equally likely at any level, so the chance of success is 2/3 because four of the six permutations of 𝐵𝑊, 𝑊𝐵, 𝐵𝐵 lead to success. It is remarkable that there is a relatively simple strategy that succeeds 70% of the time (and this is conjectured to be optimal). One can first examine strategies for the infinite game where the prisoners only look at the lowest 𝑛 hats and choose an integer from 1 to 𝑛. This is the same as the 𝑛-hat game, where only 𝑛 hats are placed on each head. When 𝑛 = 2, the first-black strategy is 𝐵𝐵 → 1, 𝐵𝑊 → 1, 𝑊𝐵 → 2, 𝑊𝑊 → 1, where the letter pairs refer to the colors of the two hats seen, in order. This succeeds with probability 5/8 and that is best possible. For 𝑛 = 3, a computer search finds that an optimal strategy is 𝜎3 , given as follows: 𝐵𝐵𝐵 → 1,

𝐵𝐵𝑊 → 3,

𝐵𝑊𝐵 → 1,

𝐵𝑊𝑊 → 3,

𝑊𝐵𝐵 → 2,

𝑊𝐵𝑊 → 2,

𝑊𝑊𝐵 → 1,

𝑊𝑊𝑊 → 1.

The strategy 𝜎3 succeeds in 44 of the 8 ⋅ 8 = 64 possible scenarios, so its success rate is 11/16 = 0.6875, which solves the stated problem. But one can do better. The following strategy was found by Larry Carter, Jay-C Reyes, Joel Rosenberg, and Mark Tiefenbruck and, independently, by Jonathan Kariv, Clint van Allen, and Dmytro Yeroshkin [74]. The cited paper deals with the version where a success is defined as the two players selecting a white hat. It is not hard to see that, for any strategy, the probability for the two-white version is exactly half the probability of matching colors. If one looks more closely at 𝜎3 , one sees that if both prisoners see two different colors among the three hats, then the probability of the team making correct choices is 5/6; but if either sees only one color, the probability of success is merely 1/2. This is because the 44 scenarios leading to success for 𝜎3 consist of two of the four scenarios when both are constant-color, 12 of the 24 cases when only one is constant-color, and 30 of the 36 cases when neither is constant-color. This leads to the following strategy for infinitely many hats, which uses the trick of making the low-probability 50% case in 𝜎3 disappear. We call it the triple-jump strategy. Alice uses 𝜎3 on the first three levels, provided she sees two colors among these. If she sees only one color, she moves to the first set of three levels of the form {3𝑘 + 1, 3𝑘 + 2, 3𝑘 + 3} for which she sees two colors and uses 𝜎3 on those levels.

76. Matching Hats

215

Bob does the same. With probability one, each prisoner will eventually find a set of three levels that can be used. Theorem 76.1. The success probability of the triple-jump strategy is 7/10. Proof. First we compute the probability that Alice and Bob play 𝜎3 in the same three levels. The probability that they both play at the first three levels is (6/8)2 = 9/16. The probability that they both play at the next three is (2/8)(2/8)(9/16) = (1/16)(9/16), and in general, the probability that they both play at the 𝑘th triple of levels is (1/16)𝑘−1 (9/16). So the probability that they choose from the same levels is the sum of a geometric series, which is (9/16)/(1 − 1/16) = 3/5. Therefore with probability 2/5 they play at different (in fact, disjoint) triples of levels. If they play at the same levels, then both see different colors at those levels, and as we have seen their probability of success is 5/6. If they play at disjoint levels, then because Alice’s declared hat can be either 𝐵 or 𝑊 without affecting Bob’s declared number (and vice versa), the chance of success is 1/2. So the overall probability of success is 3 5 2 1 1 1 7 ⋅ + ⋅ = + = . 5 6 5 2 2 5 10 If the strategy is defined using two levels instead of three, the overall probability of success is 2/3. If instead a quadruple-jump strategy is used, using the best-known strategy for the four-hat case (given by Theorem 76.2), it works out to 44/63 = 0.698. . .. Much investigation has not led to any strategy better than the triple-jump method, so we have the following conjecture. A step in the right direction was provided by Chris Freiling, who proved that the probability of success cannot exceed 81/112 ≈ 72.3%. Conjecture. No strategy can succeed more than 70% of the time. If this conjecture is true, then the maximum probability in the case of 𝑛 hats is known. One can start with the trivial strategy for 𝑛 = 1 (there is only one number to choose from) and move up inductively to get a strategy with success rate approaching 70% as 𝑛 → ∞. Moreover, assuming the preceding conjecture, these finite strategies are optimal. Theorem 76.2 in the odd case was found by Carter, Reyes, Rosenberg, and Tiefenbruck and in the even case by Stan Wagon and Al Zimmermann. Theorem 76.2. For positive integers 𝑛, there is a strategy in the 𝑛-hat situation with success rate 7 1 1 𝑝𝑛 = − 𝑛 (1 + (−1)𝑛 ) . 10 4 5

216

Chapter 7. Algorithms and Strategy

Proof sketch. For the odd case the proof is by induction. Start with the unique strategy when 𝑛 = 1 (say “1”); it succeeds with probability 1/2. For odd 𝑛 ≥ 3, suppose 𝜎 is the inductively defined strategy for 𝑛 − 2 hats and the prisoners now have 𝑛 hats. Alice looks at Bob’s first 𝑛 − 2 hats. If they’re all white and the (𝑛 − 1)st hat is black, she declares 𝑛 − 1. If they’re all black and the 𝑛th hat is white, she declares 𝑛. In all other cases she uses 𝜎 on the first 𝑛 − 2 hats. Bob follows the identical strategy. For even 𝑛, suppose 𝜎 is the strategy for 𝑛 − 1 hats that satisfies the formula, and the prisoners now have 𝑛 hats. Alice looks at Bob’s first 𝑛 − 1 hats. If they’re all white or all black, she moves up to the last 𝑛 − 1 levels and uses 𝜎 there. Otherwise she uses 𝜎 on the first 𝑛 − 1 hats. Bob uses the same strategy. Details that the success rates of these strategies are as claimed are omitted. Yeroshkin observed that the probability in Theorem 76.2 is of the form 𝑞 = 𝑀 ⋅ 4−𝑛 , where 𝑀 is the largest even integer such that 𝑞 < 7/10; the proof of this reduces to the behavior of powers of 4 modulo 10. This means that if the 70% conjecture is true, then the strategies of Theorem 76.2 are optimal. For if there were a better strategy for some 𝑛, its success probability must have the form 𝑄⋅4−𝑛 (𝑄 an integer) because there are exactly 4𝑛 scenarios. Further, 𝑄 must be even because the chance of a match is the sum of the chance of 𝐵𝐵 or 𝑊𝑊 and these two probabilities are equal. And then one could use the finite strategy in the infinite game, contradicting optimality of 7/10. Note that the induction of Theorem 76.2 leads to 𝜎3 used earlier, and the formula then gives success probability 11/16. For more on hat problems see [67]. This problem appeared in [74], and also in [18, Fall 2015, problem 5].

77 One Hat Too Many One idea is for all prisoners to assume the missing color is 1. If that is true, then everyone can deduce their color (by assuming that all previous declarations were correct). Therefore they succeed when the missing color is 1, which occurs with probability 1/11. But there is a completely different strategy that succeeds with probability 50%, and this is best possible. Imagine a ghost prisoner who stands behind Alice and wears the unused hat. So now the hat placements form a permutation 𝑃 of {1, 2, . . . , 11}, where the colors are identified with these integers. Recall that a permutation is even if it is a product of an even number of transpositions; otherwise it is odd. The strategy the prisoners will adopt is to assume that 𝑃 is even, which it will be with probability 1/2. Then each prisoner, on his or her turn, will eliminate all the hats that are seen and assume that all the preceding declarations are correct. That leaves two hats from which to choose. The prisoner will choose the one that, if he or she is wearing it, makes the permutation even. The two choices differ

78. The Prisoners Must Agree

217

by a transposition, so exactly one choice leads to an even permutation. If 𝑃 is indeed even, then all choices are correct; if not, Alice’s choice will be wrong and the others will be right. So the strategy succeeds with probability 1/2. Because Alice’s hat can be either one of the two remaining after she ignores the colors she sees, any strategy will have a 50% chance of failure as regards Alice’s guess. So the preceding strategy is the best possible. This idea works the same way if there are 𝑛 prisoners instead of ten. One variation on the problem is to suppose there are two extra hats, not one. Then Alice is choosing from three hats, so the best possible success rate is 1/3. It seems possible that, for any number of prisoners, a strategy with success rate 1/3 exists, but this fails for 𝑛 ≥ 7 [100]. For two prisoners the colors are 1, 2, 3, 4, and their strategy could be to assume that the color vector (Alice color, Bob color) is one of (1, 2), (2, 3), (3, 4), (4, 1). So if Alice sees 3 she declares 2 and if Bob hears 2 he declares 3. There are 12 possible color vectors and the assumption is that the true vector is one of four, so they succeed in four of the 12 cases. For three prisoners, the following set of 20 color vectors defines a strategy (the prisoners assume the hat assignment lies in this set) that wins with probability 20/60, which is 1/3. These are vectors of the form (𝑎, 𝑏, 3𝑎 + 3𝑏) (mod 5) for 1 ≤ 𝑎, 𝑏 ≤ 5 with 𝑎 ≠ 𝑏. The explicit set is {(1, 2, 4), (1, 3, 2), (1, 4, 5), (1, 5, 3), (2, 1, 4), (2, 3, 5), (2, 4, 3), (2, 5, 1), (3, 1, 2), (3, 2, 5), (3, 4, 1), (3, 5, 4), (4, 1, 5), (4, 2, 3), (4, 3, 1), (4, 5, 2), (5, 1, 3), (5, 2, 1), (5, 3, 4), (5, 4, 2)}. Such 1/3-strategies exist for four, five, and six prisoners, but not for seven or more. See [100], where the more general question of 𝑘 extra hats is investigated in detail. This problem is based on a problem of Alexander Shapovalov and Konstantin Kopp; see [78].

78 The Prisoners Must Agree (a) There are three natural strategies that Alice and Bob might choose (they will both use the same strategy): “always shout red,” “always shout blue,” or “shout the color you see.” For the first two, they will definitely agree (but the color they shout might not appear); for the last, the colors shouted will definitely appear (but they might not agree). The possible hat placements are red/red, blue/blue, red/blue, blue/red. In each of these cases, two of the three strategies lead to success and one to failure. So the prisoners can get a 2/3 guaranteed success rate, no matter how the hats are placed, by randomly choosing one of the three strategies. Therefore they number the strategies and ask the random number generator for one of 1, 2, or 3; then they follow the rules: 1 → “shout red,” 2 → “shout blue,” 3 → “shout the color you see.”

218

Chapter 7. Algorithms and Strategy

We now prove that 2/3 is the best possible. Any strategy used by Alice and Bob will involve a random integer 𝑟 in some range [𝑁] = {1, 2, . . . , 𝑁}. Once the hat assignment and the random integer are chosen, we can determine what Alice and Bob will shout if they use the strategy, and therefore we can tell if they will win or lose. Therefore we can make a 3 × 𝑁 table, where the rows correspond to the three hat assignments red/red, blue/blue, and red/blue, and the columns correspond to the values of 𝑟. In each cell of the table, there is a 𝑊 or an 𝐿, indicating whether Alice and Bob win or lose with that hat assignment and 𝑟value. Now count the 𝑊s. For any column (i.e., any choice of 𝑟), if Alice and Bob win with the hat assignments red/red and blue/blue, then they must lose with red/blue. This is because they both must shout “red” in the first case and “blue” in the second. But the third case is indistinguishable from the first for Bob, and indistinguishable from the second for Alice, so Bob will shout “red,” Alice will shout “blue,” and they lose. Therefore each column has at most two 𝑊s, and so the number of 𝑊s in the whole table is at most 2𝑁. But there are three rows, so there is some row in which the number of 𝑊s is at most 2𝑁/3; this means that for the hat assignment represented by that row, the probability of success is at most 2/3. (b) The same idea as in (a) works for 𝑛 prisoners and ℎ possible hat colors. Consider the colors to be 𝑐1 , 𝑐2 , . . . , 𝑐ℎ . There are two natural families of deterministic strategies for the prisoners. First, there are the fixed strategies 𝐹𝑖 (1 ≤ 𝑖 ≤ ℎ): no matter what is seen, the prisoner shouts 𝑐𝑖 . This strategy guarantees that the prisoners agree. Second, there are strategies based on what is seen; call them 𝑆𝑗 for 1 ≤ 𝑗 ≤ 𝑛 − 1. Strategy 𝑆𝑗 is: imagine lining up the people you see so that their hat color numbers are in increasing order, and shout the color of the hat on the 𝑗th person in that line. Now, as in part (a), consider, for each possible hat assignment, the count of the strategies that lead to success. Consider an arbitrary hat assignment. Suppose there are 𝑘 distinct colors in the assignment. It is easy to tell which fixed strategies lead to success: 𝐹𝑖 , where 𝑖 is one of the 𝑘 colors that appear in the assignment, leads to success, and the others fail. For the nonfixed strategies, imagine that the 𝑛 prisoners are lined up with their hat color numbers in increasing order; call this lineup the full lineup. The line imagined by any prisoner 𝑝 is the full lineup, with 𝑝 removed. Now consider the strategy 𝑆𝑗 for 1 ≤ 𝑗 ≤ 𝑛−1. When 𝑝 picks out the 𝑗th person in the imagined lineup, it will be either the 𝑗th or the (𝑗+1)th person in the full lineup, depending on 𝑝’s position in the full lineup. So strategy 𝑆𝑗 leads to success if and only if the 𝑗th and (𝑗 + 1)th prisoners in the full lineup have the same color hat. Because there are 𝑘 distinct colors, there are 𝑘−1 values of 𝑗 such that the 𝑗th and (𝑗+1)th prisoners in the full lineup are not wearing the same color hat (these are the

78. The Prisoners Must Agree

219

𝑘 − 1 positions in the full lineup where there is a transition from one color to the next). So of the 𝑛 − 1 strategies 𝑆𝑗 , 𝑘 − 1 of them lead to failure, and therefore (𝑛 − 1) − (𝑘 − 1) = 𝑛 − 𝑘 lead to success. So the total number of strategies that lead to success is 𝑘 + (𝑛 − 𝑘) = 𝑛, out of a total of 𝑛 + ℎ − 1 strategies under consideration. Therefore, as in part (a), if the prisoners randomly choose one of the 𝑛 + ℎ − 1 strategies, their guaranteed success rate will be 𝑛/(𝑛 + ℎ − 1). For 100 prisoners and 100 colors this is 100/199, or about 50.25%. The strategy we have given for the general case can be proved optimal as follows. Assume that the prisoners are just the integers 1, 2, . . . , 𝑛. Consider any strategy for the prisoners. The strategy will make use of a random integer 𝑟 ∈ [𝑁] for some positive integer 𝑁. To understand the proof, it is helpful to imagine that the warden uses a twostep process to assign the hats: first he chooses what collection of hats to use, and then he decides how to assign those hats to the prisoners. To choose the collection of hats, he chooses a sequence 𝑎1 , 𝑎2 , . . . , 𝑎𝑛 with 1 ≤ 𝑎1 ≤ 𝑎2 ≤ ⋯ ≤ 𝑎𝑛 ≤ ℎ. The hats used will have colors 𝑐𝑎1 , 𝑐𝑎2 , . . . , 𝑐𝑎𝑛 . We will say that the sequence 𝛼 = (𝑎1 , 𝑎2 , . . . , 𝑎𝑛 ) is a color collection. To assign the hats to prisoners, he will choose a permutation 𝜏 = 𝑡1 𝑡2 ⋯ 𝑡𝑛 of the prisoners [𝑛]: then prisoner 𝑡𝑖 will be given a hat of color 𝑐𝑎𝑖 . For example, if 𝛼 = (1, 3, 3, 4) and 𝜏 = 3 1 4 2, then prisoner 3 will get hat color 𝑐1 , prisoners 1 and 4 will get 𝑐3 , and prisoner 2 will get 𝑐4 . We will call the pair (𝛼, 𝜏) a hat choice. Note that different hat choices will sometimes lead to the same assignment of hat colors to prisoners. We now make a table, with a row for each hat choice (𝛼, 𝜏) and a column for each value of 𝑟 ∈ [𝑁]. In each cell of the table we place a 𝑊 or 𝐿, indicating whether the prisoners win or lose with that hat choice and random integer. The table has 𝑁 columns. To count the rows, we make use of the well-known fact that the number of color collections is ( 𝑛+ℎ−1 ). The number of permutations of 𝑛 prisoners is 𝑛!, so the number of rows is ( 𝑛+ℎ−1 ) 𝑛!, or (𝑛 + ℎ − 1)! /(ℎ − 1)!. 𝑛 We claim that the number of 𝑊s in any column of the table is at most (

𝑛+ℎ−2 (𝑛 + ℎ − 2)! 𝑛 . )𝑛! = 𝑛−1 (ℎ − 1)!

From this claim it follows that the total number of 𝑊s in the table is at most (𝑛 + ℎ − 2)! 𝑛𝑁/(ℎ − 1)! and therefore there must be a row in which the number of 𝑊s is at most (𝑛+ℎ−2)! 𝑛𝑁 𝑛𝑁 (ℎ−1)! = . (𝑛+ℎ−1)! 𝑛+ℎ−1 (ℎ−1)!

If the warden makes the hat choice corresponding to this row, then the probability of success for the prisoners will be at most 𝑛/(𝑛 + ℎ − 1), which proves that this is an upper bound on the guaranteed success rate that the prisoners can achieve.

220

Chapter 7. Algorithms and Strategy

It remains to prove the claim about the number of 𝑊s in any column. Fix a value of 𝑟 ∈ [𝑁], which determines a column. Suppose there is a 𝑊 in the row corresponding to the hat choice (𝛼, 𝜏), where 𝛼 = (𝑎1 , 𝑎2 , . . . , 𝑎𝑛 ) and 𝜏 = 𝑡1 𝑡2 ⋯ 𝑡𝑛 . Then with that hat choice and value of 𝑟, the prisoners will all shout the same color 𝑐𝑠 , and at least one prisoner has a hat of that color. That means that the number 𝑠 appears somewhere in 𝛼. Let 𝑗 be the least index such that 𝑎𝑗 = 𝑠. Let 𝛼′ be the result of deleting 𝑎𝑗 from 𝛼, and let 𝜏′ be the result of deleting 𝑡𝑗 from 𝜏. A crucial observation is that from 𝛼′ , 𝜏′ , and 𝑟 we can reconstruct 𝛼 and 𝜏. To do this, note that the pair (𝛼′ , 𝜏′ ) tells us what hats to assign to all prisoners except prisoner 𝑡𝑗 . And with that hat assignment and the value of 𝑟, we can use the prisoners’ strategy to determine what color prisoner 𝑡𝑗 will shout. But we know that he shouts 𝑐𝑠 , so that means we can determine 𝑠. This tells us that to construct 𝛼, we must insert an 𝑠 into 𝛼′ . And since we deleted the first occurrence of 𝑠 in 𝛼, and the numbers in 𝛼 are nondecreasing, we also know what position to insert the 𝑠 into; in other words, we can determine 𝑗. Once we have determined 𝑠 and 𝑗, we can reconstruct 𝛼 and 𝜏 by inserting 𝑠 into 𝛼′ at position 𝑗, and 𝑡𝑗 into 𝜏′ at position 𝑗. It follows that the pairs (𝛼′ , 𝜏′ ) will be different for different winning cases in column 𝑟, and therefore the number of 𝑊s in column 𝑟 is at most the number of possibilities for (𝛼′ , 𝜏′ ). But 𝛼′ is a color collection of size ℎ−1; there are therefore ′ ′ ( 𝑛−1+ℎ−1 ), or ( 𝑛+ℎ−2 𝑛−1 𝑛−1 ), possibilities for 𝛼 . And 𝜏 is a list of 𝑛−1 distinct numbers chosen from [𝑛], so there are 𝑛! possibilities for 𝜏′ . Therefore the number of 𝑊s in column 𝑟 is at most ( 𝑛+ℎ−2 𝑛−1 ) 𝑛!, as claimed. This problem appeared in [114].

79 How to Use Irrelevant Information For both parts of the problem, we partition the boxes into two infinite families of boxes 𝐴1 , 𝐴2 , 𝐴3 , . . . and 𝐵1 , 𝐵2 , 𝐵3 , . . . . For example, we can do this by letting the 𝐴-boxes be the even-numbered boxes and the 𝐵-boxes the odd-numbered boxes. Let 𝑎𝑛 denote the number in box 𝐴𝑛 , and 𝑏𝑛 the number in 𝐵𝑛 . (a) On her turn, Alice opens all of the 𝐴-boxes. Since all but finitely many boxes contain 0, there must be some positive integer 𝑁 such that for all 𝑛 ≥ 𝑁, 𝑎𝑛 = 0; let 𝑁𝐴 be the smallest such 𝑁. Because Alice has opened all of the 𝐴boxes, she can determine the value of 𝑁𝐴 . She guesses that box 𝐵𝑁𝐴 contains 0. Similarly, Bob opens the 𝐵-boxes, determines the smallest 𝑁𝐵 such that for all 𝑛 ≥ 𝑁𝐵 , 𝑏𝑛 = 0, and guesses that 𝐴𝑁𝐵 contains 0. If 𝑁𝐴 ≥ 𝑁𝐵 , then, by the definition of 𝑁𝐵 , 𝑏𝑁𝐴 = 0, so Alice’s guess is correct. Similarly, if 𝑁𝐵 ≥ 𝑁𝐴 , then Bob guesses correctly. Since it must be the case that either 𝑁𝐴 ≥ 𝑁𝐵 or 𝑁𝐵 ≥ 𝑁𝐴 , either Alice or Bob is correct.

79. How to Use Irrelevant Information

221

(b) Consider the equivalence relation on sequences of reals where two sequences are equivalent if they agree except on a finite initial segment. Before the trial, the prisoners use the axiom of choice to agree on a representative of each equivalence class. Let (𝑎′𝑛 ) be the chosen representative of the equivalence class of (𝑎𝑛 ), and (𝑏𝑛′ ) the representative of the equivalence class of (𝑏𝑛 ). Since (𝑎𝑛 ) and (𝑎′𝑛 ) are equivalent, they agree except on a finite initial segment; let 𝑁𝐴 be the smallest positive integer such that for all 𝑛 ≥ 𝑁𝐴 , 𝑎′𝑛 = 𝑎𝑛 . Similarly, let 𝑁𝐵 be the least positive integer such that for all 𝑛 ≥ 𝑁𝐵 , 𝑏𝑛′ = 𝑏𝑛 . We can now describe the strategies Alice and Bob will use. Alice begins by opening all of the 𝐴-boxes. This allows her to determine (𝑎′𝑛 ) and 𝑁𝐴 . Then she opens all of the 𝐵-boxes except 𝐵𝑁𝐴 , which allows her to determine (𝑏𝑛′ ). Finally, ′ she guesses that 𝐵𝑁𝐴 contains 𝑏𝑁 . Notice that if 𝑁𝐴 ≥ 𝑁𝐵 , then, by the definition 𝐴 ′ of 𝑁𝐵 , 𝑏𝑁𝐴 = 𝑏𝑁𝐴 , so her guess is correct. Bob’s strategy is similar, with the roles of the 𝐴- and 𝐵-boxes reversed. Bob first opens all 𝐵-boxes and determines (𝑏𝑛′ ) and 𝑁𝐵 . Then he opens all 𝐴-boxes except 𝐴𝑁𝐵 and determines (𝑎′𝑛 ). Finally, he guesses that 𝐴𝑁𝐵 contains 𝑎′𝑁𝐵 , and if 𝑁𝐵 ≥ 𝑁𝐴 , then his guess is correct. Since either 𝑁𝐴 ≥ 𝑁𝐵 or 𝑁𝐵 ≥ 𝑁𝐴 , either Alice or Bob makes a correct guess. For any positive integer 𝑚, similar strategies can be used to allow 𝑚 prisoners to take the test with at most one guessing wrong no matter what numbers are in the boxes. To accomplish this, instead of partitioning the boxes into two infinite families, we partition them into 𝑚 families. And with a somewhat more complicated argument one can even find strategies for a countably infinite collection of prisoners that ensure that at most one will guess wrong. Another variant gives a randomized strategy that a single prisoner can use to guess correctly with extremely high probability, no matter what numbers are in the boxes: For any 𝑚, one can randomly choose one of the prisoners in the 𝑚-prisoner game and follow that prisoner’s strategy. Since at most one prisoner guesses wrong in the 𝑚-prisoner game, the probability of success for this randomized strategy is at least 1 − 1/𝑚. These results appear paradoxical because opening some boxes and examining their contents seems to give no information about the contents of an unopened box. How is it that one can guess so successfully based on what appears to be irrelevant information? One possible reason is that our intuition is derived from a world where one can examine only finitely many boxes, and in that context the information gained by examining boxes is truly unhelpful. To understand the finite case, suppose there are 𝑁 boxes numbered from 1 to 𝑁, each containing one of the numbers 0, 1, or 2. Let 𝑆 be the set of all assignments of numbers to boxes; we will call the elements of 𝑆 scenarios. Since each box must contain one of three values, there are 3𝑁 scenarios. Now consider any strategy a prisoner might use to open 𝑁 − 1 boxes and then guess the contents

222

Chapter 7. Algorithms and Strategy

of the unopened box. For any scenario 𝑠, let 𝑛𝑠 be the number of the box left unopened by a prisoner following this strategy when the box contents are specified by 𝑠, let 𝑐𝑠 be the actual contents of the unopened box, and let 𝑔𝑠 be the guessed contents. We define the discrepancy of 𝑠 to be the number 𝑑𝑠 = 𝑐𝑠 − 𝑔𝑠 , where the difference is computed mod 3. Thus, the discrepancy is either 0, 1, or 2, and it is 0 when the guess is correct. For 𝑛 ∈ [𝑁] = {1, 2, . . . , 𝑁} and 𝑑 ∈ {0, 1, 2}, let 𝑆𝑛,𝑑 = {𝑠 ∈ 𝑆 ∶ 𝑛𝑠 = 𝑛 and 𝑑𝑠 = 𝑑}. Then adding 1 (mod 3) to the contents of box 𝑛 gives bijections from 𝑆𝑛,0 to 𝑆𝑛,1 and from 𝑆𝑛,1 to 𝑆𝑛,2 , and therefore |𝑆𝑛,0 | = |𝑆𝑛,1 | = |𝑆𝑛,2 |. For each 𝑑, the set 𝑆𝑑 = {𝑠 ∈ 𝑆 ∶ 𝑑𝑠 = 𝑑} is the disjoint union of the sets 𝑆𝑛,𝑑 for 𝑛 ∈ [𝑁], and therefore |𝑆0 | = |𝑆1 | = |𝑆2 |. But these sets form a partition of 𝑆, so each must have 3𝑁−1 elements. In particular, |𝑆0 | = 3𝑁−1 , so the strategy leads to a correct guess in only 1/3 of the scenarios. This is exactly the outcome one would get by simply guessing some value for a box, without looking in the other boxes. Thus, in this case the irrelevant information is unhelpful. Now suppose Alice and Bob are trying to win their freedom in a game with finitely many boxes containing 0, 1, or 2. As usual, at most one must guess wrong for them to be released. As we have just seen, no matter what strategies they use, each of Alice and Bob will guess correctly in only 1/3 of the scenarios, and therefore in at least 1/3 of the scenarios they will both guess wrong and be returned to their cells. And yet, as the solution to the stated problem shows, with a countably infinite collection of boxes they can succeed even if the contents of the boxes can be arbitrary real numbers. It is natural to suspect that the axiom of choice is to blame for the apparent paradox; after all, there are many paradoxical consequences of the axiom of choice that disappear if that axiom is not assumed. And indeed it can be shown that it is impossible to prove, without some form of the axiom of choice, that with a countably infinite collection of boxes Alice and Bob can guarantee their release. But a truly remarkable recent theorem of Elliot Glazer [57] shows that even without using the axiom of choice we can derive a similar paradoxical result if we are willing to use a much larger collection of boxes. In Glazer’s theorem, the boxes are labeled with sets of real numbers: for each set of real numbers 𝐴, there is a box labeled 𝐴 that contains a real number. One by one, each member of a countably infinite set of prisoners enters the room, opens all boxes except one, and then guesses the contents of the unopened box. Glazer’s theorem, proven without using the axiom of choice, says that there are strategies that guarantee that at most one prisoner will guess wrong. Discussions of this problem can be found in [101, 102]. The version in which all but finitely many boxes must contain 0 was suggested by Aaron Meyerowitz in [102]. For more counterintuitive results using the axiom of choice, see [67].

81. Battleship Destruction

223

80 Flipping Pennies Let the coins be 𝑐1 , 𝑐2 , . . . , 𝑐𝑛 . When we flip a coin 𝑐𝑘 and its neighbors, we will say that we are acting on coin 𝑐𝑘 . We first observe that it is easy to get all the coins to be heads except possibly 𝑐𝑛 . Simply act on 𝑐2 if necessary to get 𝑐1 to be heads, then act on 𝑐3 if necessary to get 𝑐2 to be heads, and so on, ending by acting on 𝑐𝑛 if necessary to get 𝑐𝑛−1 to be heads. If we’re lucky, 𝑐𝑛 will also end up heads. But if not, then all coins will be heads except 𝑐𝑛 , which will be tails. It suffices, then, to determine whether or not we can use a sequence of moves to get from this state—let’s call it the final tail state—to all heads. We will show that such a sequence of moves exists if and only if 𝑛 ≢ 2 (mod 3). Let 𝑆 = {𝑐1 , 𝑐2 , 𝑐4 , 𝑐5 , 𝑐7 , . . .} = {𝑐𝑘 ∶ 1 ≤ 𝑘 ≤ 𝑛 and 𝑘 is not divisible by 3}. Notice that for any 𝑘 < 𝑛, if 𝑐𝑘 ∈ 𝑆, then exactly one neighbor of 𝑐𝑘 is also in 𝑆, and if 𝑐𝑘 ∉ 𝑆, then both neighbors are in 𝑆. It follows that acting on 𝑐𝑘 will flip exactly two elements of 𝑆. However, the same may not be true for 𝑐𝑛 . If 𝑛 ≡ 2 (mod 3), then 𝑐𝑛 and 𝑐𝑛−1 are both in 𝑆, so acting on 𝑐𝑛 will also flip two elements of 𝑆. It follows that no move can change the parity of the number of tails in 𝑆. Thus, if we start in the final tail state, in which only 𝑐𝑛 is tails, then we will always have an odd number of tails in 𝑆, and therefore no sequence of moves can get us to all heads. Now suppose 𝑛 ≡ 1 (mod 3). Then 𝑐𝑛 ∈ 𝑆 but 𝑐𝑛−1 ∉ 𝑆. If we act on every coin in 𝑆, one at a time, then every coin will get flipped twice except for 𝑐𝑛 , which will only be flipped once. It follows that this sequence of moves will get us from the final tail state to all heads. Finally, suppose 𝑛 ≡ 0 (mod 3). Then 𝑐𝑛 ∉ 𝑆 but 𝑐𝑛−1 ∈ 𝑆. Once again, acting on every coin in 𝑆 will cause 𝑐𝑛 to flip once and every other coin to flip twice, getting us from the final tail state to all heads. This problem is from the St. Olaf College Math Mess, Feb. 17, 1997.

81 Battleship Destruction The set of integers is countable; also the set of pairs of integers is countable. Enumerate all possible initial states as (𝑋𝑛 , 𝑉𝑛 ). Now, at integer time 𝑛 seconds, shoot at 𝑋𝑛 + 𝑛𝑉𝑛 , which will strike the center point of a ship starting at 𝑋𝑛 with velocity 𝑉𝑛 and so every possible initial state will eventually lead to a strike. For a more explicit method, use the positive integer 2𝑋 3𝑉 to encode the pair (𝑋, 𝑉) when both are nonnegative, use 2−𝑋 3−𝑉 5 if both are negative, use 2−𝑋 3𝑉 52 if 𝑋 is negative and 𝑉 is not, and use 2𝑋 3−𝑉 53 if 𝑉 is negative and 𝑋 is not. Then, at any positive integer time 𝑛, look at the factorization of 𝑛; if 𝑛 does not have one of the four forms above, shoot randomly. But if 𝑛 does encode 𝑋 and 𝑉 as described above, shoot at 𝑋 + 𝑛𝑉, the location of the center of a ship starting at 𝑋 with velocity 𝑉. This problem appeared in [18, Spring 2013, problem 2].

224

Chapter 7. Algorithms and Strategy

82 Real Battleship Destruction Consider the plane of all possible initial conditions: all pairs (𝑋, 𝑉). Each shot knocks out not just a single point, but an infinite strip in this plane. If at time 𝑛 we focus on the point (𝐴, 𝐵) and shoot to get the center of a ship that started at (𝑋, 𝑉) = (𝐴, 𝐵), then we would shoot at 𝐴 + 𝑛𝐵 on the real line. This knocks out a ship that started at (𝐴, 𝐵), but also any ship that started at (𝑎, 𝑏) where 𝐴 + 𝑛𝐵 − 1 ≤ 𝑎 + 𝑛𝑏 ≤ 𝐴 + 𝑛𝐵 + 1. This inequality defines an infinite strip in the plane of horizontal width 2 and slope −1/𝑛. Figure 82.1 shows this when (𝐴, 𝐵) = (2, 7) and 𝑛 = 3.      



 





Figure 82.1. If one shoots at time 3 so as to strike a ship starting at 2 with speed 7, one will strike any ship with initial state in an infinite strip of slope −1/3. Let us define an 𝑛-rectangle to be a rectangle having sides parallel to the axes, width 1, and height 1/𝑛. Any 𝑛-rectangle can be covered by an infinite strip as just discussed of horizontal width 2 and slope −1/𝑛 (the strip’s left boundary passes through the lower left corner of the rectangle). In Figure 82.1, a black 3-rectangle is covered by a strip of slope −1/3. We claim now that we can cover the entire plane with a sequence of rectangles 𝑅1 , 𝑅2 , . . . such that for every 𝑛, 𝑅𝑛 is an 𝑛rectangle. To accomplish this, first partition the positive integers into infinitely many disjoint families so that the series of reciprocals of the numbers in each family diverges. Just put all odd positive integers into the first family, all positive integers of the form twice an odd into the second, four times an odd into the third, eight times an odd into the fourth, and so on. Each family has a divergent series of reciprocals. Now we can use 𝑛-rectangles 𝑅𝑛 for 𝑛 in the first family to completely cover the vertical strip over [0, 1] on the 𝑋-axis, 𝑛-rectangles 𝑅𝑛 for 𝑛 in the second family to cover the vertical strip under [0, 1], and so on, using the families to completely cover all vertical strips of width 1 (Figure 82.2 shows rectangles based on four of the families). This covers the entire plane by the

83. A Very Local Maximum

225

Figure 82.2. An arrangement of rectangles of harmonic height that covers the plane. rectangles 𝑅𝑛 . (There are other ways to cover the plane in this way, but this is nicely simple.) Now at time 𝑛, use rectangle 𝑅𝑛 to decide where to shoot. Determine (𝐴, 𝐵) so that the strip determined by (𝐴, 𝐵) contains 𝑅𝑛 and shoot at 𝐴 + 𝑛𝐵. This will strike ships whose initial conditions are in the strip, and that includes ships whose initial conditions are in 𝑅𝑛 . Since the rectangles cover the plane, any ship is struck at some finite time. We can be more precise. If rectangle 𝑅𝑛 has (𝑎𝑛 , 𝑏𝑛 ) at its lower left corner, then (𝐴, 𝐵) = (𝑎𝑛 + 1, 𝑏𝑛 ) determines a strip containing 𝑅𝑛 . So at time 𝑛, shoot at 𝑎𝑛 + 1 + 𝑛𝑏𝑛 . This solution is due to Larry Carter and Hugh Thomas [125].

83 A Very Local Maximum The problem statement contains a small hint: the number 55 is a Fibonacci number. Recall that the Fibonacci numbers are defined by the equations 𝐹0 = 0, 𝐹1 = 1, and for 𝑛 ≥ 2, 𝐹𝑛 = 𝐹𝑛−2 + 𝐹𝑛−1 . Table 83.1 shows the first few Fibonacci numbers; note in particular that 𝐹10 = 55. Number the cards consecutively around the circle from 1 to 55, and let 𝑥𝑖 be the number on the underside of card number 𝑖. We begin by turning over cards 1 and 22 to reveal 𝑥1 and 𝑥22 . We may assume that 𝑥1 < 𝑥22 (if not, then renumber the cards, in the opposite order around the circle, to swap the numbers

226

Chapter 7. Algorithms and Strategy Table 83.1. The Fibonacci numbers. 𝑛 𝐹𝑛

0 1 0 1

2 1

3 2

4 3

5 5

6 8

7 13

8 21

9 34

10 55

of cards 1 and 22). It will be convenient to say that card 1 is also card 56, so that 𝑥56 = 𝑥1 < 𝑥22 . Notice that 22 − 1 = 21 = 𝐹8 and 56 − 22 = 34 = 𝐹9 . Next we turn over card 35. If 𝑥35 < 𝑥22 , then 𝑥22 is the maximum of {𝑥1 , 𝑥22 , 𝑥35 }, 22 − 1 = 21 = 𝐹8 , and 35 − 22 = 13 = 𝐹7 . If 𝑥35 > 𝑥22 , then 𝑥35 is the maximum of {𝑥22 , 𝑥35 , 𝑥56 }, 35 − 22 = 13 = 𝐹7 , and 56 − 35 = 21 = 𝐹8 . We will say that a triple (𝑎, 𝑏, 𝑐) is a 𝑘-triple if 𝑎 < 𝑏 < 𝑐, 𝑥𝑏 is the maximum of {𝑥𝑎 , 𝑥𝑏 , 𝑥𝑐 }, and {𝑏 − 𝑎, 𝑐 − 𝑏} = {𝐹𝑘 , 𝐹𝑘+1 }. Thus, with our first two card flips we found that (1, 22, 56) is an 8-triple, and on our next step we discovered that either (1, 22, 35) or (22, 35, 56) is a 7-triple. We continue our search for 𝑘-triples with smaller and smaller values of 𝑘. Suppose we have found that (𝑎, 𝑏, 𝑐) is a 𝑘-triple. Then either 𝑐 − 𝑏 = 𝐹𝑘+1 or 𝑏 − 𝑎 = 𝐹𝑘+1 . Suppose first that 𝑐 − 𝑏 = 𝐹𝑘+1 . On our next step we flip card 𝑑 = 𝑏 + 𝐹𝑘−1 . Notice that 𝑎 < 𝑏 < 𝑑 < 𝑐, 𝑏 − 𝑎 = 𝐹𝑘 , 𝑑 − 𝑏 = 𝐹𝑘−1 , and 𝑐 − 𝑑 = 𝑐 − 𝑏 − 𝐹𝑘−1 = 𝐹𝑘+1 − 𝐹𝑘−1 = 𝐹𝑘 . If 𝑥𝑑 < 𝑥𝑏 , then (𝑎, 𝑏, 𝑑) is a (𝑘 − 1)triple, and if 𝑥𝑑 > 𝑥𝑏 , then (𝑏, 𝑑, 𝑐) is a (𝑘 − 1)-triple. Similar reasoning applies if 𝑏 − 𝑎 = 𝐹𝑘+1 : in that case, our next step is to flip card 𝑑′ = 𝑏 − 𝐹𝑘−1 , and either (𝑎, 𝑑′ , 𝑏) or (𝑑′ , 𝑏, 𝑐) is a (𝑘 − 1)-triple. After flipping nine cards we will have found a 1-triple (𝑎, 𝑏, 𝑐). But since 𝐹1 = 𝐹2 = 1, this means that 𝑐 − 𝑏 = 𝑏 − 𝑎 = 1. In other words, cards 𝑎, 𝑏, and 𝑐 are adjacent, and since 𝑥𝑏 is the maximum of {𝑥𝑎 , 𝑥𝑏 , 𝑥𝑐 }, card 𝑏 is the desired local maximum. Thus, the problem can be solved by flipping nine cards. As we will see, this is optimal. Before proving optimality, we generalize the problem. Suppose we have a circle of 𝑚 cards, where 𝑚 ≥ 3. Choose 𝑛 such that 𝐹𝑛−1 < 𝑚 ≤ 𝐹𝑛 . We number the cards from 1 to 𝑚 + 1, with card 1 also being numbered 𝑚 + 1. We begin by flipping cards 1 and 𝑠 = 𝐹𝑛−2 + 1, and as before by renumbering the cards if necessary we may assume that 𝑥𝑚+1 = 𝑥1 < 𝑥𝑠 . Notice that 1 < 𝑠 < 𝑚 + 1, 𝑠 − 1 = 𝐹𝑛−2 , and 𝑚 + 1 − 𝑠 ≤ 𝐹𝑛 + 1 − (𝐹𝑛−2 + 1) = 𝐹𝑛−1 . Modifying our earlier definition slightly, we will say that (𝑎, 𝑏, 𝑐) is a 𝑘-triple if 𝑎 < 𝑏 < 𝑐, 𝑥𝑏 is the maximum of {𝑥𝑎 , 𝑥𝑏 , 𝑥𝑐 }, min{𝑏 − 𝑎, 𝑐 − 𝑏} ≤ 𝐹𝑘 , and max{𝑏 − 𝑎, 𝑐 − 𝑏} ≤ 𝐹𝑘+1 . By this new definition, {1, 𝑠, 𝑚 + 1} is an (𝑛 − 2)-triple. As before, given a 𝑘-triple, we can flip at most one more card and find a (𝑘 − 1)-triple. Thus, after flipping at most 𝑛 − 1 cards we will have a 1-triple, and the middle card of this triple will be a local maximum. To prove that this strategy is optimal, suppose Alice is flipping the cards, following some strategy for choosing which cards to flip over. We will construct

83. A Very Local Maximum

227

an assignment of numbers to cards that causes Alice to need at least 𝑛 − 1 flips to find a local maximum. A helpful way to think of this construction is to imagine that the undersides of all the cards are initially blank, and Alice has an adversary, Bob, who fills in the numbers as the game is being played. After each of Alice’s moves, Bob may, if he chooses, fill in numbers on one or more cards that are blank. He need not fill in any cards if he doesn’t want to, except that if Alice flips a blank card, then Bob must immediately assign a number to it, so that Alice can continue to follow her strategy. We will describe a strategy for Bob that prevents Alice from discovering a local maximum in fewer than 𝑛 − 1 flips. Alice goes first, and we may assume that the first card she flips is card 1, which is also card 𝑚 + 1 (if not, renumber the cards). Since the card is blank, Bob must assign a number to it; he assigns the number 0. Suppose the next card to be flipped is card 𝑠; Bob assigns it the number 1. We now have 𝑥𝑚+1 = 𝑥1 = 0 < 1 = 𝑥𝑠 . If (1, 𝑠, 𝑚 + 1) is an (𝑛 − 3)-triple, then min{𝑠 − 1, 𝑚 + 1 − 𝑠} ≤ 𝐹𝑛−3 and max{𝑠 − 1, 𝑚 + 1 − 𝑠} ≤ 𝐹𝑛−2 . But then 𝑚 = (𝑠 − 1) + (𝑚 + 1 − 𝑠) ≤ 𝐹𝑛−3 + 𝐹𝑛−2 = 𝐹𝑛−1 < 𝑚, which is impossible. Therefore (1, 𝑠, 𝑚 + 1) is not an (𝑛 − 3)-triple. Bob’s strategy will be to ensure that for 2 ≤ 𝑘 ≤ 𝑛 − 2, after Alice has turned over her 𝑘th card and Bob has responded, there is a triple (𝑎, 𝑏, 𝑐) with the following list of properties: •

1 ≤ 𝑎 < 𝑏 < 𝑐 ≤ 𝑚 + 1,

numbers 𝑥𝑖 have been chosen for 1 ≤ 𝑖 ≤ 𝑎 and they form an increasing sequence,

numbers 𝑥𝑖 have been chosen for 𝑐 ≤ 𝑖 ≤ 𝑚 + 1 and they form a decreasing sequence,

the number 𝑥𝑏 has been chosen and is the maximum of {𝑥𝑎 , 𝑥𝑏 , 𝑥𝑐 },

no other numbers have been assigned to cards, and

(𝑎, 𝑏, 𝑐) is not an (𝑛 − 𝑘 − 1)-triple.

This last requirement means that either min{𝑏 − 𝑎, 𝑐 − 𝑏} > 𝐹𝑛−𝑘−1

or

max{𝑏 − 𝑎, 𝑐 − 𝑏} > 𝐹𝑛−𝑘 .

We will say that a triple (𝑎, 𝑏, 𝑐) satisfying all of these properties is a 𝑘-witness for Bob. Notice that if (𝑎, 𝑏, 𝑐) is a 𝑘-witness, then max{𝑏−𝑎, 𝑐−𝑏} > 𝐹𝑛−𝑘−1 ≥ 𝐹1 = 1. Therefore there are cards, either between 𝑎 and 𝑏 or between 𝑏 and 𝑐, that have not yet had numbers assigned to them, and it is not hard to see that these numbers could be assigned in such a way that either card 𝑏 or some other card is the unique local maximum. This implies that the cards that have been flipped so far have not

228

Chapter 7. Algorithms and Strategy

revealed enough information to determine a local maximum. Thus, if Bob is able to carry out this strategy, then Alice will need at least 𝑛 − 1 flips to find a local maximum. We have already seen that after Alice has flipped the first two cards and Bob has assigned numbers to them, the triple (1, 𝑠, 𝑚 + 1) is a 2-witness for Bob. To see that he can continue, suppose that 2 ≤ 𝑘 < 𝑛 − 2, Alice has flipped over her 𝑘th card, Bob has given his response, and (𝑎, 𝑏, 𝑐) is a 𝑘-witness. Let the next card Alice flips be card 𝑑. Then (𝑎, 𝑏, 𝑐) will also be a (𝑘 + 1)-witness (with no further assignments needed from Bob) unless either 𝑎 < 𝑑 < 𝑏 or 𝑏 < 𝑑 < 𝑐, in which case Bob must assign a number 𝑥𝑑 to card 𝑑. We will assume that 𝑏 < 𝑑 < 𝑐; the proof for the other case is similar. Suppose first that 𝑏 − 𝑎 > 𝐹𝑛−𝑘−1 . Then Bob can choose numbers 𝑥𝑖 for 𝑑 ≤ 𝑖 < 𝑐 so that 𝑥𝑏 > 𝑥𝑑 > 𝑥𝑑+1 > ⋯ > 𝑥𝑐 . We have max{𝑏 − 𝑎, 𝑑 − 𝑏} ≥ 𝑏 − 𝑎 > 𝐹𝑛−𝑘−1 , so (𝑎, 𝑏, 𝑑) is not an (𝑛 − 𝑘 − 2)-triple, and therefore it is a (𝑘 + 1)-witness. Now suppose that 𝑏 − 𝑎 ≤ 𝐹𝑛−𝑘−1 . Then since (𝑎, 𝑏, 𝑐) is not an (𝑛 − 𝑘 − 1)triple, it must be the case that 𝑐 − 𝑏 > 𝐹𝑛−𝑘 . Bob chooses 𝑥𝑑 > 𝑥𝑏 and also 𝑥𝑖 for 𝑎 < 𝑖 ≤ 𝑏 so that 𝑥𝑎 < 𝑥𝑎+1 < ⋯ < 𝑥𝑏 . If (𝑏, 𝑑, 𝑐) is an (𝑛 − 𝑘 − 2)-triple, then min{𝑑 − 𝑏, 𝑐 − 𝑑} ≤ 𝐹𝑛−𝑘−2 and max{𝑑 − 𝑏, 𝑐 − 𝑑} ≤ 𝐹𝑛−𝑘−1 , and therefore 𝑐 − 𝑏 = (𝑑 − 𝑏) + (𝑐 − 𝑑) ≤ 𝐹𝑛−𝑘−2 + 𝐹𝑛−𝑘−1 = 𝐹𝑛−𝑘 , which is a contradiction. Therefore (𝑏, 𝑑, 𝑐) is a (𝑘 + 1)-witness. The search method we have used here is based on the Fibonacci search algorithm introduced by Jeannette Kiefer [79].

84 Detecting a Black Hole The minimum number of queries is 88. We will write 𝑖 → 𝑗 to denote a query asking if direct communication from node 𝑖 to node 𝑗 is possible. If you learn from this query that direct communication from 𝑖 to 𝑗 is possible, then you can conclude that 𝑖 is not a black hole; but this information is compatible with 𝑗 being a black hole. On the other hand, if you learn that direct communication from 𝑖 to 𝑗 is not possible, then you can rule out the possibility of 𝑗 being a black hole, but you can’t rule out 𝑖 being a black hole. Thus, a query 𝑖 → 𝑗 is guaranteed to give information that rules out either 𝑖 or 𝑗 as a black hole, but is compatible with the other being a black hole. Note that although you can learn from a single query that a node is not a black hole, the only way to be sure that a node is a black hole is to test all of the 62 potential communication channels between the node and all 31 other nodes, in both directions. To find the answer with 88 queries, first split the 32 nodes into 16 disjoint pairs, and make one query for each pair (the query can ask about communication in either direction). This will rule out 16 nodes as potential black holes, and

84. Detecting a Black Hole

229

for each of the other 16, one of the 62 possible communication channels involving that node will have been tested. Next, split the remaining 16 nodes into eight pairs and test each pair, ruling out eight nodes as potential black holes and testing a second communication channel for each of the other eight. Repeating this halving operation three more times, after a total of 31 queries you will be down to just one potential black hole, on which five tests have already been done. This leaves 57 potential communication channels to be checked to determine whether or not this last node is a black hole. The total number of queries is 31 + 57 = 88. More generally, suppose there are 𝑛 nodes. Then by testing ⌈𝑛/2⌉ pairs you can get down to ⌊𝑛/2⌋ potential black holes, each of which has been tested at least once. (The pairs tested will be disjoint, except that if 𝑛 is odd, then one node will have to be used in two queries.) Another similar round of queries gets you down to ⌊⌊𝑛/2⌋/2⌋ = ⌊𝑛/4⌋ potential black holes, each of which has been tested at least twice. Since each query eliminates one node, after 𝑛 − 1 queries you will be down to only one potential black hole, which has been tested at least ⌊log2 𝑛⌋ times. Another 2(𝑛 − 1) − ⌊log2 𝑛⌋ queries will suffice to determine whether the last node is a black hole, for a total of at most 3(𝑛 − 1) − ⌊log2 𝑛⌋ queries. We now show that this bound is optimal. To do this, we imagine that the communication network is being designed on the fly by an adversary who decides on the answer to each query as it is made. We give a strategy that the adversary can use to make these choices in such a way that at least 3(𝑛−1)−⌊log2 𝑛⌋ queries are required. During the query process, the adversary can keep track of which nodes have been determined not to be black holes by the queries that have been made so far, and which are still potential black holes. Let 𝑃𝑚 be the set of potential black holes after 𝑚 queries. If a query 𝑖 → 𝑗 is made at a time when both 𝑖 and 𝑗 are potential black holes, then the adversary will have to give an answer that eliminates either 𝑖 or 𝑗 as a potential black hole; we will call such a query an elimination query. For each 𝑘 ∈ 𝑃𝑚 , let 𝑒𝑚,𝑘 be the number of the first 𝑚 queries that are elimination queries involving node 𝑘. The adversary will also keep track of these numbers. We now describe the adversary’s strategy. Suppose that 𝑚 queries have been made, and query number 𝑚 + 1 is 𝑖 → 𝑗. If this query is not an elimination query, then either 𝑖 or 𝑗 has already been eliminated from the set of potential black holes. In this case, the adversary gives an answer that would eliminate a node that has already been eliminated. In other words, the adversary gives an answer that ensures that 𝑃𝑚+1 = 𝑃𝑚 . Notice that this means that the last node can never be removed from 𝑃𝑚 , so 𝑃𝑚 will never be empty. Now suppose the query is an elimination query. If 𝑒𝑚,𝑖 ≥ 𝑒𝑚,𝑗 , then the adversary says that communication from 𝑖 to 𝑗 is possible, which eliminates node 𝑖 as a potential black hole, and otherwise he says that such communication is not possible, eliminating node 𝑗.

230

Chapter 7. Algorithms and Strategy

Thus, when choosing which of 𝑖 or 𝑗 to eliminate, the adversary eliminates the one that has been involved in the most elimination queries so far. We claim now that for all 𝑚, ∑ 2𝑒𝑚,𝑘 ≤ 𝑛.

(84.1)

𝑘∈𝑃𝑚

We prove this by induction on 𝑚. When no queries have been made, no nodes have been eliminated, so 𝑃0 is the set of all nodes, and for every node 𝑘, 𝑒0,𝑘 = 0. Therefore ∑𝑘∈𝑃 2𝑒0,𝑘 = 𝑛. This establishes the base case. Now suppose the in0 equality holds for 𝑚, and consider query number 𝑚 + 1. If it is not an elimination query, then 𝑃𝑚+1 = 𝑃𝑚 and for all 𝑘 ∈ 𝑃𝑚 , 𝑒𝑚+1,𝑘 = 𝑒𝑚,𝑘 . Therefore the inequality for 𝑚 + 1 is the same as the inequality for 𝑚, and it holds by the inductive hypothesis. Now suppose query 𝑚 + 1 is an elimination query involving nodes 𝑖 and 𝑗, and assume without loss of generality that the adversary gives a response that eliminates node 𝑖. Then 𝑒𝑚,𝑖 ≥ 𝑒𝑚,𝑗 , 𝑃𝑚+1 = 𝑃𝑚 − {𝑖}, 𝑒𝑚+1,𝑗 = 𝑒𝑚,𝑗 + 1, and for all other 𝑘 ∈ 𝑃𝑚+1 , 𝑒𝑚+1,𝑘 = 𝑒𝑚,𝑘 . Therefore ∑ 2𝑒𝑚+1,𝑘 = ∑ 2𝑒𝑚,𝑘 − 2𝑒𝑚,𝑖 − 2𝑒𝑚,𝑗 + 2𝑒𝑚,𝑗 +1 𝑘∈𝑃𝑚+1

𝑘∈𝑃𝑚

≤ 𝑛 − 2 ⋅ 2𝑒𝑚,𝑗 + 2 ⋅ 2𝑒𝑚,𝑗 = 𝑛. This completes the induction. To see that this strategy works, we show that if 𝑚 < 3(𝑛 − 1) − ⌊log2 𝑛⌋, then after 𝑚 queries the adversary can complete the design of the communication network so that there is a black hole, or so that there isn’t; therefore there is not yet enough information to tell whether or not a black hole exists. As observed earlier, 𝑃𝑚 ≠ ∅, so there is at least one node that is still a potential black hole. The adversary could make all further decisions regarding this node in such a way that it turns out to be a black hole, so the existence of a black hole is possible. It is a little harder to show that there might be no black hole. Suppose first that 𝑃𝑚 contains at least two elements. No communication channel between any pair of nodes in 𝑃𝑚 has yet been tested, since any such test would have eliminated one of them as a potential black hole. Therefore the adversary can choose to allow all communications among these nodes, which will ensure that none of them is a black hole. Finally, suppose 𝑃𝑚 contains only one element; say 𝑃𝑚 = {𝑖}. Then by (84.1), 2𝑒𝑚,𝑖 ≤ 𝑛, so 𝑒𝑚,𝑖 ≤ ⌊log2 𝑛⌋. Since each elimination query rules out one node as a possible black hole, there must have been 𝑛 − 1 elimination queries, and only 𝑒𝑚,𝑖 ≤ ⌊log2 𝑛⌋ of them involved node 𝑖. Therefore at least 𝑛−1−⌊log2 𝑛⌋ queries have not involved node 𝑖. Since there have been a total of 𝑚 queries, the number involving node 𝑖 is at most 𝑚 − (𝑛 − 1 − ⌊log2 𝑛⌋) < (3(𝑛 − 1) − ⌊log2 𝑛⌋) − (𝑛 − 1 − ⌊log2 𝑛⌋) = 2(𝑛 − 1).

85. Pablito’s Solitaire

231

It follows that at least one of the 2(𝑛−1) communication channels involving node 𝑖 has not yet been tested. The adversary can decide the status of that communication channel so as to rule out node 𝑖 as a black hole.

85 Pablito’s Solitaire The largest value of 𝑅 for which the goal can be achieved is 𝑅 = 7. Figure 85.3 shows a starting configuration for 𝑅 = 7 that works. This 53-checker configuration was found by George I. Bell, Daniel S. Hirschberg, and Pablo GuerreroGarcía [9], who showed that it is the smallest winning configuration for 𝑅 = 7. They also discuss a number of variations on the game.

a 1 2 3 4 5 6 7 8 9 10 11 12 13 14

b c d e f g h i j k l m n

Figure 85.3. A starting configuration with 𝑅 = 7. The rows in the figure are numbered 1 through 14, and the cells in each row are labeled with the letters a, b, c, and so on. The first move is that the piece in row 8, cell a jumps to row 6, cell a, jumping over the piece in row 7, cell a, which is removed. We denote this move 8a–6a. A sequence of moves that leads to a single piece in the top cell is shown in Table 85.1 and illustrated in Figure 85.4. To see why it is impossible to win with 𝑅 = 8, we assign point values to the cells on the board. Let 𝜙 = (√5 − 1)/2 = 0.618. . ., and notice that 𝜙2 + 𝜙 = 1; 𝜙 is called the golden ratio. We assign point value 1 to the top cell, 𝜙 to each of the two cells in row 2, 𝜙2 to each of the three cells in row 3, and in general 𝜙𝑛−1 to each cell in row 𝑛. The score of any board position is the sum of the point values of all occupied cells. When a piece in row 𝑛+2 makes an upward jump over a piece in row 𝑛+1 and lands in row 𝑛, the change in score is 𝜙𝑛−1 − 𝜙𝑛 − 𝜙𝑛+1 = 𝜙𝑛−1 (1 − 𝜙 − 𝜙2 ) = 0.

232

Chapter 7. Algorithms and Strategy a

1 2 3 4 5 6 7 8 9 10 11 12 13 14 a 1 2 3 4 5 6 7 8 9 10 11 12 13 14 a 1 2 3 4 5 6 7 8 9 10 11 12 13 14 a 1 2 3 4 5 6 7 8 9 10 11 12 13 14 a 1 2 3 4 5 6 7 8 9 10 11 12 13 14

b c

b c

b c

b c

b c

a d e

f

g h i

j

k l

m n

1 2 3 4 5 6 7 8 9 10 11 12 13 14 a

d e

f

g h i

j

k l

m n

1 2 3 4 5 6 7 8 9 10 11 12 13 14 a

d e

f

g h i

j

k l

m n

1 2 3 4 5 6 7 8 9 10 11 12 13 14 a

d e

f

g h i

j

k l

m n

1 2 3 4 5 6 7 8 9 10 11 12 13 14 a

d e

f

g h i

j

k l

m n

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

b c

b c

b c

b c

b c

a d e

f

g h i

j

k l

m n

1 2 3 4 5 6 7 8 9 10 11 12 13 14 a

d e

f

g h i

j

k l

m n

1 2 3 4 5 6 7 8 9 10 11 12 13 14 a

d e

f

g h i

j

k l

m n

1 2 3 4 5 6 7 8 9 10 11 12 13 14 a

d e

f

g h i

j

k l

m n

1 2 3 4 5 6 7 8 9 10 11 12 13 14 a

d e

f

g h i

j

k l

m n

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

Figure 85.4. The winning sequence of moves in Table 85.1.

b c

b c

b c

b c

b c

d e

d e

d e

d e

d e

f

f

f

f

f

g h i

g h i

g h i

g h i

g h i

j

j

j

j

j

k l

k l

k l

k l

k l

m n

m n

m n

m n

m n

85. Pablito’s Solitaire

233

Table 85.1. A winning sequence of moves for the starting configuration in Figure 85.3.

(1) 8a–6a

(12) 11b–9b

(23) 12f–10d

(33) 10h–8f

(43) 10i–8g

(2) 8b–6b

(13) 9b–7b

(24) 9g–7e

(34) 8f–6d

(44) 8g–6e

(3) 8c–6c

(14) 7b–5b

(25) 7e–5c

(35) 6d–4b

(45) 6e–4c

(4) 8d–6d

(15) 6c–4a

(26) 10f–8f

(36) 11d–9d

(46) 4c–2a

(5) 8e–6e

(16) 11e–9e

(27) 7f–5d

(37) 9d–7d

(47) 13c–11a

(6) 10a–8a

(17) 9e–7c

(28) 11g–9g

(38) 7d–5b

(48) 11a–9a

(7) 10b–8b

(18) 12f–10f

(29) 9g–7e

(39) 5b–3b

(49) 9a–7a

(8) 10c–8c

(19) 8c–6c

(30) 11i–9g

(40) 11j–9h

(50) 7a–5a

(9) 10f–8d

(20) 10d–8d

(31) 9h–7f

(41) 13k–11i

(51) 5a–3a

(32) 12h–10h

(42) 12i–10i

(52) 3a–1a

(10) 12a–10a (21) 13e–11e (11) 12d–10b (22) 14f–12f

For horizontal and downward jumps, the score decreases. Thus, no move can increase the score. The final position, with only the top cell occupied, has score 1, so it is impossible to win the game starting in a position whose score is less than 1. Any initial position in which the first seven rows are empty has a score that is bounded by the infinite series 8𝜙7 + 9𝜙8 + 10𝜙9 + ⋯ . To evaluate this series, we begin with the geometric series formula 𝑥8 , 1−𝑥

𝑥8 + 𝑥9 + 𝑥10 + ⋯ =

−1 < 𝑥 < 1.

Differentiating gives us 8𝑥7 + 9𝑥8 + 10𝑥9 + ⋯ =

8𝑥7 − 7𝑥8 , (1 − 𝑥)2

−1 < 𝑥 < 1,

and substituting 𝜙 for 𝑥 we find that 8𝜙7 + 9𝜙8 + 10𝜙9 + ⋯ =

8𝜙7 − 7𝜙8 = 0.867. . . < 1. (1 − 𝜙)2

234

Chapter 7. Algorithms and Strategy

Thus, it is impossible to win from a position in which the first seven rows are empty, and therefore the goal cannot be achieved with 𝑅 ≥ 8.

86 Are the Coins Authentic? Number the coins from 1 to 10 and let 𝑊𝑖 be the weight of coin 𝑖. It is easy to resolve uniformity in four weighings by the doubling method: weigh 1 against 2, then 1 and 2 against 3 and 4, then 1, 2, 3, and 4 against 5, 6, 7, and 8, and 1 and 2 against 9 and 10. In general, the doubling method can determine the uniformity of 2𝑛 coins in 𝑛 weighings. It had been widely believed that this method is optimal, and so the coin-weighing world was surprised when it was discovered [84] that ten coins can be resolved with only three weighings. That can be done by arranging the weighings as follows: left 23456 7 8 9 10 123

right 1 7 8 9 10 1456 456

If any of the three fail to balance, then the coins are not all of the same weight. Suppose all three weighings balance. Combining the first two we learn that 𝑊2 + 𝑊3 + 𝑊4 + 𝑊5 + 𝑊6 + 𝑊7 + 𝑊8 + 𝑊9 + 𝑊10 = 𝑊1 + 𝑊7 + 𝑊8 + 𝑊9 + 𝑊10 + 𝑊1 + 𝑊4 + 𝑊5 + 𝑊6 . Therefore 𝑊1 is the average of 𝑊2 and 𝑊3 . But there are at most two weights, so 𝑊1 = 𝑊2 = 𝑊3 . Then the third weighing indicates that 𝑊1 = 𝑊2 = 𝑊3 = 𝑊4 = 𝑊5 = 𝑊6 , and the second weighing tells us that each of 𝑊7 through 𝑊10 weighs the same as the others. Therefore all coins have the same weight. One wants to be sure that the ten-coin problem cannot be solved in just two weighings. Such negative results can make use of the following fact. Theorem ([84]). Any algorithm that decides the uniformity of 𝑚 coins requires placing at least 2𝑚 − 2 coins on the scales (where the scales are cleared of coins after each weighing). Proof. We can assume that any weighing compares sets of coins having equal size (this is because the difference between the two weights can be very small relative to the weights, and then we would learn nothing from an unequal-count comparison). And if a weighing ever fails to balance, we stop and declare the set nonuniform. So we need consider only the case in which all weighings balance, which means that we would never learn anything in a weighing that would impact the choice of what to weigh next. Therefore an algorithm simply consists of a fixed choice of sets of coins to place on the scale.

87. Web Site Analysis

235

Associate the 𝑚 coins to the vertices, 1, 2, . . . , 𝑚, of a graph. Consider the set-pairs (𝐴𝑖 , 𝐵𝑖 ), 𝑖 = 1, 2, . . . , 𝑛, that form the algorithm. We have |𝐴𝑖 | = |𝐵𝑖 |. For each 𝑖, take an arbitrary matching between 𝐴𝑖 and 𝐵𝑖 , and let 𝐺 be the graph consisting of edges that occur in any of the matchings (if an edge occurs more than once, include it only once). If 𝐺 is not connected, let 𝐶 be one of its connected components and arrange that all the coins in 𝐶 have the smaller weight, while the others have the larger weight. It follows from the use of matchings that |𝐶 ∩ 𝐴𝑖 | = |𝐶 ∩ 𝐵𝑖 | for each 𝑖. This means all the weighings will balance, but yet the coins are not of uniform weight. Therefore 𝐺 must be connected and so has at least 𝑚 − 1 edges. But the number of coins placed on the scales is twice the edge-count of 𝐺. Suppose the ten-coin problem can be solved in two weighings. By the theorem, at least 18 coins must be placed on the scales. So the only possibilities are to weigh five against five and then either five against five or four against four. We will show that there must be two coins that appear in both weighings and appear on opposite sides. Therefore if those two coins, and only those two, weigh a different amount from the others, the weighings will still balance and the difference in weights will not be detected. We can assume the protocol weighs 1, 2, 3, 4, 5 against 6, 7, 8, 9, 10 and that 1 is on the left side of the scale in the next weighing. If any of 6 through 10 is on the right side, then one of these combines with 1 to give the desired opposing pair. If the right side has none of 6 through 10, then there are only four coins available, and the second weighing must compare two sets of size four. But then it must be 1 and three from 6 through 10 against 2 through 5 and we can find an opposing partner for 2 as required. If 𝑓(𝑛) is the maximum number of coins whose uniformity can be decided in 𝑛 weighings, then the sequence of 𝑓-values for 𝑛 = 1 through 6 is 2, 4, 10, 30, 114, 454 (see [84], [99, sequence A280432]).

87 Web Site Analysis Let 𝑢𝑛 denote the 𝑛th user, and let 𝑆𝑛 be the set of sampled users after 𝑢𝑛 visits the site and is either sampled or not. We will describe a protocol that ensures that if 𝑛 < 1000, then for every 𝑗 ≤ 𝑛, 𝑃(𝑢𝑗 ∈ 𝑆𝑛 ) = 1, and if 𝑛 ≥ 1000, then for every 𝑗 ≤ 𝑛, 𝑃(𝑢𝑗 ∈ 𝑆𝑛 ) = 1000/𝑛. You must sample the first 1000 users, and if 𝑛 > 1000, you must choose 𝑢𝑛 with probability 1000/𝑛. And then, if 𝑢𝑛 is sampled, you must randomly choose a member of 𝑆𝑛 to discard so as to keep uniformity for all the possibilities. This protocol works. To prove that the protocol achieves the desired probabilities, we use induction on 𝑛. The assertion is true if 𝑛 ≤ 1000 because all users are sampled. Assume it holds for some 𝑛 ≥ 1000; we need to show that the probability that 𝑢𝑗 ∈ 𝑆𝑛+1 is 1000/(𝑛 + 1) for each 𝑗 ≤ 𝑛 + 1. This is clear for 𝑗 = 𝑛 + 1. The

236

Chapter 7. Algorithms and Strategy

probability that 𝑢𝑗 is in 𝑆𝑛+1 when 1 ≤ 𝑗 ≤ 𝑛 is 𝑃(𝑢𝑗 ∈ 𝑆𝑛+1 ) = 𝑃(𝑢𝑗 ∈ 𝑆𝑛+1 ∣ 𝑢𝑛+1 ∈ 𝑆𝑛+1 )𝑃(𝑢𝑛+1 ∈ 𝑆𝑛+1 ) + 𝑃(𝑢𝑗 ∈ 𝑆𝑛+1 ∣ 𝑢𝑛+1 ∉ 𝑆𝑛+1 )𝑃(𝑢𝑛+1 ∉ 𝑆𝑛+1 ) 999 1000 1000 = 𝑃(𝑢𝑗 ∈ 𝑆𝑛 ) + 𝑃(𝑢𝑗 ∈ 𝑆𝑛 ) (1 − ) 1000 𝑛 + 1 𝑛+1 1000 999 1000 1000 1000 1000 = + . (1 − )= 𝑛 1000 𝑛 + 1 𝑛 𝑛+1 𝑛+1 This problem is due to Shilad Sen (Macalester College).

88 Find the Car, and the Car Key If Alice chooses doors 2 and 3 and Bob chooses 1 and 3, then three of the six possible arrangements lead to success and the success rate is 1/2. The chance that Alice finds the car is 2/3 regardless of her strategy, because she gets to open two of the three doors. Therefore the highest probability of finding both the car and key that they can achieve is between 1/2 and 2/3. It is a little surprising that there is a simple strategy that guarantees them the car and key with probability 2/3. Alice opens door 1 first. If she sees a car then she is finished. If door 1 hides a key, then she opens door 2; if door 1 hides a goat, then she opens door 3. Bob’s strategy is to open door 2 first. If he finds the key, he is finished. Otherwise door 2 hides either a car, in which case he opens door 1, or a goat, in which case he opens door 3. Consider the car as being tagged with number 1, the key with number 2, and the goat with 3. The number can be viewed as the item’s home door. The arrangement of the items corresponds to a permutation 𝑃 of {1, 2, 3}; for example, if the order of the items is (goat, key, car), then the permutation is 3 2 1, which is the 2-cycle 3 ↔ 1. The strategy just described is a pointer-following strategy: Alice starts by opening the home door of the car (door 1). If the car is not at home, she next opens the home door of the object she finds. Bob operates similarly, starting with the key’s home door (2), and then, if necessary, moving to the door corresponding to what he found. If 𝑃 is not a 3-cycle, then Alice will find the car because her two openings take care of the cases that the car lies in a 2-cycle or 1-cycle. And the same is true for Bob. And if 𝑃 is a 3-cycle, then neither Alice nor Bob will find what they seek. Therefore the chance of success for Alice and Bob is 2/3, because four of the six permutations are not 3-cycles. Note that in every case that Alice finds the car, Bob locates the key. This problem is a variation of the infamous Monty Hall problem that caused quite a stir in 1990 [129, Monty Hall problem]. But it is also a variation of another well-known problem known as the 100 prisoners problem (also known as

89. Magic Coins

237

the locker puzzle) [129, 100 prisoners problem], [29]. Imagine that there are 𝑛 doors and 𝑛 prisoners. Each prisoner has a numbered tag, and the tags are hidden behind the doors, one per door. Each prisoner can open 𝑛−1 doors in search of his or her tag (in the original prisoner problem, each of the 100 prisoners could open 50 doors). If all prisoners find their tags, they are released. The pointer-following strategy has prisoner 1 starting with door 1, then opening the door whose number is on the tag she finds behind door 1, then opening the door whose number is on the tag she found behind the second door she opened, and so on. The other prisoners use the same pointer-following strategy. If the induced permutation of 𝑛 objects is an 𝑛-cycle, no prisoner will find his or her tag; in all other cases all prisoners will succeed. The number of 𝑛-cycles is (𝑛 − 1)! (because the first entry in the standard cycle notation for an 𝑛-cycle can be assumed to be 1 and the others are arbitrary) and so their chance of success is 1 − (𝑛 − 1)! /𝑛!, or (𝑛 − 1)/𝑛. If 𝑛 = 100 and the prisoners choose their 99 doors randomly, then their joint chance of total success is (99/100)100 , or 36.6%. If instead each prisoner opens all doors except the one corresponding to his or her number, this increases to 36.8%. Either strategy has a limiting success rate, as 𝑛 → ∞, of 1/𝑒. But if they use the pointer-following strategy, the success rate is 99%, with limiting value 1. In the classic case where each of the 100 prisoners can open 50 doors, the probability of success using pointer-following is the chance that the longest cycle in a permutation of 100 objects has length at most 50; this is 31.1% [29]. Random choice gives success with probability about 10−30 . For 2𝑛 prisoners who can open 𝑛 doors, the limiting probability of success as 𝑛 → ∞ with the pointer-following strategy is 1 − ln 2, or 30.7%, and with random choice it is 0. The 3-door problem is due to Adam S. Landsberg [85].

89 Magic Coins A natural approach shows that you can guarantee release in four days, so 𝑅 ≤ 4. Suppose the coins are numbered 1 through 8 and let the chosen sets be 𝑃1 = {1, 2, 3, 4}, 𝑃2 = {2, 3, 4, 5}, 𝑃3 = {3, 4, 5, 6}, and 𝑃4 = {4, 5, 6, 7}. Let 𝑄 be the next consecutive sequence {5, 6, 7, 8}. Let 𝑎 be the count of magic coins in 𝑃1 . If 𝑎 = 2, then you are released. If 𝑎 is 0 or 1, then 𝑄 has at least three magic coins. As one moves through the days, the magic count can increase by at most 1. So the magic count in 𝑃4 is at least 2 and there must be a day when the chosen set has moved up from 𝑎 to 2. If 𝑎 is 3 or 4, then the same argument works where one counts nonmagic coins instead of magic ones. There is no method that will free you in two days. To see why, first note that choosing a set with four elements will win in ( 42 ) ⋅ ( 42 ) = 36 of the ( 48 ) = 70 possible states. Similar calculations show that choosing a set with any other number of elements will win in at most 30 states. Because 30 + 36 < 70, the

238

Chapter 7. Algorithms and Strategy

only possibility for winning your freedom in two days is to choose two sets of size four. Now assume there is such a solution; then we can assume by symmetry that the first set is {1, 2, 3, 4}. The second choice set must have either 0, 1, 2, or 3 elements in common with {1, 2, 3, 4}, so we can assume that it is either {5, 6, 7, 8}, {1, 5, 6, 7}, {1, 2, 5, 6}, or {1, 2, 3, 5}. These choices cause defeat if the magic coin set is {1, 2, 3, 4}, {1, 5, 6, 7}, {1, 2, 3, 5}, or {1, 2, 3, 4}, respectively. But, as found by Nick McGrath, there is a method that works in three days! Divide the coins into four pairs of two coins each. Designate the pairs 𝐴, 𝐵, 𝐶, and 𝐷. Then you will be released in three days if on day 1, you choose 𝐴 ∪ 𝐵; on day 2 you choose 𝐴 ∪ 𝐶, and on day 3 you choose 𝐴 ∪ 𝐷. This works because 𝐴 contains either 0, 1, or 2 magic coins. In the first case, the other three pairs contain a total of four magic coins, so at least one of them must contain two magic coins; when 𝐴 is matched with that one, you win. If 𝐴 contains one magic coin, then the other three pairs contain three magic coins, so at least one of them must contain one magic coin, and again when 𝐴 is matched with that one you win. Finally, if 𝐴 contains two magic coins, then the other three pairs contain two magic coins, so at least one of them contains no magic coins, and when 𝐴 is matched with that one you win. Therefore the strategy that joins 𝐴 to each of the three other pairs works and 𝑅 = 3. There are a couple ways to extend the problem. If there are 2𝑛 coins and 𝑛 magic coins and the goal is to get a set containing two magic coins, then the preceding argument works to show that 𝑛 − 1 days will suffice, provided 𝑛 is even. Partition the coins into 𝑛 pairs 𝐴𝑖 and have the choices be the matching of 𝐴1 with 𝐴𝑖 for each 𝑖 ≥ 2. The cases work as before, except that if 𝐴1 contains one magic coin, then the remaining 𝑛 − 1 pairs have 𝑛 − 1 such coins; but 𝑛 − 1 is odd so one of the remaining pairs must have one magic coin. We do not know if this strategy is optimal, nor have we investigated the case of odd 𝑛. A different extension is the situation where there are 4𝑛 coins, 2𝑛 magic coins, and the goal is a set with exactly 𝑛 magic coins. Then the initial approach to the problem when 𝑛 = 2 works as follows. Using sets of consecutive integers 𝑃1 , . . . , 𝑃2𝑛 similar to the sets used in the 𝑛 = 2 case guarantees freedom in 2𝑛 days. Some computer searches indicate that this is likely optimal in the case of 𝑛 = 3, but we have not proved that. Another variation of the general problem (4𝑛 coins, 2𝑛 magic coins, and the goal of a set with exactly 𝑛 magic coins) is to require that the prisoner choose only sets of size exactly 2𝑛. For that, define the graph 𝐺𝑛 whose vertices are all 2𝑛-size subsets of {1, 2, . . . , 4𝑛}, with an edge connecting two vertices if their intersection has size 𝑛. Then this variation is asking for 𝛾𝑡 (𝐺𝑛 ), the total domination number of 𝐺𝑛 . (The total domination number 𝛾𝑡 (𝐺) of a graph 𝐺 is the size of the smallest set of vertices 𝐷 such that all vertices, including those in 𝐷, have a neighbor in 𝐷.) We have 𝛾𝑡 (𝐺1 ) = 2 and 𝛾𝑡 (𝐺2 ) = 3. Using integer-linear programming we

90. Russian Cards

239

determined that 𝛾𝑡 (𝐺3 ) = 6. So we have the question whether 𝑛 = 4 is the only case where 𝛾𝑡 (𝐺𝑛 ) < 2𝑛. This problem is due to Gregory Galperin. It appeared in [18, Spring 2011, problem 2].

90 Russian Cards Let 𝐴 be the mod-7 sum of Alice’s cards and 𝐵 the same for Bob, and let 𝑐 be Charlie’s card. Then Alice can say: “My cards sum to 𝐴 modulo 7.” Because 𝐶 ≡ 28 − 𝐴 − 𝐵 (mod 7), Bob, knowing 𝐵, can use 𝐴 to compute 𝑐 and thus learn Alice’s cards. It remains to show that Charlie can’t deduce the location of any card other than 𝑐. We need this fact, working with residues modulo 7: for every 𝑆, the six residues that differ from 4𝑆 can be split into three disjoint pairs, each of which sums to 𝑆. To prove this, for each 𝑥 form the set {𝑥, 𝑆 − 𝑥}. These sets are disjoint. And such a set is not a pair if and only if 𝑥 ≡ 𝑆 − 𝑥, which is equivalent to 2𝑥 ≡ 𝑆 or 𝑥 ≡ 4𝑆 (all mod 7). Note that 4 is used here because it is the mod-7 inverse of 2. Now, suppose Charlie’s card is 𝑐 and Charlie learns that Alice’s mod-7 sum is 𝐴. Let 𝑎 be any card other than c. We want to show that, based on what Charlie knows, Alice might have card 𝑎. So we need to find 𝑥 and 𝑦 such that Alice might have {𝑎, 𝑥, 𝑦}. We need 𝑎 + 𝑥 + 𝑦 ≡ 𝐴 (mod 7), which means 𝑥 + 𝑦 ≡ 𝐴 − 𝑎 (mod 7). By the fact about pairs, there are three disjoint pairs {𝑥, 𝑦} that satisfy this congruence. One of these pairs might contain 𝑎, and one might contain 𝑐; those pairs can’t be used. But there are three disjoint pairs, so there is one that contains neither 𝑎 nor 𝑐 and that gives the desired 𝑥 and 𝑦. This shows that, based on what Charlie knows, Alice could hold any card. Bob’s sum is 28 − 𝐴 − 𝑐 (mod 7), and the same argument shows that, based on Charlie’s knowledge, Bob could hold any card. To study the case of 𝑛 cards (𝑛 odd, with Alice and Bob getting the same number of cards and Charlie getting one card), note that the knowledge requirement means that a declaration by Alice must be equivalent to a statement of the form, “My set of cards is in 𝑋,” where 𝑋 is a set of possible deals to Alice. So for 𝑛 = 3 there are 23 = 8 possible statements for Alice, and it is easy to see that none of them works. For five cards there are 210 statements, and a computational check shows that none of them works. For more than seven cards, the modular sum method easily extends. Suppose Alice and Bob each get 𝑘 cards and Charlie gets one, where 𝑘 ≥ 3; let 𝑛 = 2𝑘 + 1 and suppose the cards are numbered 1 through 𝑛. The crucial fact is that for any card 𝑆, there are 𝑘 disjoint pairs that sum to 𝑆 (mod 𝑛); this is proved as for 𝑛 = 7, using (𝑛 + 1)/2 in place of 4. Now suppose Charlie’s card is 𝑐, and 𝑎1 , . . . , 𝑎𝑘−2 are any other cards. We will show that Alice might have those 𝑘 − 2 cards by finding

240

Chapter 7. Algorithms and Strategy Table 90.1. A six-case protocol for the Russian card problem with seven cards. 1 2 3 4 5 6

124 134 135 123 236 456

235 245 146 345 167 125

346 356 234 567 257 136

457 467 127 246 145 357

156 157 256 147 347 247

267 126 367

137 237

two more cards 𝑥, 𝑦 that could be added to make up Alice’s hand. So we need 𝑥 + 𝑦 ≡ 𝐴 − (𝑎1 + ⋯ + 𝑎𝑘−2 ) (mod 𝑛), and there are 𝑘 disjoint pairs {𝑥, 𝑦} to choose from. Only 𝑘 − 1 of these pairs could contain any of 𝑎1 , . . . , 𝑎𝑘−2 or 𝑐, so there must be a pair that works. And this means any card except 𝑐 can appear in a deal to Alice that has mod-𝑛 sum equal to 𝐴. As before, this handles the case of Bob’s cards as well. The history of this problem, known as the Russian card problem [90, 123], is interesting. It was part of the 2000 Moscow Mathematical Olympiad, in the form that Alice is to make a statement that gives Bob full information and Charlie no locations. One student submitted this solution: If Alice sees 𝑥, 𝑦, and 𝑧, she declares: “One of us has cards 𝑥, 𝑦, 𝑧.” This is a true statement and reveals Alice’s cards to Bob while Charlie learns nothing. So this is a valid solution when the problem makes no knowledge assumptions. The student received full credit for this solution, even though it sidesteps the point of the problem. Under the stronger requirement that Alice must know that her declaration is true, Charlie, upon hearing Alice’s declaration, can reason: “The only way Alice can know her statement is true is if she has the cards in her statement.” Therefore Charlie would learn the locations of all the cards. One can investigate protocols with stronger properties. For example, consider the rows in Table 90.1, discovered by Charlie Colbourn and Alex Rosa (see [119]) and indexed from 1 to 6. The table can be public, and so Alice can simply display the table and declare which row contains her card set. The modular-sum method leads to a similar table, but it has seven cases, not six, and so is less efficient. For other variations see [119].

91 The Generous Automated Teller Machine The answer to part (a) is that when 𝑛 = 5, the largest number of coins that can be obtained is 32. To show how to achieve this, we first define two composite moves that operate on only the last two or last three boxes:

91. The Generous Automated Teller Machine

241

Table 91.1. A sequence of moves with 𝑛 = 5 that places 32 coins in 𝐵5 . line 1 2 3 4 5 6

𝐵1 1 0 0 0 0 0

𝐵2 0 2 1 0 0 0

𝐵3 0 0 2 4 0 0

𝐵4 0 0 0 0 24 = 16 0

𝐵5 0 0 0 0 0 2 ⋅ 16 = 32

double: If 𝑛 ≥ 2 and 𝑎 ≥ 1, then we can go from (. . . , 𝑎, 0) to (. . . , 0, 2𝑎) by applying add𝑛−1 𝑎 times (only the last two boxes are affected by these moves): (. . . , 𝑎, 0) ⟶ (. . . , 𝑎 − 1, 2) ⟶ (. . . , 𝑎 − 2, 4) ⟶ ⋯ ⟶ (. . . , 0, 2𝑎). add𝑛−1

power: If 𝑛 ≥ 3 and 𝑎 ≥ 1, then we can go from (. . . , 𝑎, 0, 0) to (. . . , 0, 2𝑎 , 0) by applying add𝑛−2 , and then double and flip𝑛−2 𝑎 − 1 times (only the last three boxes are affected): (. . . , 𝑎, 0, 0) ⟶ (. . . , 𝑎 − 1, 2, 0) ⟶ (. . . , 𝑎 − 1, 0, 22 ) ⟶ (. . . , 𝑎 − 2, 22 , 0) add𝑛−2

double

flip𝑛−2

⟶ (. . . , 𝑎 − 3, 2 , 0) ⟶ ⋯ ⟶ (. . . , 0, 2𝑎 , 0). 3

double, flip𝑛−2

double, flip𝑛−2

double, flip𝑛−2

The rightmost 0 in the power move is important; although 𝐵𝑛 is empty at the beginning and end of the power move, coins are placed in it by each double move, and then removed by the succeeding flip𝑛−2 . Table 91.1 shows a sequence of moves with 𝑛 = 5 ending with 32 coins in 𝐵5 . As we will see later, this is the largest number of coins that can be obtained. Moving on to 𝑛 = 6 for part (b), we find a startling jump in the number of coins that can be obtained. Table 91.2 shows a sequence of moves that ends with 16 𝐵6 containing 22 +1 = 265537 ≈ 4 ⋅ 1019728 coins, an amount that would not fit into our universe. Once again, we will show later that this is the largest number of coins that can be obtained. 22 Moves 4–10 in Table 91.2 take us from (0, 0, 4, 0, 0, 0) to (0, 0, 0, 22 , 0, 0). To better understand this sequence of moves it is helpful to introduce Knuth’s uparrow notation: 𝑎 ↑ 𝑏 means 𝑎𝑏 , and 𝑎 ↑↑ 𝑏 means 𝑎 ↑ (𝑎 ↑ (⋯ ↑ 𝑎)), with 𝑏 many 𝑎s (this is called the 𝑏th tetration of 𝑎). In this notation, moves 4–10 in Table 91.2 transform (0, 0, 4, 0, 0, 0) into (0, 0, 0, 2 ↑↑ 4, 0, 0). Generalizing this sequence of moves gives us the following composite move:

242

Chapter 7. Algorithms and Strategy Table 91.2. A sequence of moves with 𝑛 = 6 that places 265537 coins in 𝐵6 . The moves have been divided into blocks; each block begins with only one nonempty box.

line 1 2 3 4 5 6 7 8 9

𝐵1 1 0 0 0 0 0 0 0 0

𝐵2 0 2 1 0 0 0 0 0 0

𝐵3 0 0 2 4 3 3 2 2 1

𝐵4 0 0 0 0 2 0 22 0 22 2

10 11 12 13

0 0 0 0

0 0 0 0

1 0 0 0

0 65536 0 0

22

22

𝐵5 0 0 0 0 0 22 0 2 22 0

𝐵6 0 0 0 0 0 0 0 0 0

= 216 = 65536 0 265536 0

0 0 0

flip3 power double

265537

tetration: If 𝑛 ≥ 4 and 𝑎 ≥ 1, then we can go from (. . . , 𝑎, 0, 0, 0) to (. . . , 0, 2 ↑↑ 𝑎, 0, 0) by applying add𝑛−3 , and then power and flip𝑛−3 𝑎−1 times (only the last four boxes are affected): (. . . , 𝑎, 0, 0, 0) ⟶ (. . . , 𝑎 − 1, 2, 0, 0) ⟶ (. . . , 𝑎 − 1, 0, 22 , 0) add𝑛−3

power

2

⟶ (. . . , 𝑎 − 2, 2 , 0, 0) power, ⟶ (. . . , 𝑎 − 3, 22 = 2 ↑↑ 3, 0, 0) 2

flip𝑛−3

flip𝑛−3

⟶ (. . . , 𝑎 − 4, 2 ↑↑ 4, 0, 0) power, ⟶ ⋯ power, ⟶ (. . . , 0, 2 ↑↑ 𝑎, 0, 0).

power, flip𝑛−3

flip𝑛−3

flip𝑛−3

Thus, the sequence of moves in Table 91.2 can be described as add1 , add2 , add2 , tetration, power, double. (Compare this to Table 91.1, where the sequence is add1 , add2 , add2 , power, double.) Knuth’s uparrow notation extends to triple-arrow in the same way: 𝑎 ↑↑↑ 𝑏 = 𝑎 ↑↑ (𝑎 ↑↑ (⋯ ↑↑ 𝑎)) with 𝑏 many 𝑎s, and so on. We abbreviate the 𝑛-arrow function to just ↑𝑛 (↑0 is multiplication). Using this notation we can describe the generalization to 𝑛 boxes. The analysis that follows combines ideas of Richard Stong and the authors. For integers 𝑛 ≥ 0 and 𝑥 ≥ 1 let 𝑓𝑛 (𝑥) = 2 ↑𝑛 𝑥. Thus 𝑓0 (𝑥) = 2𝑥, 𝑓1 (𝑥) = 2 ↑ 𝑥 = 2𝑥 , 𝑓2 (𝑥) = 2 ↑↑ 𝑥 = 2 ↑ (2 ↑ (⋯ ↑ 2)) (with 𝑥 many 2s), and so on.

91. The Generous Automated Teller Machine

243

These functions can also be defined recursively by the equations 𝑓0 (𝑥) = 2𝑥 and, 𝑥 for 𝑛 ≥ 1, 𝑓𝑛 (𝑥) = 𝑓𝑛−1 (1), where the superscript indicates that the function is iterated 𝑥 times. It is not hard to verify by induction that for all 𝑛, 𝑓𝑛 (1) = 2 and 𝑓𝑛 (2) = 4, but for larger values of 𝑥, 𝑓𝑛 (𝑥) grows very quickly as 𝑛 increases. Let 𝐹𝑛 = 𝑓0 ∘ 𝑓1 ∘ ⋯ ∘ 𝑓𝑛 . We will show that if one has 𝑛 boxes, and one starts with one coin in 𝐵1 and the other boxes empty, then for 𝑛 ≥ 2 one can obtain 𝐹𝑛−2 (1) coins, and this is the maximum possible. (Of course, if 𝑛 = 1, then there is only one box containing one coin; no moves are possible, so no more coins can be obtained.) This formula implies that the maximum number of coins that can be obtained with five boxes is 𝐹3 (1) = 𝑓0 (𝑓1 (𝑓2 (𝑓3 (1)))) = 𝑓0 (𝑓1 (𝑓2 (2))) = 𝑓0 (𝑓1 (4)) = 𝑓0 (24 ) = 2 ⋅ 24 = 32, while the maximum with six boxes is 𝐹4 (1) = 𝑓0 (𝑓1 (𝑓2 (𝑓3 (𝑓4 (1))))) = 𝑓0 (𝑓1 (𝑓2 (𝑓3 (2)))) = 𝑓0 (𝑓1 (𝑓2 (4))) 16

16

= 𝑓0 (𝑓1 (2 ↑↑ 4)) = 𝑓0 (𝑓1 (216 )) = 𝑓0 (22 ) = 2 ⋅ 22

= 22

16 +1

,

as claimed earlier. To analyze the 𝑛-box game we begin with some terminology. We will say that the moves add𝑘 and flip𝑘 are mediated by box 𝐵𝑘 . A state of the 𝑛-box game is an assignment of a number of coins to each of the 𝑛 boxes. Proposition 91.1. From any state, there are only finitely many possible sequences of moves. Proof. We use induction on 𝑛. When 𝑛 = 1, no moves are possible, so the only move sequence is the empty sequence. For the induction step, assume the result for 𝑛 boxes, and consider an arrangement of coins in 𝑛 + 1 boxes. Let the initial number of coins in 𝐵1 be 𝑎. Then in any sequence of moves there can be at most 𝑎 moves mediated by 𝐵1 . Thus, any sequence of moves must have the form: 𝑠1 , 𝑚1 , 𝑠2 , 𝑚2 , . . . , 𝑠𝑘 , where each 𝑠𝑖 is a sequence (possibly empty) of add and flip moves on the last 𝑛 boxes and each 𝑚𝑖 is a move mediated by 𝐵1 . Since there can be at most 𝑎 moves 𝑚𝑖 , we have 𝑘 ≤ 𝑎 + 1. So there are finitely many possibilities for 𝑘, two possibilities for each 𝑚𝑖 , and, by the inductive hypothesis, for each choice of the moves before any 𝑠𝑖 there are only finitely many possibilities for 𝑠𝑖 . We define the height of a state to be the maximum possible length of a sequence of moves starting in that state; such a maximum exists by Proposition 91.1. A state is final if the only nonempty box is 𝐵𝑛 . In a final state, no moves are possible, so the height of a final state is zero. Now consider a nonfinal state 𝑆. We will say that a state is a successor of 𝑆 if it can be reached from 𝑆 in one move.

244

Chapter 7. Algorithms and Strategy

There are finitely many successors of 𝑆, and the height of each successor is less than the height of 𝑆. The value of a state is the maximum number of coins that can be obtained starting in that state. The maximum exists by Proposition 91.1, and it can be obtained only by a sequence of moves ending in a final state, because in a nonfinal state one could use add moves to increase the number of coins. The value of a final state is the number of coins in 𝐵𝑛 . The value of a nonfinal state is the maximum of the values of all successors of the state. An optimal move is a move to a successor with largest possible value. After performing a sequence of optimal moves leading from some state to a final state, all boxes will be empty except 𝐵𝑛 , and the number of coins in 𝐵𝑛 will be the value of the initial state. A state 𝑆 dominates another state 𝑇 if every box contains at least as many coins in 𝑆 as in 𝑇; it strictly dominates if in addition there is at least one box that has more coins. Proposition 91.2. If 𝑆 strictly dominates 𝑇, then the value of 𝑆 is larger than the value of 𝑇. If 𝑆 dominates 𝑇, then the value of 𝑆 is at least as large as the value of 𝑇. Proof. Suppose the first statement is false, and consider a counterexample in which the height of 𝑇 is as small as possible. If 𝑇 is a final state, then the value of 𝑇 is the number of coins in 𝐵𝑛 . Since the total number of coins in state 𝑆 is larger than this, the value of 𝑆 is larger than the value of 𝑇, which is a contradiction. Now suppose 𝑇 is not final, and consider an optimal move for 𝑇. This move will transform 𝑇 into a successor state 𝑇 ′ that has the same value as 𝑇, but smaller height. It is not hard to see that if the same move is applied to 𝑆 it will lead to a state 𝑆′ that strictly dominates 𝑇 ′ . By the minimality of the height of 𝑇, the value of 𝑆′ is larger than the value of 𝑇 ′ . Since the value of 𝑆 is at least as large as the value of 𝑆′ and the value of 𝑇 is the same as the value of 𝑇 ′ , this is a contradiction. If 𝑆 dominates 𝑇 but doesn’t strictly dominate, then 𝑆 = 𝑇, so the values are the same. Proposition 91.3. If 𝑘 ≤ 𝑛 − 2 and boxes 𝐵𝑘 and 𝐵𝑘+1 are both nonempty, then flip𝑘 is not an optimal move. Proof. Suppose boxes 𝐵𝑘 , 𝐵𝑘+1 , and 𝐵𝑘+2 contain 𝑎, 𝑏, and 𝑐 coins, respectively, where 𝑎 ≥ 1 and 𝑏 ≥ 1. Then flip𝑘 would have this effect: (. . . , 𝑎, 𝑏, 𝑐, . . .) ⟶ (. . . , 𝑎 − 1, 𝑐, 𝑏, . . .). 𝑘

flip𝑘

(91.1)

Now consider the following alternative sequence of moves: (. . . , 𝑎, 𝑏, 𝑐, . . .) ⟶ (. . . , 𝑎, 𝑏 − 1, 𝑐 + 2, . . .) add𝑘+1

𝑘

⟶ (. . . , 𝑎 − 1, 𝑐 + 2, 𝑏 − 1, . . .) ⟶ (. . . , 𝑎 − 1, 𝑐 + 1, 𝑏 + 1, . . .). flip𝑘

(91.2)

91. The Generous Automated Teller Machine

245

The last state in (91.2) strictly dominates the last state in (91.1), so its value is larger. Therefore flip𝑘 was not optimal in (91.1). In any nonfinal state, there is at least one box 𝐵𝑘 such that 𝑘 < 𝑛, 𝐵𝑘 is nonempty, and either 𝐵𝑘+1 is empty or 𝑘 = 𝑛 − 1. The active box is the first box with these properties—i.e., the box with smallest 𝑘. A move is good if it is mediated by the active box. Proposition 91.4. In every state, there is an optimal move that is good. We will prove this proposition later. If the active box in some state is 𝐵𝑘 , then according to Proposition 91.4 either add𝑘 or flip𝑘 is optimal. Our next proposition determines which one is optimal in almost all cases. Proposition 91.5. Suppose the active box is 𝐵𝑘 . (1) If 𝑘 = 𝑛 − 1, then add𝑘 is optimal. (2) If 𝑘 ≤ 𝑛 − 2 and there are at most two coins in 𝐵𝑘+2 , then add𝑘 is optimal. (3) If 𝑘 ≤ 𝑛 − 2 and there are at least four coins in 𝐵𝑘+2 , then flip𝑘 is optimal. Proof. If 𝑘 = 𝑛−1, then the only good move is add𝑘 , so this move must be optimal; this proves statement (1). Now suppose the active box is 𝐵𝑘 , where 𝑘 ≤ 𝑛 − 2; by the definition of the active box, 𝐵𝑘+1 must be empty. Suppose the numbers of coins in boxes 𝐵𝑘 and 𝐵𝑘+2 are 𝑎 ≥ 1 and 𝑏. The two good moves are: (. . . , 𝑎, 0, 𝑏, . . .) ⟶ (. . . , 𝑎 − 1, 2, 𝑏, . . .),

(91.3)

(. . . , 𝑎, 0, 𝑏, . . .) ⟶ (. . . , 𝑎 − 1, 𝑏, 0, . . .).

(91.4)

𝑘

𝑘

If 𝑏 ≤ 2, then the last state in (91.3) strictly dominates the last state in (91.4), so add𝑘 is optimal. This proves statement (2). To prove statement (3), suppose 𝑏 ≥ 4. Then (91.4) can be extended as follows: (. . . , 𝑎, 0, 𝑏, . . .) ⟶ (. . . , 𝑎 − 1, 𝑏, 0, . . .) ⟶ (. . . , 𝑎 − 1, 2, 2𝑏 − 4, 0, . . .). (91.5) 𝑘

flip𝑘

𝑏−2

The last state in (91.5) dominates the last state in (91.3), so flip𝑘 must be optimal. Using Proposition 91.5, we can now describe a generalization of the double, power, and tetration moves.

246

Chapter 7. Algorithms and Strategy

Proposition 91.6 (Hyperpower rule). Suppose 𝐵𝑘 is the active box and holds 𝑎 coins, and all 𝐵𝑗 with 𝑗 > 𝑘 are empty. Let 𝑚 be the number of these empty boxes: 𝑚 = 𝑛 − 𝑘. Then there is a sequence of optimal moves that reaches a state that is the same as the current state except that 𝐵𝑘 is empty and 𝐵𝑘+1 holds 𝑓𝑚−1 (𝑎) coins. Proof. By induction on 𝑚. We start with the state (. . . , 𝑎, 0, 0, . . . , 0), where the 𝑎 is in position 𝑘. If 𝑚 = 1, then 𝑘 = 𝑛 − 1, and therefore by part (1) of Proposition 91.5, add𝑘 is optimal. Applying add𝑘 𝑎 times gives the desired result. Now suppose 𝑚 ≥ 2 and the proposition holds for 𝑚 − 1 final empty boxes. Since 𝐵𝑘+2 is empty, by part (2) of Proposition 91.5, add𝑘 is optimal; it leads to the state (. . . , 𝑎−1, 2, 0, . . . , 0). If 𝑎 = 1, then we are done because 𝑓𝑚−1 (1) = 2. Otherwise the inductive hypothesis implies that a sequence of optimal moves will lead to the state (. . . , 𝑎−1, 0, 𝑓𝑚−2 (2) = 4, 0, . . . , 0). Now by part (3) of Proposition 91.5 2 flip𝑘 is optimal, and it leads to the state (. . . , 𝑎 − 2, 𝑓𝑚−2 (2) = 𝑓𝑚−2 (1), 0, . . . , 0). If 𝑎 ≥ 3, then we continue with the inductive hypothesis and flip𝑘 again to get 3 (. . . , 𝑎 − 3, 𝑓𝑚−2 (1), 0, . . . , 0). Continuing until 𝐵𝑘 is empty, we eventually reach 𝑎 (. . . , 0, 𝑓𝑚−2 (1) = 𝑓𝑚−1 (𝑎), 0, . . . , 0). Theorem 91.7. For 𝑛 boxes, 𝑛 ≥ 2, with 𝐵1 initially containing one coin and all other boxes empty, the maximum number of coins that can be obtained is 𝐹𝑛−2 (1). Proof. We start with the state (1, 0, 0, . . . , 0). Applying the hyperpower rule 𝑛 − 1 times leads to the states: (0, 𝑓𝑛−2 (1), 0, . . . , 0), (0, 0, 𝑓𝑛−3 (𝑓𝑛−2 (1)), 0, . . . , 0), ⋮ (0, 0, . . . , 𝑓0 (𝑓1 (⋯ (𝑓𝑛−2 (1))))) = (0, 0, . . . , 𝐹𝑛−2 (1)). Since the moves in the hyperpower rule are optimal, 𝐹𝑛−2 (1) is the largest number of coins that can be obtained. Proof of Proposition 91.4. Suppose not. Let 𝑆 be a state of minimal height in which no optimal move is good. Let 𝑘 be the smallest positive integer such that there is an optimal move in state 𝑆 that is mediated by 𝐵𝑘 . Let this optimal move be 𝑚𝑘 , which is either add𝑘 or flip𝑘 . It leads from state 𝑆 to another state 𝑆′ . Since 𝑚𝑘 is not good in state 𝑆, 𝐵𝑘 is not the active box, so the active box is 𝐵𝑗 for some 𝑗 ≠ 𝑘. Suppose first that 𝑗 < 𝑘. Since 𝐵𝑘 is not empty, we can’t have 𝑗 = 𝑘 − 1, so 𝑗 ≤ 𝑘 − 2, 𝐵𝑗 is nonempty, and 𝐵𝑗+1 is empty. Therefore 𝑆′ is not final and 𝐵𝑗 is the active box in 𝑆′ . The height of 𝑆′ is less than the height of 𝑆, so by the choice of 𝑆 as a counterexample of minimal height there is a good optimal move in 𝑆′ . This move is mediated by 𝐵𝑗 ; let us call it 𝑚𝑗 . If 𝑗 < 𝑘 − 2, then 𝑚𝑘 and 𝑚𝑗 can

91. The Generous Automated Teller Machine

247

be swapped without changing the result; in other words, in state 𝑆, performing first 𝑚𝑗 and then 𝑚𝑘 will lead to the same state as performing 𝑚𝑘 and then 𝑚𝑗 . But this means that in state 𝑆, 𝑚𝑗 is a good optimal move, contradicting the fact that there is no good optimal move in 𝑆. Therefore 𝑗 = 𝑘 − 2. If 𝑚𝑗 is add𝑗 , then again 𝑚𝑘 and 𝑚𝑗 can be swapped, which is a contradiction as before. So 𝑚𝑗 is flip𝑗 . Let the numbers of coins in boxes 𝐵𝑗 and 𝐵𝑘 in state 𝑆 be 𝑎 ≥ 1 and 𝑏 ≥ 1, respectively. Then the effect of moves 𝑚𝑘 and 𝑚𝑗 = flip𝑗 is as follows: (. . . , 𝑎, 0, 𝑏, . . .) ⟶ (. . . , 𝑎, 0, 𝑏 − 1, - - -) ⟶ (. . . , 𝑎 − 1, 𝑏 − 1, 0, - - -), 𝑗

𝑘

𝑚𝑘

flip𝑗

(91.6)

where “- - -” is different from “. . . ” and represents the effect on boxes after 𝐵𝑘 of 𝑚𝑘 . But now consider the following alternative sequence of moves: (. . . , 𝑎, 0, 𝑏, . . .) ⟶ (. . . , 𝑎 − 1, 𝑏, 0, . . .) 𝑗

𝑘

flip𝑗

⟶ (. . . , 𝑎 − 1, 𝑏 − 1, 2, . . .) ⟶ (. . . , 𝑎 − 1, 𝑏 − 1, 1, - - -). (91.7)

𝑚𝑘

The last state in (91.7) strictly dominates the last state in (91.6), which contradicts the optimality of the moves in (91.6). This completes the proof for the case 𝑗 < 𝑘. Now suppose 𝑗 > 𝑘. Then 𝑘 ≤ 𝑛 − 2 and 𝐵𝑘+1 must not be empty, so by Proposition 91.3, 𝑚𝑘 can’t be flip𝑘 , so it must be add𝑘 . This case has the extra complication that if, in state 𝑆, box 𝐵𝑘 contains exactly one coin and 𝐵𝑘−1 is nonempty, then after 𝑚𝑘 = add𝑘 , the active box will be 𝐵𝑘−1 and not 𝐵𝑗 . Suppose first that this is not the case. Then the active box in state 𝑆′ is 𝐵𝑗 , and as before there is a good optimal move 𝑚𝑗 in 𝑆′ that is mediated by 𝐵𝑗 . Once again the moves add𝑘 and 𝑚𝑗 can be swapped and therefore 𝑚𝑗 is a good optimal move in state 𝑆, which is a contradiction. So the only remaining case is that in state 𝑆, 𝐵𝑘−1 is nonempty and 𝐵𝑘 contains exactly one coin, and therefore in 𝑆′ , the active box is 𝐵𝑘−1 , which mediates some good optimal move. If that move were add𝑘−1 , then we could swap add𝑘 and add𝑘−1 , so add𝑘−1 would be an optimal move in 𝑆, contradicting the minimality of 𝑘. Therefore flip𝑘−1 must be optimal in 𝑆′ . Let the numbers of coins in boxes 𝐵𝑘−1 , 𝐵𝑘+1 , and 𝐵𝑘+2 in 𝑆 be 𝑎 ≥ 1, 𝑏 ≥ 1, and 𝑐, respectively. Then the effect of the moves add𝑘 and flip𝑘−1 , starting in state 𝑆, is: (. . . , 𝑎, 1, 𝑏, 𝑐, . . .) ⟶ (. . . , 𝑎, 0, 𝑏 + 2, 𝑐, . . .) ⟶ (. . . , 𝑎 − 1, 𝑏 + 2, 0, 𝑐, . . .). (91.8) 𝑘

flip𝑘−1

Both of these moves are optimal. We now need to consider several cases. First, suppose 𝑏 = 1. Then the effect of the moves in (91.8) is (. . . , 𝑎, 1, 1, 𝑐, . . .) ⟶ (. . . , 𝑎 − 1, 3, 0, 𝑐, . . .). 𝑘

(91.9)

248

Chapter 7. Algorithms and Strategy

But consider this alternative move: (. . . , 𝑎, 1, 1, 𝑐, . . .) ⟶ (. . . , 𝑎 − 1, 3, 1, 𝑐, . . .). 𝑘

(91.10)

The last state in (91.10) strictly dominates the last state in (91.9), so this contradicts the optimality of the moves in (91.9). Next, suppose 𝑏 ≥ 2 and 𝑐 = 0, so the effect of the moves in (91.8) is (. . . , 𝑎, 1, 𝑏, 0) ⟶ (. . . , 𝑎 − 1, 𝑏 + 2, 0, 0, . . .). 𝑘

(91.11)

Now consider the alternative sequence of moves (. . . , 𝑎, 1, 𝑏, 0, . . .) ⟶ (. . . , 𝑎, 1, 0, 2𝑏, . . .) 𝑘

𝑏

⟶ (. . . , 𝑎, 0, 2𝑏, 0, . . .) ⟶ (. . . , 𝑎 − 1, 2𝑏, 0, 0, . . .). flip𝑘

flip𝑘−1

(91.12)

The last state in (91.12) dominates the last state in (91.11), so this shows that the move add𝑘+1 is optimal in state 𝑆. But since 𝑐 = 0, this is a good optimal move, contradicting the fact that there is no good optimal move in state 𝑆. Finally, suppose that 𝑏 ≥ 2 and 𝑐 ≥ 1, and consider the following possible sequence of moves: (. . . , 𝑎, 1, 𝑏, 𝑐, . . .) ⟶ (. . . , 𝑎, 1, 0, 𝑐 + 2𝑏, . . .) 𝑘

𝑏

⟶ (. . . , 𝑎, 0, 2𝑏 + 𝑐, 0, . . .) ⟶ (. . . , 𝑎 − 1, 2𝑏 + 𝑐, 0, 0, . . .) flip𝑘

flip𝑘−1

⟶𝑐 (. . . , 𝑎 − 1, 2𝑏, 2𝑐, 0, . . .) ⟶ (. . . , 𝑎 − 1, 2𝑏, 0, 4𝑐, . . .). add𝑘

2𝑐

(91.13)

The last state in (91.13) strictly dominates the last state in (91.8), contradicting the optimality of the moves in (91.8). This completes the proof of the proposition. This problem is a modified version of a problem that appeared on the 51st International Mathematical Olympiad in 2010. In the olympiad problem, the moves are the same, but the initial setup has one coin in each box, rather than one coin in only 𝐵1 . (The olympiad problem asked whether it is possible in the 2010 𝑛 = 6 case to get exactly 20102010 coins in 𝐵6 , with all other boxes empty.) We can use the results we have proven to find the maximum number of coins obtainable with 𝑛 boxes, each initially containing one coin. In the analysis that follows, we assume 𝑛 ≥ 4. We begin in the state (1, 1, . . . , 1), where there are 𝑛 1s. The active box is 𝐵𝑛−1 , so by Proposition 91.5, add𝑛−1 is optimal, which gets us to (1, . . . , 1, 0, 3). Now the active box is 𝐵𝑛−2 , and unfortunately this is the one case not covered by

91. The Generous Automated Teller Machine

249

Proposition 91.5. But if our next move is flip𝑛−2 , then our first two moves would be (1, . . . , 1) ⟶ (1, . . . , 1, 0, 3) ⟶ (1, . . . , 1, 0, 3, 0). (91.14) add𝑛−1

flip𝑛−2

We could instead have done (1, . . . , 1) ⟶ (1, . . . , 1, 0, 3, 1).

(91.15)

Since the last state in (91.15) strictly dominates the last state in (91.14), flip𝑛−2 is not optimal for the second move. Therefore add𝑛−2 is optimal, which gets us to (1, . . . , 1, 0, 2, 3). Now Proposition 91.5 tells us that add𝑛−3 is optimal, which leads to (1, . . . , 1, 0, 2, 2, 3), and similarly the next optimal moves are add𝑛−4 , . . . , add1 , after which the state is (0, 2, 2, . . . , 2, 3). In this state, add𝑛−1 is optimal, which gets us to (0, 2, . . . , 2, 0, 7). Now a new pattern begins. To describe this pattern it is helpful to define 𝐹 𝑛 = 𝑓𝑛 ∘ 𝑓𝑛−1 ∘ ⋯ ∘ 𝑓0 . By Proposition 91.5, in state (0, 2, . . . , 2, 0, 7), flip𝑛−2 is optimal, which gets us to (0, 2, . . . , 2, 1, 7, 0). Then the hyperpower rule leads to (0, 2, . . . , 2, 1, 0, 14) = (0, 2, . . . , 2, 1, 0, 𝑓0 (7)), and then flip𝑛−2 is optimal again, after which the state is (0, 2, . . . , 2, 0, 𝑓0 (7), 0). Now flip𝑛−3 , hyperpower, and flip𝑛−3 lead to (0, 2, . . . , 2, 0, 𝑓1 (𝑓0 (7)) = 𝐹 1 (7), 0, 0). We continue to repeat the pattern flip, hyperpower, flip until we reach (0, 0, 𝐹 𝑛−4 (7), 0, . . . , 0). Finally, as in the proof of Theorem 91.7, repeated use of the hyperpower rule leads to the final state (0, 0, . . . , 0, 𝐹𝑛−4 (𝐹 𝑛−4 (7))). Since all moves have been optimal, this shows that the largest number of coins obtainable is 𝐹𝑛−4 (𝐹 𝑛−4 (7)). In the case of five boxes, each initially containing one coin, the maximum number of coins that can be obtained is 14

14

𝐹1 (𝑓1 (𝑓0 (7))) = 𝐹1 (𝑓1 (14)) = 𝑓0 (𝑓1 (214 )) = 𝑓0 (22 ) = 2 ⋅ 22

≈ 2.38 × 104932 .

When 𝑛 = 6, the maximum is the almost indescribably large number 𝐹2 (𝐹 2 (7)) = 2 ⋅ 22↑↑(2↑↑2

14 )

.

The sequences of the maximum number of coins obtainable with 𝑛 boxes, in both our version of the problem and the olympiad version, can be found at [99, sequences A307611, A281701].

8 Miscellaneous 92 A Self-Descriptive Crossword There are 90 squares. Because the spaces (␣) are counted by one of the 14 answers, there should be 15 spaces (see Figure 92.2). But the ones at 6-across and 12-across are counted by the downs, so there are only 13 and 4-down must be THIRTEEN␣␣S. This forces THREE at 8-across (FORTY is impossible as it leads to a total beyond 90) and NINE at 11-across. SIX must occur at 9-down because either TWO or TEN would force a contradiction of the ONE at 10-across. Then 9-across is SEVENTEEN and 7-down is SEVEN. There cannot be ten Hs or ten Ws, so 5-across is TWO␣HS and 1-down is TWO␣WS. Because SEVENTY is impossible and SIXTEEN is barred by ONE␣X, 12-across is FIFTEEN. Now, 2-down is ONE␣?. The ? cannot be V or N, so 6-across is FOUR. The ONE␣U then eliminates any more FOURs. This leaves only two four-letter words with the same initial letter at 3-across and 3-down. Two NINEs would bring the total to 98, which exceeds 90. So these two are each FIVE. This leaves only some single squares, and these are easily seen to be R, V, F, N, E, and S. This problem is due to Lee Sallows (Nijmegen, Netherlands).

93 Serious Implications The solution is shown in Figure 93.2. Because 𝐴 ⇒ 𝐵 is logically equivalent to 𝐵 ∨ ¬𝐴, the 𝐞 clue can be written as 𝐛 ∨ ¬𝐞. Therefore no entry in the first column can be 𝐹, since otherwise the disjunction would be 𝑇, a contradiction. This means the first column is 𝑇𝑇𝑇𝑇. And then the 𝐞 clue tells us that the second row is 𝑇𝑇𝑇𝑇. Now, because clues 𝐛, 𝐠, and 𝐡 are tautologies, and therefore useless, and 251

252

Chapter 8. Miscellaneous 

















 

 













 









 



















































 















Figure 92.2. The solution to the self-descriptive crossword. 𝐚

𝐞 𝑇

𝐟 𝐹

𝐠 𝑇

𝐡 𝑇

𝐛

𝑇

𝑇

𝑇

𝑇

𝐜

𝑇

𝐹

𝑇

𝑇

𝐝

𝑇

𝐹

𝑇

𝑇

Figure 93.2. Solution to the crossword. 𝐞 is fully used, the clue set reduces to: 𝐚. ¬𝐟;

𝐜. 𝐛 ⇒ 𝐜;

𝐝. 𝐚 ∨ (¬𝐡);

𝐟. ¬𝐜.

Then the 𝐚 and 𝐟 clues fill in everything except 𝐚𝐡, 𝐜𝐡, 𝐝𝐟, 𝐝𝐠, and 𝐝𝐡. Clue 𝐝 then makes 𝐝𝐟 false (and then 𝐚𝐡 is true by clue 𝐚). Clue 𝐝 then makes 𝐝𝐠 and 𝐝𝐡 true. And because 𝐝𝐟 is false, 𝐜𝐡 is true by clue 𝐟. This problem is due to Jim Henle.

94 Hermione Granger and the Deadly Bottles Our puzzle is slightly different from the one facing Harry and Hermione. They can see the bottles, which gives them information that is unavailable to us. But we have information that they don’t have: we know that Hermione was able to solve the puzzle.

94. Hermione Granger and the Deadly Bottles

253

The arrangement of the bottles can be thought of as a sequence of the letters 𝐹, 𝐵, 𝑁, and 𝑃, where 𝐹 represents the bottle that allows one to move forward, 𝐵 the bottle for moving back, 𝑁 stands for a bottle holding nettle wine, and 𝑃 a bottle holding poison. The poem tells us that the sequence contains one 𝐹, one 𝐵, two 𝑁s, and three 𝑃s. It also gives us four clues about the sequence: (1) Each 𝑁 is immediately preceded by a 𝑃. (2) The first and last letters are different, and neither is 𝐹. (3) The letters in the positions representing the smallest and largest bottles are not 𝑃s. (4) The second and sixth letters are the same. We will refer to the positions of the smallest and largest bottles as the two extreme positions. We don’t know which positions are extreme, but Harry and Hermione do, and they can use this information to apply clue (3). Consider the following letter sequences, each of which is compatible with clues (1), (2), and (4) (these are not all the compatible sequences): 𝑃 𝑃 𝐵 𝐵 𝐵

𝑃 𝑃 𝑃 𝑃 𝑃

𝑁 𝑁 𝐹 𝑁 𝑃

𝐹 𝐵 𝑃 𝐹 𝑁

𝐵 𝐹 𝑁 𝑃 𝐹

𝑃 𝑃 𝑃 𝑃 𝑃

𝑁 𝑁 𝑁 𝑁 𝑁

We know that Hermione learns enough from clue (3) to eliminate at least four of these, since otherwise she would not have enough information to solve the puzzle. Suppose that neither position 2 nor position 6 is extreme. Then the extreme positions must be among 1, 3, 4, 5, and 7. But if two of the positions 3, 4, 5, and 7 are extreme, then both of the first two sequences are compatible with clue (3), and if the extreme positions are 1 and one of 3, 4, 5, and 7, then at least two of the last three are compatible. In either case, we have a contradiction. We conclude that at least one of positions 2 and 6 must be extreme. Therefore the second and sixth letters, which must be the same by clue (4), cannot be 𝑃, so they must be 𝑁, and by clue (1) the first and fifth must be 𝑃. Clue (2) now rules out 𝑃 and 𝐹 for position 7, and the two 𝑁s have already been placed in positions 2 and 6, so position 7 must be 𝐵. We now have the solution to the stated problem: the bottle that allows them to move back is the one on the right. We have solved our puzzle, but we still don’t know how Hermione solved hers. We have determined that either position 2 or position 6 is extreme, and using this information we have narrowed down to two possible letter sequences: 𝑃 𝑃

𝑁 𝑁

𝐹 𝑃

𝑃 𝐹

𝑃 𝑃

𝑁 𝑁

𝐵 𝐵

254

Chapter 8. Miscellaneous

How can Hermione determine which is correct? The only possibility is that position 3 or 4 must be extreme, and whichever of these positions is extreme must be the location of the 𝐹. Thus, the bottle for going forward must be either smallest or largest, and the bottle for going back is the rightmost. Fans of J. K. Rowling will be pleased to know that Hermione got it right [108, p. 286]: “Got it,” she said. “The smallest bottle will get us through the black fire—toward the Stone.” Harry looked at the tiny bottle. “There’s only enough there for one of us,” he said. “That’s hardly one swallow.” They looked at each other. “Which one will get you back through the purple flames?” Hermione pointed at a rounded bottle at the right end of the line. Well done, Hermione!

95 Forbidden Polynomials All permutations except 2 4 1 3 and its inverse, 3 1 4 2, can arise. Table 95.1 shows how to get all the ones that are not forbidden. Figure 95.2 shows the graphs of these, omitting the cases where the permutation is an inverse of an earlier one, because if a set of polynomials represents some permutation, then substituting −𝑥 for 𝑥 gives polynomials that represent the inverse of the permutation. Now for the proof that 2 4 1 3 (and its inverse 3 1 4 2) cannot arise. Suppose polynomials 𝑃, 𝑄, 𝑅, 𝑆 did transform to 𝑄, 𝑆, 𝑃, 𝑅 at the origin. Then 𝑃 − 𝑃, 𝑄 − 𝑃, 𝑅 − 𝑃, 𝑆 − 𝑃 work as well. So, renaming, we may assume that 𝑃 is identically 0 and that, left of the 𝑦-axis, the others are positive; the situation is shown in Figure 95.3. Let the minimal degree of a nonzero term of polynomial 𝑓 be 𝑑(𝑓). The key two facts, for polynomials 𝑓 and 𝑔 that vanish at the origin, are the following; the proofs are easy, based on the fact that near 0 the lowest-degree nonzero term of a polynomial dominates the other terms: •

The sign of 𝑓 equals the sign of the degree-𝑑(𝑓) term of 𝑓 on any interval around the origin that contains no nonzero roots of 𝑓.

If 0 < 𝑓(𝑥) < 𝑔(𝑥) in an open interval (𝑎, 0) or (0, 𝑏), then 𝑑(𝑓) ≥ 𝑑(𝑔).

Because 𝑄 changes sign at the origin and 𝑅 does not, 𝑑(𝑄) is odd and 𝑑(𝑅) is even. From the behavior on the left, 𝑑(𝑄) ≥ 𝑑(𝑅) ≥ 𝑑(𝑆). From the behavior on the right, 0 < −𝑆 < −𝑄, so 𝑑(𝑆) ≥ 𝑑(𝑄). Therefore 𝑑(𝑆) ≥ 𝑑(𝑄) ≥ 𝑑(𝑅) ≥ 𝑑(𝑆), and they are all equal, contradicting the parity fact.

95. Forbidden Polynomials

255

Table 95.1. For all but two of the 24 permutations, there is a sequence of four polynomials that realizes that permutation. 1234 1243 1324 1342 1423 1432 2134 2143 2314 2341 2413 2431 3124 3142 3214 3241 3412 3421 4123 4132 4213 4231 4312 4321

0 −2𝑥2 −𝑥2 −𝑥2 −𝑥2 −𝑥2 −𝑥2 −𝑥2 𝑥3 𝑥

𝑥2 −𝑥2 𝑥3 𝑥3 −𝑥4 2𝑥3 −𝑥3 − 𝑥2 −𝑥3 − 𝑥2 0 −2𝑥2

2𝑥2 0 0 −𝑥4 0 𝑥3 0 0 𝑥4 −𝑥2

3𝑥2 −𝑥3 𝑥2 0 −𝑥3 0 𝑥2 −𝑥3 𝑥2 0

𝑥 0

−𝑥2 𝑥4

0 −𝑥3

−𝑥3 𝑥2

2𝑥3 𝑥 −𝑥2 2𝑥 −2𝑥2 −𝑥2 3 𝑥 − 𝑥2 𝑥 0 2𝑥

𝑥3 −𝑥2 0 𝑥 −𝑥2 𝑥3 −𝑥2 −𝑥2 𝑥2 𝑥

0 −𝑥 − 𝑥2 −𝑥2 − 𝑥 0 0 0 0 0 −𝑥 0

𝑥2 0 −𝑥 𝑥2 −𝑥 −𝑥 −𝑥 −𝑥 −2𝑥 −𝑥

3

One can get a forbidden permutation using nonpolynomial functions; for example, the following sequence uses nonanalytic, infinitely differentiable functions: (0, 𝑓1,−3 , 𝑓2,2 , 𝑓3,−2 ), where 1/𝑥 if 𝑥 < 0, ⎧𝑎𝑒 , 𝑓𝑎,𝑏 (𝑥) = 0, if 𝑥 = 0, ⎨ −1/𝑥 , if 𝑥 > 0. ⎩𝑏𝑒

Figure 95.4 shows the graphs of these functions. The discovery that there are forbidden permutations of 1 2 3 4 is due to Maxim Kontsevich. A natural generalization would be to determine which permutations of 1 2 ⋯ 𝑛 are definable by polynomials. Clearly such a permutation cannot be defined by polynomials if four of the polynomials would end up defining one of

256

Chapter 8. Miscellaneous

Figure 95.2. Graphs of the polynomials for all nonforbidden permutations. Only 16 are shown because inverses follow by reflecting in the 𝑦-axis. the two forbidden permutations of 1 2 3 4. It was shown by Étienne Ghys that this is the only restriction; any permutation not ruled out by this requirement is definable by polynomials. For details see [56].

96 A Polynomial Scandal It is helpful to first solve the problem for a polynomial 𝑓(𝑥) in one variable. For a constant polynomial, the range will be a singleton set, and every singleton is the range of a constant polynomial. If 𝑓(𝑥) is a nonconstant polynomial of odd degree, then the range of 𝑓 is (−∞, ∞). If 𝑓(𝑥) is a nonconstant polynomial of even degree, then the range will have the form [𝑎, ∞) or (−∞, 𝑎] for some real number 𝑎; for example, the range of the polynomial 𝑎+𝑥2 is [𝑎, ∞), and the range of 𝑎 − 𝑥2 is (−∞, 𝑎].

96. A Polynomial Scandal

257

Figure 95.3. These functions induce the permutation 2 4 1 3, something that cannot occur with polynomials.

Figure 95.4. Using nonanalytic functions achieves the permutation 2 4 1 3. Because a polynomial in one variable can also be considered to be a polynomial in two variables, all sets of the form {𝑎}, [𝑎, ∞), (−∞, 𝑎], or (−∞, ∞) are possible ranges for a polynomial in two variables. Are there other possibilities? Suppose 𝑓(𝑥, 𝑦) is a polynomial in 𝑥 and 𝑦. By continuity, the range must be an interval. If 𝑓(𝑥, 𝑦) is not a constant polynomial, then either there is some number 𝑎 such that 𝑓(𝑎, 𝑦) is a nonconstant polynomial in 𝑦 or there is some number 𝑏 such that 𝑓(𝑥, 𝑏) is a nonconstant polynomial in 𝑥. In either case, our solution to the one-variable case shows that the range must be an infinite interval. Thus, the only remaining possibilities for the range are sets of the form (𝑎, ∞) or (−∞, 𝑎).

258

Chapter 8. Miscellaneous

Surprisingly, although these sets are not possible as ranges of polynomials in one variable, they are possible ranges of polynomials in two variables. To prove this, we first find a polynomial in two variables whose range is (0, ∞). A natural approach is to try a polynomial of the form 𝑓(𝑥, 𝑦) = 𝑎(𝑦)𝑥2 + 𝑏(𝑦)𝑥 + 𝑐(𝑦) for some polynomials 𝑎(𝑦), 𝑏(𝑦), and 𝑐(𝑦). For fixed 𝑦, this is a function of 𝑥 whose graph is a parabola. If 𝑎(𝑦) is always positive, then this parabola will always be concave up; for example, we could let 𝑎(𝑦) = 𝑦2 + 1. With this choice, it is not hard to show that for fixed 𝑦, the minimum value of 𝑓(𝑥, 𝑦) is (4𝑦2 + 4)𝑐(𝑦) − (𝑏(𝑦))2 . (4𝑦2 + 4) We now look for polynomials 𝑏(𝑦) and 𝑐(𝑦) for which this minimum value is always positive but approaches 0 as 𝑦 → ∞; these conditions will guarantee that the range of 𝑓 is (0, ∞). A simple example is 𝑏(𝑦) = 2𝑦 and 𝑐(𝑦) = 1, for which the minimum value is 1/(𝑦2 +1). This shows that the polynomial 𝑓(𝑥, 𝑦) = (𝑦2 + 1)𝑥2 + 2𝑦𝑥 + 1 = 𝑥2 + (𝑥𝑦 + 1)2 has range (0, ∞) (see Figure 96.1). Therefore for any real number 𝑎, the range of the polynomial 𝑎 + 𝑥2 + (𝑥𝑦 + 1)2 is (𝑎, ∞), and the range of 𝑎 − 𝑥2 − (𝑥𝑦 + 1)2 is (−∞, 𝑎). We conclude that the possible ranges for polynomials in two variables are all sets of the form {𝑎}, [𝑎, ∞), (𝑎, ∞), (−∞, 𝑎], (−∞, 𝑎), or (−∞, ∞). This problem was problem A1 on the 1969 Putnam Competition. According to the report on that year’s competition [92], “When the examination was printed it was believed that [a semi-infinite open interval] was not possible. The arguments were erroneous. This extra complexity is the primary reason for the few high scores.” Only 15 of 1501 contestants scored 8 or more points (out of 10) on this problem. That was the scandal.

97 Pascal’s Determinant Here are two more ways to write Pascal’s triangle as a rectangular array: 1 0 1 1 1 2 1 3 1 4 ⋮ ⋮

0 0 1 3 6 ⋮

0 0 0 1 4 ⋮

0 0 0 0 1 ⋮

... ... ... ... ...

1 1 0 1 0 0 0 0 0 0 ⋮ ⋮

1 1 1 2 3 4 1 3 6 0 1 4 0 0 1 ⋮ ⋮ ⋮

... ... ... ... ...

For each positive integer 𝑛, let 𝐿𝑛 be the matrix consisting of the first 𝑛 rows and columns on the array on the left, and let 𝑈𝑛 be the matrix consisting of the first 𝑛 rows and columns of the array on the right. As we will show below, 𝑃𝑛 = 𝐿𝑛 𝑈𝑛 . The solution to the problem follows immediately. Since 𝐿𝑛 is lower triangular

97. Pascal’s Determinant

259

Figure 96.1. A contour plot of the polynomial 𝑓(𝑥, 𝑦) = 𝑥2 + (𝑥𝑦 + 1)2 . and all diagonal entries are 1, we have det 𝐿𝑛 = 1, and similarly det 𝑈𝑛 = 1. Therefore det 𝑃𝑛 = (det 𝐿𝑛 )(det 𝑈𝑛 ) = 1. To see why 𝑃𝑛 = 𝐿𝑛 𝑈𝑛 , we look at the (𝑖, 𝑗)-entry of 𝐿𝑛 𝑈𝑛 . (It is simplest in this problem to number the rows and columns of all matrices starting with 0 rather than 1.) We have 𝑛−1

(𝐿𝑛 𝑈𝑛 )𝑖,𝑗 = ∑ (𝐿𝑛 )𝑖,𝑘 (𝑈𝑛 )𝑘,𝑗 = 𝑘=0

min(𝑖,𝑗)

∑ 𝑘=0

𝑖 𝑗 ( )( ). 𝑘 𝑗−𝑘

The summation may be interpreted combinatorially. Let 𝐴 and 𝐵 be disjoint sets with cardinalities 𝑖 and 𝑗, respectively. Then term 𝑘 of the summation counts the number of ways of choosing 𝑘 items from 𝐴 and 𝑗 − 𝑘 items from 𝐵. Summing over 𝑘 then gives the number of ways of choosing 𝑗 items from 𝐴 ∪ 𝐵, which is 𝑖+𝑗 ( 𝑗 ) = (𝑃𝑛 )𝑖,𝑗 . Thus, (𝑃𝑛 )𝑖,𝑗 = (𝐿𝑛 𝑈𝑛 )𝑖,𝑗 , as required. Several more proofs of the equation 𝑃𝑛 = 𝐿𝑛 𝑈𝑛 can be found in [36].

260

Chapter 8. Miscellaneous

98 Pains of Imperfect Glass Let us assume that the fraction of light transmitted through a pane of glass is 𝑡 and the fraction reflected is 𝑟, where 𝑡 and 𝑟 are positive and 𝑡 + 𝑟 ≤ 1. For the stated problem, 𝑡 = 7/10 and 𝑟 = 1/5, but we will derive formulas for the general case. It is tempting to think that the fraction of light transmitted through two panes of glass will be 𝑡2 , but this only counts the light that passes directly through both panes. There is also light that passes through the first, is reflected back by the second, is reflected again by the first, and then passes through the second. The fraction of light that takes this path is 𝑡2 𝑟2 . Of course, we must also count light that bounces back and forth 𝑛 times between the two panes before passing through the second, for every 𝑛, so the total light transmitted is the sum of an infinite geometric series: 𝑡2 𝑡2 + 𝑡2 𝑟2 + 𝑡2 𝑟4 + ⋯ = . 1 − 𝑟2 (The series converges because 0 < 𝑟 ≤ 1 − 𝑡 < 1.) Similarly, the fraction of light reflected back by two panes of glass is 𝑟 + 𝑡 2 𝑟 + 𝑡 2 𝑟3 + ⋯ = 𝑟 +

𝑡2 𝑟 . 1 − 𝑟2

Thus, two panes of glass act like a pane of a new kind of glass that transmits and reflects these fractions of light. To handle more panes of glass, it is easiest to work recursively. Let 𝑡𝑛 and 𝑟𝑛 be the fractions of light transmitted and reflected by 𝑛 panes of glass. So far we have 𝑡2 𝑟 𝑡2 , 𝑟 = 𝑟 + . 𝑡1 = 𝑡, 𝑟1 = 𝑟, 𝑡2 = 2 1 − 𝑟2 1 − 𝑟2 In fact, we could start with 𝑡0 = 1, 𝑟0 = 0: with no panes of glass, all of the light is transmitted and none is reflected. Notice that 𝑡2 and 𝑟2 are positive, and 𝑡2 + 𝑟2 = 𝑟 +

𝑡2 𝑡2 (1 + 𝑟) 𝑡2 = 𝑟 + = 𝑟 + 𝑡 ≤ 1. ≤ 𝑟 + 1−𝑟 𝑡 1 − 𝑟2

Now suppose we have determined 𝑡𝑛 and 𝑟𝑛 , and they are positive numbers with 𝑡𝑛 + 𝑟𝑛 ≤ 1. To find 𝑡𝑛+1 and 𝑟𝑛+1 , consider 𝑛 + 1 panes. We treat the last 𝑛 panes as if they were a single pane of a type of glass whose transmission and reflection fractions are 𝑡𝑛 and 𝑟𝑛 . Repeating our analysis for two panes, but using these new transmission and reflection fractions for the second pane, we get: 𝑡 , 1 − 𝑟𝑛 𝑟 𝑡 = 𝑟 + 𝑡2 𝑟𝑛 + 𝑡2 𝑟𝑛2 𝑟 + ⋯ = 𝑟 + 𝑡𝑟𝑛 ⋅ . 1 − 𝑟𝑛 𝑟

𝑡𝑛+1 = 𝑡𝑡𝑛 + 𝑡𝑟𝑛 𝑟𝑡𝑛 + 𝑡𝑟𝑛2 𝑟2 𝑡𝑛 + ⋯ = 𝑡𝑛 ⋅ 𝑟𝑛+1

98. Pains of Imperfect Glass

261

Notice that these equations are correct even in the case 𝑛 = 0. Clearly 𝑡𝑛+1 and 𝑟𝑛+1 are positive, and 𝑡(𝑡𝑛 + 𝑡𝑟𝑛 ) 𝑡(𝑡 + (1 − 𝑟)𝑟𝑛 ) ≤𝑟+ 𝑛 1 − 𝑟𝑛 𝑟 1 − 𝑟𝑛 𝑟 𝑡(𝑡 + 𝑟 − 𝑟 𝑟) 𝑡(1 − 𝑟𝑛 𝑟) =𝑟+ 𝑛 𝑛 𝑛 ≤𝑟+ = 𝑟 + 𝑡 ≤ 1. 1 − 𝑟𝑛 𝑟 1 − 𝑟𝑛 𝑟

𝑡𝑛+1 + 𝑟𝑛+1 = 𝑟 +

Using these recurrences, and the values 𝑡 = 7/10 and 𝑟 = 1/5, we find that 343 645 𝑡3 = 𝑟3 = , . 902 1804 This solves the stated problem: the fraction of light transmitted through three panes of glass is 343/902. But we can do more: by solving the recurrences above, we can find general formulas for the fractions of light transmitted and reflected by 𝑛 panes of glass. To do this, it is convenient to introduce the notation 𝑎𝑛 = 𝑡/(1 − 𝑟𝑛 𝑟), since this quantity appears in both recurrence relations. Clearly 𝑎𝑛 is positive, and 𝑎𝑛 < 𝑡/(1 − 𝑟) ≤ 𝑡/𝑡 = 1. With this notation, our recurrence relations read 𝑡𝑛+1 = 𝑡𝑛 𝑎𝑛 , 𝑟𝑛+1 = 𝑟 + 𝑡𝑟𝑛 𝑎𝑛 . The first of these equations says that we can think of 𝑎𝑛 as the attenuation of transmitted light caused by adding one more pane of glass to 𝑛 panes. Applying this equation repeatedly we see that 𝑡𝑛 = 𝑡0 𝑎0 𝑎1 ⋯ 𝑎𝑛−1 = 𝑎0 𝑎1 ⋯ 𝑎𝑛−1 . We can use the second equation to derive a recurrence for 𝑎𝑛 . Rearranging the equation 𝑎𝑛 = 𝑡/(1 − 𝑟𝑛 𝑟) we get 𝑟𝑛 𝑟𝑎𝑛 = 𝑎𝑛 − 𝑡, so 𝑡 𝑡 𝑡 𝑎𝑛+1 = = = 1 − 𝑟𝑛+1 𝑟 1 − 𝑟2 − 𝑡𝑟𝑛 𝑟𝑎𝑛 1 − (𝑟 + 𝑡𝑟𝑛 𝑎𝑛 )𝑟 1 1 𝑡 = = = , 2 2 2 𝐶 − 𝑎𝑛 1 − 𝑟 − 𝑡(𝑎𝑛 − 𝑡) (1 − 𝑟 + 𝑡 )/𝑡 − 𝑎𝑛 where 𝐶 = (1 − 𝑟2 + 𝑡2 )/𝑡. Thus, the 𝑎𝑛 sequence is generated by starting with 𝑎0 = 𝑡 and then repeatedly applying the function 𝑓(𝑥) = 1/(𝐶 − 𝑥); in other words, 𝑎𝑛 = 𝑓𝑛 (𝑡). Using this formula for 𝑎𝑛 leads to continued fractions: 1 1 1 𝑎0 = 𝑡, 𝑎1 = , 𝑎2 = 𝑎3 = , ... . 1 1 , 𝐶−𝑡 𝐶− 𝐶− 1 𝐶−𝑡

𝐶−

𝐶−𝑡

Simplifying these fractions, we get: 𝑎0 = 𝑡 =

1 𝑡 , 𝑎1 = , 1 𝐶−𝑡

𝑎2 =

𝐶2

𝐶−𝑡 𝐶 2 − 𝐶𝑡 − 1 , 𝑎3 = 3 , ... . − 𝐶𝑡 − 1 𝐶 − 𝐶 2 𝑡 − 2𝐶 + 𝑡

262

Chapter 8. Miscellaneous

It appears that these numbers might best be described as 𝑎𝑛 = 𝑝𝑛 /𝑝𝑛+1 , where 𝑝0 = 𝑡, 𝑝1 = 1, 𝑝2 = 𝐶 − 𝑡, and so on. To see how this pattern will continue, we assume it holds for 𝑎𝑛 and use our recurrence relation to compute 𝑎𝑛+1 : 𝑎𝑛+1 =

𝑝𝑛+1 1 1 = . 𝑝𝑛 = 𝐶 − 𝑎𝑛 𝐶𝑝𝑛+1 − 𝑝𝑛 𝐶− 𝑝𝑛+1

Thus if we define 𝑝𝑛 by the recurrence 𝑝𝑛+2 = 𝐶𝑝𝑛+1 − 𝑝𝑛 , with 𝑝0 = 𝑡 and 𝑝1 = 1, then the formula 𝑎𝑛 = 𝑝𝑛 /𝑝𝑛+1 follows by induction. The recurrence for 𝑝𝑛 is a second-order linear recurrence, and methods for solving this kind of recurrence are well known (see, for example, [40]). It turns out that the solution depends on whether 𝑡 + 𝑟 < 1 or 𝑡 + 𝑟 = 1. If 𝑡 + 𝑟 < 1, then 𝐶 = (1 − 𝑟2 + 𝑡2 )/𝑡 > (1 − (1 − 𝑡)2 + 𝑡2 )/𝑡 = 2, and the solution is 𝑝𝑛 = 𝑏1 𝜆𝑛1 + 𝑏2 𝜆𝑛2 , where 𝜆1 = 𝑏1 =

𝐶 + √𝐶 2 − 4 , 2

𝜆2 =

1 − 𝑡2 + 𝑟2 + 𝑡√𝐶 2 − 4 2√𝐶 2 − 4

,

𝑏2 =

𝐶 − √𝐶 2 − 4 , 2 𝑡 2 − 1 − 𝑟 2 + 𝑡 √𝐶 2 − 4 2√𝐶 2 − 4

.

Notice that since 𝐶 > 2, all of these are real numbers, 𝜆1 > 1, 0 < 𝜆2 = 1/𝜆1 < 1, and 𝑏1 > 0. On the other hand, if 𝑡 + 𝑟 = 1, then 𝐶 = 2, and the solution is 𝑝𝑛 = 𝑡 + 𝑟𝑛. With these formulas for 𝑝𝑛 , we can now give general formulas for 𝑡𝑛 and 𝑟𝑛 . We have 𝑝 𝑝 𝑝 𝑝 𝑡 𝑡𝑛 = 𝑎0 𝑎1 ⋯ 𝑎𝑛−1 = 0 ⋅ 1 ⋯ 𝑛−1 = 0 = , 𝑝1 𝑝2 𝑝𝑛 𝑝𝑛 𝑝𝑛 and solving the equation 𝑎𝑛 = 𝑡/(1 − 𝑟𝑛 𝑟) for 𝑟𝑛 gives 𝑟𝑛 =

1 𝑡 1 𝑡𝑝 − = − 𝑛+1 . 𝑟 𝑟𝑎𝑛 𝑟 𝑟𝑝𝑛

In the case 𝑡 + 𝑟 < 1 we get 𝑡𝑛 =

𝑡 𝑡 = , 𝑝𝑛 𝑏1 𝜆𝑛1 + 𝑏2 𝜆𝑛2

𝑟𝑛 =

+ 𝑏2 𝜆𝑛+1 1 𝑡𝑝𝑛+1 1 𝑡(𝑏1 𝜆𝑛+1 1 2 ) − = − . 𝑛 𝑛 𝑟 𝑟𝑝𝑛 𝑟 𝑟(𝑏1 𝜆1 + 𝑏2 𝜆2 )

It is interesting to consider what happens as the number of panes of glass grows very large. As 𝑛 → ∞, 𝑝𝑛 = 𝑏1 𝜆𝑛1 + 𝑏2 𝜆𝑛2 → ∞, so 𝑡𝑛 = 𝑡/𝑝𝑛 → 0. This means

98. Pains of Imperfect Glass

263

that very little light will be transmitted through a large number of panes of glass. Also, 𝑎𝑛 =

𝑏1 𝜆𝑛1 + 𝑏2 𝜆𝑛2 𝑝𝑛 𝑏1 + 𝑏2 (𝜆2 /𝜆1 )𝑛 1 = → = = 𝜆2 . 𝑛+1 𝑛+1 𝑛 𝑝𝑛+1 𝜆 𝑏 𝜆 + 𝑏 𝜆 (𝜆 /𝜆 ) 𝑏1 𝜆1 + 𝑏2 𝜆2 1 1 1 2 2 2 1

Thus, once you have a large number of panes of glass, the addition of one more causes an attenuation of about 𝜆2 . Finally, 𝑟𝑛 =

1 − 𝑡𝜆1 1 𝑡 → − . 𝑟 𝑟𝑎𝑛 𝑟

A large number of panes will reflect roughly this fraction of light. For the original problem, with 𝑡 = 7/10 and 𝑟 = 1/5, the values of the parameters in our formulas are: 29 + √57 , 28 399 + 77√57 𝑏1 = , 1140

𝜆1 =

29 − √57 , 28 399 − 77√57 𝑏2 = . 1140

𝜆2 =

The limiting value of 𝑎𝑛 is (29 − √57)/28 ≈ 0.766, and the limiting value of 𝑟𝑛 is (11 − √57)/8 ≈ 0.431. This means that if you have a large number of panes of this glass, then adding one more pane will reduce the transmitted light to about 76.6% of its former value, a bit more than the 70% transmitted by a single pane. And a large collection of panes will reflect about 43.1% of the light that strikes it, quite a bit more than the 20% reflected by a single pane. Very little light will get through the collection of panes, so almost all of the remaining 56.9% of the light will be absorbed by the glass. When 𝑡 + 𝑟 = 1, the formulas are much simpler. We have 𝑡 + 𝑟𝑛 𝑡 + 𝑟𝑛 = , 𝑡 + 𝑟𝑛 + 𝑟 1 + 𝑟𝑛 𝑡 𝑡 , 𝑡𝑛 = = 𝑝𝑛 𝑡 + 𝑟𝑛 1 𝑡 1 𝑡𝑝 𝑡 1 𝑡(𝑡 + 𝑟𝑛 + 𝑟) = − − 𝑟𝑛 = − 𝑛+1 = − = 1 − 𝑡𝑛 . 𝑟 𝑟𝑝𝑛 𝑟 𝑟 𝑟 𝑡 + 𝑟𝑛 𝑟(𝑡 + 𝑟𝑛)

𝑎𝑛 =

In this case, the glass absorbs none of the light, so all of it is either transmitted or reflected. As 𝑛 → ∞, we have 𝑎𝑛 → 1, 𝑡𝑛 → 0, and 𝑟𝑛 → 1. Thus, once you have a large number of panes, very little light will be transmitted, almost all light will be reflected, and adding an additional pane will have very little effect on the transmitted light. This problem is due to Johan H. Meyer, University of the Orange Free State, Bloemfontein, South Africa.

264

Chapter 8. Miscellaneous

99 On the Highway It is tempting to think that the number of cars going faster than Alice must have been the same as the number going slower, so her speed was the median. But in fact, it was the mean! Suppose Alice’s speed was 𝑎 miles per hour. If 𝑠 ∈ 𝑆 and 𝑠 > 𝑎, then a car going 𝑠 miles per hour would have passed Alice during her hour of driving if and only if it started at most 𝑠 − 𝑎 miles behind Alice. Since 𝑠 − 𝑎 is an integer and each mile contained 𝑑𝑠 cars going 𝑠 miles per hour, the number of cars going 𝑠 miles per hour that passed Alice was (𝑠 − 𝑎)𝑑𝑠 . Similarly, if 𝑠 ∈ 𝑆 and 𝑠 < 𝑎, then the number of cars going 𝑠 miles per hour that Alice passed was (𝑎 − 𝑠)𝑑𝑠 . Since the number of cars that Alice passed was the same as the number that passed her, ∑ (𝑠 − 𝑎)𝑑𝑠 = 𝑠∈𝑆,𝑠>𝑎

∑ (𝑎 − 𝑠)𝑑𝑠 , 𝑠∈𝑆,𝑠𝑎

∑ (𝑠 − 𝑎)𝑑𝑠 = 0. 𝑠∈𝑆,𝑠 0. For 𝑛 ≥ 0, if there are at least 𝑛 collisions, then let 𝑣𝑛 be the velocity of 𝐿 after the 𝑛th collision, and let 𝑢𝑛 be the velocity of 𝑅, with positive velocity indicating motion to the right. We choose our units so that the initial velocity of 𝑅 is −1, so 𝑢0 = −1 and 𝑣0 = 0. Notice that the total kinetic energy of the two blocks is conserved in both kinds of collisions, and therefore for all 𝑛, 𝑀𝑢20 𝑣02 𝑀𝑢2𝑛 𝑣𝑛2 𝑀 + = + = , 2 2 2 2 2 or equivalently, 𝑣2 𝑢2𝑛 + 𝑛 = 1. 𝑀 In other words, the point (𝑢𝑛 , 𝑣𝑛 /√𝑀) lies on the unit circle 𝑥2 +𝑦2 = 1. Therefore there is some angle 𝛼𝑛 such that 𝑢𝑛 = cos 𝛼𝑛 and 𝑣𝑛 = √𝑀 sin 𝛼𝑛 . We will find it convenient to choose 𝛼𝑛 in the range −𝜋 < 𝛼𝑛 ≤ 𝜋. As we will see, there is a simple formula for 𝛼𝑛 . Notice that if the point (𝑢𝑛 , 𝑣𝑛 /√𝑀) lies on the 𝑥-axis, then 𝑣𝑛 = 0, so block 𝐿 is stationary. If it is below the 𝑥-axis, then 𝑣𝑛 < 0, so 𝐿 is sliding to the left, and if it is above the 𝑥-axis, then 𝑣𝑛 > 0 and 𝐿 is sliding to the right. Rephrasing this in terms of 𝛼𝑛 , we see that if 𝛼𝑛 is either 0 or 𝜋, then 𝑣𝑛 = 0, if −𝜋 < 𝛼𝑛 < 0, then 𝑣𝑛 < 0, and if 0 < 𝛼𝑛 < 𝜋, then 𝑣𝑛 > 0. We will also be interested in comparing the velocities of the two blocks. These velocities are equal if and only if the point (𝑢𝑛 , 𝑣𝑛 /√𝑀) lies on the line 𝑦 = 𝑥/√𝑀. If the point is below this line, then 𝑣𝑛 < 𝑢𝑛 , so the blocks are getting further apart, and if it is above the line, then 𝑣𝑛 > 𝑢𝑛 and the blocks are getting closer together. To see how this relates to 𝛼𝑛 , let 𝛿 = tan−1 (1/√𝑀). Then 0 < 𝛿 < 𝜋/2 and tan 𝛿 = 1/√𝑀; for later reference, we note that cos 𝛿 = √𝑀/√𝑀 + 1 and sin 𝛿 = 1/√𝑀 + 1. We conclude that if either 𝛼𝑛 = 𝛿 or 𝛼𝑛 = −𝜋 + 𝛿, then 𝑣𝑛 = 𝑢𝑛 , if −𝜋 + 𝛿 < 𝛼𝑛 < 𝛿, then 𝑣𝑛 < 𝑢𝑛 , and if either 𝛿 < 𝛼𝑛 ≤ 𝜋 or −𝜋 < 𝛼𝑛 < −𝜋 + 𝛿, then 𝑣𝑛 > 𝑢𝑛 . This is illustrated in Figure 105.2. Suppose 𝑛 ≥ 0 and there are at least 2𝑛 collisions. If 𝑛 = 0, then the initial conditions tell us that 𝛼2𝑛 = 𝛼0 = 𝜋. If 𝑛 > 0, then collision number 2𝑛 is between 𝐿 and the wall, and after the collision 𝐿 is sliding to the right, so 0 < 𝛼2𝑛 < 𝜋. Thus, in either case we have 0 < 𝛼2𝑛 ≤ 𝜋. Will there be another collision? It depends on which is larger, 𝑢2𝑛 or 𝑣2𝑛 : if 𝑣2𝑛 > 𝑢2𝑛 , then the blocks are approaching each other and they will eventually collide, but if 𝑣2𝑛 ≤ 𝑢2𝑛 , then they won’t. By our earlier observations this means we have the following

105. The Miracle of the Colliding Blocks

271

Figure 105.2. If the point (𝑢𝑛 , 𝑣𝑛 /√𝑀) lies on the blue part of the circle, then 𝐿 is moving left; if it is on the red part, then 𝐿 is moving right. If the point is on the dashed part of the circle, then the blocks are getting further apart, and if it is on the solid part, then the blocks are getting closer together. stopping condition after an even number of collisions: collision 2𝑛 is the last collision if and only if 𝛼2𝑛 ≤ 𝛿.

(105.1)

Suppose 𝛿 < 𝛼2𝑛 ≤ 𝜋, so there will be a collision number 2𝑛 + 1. To find 𝛼2𝑛+1 we use conservation of momentum, which tells us that 𝑀𝑢2𝑛+1 + 𝑣2𝑛+1 = 𝑀𝑢2𝑛 + 𝑣2𝑛 . Rewriting this in terms of 𝛼2𝑛 and 𝛼2𝑛+1 we have 𝑀 cos 𝛼2𝑛+1 + √𝑀 sin 𝛼2𝑛+1 = 𝑀 cos 𝛼2𝑛 + √𝑀 sin 𝛼2𝑛 . We now divide by √𝑀 √𝑀 + 1 to get √𝑀 √𝑀 + 1

cos 𝛼2𝑛+1 +

1 √𝑀 + 1

sin 𝛼2𝑛+1 =

√𝑀 √𝑀 + 1

cos 𝛼2𝑛 +

1 √𝑀 + 1

sin 𝛼2𝑛 .

This can be rewritten as cos 𝛿 cos 𝛼2𝑛+1 + sin 𝛿 sin 𝛼2𝑛+1 = cos 𝛿 cos 𝛼2𝑛 + sin 𝛿 sin 𝛼2𝑛 , which simplifies to cos(𝛼2𝑛+1 − 𝛿) = cos(𝛼2𝑛 − 𝛿). This momentum conservation equation gives us two possibilities for 𝛼2𝑛+1 . One possibility is that 𝛼2𝑛+1 = 𝛼2𝑛 . This is what would happen if, when the blocks meet, they pass through each other and maintain their velocities. Of course momentum would be conserved in that case, but it is not what actually

272

Chapter 8. Miscellaneous

happens. The only other possibility is that 𝛼2𝑛+1 − 𝛿 = −(𝛼2𝑛 − 𝛿) + 2𝜋𝑘 for some integer 𝑘. Thus 𝛼2𝑛+1 = −𝛼2𝑛 + 2𝛿 + 2𝜋𝑘, where the value of 𝑘 is determined by the requirement that −𝜋 < 𝛼2𝑛+1 ≤ 𝜋. But 𝛿 < 𝛼2𝑛 ≤ 𝜋 implies that −𝜋 + 2𝛿 ≤ −𝛼2𝑛 + 2𝛿 < 𝛿, so 𝑘 = 0 and we have 𝛼2𝑛+1 = −𝛼2𝑛 + 2𝛿.

(105.2)

Notice that −𝜋 + 𝛿 < 𝛼2𝑛+1 < 𝛿, so after collision number 2𝑛 + 1 the blocks are getting further apart, as one would expect. Will there be another collision? This time the determining factor is the sign of 𝑣𝑛 : if 𝑣𝑛 < 0, then 𝐿 will move left and eventually hit the wall, and if 𝑣𝑛 ≥ 0, then there will be no further collisions. Once again, our earlier observations turn this into a simple stopping condition: collision 2𝑛 + 1 is the last collision if and only if 𝛼2𝑛+1 ≥ 0.

(105.3)

If 𝛼2𝑛+1 < 0, then the next collision is easy to understand: block 𝐿 reverses direction but maintains the same speed, and the velocity of block 𝑅 is unchanged. This means that 𝛼2𝑛+2 = −𝛼2𝑛+1 . (105.4) We now have in place all of the facts we need to analyze the sequence of collisions. Combining equations (105.2) and (105.4), we get 𝛼2𝑛+2 = 𝛼2𝑛 − 2𝛿. Since the initial condition tells us that 𝛼0 = 𝜋, we see that if there are at least 2𝑛 collisions, then 𝛼2𝑛 = 𝜋 − 2𝑛𝛿. (105.5) And substituting this value into (105.2) we see that if there are at least 2𝑛 + 1 collisions, then 𝛼2𝑛+1 = −𝜋 + (2𝑛 + 2)𝛿. (105.6) Figure 105.3 shows how the points (cos 𝛼𝑛 , sin 𝛼𝑛 ) = (𝑢𝑛 , 𝑣𝑛 /√𝑀) move around the unit circle in the case 𝑀 = 16. Finally, we can substitute the values in equations (105.5) and (105.6) into our stopping conditions (105.1) and (105.3). For any 𝑛, if there are at least 2𝑛 collisions, then collision 2𝑛 is the last if and only if 𝜋 − 2𝑛𝛿 ≤ 𝛿, or equivalently 𝜋/𝛿 ≤ 2𝑛 + 1. If there are at least 2𝑛 + 1 collisions, then collision 2𝑛 + 1 is the last if and only if −𝜋 + (2𝑛 + 2)𝛿 ≥ 0, or equivalently 𝜋/𝛿 ≤ 2𝑛 + 2. Thus, the number of collisions is the unique integer 𝑁 such that 𝑁 < 𝜋/𝛿 ≤ 𝑁 + 1, or equivalently 𝜋/𝛿 − 1 ≤ 𝑁 < 𝜋/𝛿. In other words, the number of collisions is ⌈𝜋/𝛿 − 1⌉. In the case 𝑀 = 1010 we get 𝜋/𝛿 ≈ 314159.3, so ⌈𝜋/𝛿 − 1⌉ = 314159. Why are the digits of 𝜋 appearing in the answer? Intuitively, the explanation is that for small 𝑥, tan−1 𝑥 ≈ 𝑥. For 𝑀 = 1010 , this means that 𝛿 = tan−1 (1/√𝑀) = tan−1 (1/105 ) ≈ 1/105 , and therefore 𝜋/𝛿 ≈ 105 𝜋 = 314159.2. . .. Before making this intuitive explanation precise, we generalize. Suppose 𝑀 = 102𝑘 for some integer 𝑘 ≥ 0. Table 105.1 shows the computation of the number of collisions for 0 ≤ 𝑘 ≤ 5. The table suggest a conjecture. Let the 𝑛th digit

105. The Miracle of the Colliding Blocks

6 4

273

8 10

2 12 0 11 1 9 3 5

7

= Figure 105.3. The points (cos 𝛼𝑛 , sin 𝛼𝑛 ) (𝑢𝑛 , 𝑣𝑛 /√𝑀) in the case 𝑀 = 16. Each point is labeled with the value of 𝑛. Notice that 𝛼12 < 𝛿 = tan−1 (1/4), so the 12th collision is the last. Table 105.1. Computing the number of collisions when 𝑀 = 102𝑘 . 𝑘 0 1 2 3 4 5

𝑀 = 102𝑘 1 100 104 106 108 1010

𝛿 = tan−1 (1/√𝑀) 𝜋/4 0.099669 0.0099997 0.001 0.0001 0.00001

𝜋/𝛿 4 31.5 314.2 3141.6 31415.9 314159.3

Number of collisions 3 31 314 3141 31415 314159

of 𝜋 after the decimal point be 𝑑𝑛 , so that, in decimal notation, 𝜋 = 3.𝑑1 𝑑2 𝑑3 . . .. Then it appears that when 𝑀 = 102𝑘 , the number of collisions is 𝑁𝑘 = 3𝑑1 𝑑2 . . .𝑑𝑘 , the integer whose digits are the first 𝑘 + 1 digits of 𝜋. The table confirms the conjecture for 𝑘 ≤ 5. To investigate the conjecture for 𝑘 > 5, we begin by studying the accuracy of our approximation of tan−1 𝑥. For any 𝑥 > 0, the mean value theorem applied to the inverse tangent function on

274

Chapter 8. Miscellaneous

the interval [0, 𝑥] tells us that there is some number 𝑐 between 0 and 𝑥 such that tan−1 𝑥 1 = . 𝑥 1 + 𝑐2 Since 0 < 𝑐 < 𝑥, we conclude that 𝑥 < tan−1 𝑥 < 𝑥. 1 + 𝑥2 Applying this inequality to 𝛿 = tan−1 (1/√𝑀) = tan−1 (1/10𝑘 ), we find that 𝜋 𝜋 10𝑘 𝜋 < < 10𝑘 𝜋 + 𝑘 . 𝛿 10 Thus, if there are 𝑁 collisions, then 𝜋 𝜋 𝜋 10𝑘 𝜋 − 1 < − 1 ≤ 𝑁 < < 10𝑘 𝜋 + 𝑘 . 𝛿 𝛿 10 In other words, the number of collisions must belong to the interval (10𝑘 𝜋 − 1, 10𝑘 𝜋 + 𝜋/10𝑘 ). The width of this interval is just slightly more than 1. Thus, the interval probably contains only one integer, and that integer must be the number of collisions, but there is a slight chance that it might contain two integers. Writing the relevant quantities in decimal notation, we have 𝜋 10𝑘 𝜋 = 3𝑑1 𝑑2 . . .𝑑𝑘 .𝑑𝑘+1 𝑑𝑘+2 . . ., = 0.00. . .03𝑑1 𝑑2 . . .. ⏟ 10𝑘 𝑘−1 zeros It is clear now that 𝑁𝑘 = 3𝑑1 𝑑2 . . .𝑑𝑘 belongs to the interval (10𝑘 𝜋 − 1, 10𝑘 𝜋 + 𝜋/10𝑘 ). It is possible that 𝑁𝑘 +1 also belongs to this interval, but this could happen only if, when 𝜋/10𝑘 is added to 10𝑘 𝜋, there is a carry into the ones place, and this can’t happen unless there are 𝑘 − 1 consecutive 9s in the decimal expansion of 𝜋, starting at digit 𝑘 + 1 after the decimal point. Thus the number of collisions is either 𝑁𝑘 or 𝑁𝑘 + 1, and if the 𝑘 − 1 digits of 𝜋 starting at digit 𝑘 + 1 are not all 9s, then it must be 𝑁𝑘 . Over a trillion digits of 𝜋 have been computed, and some strings of consecutive 9s have been found. Starting at digit 762 after the decimal point, there is a string of six consecutive 9s. The longest known sequence of consecutive 9s has length 14, and starts in position 5758910552709 (see [10], [99, sequence A048940]). These sequences are not nearly long enough to create a situation in which the number of collisions is 𝑁𝑘 + 1 rather than 𝑁𝑘 . It seems very unlikely that such a situation will arise beyond the first trillion digits. Can we estimate the probability? Of course, this question makes no sense: 𝜋 is a determinate number, and either the required sequence of 9s appears in its decimal expansion or it doesn’t; probability theory doesn’t enter into it. But the digits of 𝜋 look random; indeed, it has been conjectured that they do behave, on a large scale, as if they were occurring randomly (precisely, 𝜋 is conjectured to be a normal number), and statistical tests support this conjecture (see, for example, [6, 7, 62, 133]). So we can ask the

105. The Miracle of the Colliding Blocks

275

question: if the digits of a number are chosen at random, what is the probability that for some 𝑘 ≥ 1012 , the 𝑘 − 1 digits starting in position 𝑘 + 1 are all 9s? For any particular 𝑘, the probability of a sequence of 𝑘 − 1 consecutive 9s in the required positions is 1/10𝑘−1 , so the probability of such a sequence occurring for at least one 𝑘 ≥ 1012 is at most ∞

∑ 𝑘=1012

12

1/1010 −1 1 1 = . = 9/10 10𝑘−1 9 ⋅ 101012 −2

So it seems that we can be fairly confident that for every 𝑘, if 𝑀 = 102𝑘 , then there will be exactly 𝑁𝑘 collisions, but we don’t have a proof. There are some other values of 𝑀 that lead to interesting motions of the blocks. For example, if 𝑀 = 3, then 𝛿 = tan−1 (1/√3) = 𝜋/6, and the sequence of values of 𝛼𝑛 is (𝜋, −2𝜋/3, 2𝜋/3, −𝜋/3, 𝜋/3, 0). Translating these values back into velocities, we see that the sequence of events is as follows. After the first collision, block 𝑅 continues moving left, but at speed 1/2, and block 𝐿 moves left at speed 3/2. After 𝐿 bounces off the wall, the blocks collide again, after which 𝐿 travels to the left at speed 3/2 and 𝑅 to the right at speed 1/2. Now the sequence of events up to this point plays out again exactly in reverse. Block 𝐿 bounces off the wall again, and after the fifth and last collision block 𝐿 is at rest in its original location and block 𝑅 travels off to the right with speed 1. If 𝑀 = 1/3, then 𝛿 = tan−1 (√3) = 𝜋/3, and there are only two collisions. After the first collision, 𝐿 travels left and 𝑅 travels right, both at speed 1/2. After 𝐿 bounces off the wall, both blocks slide to the right forever at speed 1/2. The phenomenon in this problem was discovered by Gregory Galperin [55]. A beautiful sequence of videos illustrating the solution can be found at [113].

Bibliography [1] A. Aleksenko and A. Plakhov, Bodies of zero resistance and bodies invisible in one direction, Nonlinearity 22 (2009), no. 6, 1247–1258, DOI 10.1088/0951-7715/22/6/001. MR2507320 [2] N. Alon and M. Dubiner, Zero-sum sets of prescribed size, Combinatorics, Paul Erdős is Eighty, vol. 1, Bolyai Soc. Math. Stud., János Bolyai Math. Soc., Budapest, 1993, pp. 33–50. MR1249703 [3] L. Alonso, E. M. Reingold, and R. Schott, Determining the majority, Inform. Process. Lett. 47 (1993), no. 5, 253–255, DOI 10.1016/0020-0190(93)90135-V. MR1245142 [4] J. M. Ash, M. Ash, and P. Ash, Constructing a quadrilateral inside another one, Math. Gaz. 93 (2009), 522–532. [5] J. S. Athreya, B. Reznick, and J. T. Tyson, Cantor set arithmetic, Amer. Math. Monthly 126 (2019), no. 1, 4–17, DOI 10.1080/00029890.2019.1528121. MR3904605 [6] D. H. Bailey and J. Borwein, Pi day is upon us again and we still do not know if pi is normal, Amer. Math. Monthly 121 (2014), no. 3, 191–206, DOI 10.4169/amer.math.monthly.121.03.191. MR3168990 [7] D. H. Bailey, J. M. Borwein, C. S. Calude, M. J. Dinneen, M. Dumitrescu, and A. Yee, An empirical approach to the normality of 𝜋, Exp. Math. 21 (2012), no. 4, 375–384, DOI 10.1080/10586458.2012.665333. MR3004253 [8] B. A. Balof, A. T. Benjamin, J. Cordes, and J. Kisenwether, Bingo paradoxes, The Mathematics of Various Entertaining Subjects, vol. 3, Princeton Univ. Press, Princeton, NJ, 2019, pp. 77–90. MR3931805 [9] G. I. Bell, D. S. Hirschberg, and P. Guerrero-García, The minimum size required of a solitaire army, Integers 7 (2007), G07, 22. MR2342185 [10] F. Bellard, Pi digits, https://bellard.org/pi/pi2700e9/pidigits.html. [11] A. Benjamin, J. Kisenwether, and B. Weiss, The BINGO paradox, Math Horiz. 25 (2017), no. 1, 18–21, DOI 10.4169/mathhorizons.25.1.18. MR3714339 [12] A. Berger and T. P. Hill, An Introduction to Benford’s Law, Princeton University Press, Princeton, NJ, 2015. MR3242822 [13] G. Bor, M. Levi, R. Perline, and S. Tabachnikov, Tire tracks and integrable curve evolution, http://www.math.psu.edu/tabachni/prints/main.pdf. [14] R. S. Boyer and J. S. Moore, A fast majority vote algorithm, Automated Reasoning: Essays in Honor of Woody Bledsoe (R. S. Boyer, ed.), Automated Reasoning Series, Kluwer Academic Publishers, Dordrecht, The Netherlands, 1991, pp. 105–117. [15] D. Bressoud and S. Wagon, A Course in Computational Number Theory, Key College Publishing, Emeryville, CA; in cooperation with Springer-Verlag, New York, 2000. With 1 CD-ROM (Windows, Macintosh and UNIX). MR1756372 [16] A. Brown, A circle-stacking theorem, Math. Mag. 76 (2003), no. 4, 301–302. MR1573699 [17] J. Bryant and C. Sangwin, How Round is Your Circle?: Where Engineering and Mathematics Meet, Princeton University Press, Princeton, NJ, 2008. MR2377148 [18] J. Buhler and E. Berlekamp, Puzzles column, The Emissary, MSRI Newsletter, http://www. msri.org/web/msri/about-msri/news/emissary-newsletter.

277

278

Bibliography

[19] J. Buhler, L. Carter, and R. Stong, Problem 12104, Amer. Math. Monthly 126 (2019), 370. [20] J. Buhler, S. Golan, R. Pratt, and S. Wagon, Symmetric Littlewood polynomials and equalmoment partitions, to appear. [21] S. Cambie, Symmetric punctured intervals tile ℤ3 , https://arxiv.org/pdf/1808.05433. pdf. [22] L. Carter and S. Wagon, The Mensa correctional institute, Amer. Math. Monthly 125 (2018), no. 4, 306–319, DOI 10.1080/00029890.2018.1418100. MR3779218 [23] L. Clevenson, M. Schilling, A. Watkins, and W. Watkins, The average speed on the highway, College Math. J. 32 (2001), 169–171. [24] G. Cohen (ed.), 50 Mathematical Puzzles & Problems, Red Collection, Key Curriculum Press, 2001. [25] G. Cohen, I. Honkala, S. Litsyn, and A. Lobstein, Covering Codes, North-Holland Mathematical Library, vol. 54, North-Holland Publishing Co., Amsterdam, 1997. MR1453577 [26] M. M. Conroy, A collection of dice problems, https://www.madandmoonly.com/ doctormatt/mathematics/dice1.pdf. [27] B. Cox and S. Wagon, Nonplanar rectangular heptagons, Wolfram Demonstrations Project, http://demonstrations.wolfram.com/NonplanarRectangularHeptagons. [28] B. J. Cox, On regular seven-membered loops in ℝ3 with arbitrary join angle, Z. Angew. Math. Phys. 67 (2016), no. 3, Art. 52, 17, DOI 10.1007/s00033-016-0635-1. MR3492052 [29] E. Curtin and S. Warshauer, The locker puzzle, Math. Intelligencer 28 (2006), no. 1, 28–31. [30] M. Deakin, A new look at Eddington’s liar problem, Math. Gaz 93 (2009), 1–6. [31] A. DeMorgan, A Budget of Paradoxes, Longmans, Green, and Co., London, 1872. [32] G. Dresden, K. Hess, S. Islam, J. Rouse, A. Schmitt, E. Stamm, T. Warren, and P. Yue, When is 𝑎𝑛 + 1 the sum of two squares?, Involve 12 (2019), no. 4, 585–605, DOI 10.2140/involve.2019.12.585. MR3941600 [33] S. R. Dunbar, Reinier J. C. Bosman, and Sander E. M. Nooij, The track of a bicycle back tire, Math. Mag. 74 (2001), no. 4, 273–287. MR1573543 [34] C. V. Durell, A Concise Geometrical of Conics, Macmillan and Co., London, 1927. [35] A. Eddington, New Pathways in Science, Cambridge Univ. Press, Cambridge, UK, 1935. [36] A. Edelman and G. Strang, Pascal matrices, Amer. Math. Monthly 111 (2004), no. 3, 189–197, DOI 10.2307/4145127. MR2042124 [37] J. Eells, The surfaces of Delaunay, Math. Intelligencer 9 (1987), no. 1, 53–57, DOI 10.1007/BF03023575. MR869541 [38] M. Elgersma and S. Wagon, A stable cup of coffee, UMAP J. 37 (2016), no. 1, 19–41. [39] G. E. Engebretsen, Problem 2883, School Science and Mathematics 63 (1963), 604. [40] S. Epp, Discrete Mathematics with Applications, 5th ed., Cengage Learning, Boston, 2020. [41] P. Erdős, A. Ginzburg, and A. Ziv, Theorem in the additive number theory, Bull. Res. Council Israel Sect. F 10F (1961), no. 1, 41–43. MR3618568 [42] V. Faber and J. Mycielski, The shortest curve that meets all the lines that meet a convex body, Amer. Math. Monthly 93 (1986), no. 10, 796–801, DOI 10.2307/2322935. MR867106 [43] V. Faber, J. Mycielski, and P. Pedersen, On the shortest curve which meets all the lines which meet a circle, Ann. Polon. Math. 44 (1984), no. 3, 249–266, DOI 10.4064/ap-44-3-249-266. MR817799 [44] S. R. Finch, Mathematical Constants, Encyclopedia of Mathematics and its Applications, vol. 94, Cambridge University Press, Cambridge, 2003. MR2003519 [45] D. Finn, Can a bicycle create a unicycle track?, College Math. J. 33 (2002), 283–292. [46] M. J. Fischer and S. L. Salzberg, Finding a majority among 𝑛 votes, J. Algorithms 3 (1982), 362– 380. [47] D. Flath, C. Stoll, and S. Wagon, Rocket math, College Math. J. 35 (2004), 262–273.

Bibliography

279

[48] R. Foote, M. Levi, and S. Tabachnikov, Tractrices, bicycle tire tracks, hatchet planimeters, and a 100-year-old conjecture, Amer. Math. Monthly 120 (2013), no. 3, 199–216, DOI 10.4169/amer.math.monthly.120.03.199. MR3030293 [49] A. Friedland, Puzzles in Math and Logic, Dover, New York, 1971. [50] E. Friedman, Problem of the month (February 1999), https://www2.stetson.edu/ ~efriedma/mathmagic/0299.html. [51] E. Friedman, Problem of the month (November 2005), https://www2.stetson.edu/ ~efriedma/mathmagic/1105.html. [52] E. Friedman, Squares touching a constant number of other squares, Geombinatorics 12 (2002), no. 2, 55–60. MR1932414 [53] H. Friedman, Enormous integers in real life, unpublished notes, 2000; https://cpb-us-w2. wpmucdn.com/u.osu.edu/dist/1/1952/files/2014/01/EnormousInt.12pt.6_1_0023kmig3.pdf. [54] A. Frohmader, More constructions for Turán’s (3, 4)-conjecture, Electron. J. Combin. 15 (2008), no. 1, Research Paper 137, 23. MR2465761 [55] G. Galperin, Playing pool with 𝜋 (the number 𝜋 from a billiard point of view), Regul. Chaotic Dyn. 8 (2003), no. 4, 375–394, DOI 10.1070/RD2003v008n04ABEH000252. MR2023043 [56] É. Ghys, A Singular Mathematical Promenade, ENS Éditions, Lyon, 2017. MR3702027 [57] E. Glazer, Choiceless probability paradoxes via box games, unpublished notes, 2019. [58] G. Gordon, The playground!, Math Horizons 23 (2016), no. 4, 31–33. [59] G. Gordon, The playground!, Math Horizons 24 (2016), no. 2, 30–33. [60] B. Gourévitch, 𝑒 and 𝜋 in a mirror, http://www.pi314.net/eng/miroir.php. [61] C. Greene and D. J. Kleitman, Strong versions of Sperner’s theorem, J. Combinatorial Theory Ser. A 20 (1976), no. 1, 80–88, DOI 10.1016/0097-3165(76)90079-0. MR389608 [62] Q. F. Gronau and E.-J. Wagenmakers, Bayesian evidence accumulation in experimental mathematics: A case study of four irrational numbers, Exp. Math. 27 (2018), no. 3, 277–286, DOI 10.1080/10586458.2016.1256006. MR3857664 [63] B. Grünbaum, Venn diagrams and independent families of sets, Math. Mag. 48 (1975), 12–23, DOI 10.2307/2689288. MR376402 [64] V. Gruslys, I. Leader, and T. S. Tan, Tiling with arbitrary tiles, arXiv:1505.03697 (2015). [65] S. D. Guest and P. W. Fowler, Mobility of ‘𝑁-loops’: Bodies cyclically connected by intersecting revolute hinges, Proc. R. Soc. Lond. Ser. A Math. Phys. Eng. Sci. 466 (2010), no. 2113, 63–77, DOI 10.1098/rspa.2009.0370. MR2564917 [66] G. Hamilton, K. S. Kedlaya, and H. Picciotto, Square-sum pair partitions, College Math. J. 46 (2015), no. 4, 264–269, DOI 10.4169/college.math.j.46.4.264. MR3449819 [67] C. S. Hardin and A. D. Taylor, The Mathematics of Coordinated Inference: A Study of Generalized Hat Problems, Developments in Mathematics, vol. 33, Springer, Cham, 2013. MR3100500 [68] G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers, 6th ed., Oxford University Press, Oxford, 2008. Revised by D. R. Heath-Brown and J. H. Silverman; With a foreword by Andrew Wiles. MR2445243 [69] S. Hart, Pursuing to the limit, http://www.ma.huji.ac.il/hart/puzzle/pursuit.pdf. [70] L. Hoehn, Area relations on the skewed chessboard, College Math. J. 34 (2003), 232–236. [71] R. Honsberger, Mathematical Diamonds, The Dolciani Mathematical Expositions, vol. 26, Mathematical Association of America, Washington, DC, 2003. MR1958945 [72] G. Kalai, Test your intuition 30: Expected number of dice throws, https://gilkalai. wordpress.com/2017/09/07/tyi-30-expected-number-of-dice-throws. [73] G. Kalai, Test your intuition 35: What is the limiting distance?, https://gilkalai. wordpress.com/2018/06/29/test-your-intuition-35-what-is-the-limitingdistance. [74] J. Kariv, C. van Allen, and D. Yeroshkin, Computing optimal strategies for a cooperative hat game, https://arxiv.org/abs/1407.4711.

280

Bibliography

[75] P. Keevash, Hypergraph Turán Problems, Surveys in Combinatorics 2011, London Math. Soc. Lecture Note Ser., vol. 392, Cambridge Univ. Press, Cambridge, 2011, pp. 83–139. MR2866732 [76] D. Kennefick, No Shadow of a Doubt: The 1919 Eclipse That Confirmed Einstein’s Theory of Relativity, Princeton Univ. Press, Princeton, NJ, 2019. [77] T. Khovanova, Martin Gardner’s mistake, College Math. J. 43 (2012), no. 1, 20–24, DOI 10.4169/college.math.j.43.1.020. MR2875552 [78] T. Khovanova, A line of sages, Math. Intelligencer 36 (2014), no. 3, 44–46. [79] J. Kiefer, Sequential minimax search for a maximum, Proc. Amer. Math. Soc. 4 (1953), 502–506, DOI 10.2307/2032161. MR55639 [80] T. Kilkelly, The ARML Power Contest, MSRI Mathematical Circles Library, vol. 15, American Mathematical Society, Providence, RI; Mathematical Sciences Research Institute, Berkeley, CA, 2014. MR3290247 [81] L. A. S. Kirby and J. B. Paris, Initial segments of models of Peano’s axioms, Set theory and hierarchy theory, V (Proc. Third Conf., Bierutowice, 1976), Lecture Notes in Math., vol. 619, Springer, Berlin, 1977, pp. 211–226. MR0491157 [82] J. D. E. Konhauser, D. Velleman, and S. Wagon, Which Way Did the Bicycle Go? . . . and Other Intriguing Mathematical Mysteries, Dolciani Mathematical Expositions, vol. 18, Math. Assoc. of Amer., Washington, 1996. [83] A. G. Konheim and B. Weiss, An occupancy discipline and applications, SIAM J. Appl. Math. 14 (1966), no. 6, 1266–1274. [84] D. N. Kozlov and V. H. Vu, Coins and cones, J. Combin. Theory Ser. A 78 (1997), no. 1, 1–14, DOI 10.1006/jcta.1996.2724. MR1439629 [85] A. S. Landsberg, Letter to the editor, Math. Intelligencer 31 (2009), no. 2, 1. [86] J. Lee and S. Wagon, Problem 12006, Amer. Math. Monthly 124 (2017), 970, solution 126 (2019), 475–476. [87] D. Leites (ed.), 60-Odd Years of Moscow Mathematical Olympiads. [88] M. Levi and S. Tabachnikov, On bicycle tire tracks geometry, hatchet planimeter, Menzin’s conjecture, and oscillation of unicycle tracks, Experiment. Math. 18 (2009), no. 2, 173–186. MR2549686 [89] R. Mabry, Crosscut convex quadrilaterals, Math. Mag. 84 (2011), no. 1, 16–25, DOI 10.4169/math.mag.84.1.016. MR2793173 [90] K. S. Makarychev and Y. S. Makarychev, The importance of being formal, Math. Intelligencer 23 (2001), no. 1, 41–42. [91] Invisible bodies, mathematical etudes, http://www.etudes.ru/en/etudes/invisiblebody. [92] J. H. McKay, The William Lowell Putnam Mathematical Competition, Amer. Math. Monthly 77 (1970), no. 7, 721–728, DOI 10.2307/2316202. MR1535979 [93] H. Metrebian, Tiling with punctured intervals, Mathematika 65 (2019), no. 2, 181–189, DOI 10.1112/S0025579318000384. MR3869676 [94] S. Miller (ed.), Benford’s Law: Theory and Applications, Princeton Univ. Press, Princeton, 2015. [95] S. Morris, R. Stong, and S. Wagon, And the winners are. . ., Math Horiz. 20 (2013), no. 4, 20–22, DOI 10.4169/mathhorizons.20.4.20. MR3126984 [96] B. Nagle, Turán related problems for hypergraphs, Proceedings of the Thirtieth Southeastern International Conference on Combinatorics, Graph Theory, and Computing (Boca Raton, FL, 1999), Congr. Numer. 136 (1999), 119–127. MR1744177 [97] P. J. Nahin, Chases and Escapes: The Mathematics of Pursuit and Evasion; Paperback Edition of the 2007 Original [MR2319182], Princeton Puzzlers, Princeton University Press, Princeton, NJ, 2012. MR3185515 [98] A. Nesky and C. Redwood, Discrete and smooth bicycle “unicycle” paths, College Math. J. 47 (2016), no. 3, 180–189, DOI 10.4169/college.math.j.47.3.180. MR3539866 [99] The On-Line Encyclopedia of Integer Sequences, https://oeis.org.

Bibliography

281

[100] R. Pratt, S. Wagon, M. Wiener, and P. Zieliński, Too many hats, Math. Intelligencer 41 (2019), no. 3, 66–71, DOI 10.1007/s00283-019-09896-6. MR3995321 [101] Predicting real numbers, Mathematics StackExchange, https://math.stackexchange. com/questions/371184/predicting-real-numbers. [102] Probabilities in a riddle involving axiom of choice, MathOverflow, https://mathoverflow. net/questions/151286/probabilities-in-a-riddle-involving-axiom-of-choice. [103] J. F. Putz, The golden section and the piano sonatas of Mozart, Math. Mag. 68 (1995), no. 4, 275–282. MR1573102 [104] V. V. Bapeswara Rao and M. B. Rao, A three-door game show and some of its variants, Math. Sci. 17 (1992), no. 2, 89–94. MR1196598 [105] J. Riordan, Ballots and trees, J. Combinatorial Theory 6 (1969), 408–411. MR234843 [106] G. B. Robison, Rockers and rollers, Math. Mag. 33 (1960), 139–144. [107] J. Rosenhouse, The Monty Hall Problem: The Remarkable Story of Math’s Most Contentious Brainteaser, Oxford University Press, Oxford, 2009. MR2543995 [108] J. K. Rowling, Harry Potter and the Sorcerer’s Stone, Scholastic, New York, 1998. [109] F. Ruskey, C. D. Savage, and S. Wagon, The search for simple symmetric Venn diagrams, Notices Amer. Math. Soc. 53 (2006), no. 11, 1304–1312. MR2268388 [110] F. Ruskey, A survey of Venn diagrams, Electron. J. Combin. 4 (1997), no. 1, Dynamic Survey 5, 10 HTML documents. MR1668051 [111] M. E. Saks and M. Werman, On computing majority by comparisons, Combinatorica 11 (1991), no. 4, 383–387, DOI 10.1007/BF01275672. MR1137770 [112] M. Sand, Adding and subtracting in the Cantor set, College Math. J. 50 (2019), no. 1, 41–45, DOI 10.1080/07468342.2019.1534505. MR3904625 [113] G. Sanderson, The most unexpected answer to a counting puzzle, https://www.youtube. com/watch?v=HEfHFsfGXjs. [114] D. E. Seacrest and T. Seacrest, The prisoner shouting puzzle and variations, Amer. Math. Monthly 126 (2019), no. 4, 291–305, DOI 10.1080/00029890.2019.1558685. MR3941720 [115] S. G. Simpson, Unprovable theorems and fast-growing functions, Logic and Combinatorics (Arcata, Calif., 1985), Contemp. Math., vol. 65, Amer. Math. Soc., Providence, RI, 1987, pp. 359– 394, DOI 10.1090/conm/065/891258. MR891258 [116] R. L. Graham and N. J. A. Sloane, On the covering radius of codes, IEEE Trans. Inform. Theory 31 (1985), no. 3, 385–401, DOI 10.1109/TIT.1985.1057039. MR794436 [117] T. H. Spencer, On the size of independent sets in hypergraphs, Coding Theory, Design Theory, Group Theory (Burlington, VT, 1990), Wiley-Intersci. Publ., Wiley, New York, 1993, pp. 263– 273. MR1227140 [118] F. E. Su, Math Fun Facts, https://www.math.hmc.edu/funfacts. [119] C. M. Swanson and D. R. Stinson, Combinatorial solutions providing improved security for the generalized Russian cards problem, Des. Codes Cryptogr. 72 (2014), no. 2, 345–367, DOI 10.1007/s10623-012-9770-7. MR3210190 [120] A. N. Trahtman, The road coloring problem, Israel J. Math. 172 (2009), 51–60, DOI 10.1007/s11856-009-0062-5. MR2534238 [121] M. Trott, Bicycle rides, The Wolfram Demonstrations Project, http://demonstrations. wolfram.com/BicycleRides/. [122] University of Regina problem of the month PM 97, September 2010, http://mathcentral. uregina.ca/mp/previous2010/sep10sol.php. [123] H. van Ditmarsch and B. Kooi, One Hundred Prisoners and a Light Bulb, Springer, Cham, 2015. Illustrations by Elancheziyan; Original Dutch edition published by Epsilon Uitgaven, Amsterdam, 2013. MR3379496 [124] S. Wagon, The ultimate flat tire, Math Horizons 6 (1999), no. 3, 14–17, reprinted in The Edge of the Universe, Haunsperger and Kennedy, eds., Math. Assoc. of Amer., 2006. [125] S. Wagon, Test your intuition, Math Horizons 22 (2014), no. 1, 8–9, 26–28.

282

Bibliography

[126] S. Wagon and P. Webb, Venn symmetry and prime numbers: A seductive proof revisited, Amer. Math. Monthly 115 (2008), no. 7, 645–648, DOI 10.1080/00029890.2008.11920574. MR2444940 [127] J. Wästlund, An elementary proof of the Wallis product formula for pi, Amer. Math. Monthly 114 (2007), no. 10, 914–917, DOI 10.1080/00029890.2007.11920484. MR2363057 [128] E. W. Weisstein, Lambert 𝑊-function. From MathWorld–a Wolfram Web Resource, http:// mathworld.wolfram.com/LambertW-Function.html. [129] Wikipedia contributors, Wikipedia, the Free Encyclopedia, https://www.wikipedia.org. [130] G. Wildenberg, Problem 1110, Seven is possible, Math. Mag. 55 (1982), 47–48. [131] P. Winkler, Conditional probability and “He said, she said”, http://blog.tanyakhovanova. com/2010/05/conditional-probability-and-he-said-she-said. [132] P. Winkler, Mathematical Mind-Benders, A K Peters, Wellesley, MA, 2007. [133] K. F. Xylogiannopoulos, P. Karampelas, and R. Alhajj, Experimental analysis on the normality of 𝜋, 𝑒, 𝜙, √2 using advanced data-mining techniques, Exp. Math. 23 (2014), no. 2, 105–128, DOI 10.1080/10586458.2013.878674. MR3223767 [134] C. H. Yan, Parking functions, Handbook of Enumerative Combinatorics, Discrete Math. Appl. (Boca Raton), CRC Press, Boca Raton, FL, 2015, pp. 835–893. MR3409354

Index

Aleksenko, A., 81 ant, 25, 154 area, 7, 9, 73–74, 80 Asimov, D., 95 automated teller machine, 41, 240 axiom of choice, 221–222 Azer, E., 111 base in a number system, 17, 31, 177–179, see also binary battery, 21, 131–134 battleship, 37, 38, 223–225 beam-detection problem, 69 beam-splitter constant, 69 Bell, G. I., 231 Benford’s law, 157–158 Benjamin, A., 165 Bertrand–Chebyshev theorem, 110 bicycle, 3, 53–66 binary, 121, 163, 178, 203, 206 binary operation, 47, 265 BINGO, 27, 165–168 Bixler, B., 66 black hole, 38, 228–231 blossom algorithm, 111 Bohl, P., 158 Boshernitzan, M., 118 boustrophocycle, 91 box, 37, 220–222 Boyd, D., 121 Boyer, R., 206 Broadhurst, D., 159 Brown, A., 67 cake, 14, 104–107 Cambie, S., 84 cannon, 31, 182–185 Cantor set, 48, 269

car, 28, 40, 46, 171–175, 236, 264 card, 26, 35, 154, 162–163, 210–213 Carter, L., 86, 91, 214, 215, 225 Castro, D., 67 catenary, 101, 102 cave, 33, 199–201 center of mass, 32, 190–192 Chalcroft, A., 83 checker, 38, 231 checkerboard, 7, 34, 199–202, 206, 207, 209 Cheng, E., 123 child, 25, 151–154 circle, 67–72 circuit, 47 clique, 132–134 clock, 11, 84–86 Cloitre, B., 190 coding theory, 210 coin, 27, 34, 37, 39–41, 168–169, 206–210, 223, 234–235, 237–249 Colbourn, C., 240 Collignon, B., 100 collision, 49, 270–275 combination lock, 23, 142–147 committee, 22, 23, 141–142 competition, 24, 149 complex number, 124 conditional probability, 151–153, 156, 169–171, 173–174 cone, 102, 103 continued fraction, 193 convergence, 32, 185–188 convex, 12 Cottingham, E. T., 171 counterfeit, 34, 39 Crommelin, A. C. C., 171 crossword, 43, 251–252

283

284

Index

cube, 12, 83, 89–95 Cuff, P., 156 cusp, 59–61, 63 cycle, 142, 148, 149, 210–211, 236–237 cylinder, 32, 190–192

Friedland, A., 163 Friedman, E., 78, 82 Friedman, H., 128 front formula, 53 full house, 26, 162–163

Davidson, C. R., 171 decagon, 99 DeMorgan, A., 5 determinant, 46, 258, 259 dice, 25, 26, 154–156 differential equation, 62, 64–66, 194–196 digit, 16, 26, 117–118, 157–159, 270, 272–275 Dima, D., 269 Diophantine, 16, 113 directions, 24, 147–149 divisibility, 16, 17, 117–118, 124–125 divisor, 15, 111–112 dog, 32, 194–197 domatic number, 207–209 dominating set, 207–208 domination number, 207, 209 total, 238 domino, 78, 203 Duncan, J., 177

Galperin, G., 89, 239, 275 Ghys, É., 256 Ginzburg, A., 125 glass, 46, 260–263 Glazer, E., 222 goat, 28, 40, 172–175, 236 God, 26 golden ratio, 6, 69–70, 231 Goodstein’s theorem, 127 Goodstein, R., 127 googolplex, 19 Granger, Hermione, 43, 252–254 graph, 90, 92, 132–134, 141–142, 144, 149, 207–209, 235, 238 gravity, 31, 86–88, 179, 182 greatest common divisor, 70, 112, 116, 140 greedy algorithm, 142, 147, 267, 269 grid, 22, 33, 138, see also checkerboard Griggs, J., 80 Grossman, J., 89, 123 Grünbaum, B., 77, 79 Gruslys, V., 83 Guerrero-García, P., 39, 231 Guildford, Jim, 117 Guilford, John, 117, 147, 154, 265

eclipse expeditions of 1919, 171 Eddington, Sir A., 171 Elgersma, M., 66, 89 ellipse, 8, 79 Engebretsen, G., 116 equal-arm balance, 39 equidistribution theorem, 157–162 equilateral triangle, 11, 84, 85 equipowerful, 118–121 equivalence relation, 133, 221 Erdős, P., 125 Euclidean algorithm, 70, 84, 112–113, 193 Euler’s formula, 89 Euler’s totient function 𝜙, 140 evil number, 121 exclusive or, 206, 265–266 expected value, 25–27, 154–156, 163 Farey sequence, 140 Fermat’s little theorem, 124 Fibonacci number, 225–226 Fibonacci search, 228 Finn, D., 53, 66 Fischer, M., 206 focus, 12, 101–102, 180–182 Foshee, G., 152 Freiling, C., 215

Hall, Monty, 28, 171–175, 236 Hamburger, P., 80 Hamiltonian path, 90 harmonic mean, 116 Hart, S., 196 hat, 35, 36, 214–220 Henderson, D., 79 Henle, J., 127, 252 heptagon, 98, 100 hexagon, 12, 38, 96–99 Hickerson, D., 96 Hirschberg, D. S., 231 horse race, 33, 201–202 hundred prisoners problem, 236 hypercube graph, 207, 209 hypergraph, 134 icing, 14, 104–106 inclination angle, 13, 31, 61, 63, 67, 102, 179–183 inclinometer, 13

Index independent set, 111, 141–142 indicator variable, 155 integer-linear programming, 92, 93, 121, 238 integral, 31, 177–179 invisibility, 80–81 Jordan domain, 12 juggling, 47, 265, 267 Kariv, J., 214 key, 40, 236 Khovanova, T., 154 Kiefer, J., 228 Killian, C., 80 kinetic energy, 49, 270 Kirby, L., 127 Kisenwether, J., 165 Knuth’s uparrow notation, 128, 241 Konheim, A., 137 König’s tree lemma, 128 Kontsevich, M., 255 Kopp, K., 217 Lambert’s 𝑊-function, 195 Landsberg, A. S., 237 Laurie, D., 116 Leader, I., 83 Lee, J., 192 light, 46, 260–263 linear ordering, 22, 139–140 Lipták, L., 85, 123 local maximum, 38, 225–228 locker puzzle, 237 logarithmic spiral, 95 logic gate, 47, 265–266 Lucas, S., 175 majority, 34, 203–206 Martian, 34, 203 matching, 15, 109–111 Mathematica, 111, 166 McGrath, N., 238 McGregor, C., 86 mean, 46, 264 median, 46, 264 Mensa, 35, 210 Metrebian, H., 84 Meyer, J. H., 263 Meyerowitz, A., 222 mirror, 6, 9, 71–72 momentum, 49, 271 Moore, J. S., 206 Morris, S., 123, 177

285 Mossel, E., 156 normal number, 274 Olympiad Brazilian, 134 British, 122 Estonian, 138 Indian, 111, 112 International, 248 Moscow, 106, 240 St. Petersburg, 141 Turkish, 139 paper-folding, 5, 67 parabola, 12, 101, 163–164, 180–183, 196, 197, 258, 268 paradox, 221–222 Paris, J., 127 parking function, 21, 135–137 partition, 166–168 Pascal’s triangle, 46, 258 Peano axioms, 127 pentagon, 100 permutation, 45, 136, 138–139, 210–214, 216–217, 219, 236–237, 254–257 𝜋, 32, 163, 192–194, 270, 272–275 pizza, 7, 72–74 Plakhov, A., 81 planarity, 47 pointer-following strategy, 210, 236–237 poker, 26, 162–163 Pollak, H. O., 135, 137 polygon, 7, 12, 75, 77, 96, 98–100 polyhedron, 11, 89 polynomial, 17, 45, 112–113, 119, 123, 254–259 Potter, Harry, 43, 252–254 Pratt, R., 91, 93, 163 prime number, 16, 17, 79, 110, 112–114, 124 prisoner, 35–37, 40, 214–222, 236–238 pursuit curve, 195, 197 Putnam Competition, 149, 258 Putz, J., 70 Pythagorean triple, 111 quadrilateral, 7, 9, 80 rabbit, 32, 194–197 radio, 21, 131–134 random walk, 27, 163 Rao, M. B., 175 Rao, V. V. B., 175

286 rational number, 32, 185–188 recurrence, 32, 145, 186, 189–190, 243, 260–262, 266, 267 reflection, 6, 9, 46, 70–72, 80–81, 180, 181, 260–263 relatively prime, 15, 112, 116 resultant, 113 Reyes, J.-C., 86, 214, 215 Riemann sum, 178–179 Robison, G., 102 rocket, 13, 102–103 rolling parabola, 12, 101 rolling square, 102 root, 17, 123 Rosa, A., 240 Rosenberg, J., 214, 215 Rosenhouse, J., 175 Rouse, J., 124 Rowling, J. K., 43, 254 run, 47, 264–265 Russian card problem, 40, 239–240 Saks, M., 205 Sallows, L., 251 Saltzman, P., 209 Salzberg, S., 206 Saukkola, J., 82 Savage, C., 80 Schepler, A., 175 score, 24, 149 selector function, 138 selector function, 22, 139 self-reference, 43, 251 Sen, S., 236 Shapovalov, A., 217 shrinkable, 12, 96, 98 Sierpiński, W., 158 smooth curve, 53 snake, 90–95 son, 25, 151–154 special, 19, 127–130 speed, 46, 264 square, 7, 9, 74–78, 83–84, 101, 102 square number, 16, 17, 113–116, 124 star-shaped, 12, 96, 98 Steinhaus, H., 269 Stoll, C., 103 Stong, R., 242 Sullivan, J., 96 superbase, 17, 127 symmetry, 8, 79, 120

Index T-shirt gun, 31, 179–183 Tabachnikov, S., 66 Tan, T. S., 83 tangent vector, 3, 53, 58 tank, 33, 202, 203 tetration, 241, 242, 245 Thomas, H., 225 Thue–Morse–Hedlund sequence, 121 Tiefenbruck, M., 214, 215 tile, 9, 81–84 Tilley, J., 209 totient, see Euler’s totient function 𝜙 Trahtman, A., 149 trisection, 5, 67 trisectrix of Delanges, 86 trough, 11, 86–89 truth, 28, 43, 169–171, 251–252 Turán graph, 132, 134 Turán’s theorem, 132–134 unibike path, 53–64 weak, 60–64 unicycle, 3, 53–66 uniform convergence, 65–66, 178 universal parabolic constant, 163–164 uparrow, see Knuth’s uparrow notation van Allen, C., 214 Venn diagram, 8, 79–80 Wagon, S., 79, 91, 93, 209, 215 Wallis product, 189 water, 11, 22, 32, 86–89, 139, 190–192 wave, 22, 139–140 web site, 39, 235–236 Webb, P., 79 weight, 47, 265–269 Weiss, B., 137, 165 Wells, H. G., 9, 80 Werman, M., 205 Weyl, H., 158 wheel, 3, 101 Wildenberg, G., 98 Winkler, P., 154 xkcd, 29 Yeroshkin, D., 214, 216 Yuster, T., 163 Zimmermann, A., 215 Ziv, A., 125

PROBLEM BOOKS

Photo of Dan Velleman courtesy of Shelley Velleman.

Bicycle or Unicycle? is a collection of 105 mathematical puzzles whose defin i n g ch a r a c t e ristic is the surprise encountered in their solutions. Solvers will be surprised, even occasionally shocked, at those solutions. The problems unfold into levels of depth and generality very unusual in the types of problems seen in contests. In contrast to contest problems, these are problems meant to be savored; many solutions, all beautifully explained, lead to unanswered research questions. At the same time, the mathematics necessary to understand the problems and their solutions is all at the undergraduate level.The puzzles will, nonetheless, appeal to professionals as well as to students and, in fact, to anyone who finds delight in an unexpected discovery. These problems were selected from the Macalester College Problem of the Week archive. The Macalester tradition of a weekly problem was started by Joseph Konhauser in 1968. In 1993 Stan Wagon assumed problem-generating duties. A previous book written by Wagon, Konhauser, and Dan Velleman, Which Way Did the Bicycle Go?, gathered problems from the first twenty-five years of the archive. The title problem in that collection was inspired by an error in logic made by Sherlock Holmes, who attempted to determine the direction of a bicycle from the tracks of its wheels. Here the title problem asks whether a bicycle track can always be distinguished from a unicycle track. You’ll be surprised by the answer.