488

Math puzzles: classic riddles in counting, geometry, probability, and game theory

  • Upload
    others

  • View
    9

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Math puzzles: classic riddles in counting, geometry, probability, and game theory
www.princexml.com
Prince - Personal Edition
This document was created with Prince, a great way of getting web content onto paper.
Page 2: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Math puzzles: classic riddles incounting,

geometry, probability, and gametheory

Presh Talwalkar

Page 3: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Copyright Presh Talwalkar, 2012

All rights reserved

Page 4: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Acknowledgements

I want to thank readers of Mind Your De-cisions for their continued support. I alwaysloved math puzzles and I'm fortunate for thecommunity of readers that have suggestedpuzzles to me and offered ingenioussolutions.

These puzzles are a collection of problemsthat I have read over the years in books,math competitions, websites, and emails. Ihave credited original sources when aware,but if there are any omissions please let meknow at [email protected]

Page 19: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Section 1: Counting and geo-metry problems

The following 25 puzzles deal withclassic riddles about counting andgeometry.

Page 20: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 1: Ants on a Triangle

Three ants are positioned on separatecorners of a triangle.

If each ant moves along an edge toward arandomly chosen corner, what is the chancethat none of the ants collide?

How would the problem generalize if therewere n ants positioned on the vertices of a

Page 21: Math puzzles: classic riddles in counting, geometry, probability, and game theory

regular n-gon, again each moving along anedge to a random adjacent vertex?

21/488

Page 22: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 1: Ants on aTriangle

In order that none of the ants collide, theymust all move in the same direction. That is,all of the ants must move in either clockwiseor counter-clockwise towards a new corner.

This can be seen by inductive reasoning:whichever orientation ant 1 picks, ant 2 mustpick the same orientation to avoid a colli-sion, and then ant 3 must do the same thingas well.

Page 23: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Therefore there are 2 different ways that theants can avoid running into each other.

As each ant can travel in to 2 different direc-

tions, there are 23 = 8 total possible ways theants can move.

The probability the ants do not collide is 2/8= 25%.

Extension to general n-gon

An interesting extension is to ask what wouldhappen to 4 ants on the vertices of a

23/488

Page 24: Math puzzles: classic riddles in counting, geometry, probability, and game theory

quadrilateral? Or more generally, if there aren ants on an n-gon?

The general problem can be solved by thesame logic.

Again, the ants can only avoid collision ifthey all move in the same orientation--eitherclockwise or counter-clockwise. So againthere are only 2 safe routes the ants as agroup can take.

The total number of routes the ants can takeis also easy to count. Each ant can choose

between 2 adjacent vertices, so there are 2n

possibilities ways the ants could choose totravel.

The probability that none of the ants will col-

lide is 2/2n= 1/2n - 1

For example, on an 8-sided octagon, theprobability that none of the ants will collide

24/488

Page 25: Math puzzles: classic riddles in counting, geometry, probability, and game theory

is a mere 1/128 = 0.0078125, which is lessthan one percent.

For larger polygons it will be rare that theants do not collide, but not impossible.

25/488

Page 26: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 2: Three brickproblem

This is a very simple problem that tests a bitof your creative ability.

How can you measure the diagonal of a brickwithout using any formula, if you have threebricks and a ruler?

Page 27: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 2: Threebrick problem

There is a remarkably easy way to find thediagonal.

What you need to do is stack two bricks, oneon top of each other, and then place the thirdbrick next to the bottom brick.

The idea is you create an empty space inwhich a fourth brick could be placed. Here isa diagram to illustrate:

Page 28: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Now you can measure the length of the diag-onal by measuring the length of the emptyspace using a ruler.

No Pythagorean theorem or geometry for-mulas required!

28/488

Page 29: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 3: World's best tortillaproblem

You start out with a round tortilla, as depic-ted below.

Your job is to divide the tortilla into eightequal pieces, using only cuts made in astraight line.

Page 31: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 3: World'sbest tortilla problem

You only need one cut! The trick to thisproblem is you can fold the tortilla threetimes in half and then make one cut (foldalong the dotted lines, and then cut along thedark line in the following diagram.

Page 32: Math puzzles: classic riddles in counting, geometry, probability, and game theory

I came across this problem when I was mak-ing homemade baked tortilla chips. Most in-structional cooking videos show people inef-ficiently making 4 cuts which I found some-what annoying.

32/488

Page 33: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 4: Slicing up a pie

Alice and Bob are preparing for a holidayparty, and each has a pie to slice up intopieces.

They decide to have a little contest to makethings fun. Each person is allowed to make 3cuts of the pie with a knife, and whoever

Page 34: Math puzzles: classic riddles in counting, geometry, probability, and game theory

ends up with more pieces is the winner. Theyagree stacking is not allowed, but that “cen-ter” pieces without the crust are permissible.

How many pieces can be made using 3 cuts?What about 4 cuts, or more generally n cuts?

34/488

Page 35: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 4: Slicing apie

When you make one cut, you can create 2halves. With two cuts, you can slice througheach half again, to make 4 pieces.

The third cut is a bit trickier. What you wantis to cross the previous cuts without goingthrough the intersection point. Every timeyou intersect a previous cut you create an-other section (piece) of the pie, as in the fol-lowing diagram.

Page 36: Math puzzles: classic riddles in counting, geometry, probability, and game theory

So with 3 cuts, you can make 7 pieces in all.

We can now generalize. The first cut makesthe pie into 2 pieces. But after that, makingthe cut n will add on n new pieces to the pie.Thus, we know that on cut n the total num-ber of pieces can be calculated by theformula:

f(n) = 2 + 2 + 3 + 4 + ... + n = 1 + (1 + 2 + 3 +...) = 1 +n(n + 1)/2

36/488

Page 37: Math puzzles: classic riddles in counting, geometry, probability, and game theory

This sequence has a special name. The num-ber of cuts you can make with n cuts isknown as lazy caterer's sequence.

37/488

Page 38: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 5: Measuring ballbearings

This is a classic puzzle about weighing.

You are given a container that contains hun-dreds of ball bearings, amassing to exactly 24ounces.

You have a balance but no weights for thescale.

Page 39: Math puzzles: classic riddles in counting, geometry, probability, and game theory

You want to measure exactly 9 ounces. Howcan you do it?

39/488

Page 40: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 5: Measur-ing ball bearings

If you could count the number of ball bear-ings, you could get a unit weight for 1 bearingand proceed by counting. But the ball bear-ings are too numerous, and you can figure itout quicker by using several weighings.

Here is one way to do it in five steps.

1. Divide the balls into two equal pilesusing the balance (12 ounces on eachside)

2. Remove the ball bearings from thescale. Divide one of the 12 ounce pilesinto two equal piles using the scale (6ounces on each side)

3. Set aside one of the 6 ounce piles

Page 41: Math puzzles: classic riddles in counting, geometry, probability, and game theory

4. Divide the other 6 ounce pile into twopiles (3 ounces on each side)

5. Combine a 3 ounce pile with a 6ounce pile to get to 9 ounces

41/488

Page 42: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 6: Paying an employeein gold

You have a solid gold bar, marked into 7equal divisions as follows:

| – | – | – | – | – | – | – |

You need to pay an employee each day forone week. He asks to be paid exactly 1 pieceof the gold bar per day.

The problem is you don't trust him enoughto prepay him, and he would prefer not to bepaid late.

If you can only make 2 cuts in the bar, canyou figure out a way to make the cuts so yourworker gets paid exactly one gold piece everyday?

Page 43: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 6: Payingan employee in gold

You can pay the employee if you cut thepieces in the correct spots. If the gold bar islabeled as follows:

| 1 | 2 | 3 | 4 | 5 | 6 | 7 |

Then you want to make the cuts betweenpieces 1 and 2, and between pieces 4 and 5.So now you have pieces:

|1| |2|3| |4|5|6|7|

Now you have a 1-block piece, a 2-blockpiece, and a 4-block piece. Here is how youcan pay the employee one piece of gold foreach day during the week:

Day 1: Give him the 1-block piece

Page 44: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Day 2: Trade him the 2-block piece forthe 1-block piece

Day 3: Give him back the 1-block piece

Day 4: Trade him the 4-block piece forthe 1 and 2-block pieces

Day 5: Give him the 1-block piece

Day 6: Trade him the 2-block piece forthe 1-block piece

Day 7: Give him the 1-block piece back

As you can see, the worker will be paid 1block each day.

44/488

Page 45: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 7: Leaving workquickly

Alice and Bob were ready to leave the officewhen their mean boss assigned them morework.

The boss told them to do the following bor-ing things before they could go home:

1. Manually copy pages from bound books2. Audit numbers in a spreadsheet3. Fax documents to another office

Each task takes 40 minutes to complete, andonly one person can work on a task at a time(the office only has one copy machine, onefax machine, and auditing cannot be donesimultaneously).

How quickly can they complete their workand go home?

Page 46: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 7: Leavingwork quickly

At first thought it seems like the tasks will re-quire 80 minutes: in the first 40 minutes,each does one task, and in the last 40minutes someone finishes the last task.

But let us diagram the chores usingsomething called a Gantt chart which showswhat is being done in each interval of time:

You will notice in the second 40 minutes thatonly one person is working while the other isdoing nothing. This chart should give us anidea of how to work more efficiently: both

Page 47: Math puzzles: classic riddles in counting, geometry, probability, and game theory

people need to be working simultaneouslythe entire time.

So imagine they split up the tasks into 20minute intervals, and divide the tasks asfollows:

Very curiously by splitting up one of thetasks (in this case, faxing), they are able tofinish all of the work in 60 minutes!

In fact this really this should not be too big ofa surprise: there are 3 chores that take 40minutes for a total of 120 minutes. With twopeople working it should take no more than60 minutes.

47/488

Page 48: Math puzzles: classic riddles in counting, geometry, probability, and game theory

This type of problem is based on an old mathpuzzle about cooking three hamburgers ontwo grills: see details on page 133 and 134 ofthis pdf. I never liked this problem as muchbecause you can’t split up the task of grillinga burger: if you start cooking something andlet it rest, it will keep cooking even if it is noton the flame. Nevertheless, the mathematicalprinciple is useful for other problems.

48/488

Page 49: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 8: Science experiment

A chemistry teacher offers his class an exper-iment for extra credit. To complete the lab,students are to keep bacteria in a specialchamber for exactly 9 minutes.

The sadistic part is the teacher only gives thestudents a 4-minute and a 7-minute hour-glass with which to measure time. There areno other time-measuring instruments, aswristwatches and cell phones areconfiscated.

To complete the lab, the bacteria can bestored in small intervals of time, but the totaltime that it should be in the chamber mustbe 9 minutes.

Extra credit will only be awarded to the stu-dent or students that complete the lab first.

Page 50: Math puzzles: classic riddles in counting, geometry, probability, and game theory

What is the shortest time the experiment canbe completed?

A) 9 minutesB) 12 minutesC) 18 minutesD) 21 minutes

50/488

Page 51: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 8: Scienceexperiment

The multiple choice of answers is a bit of adistractor. The experiment can be done in 9minutes as the hourglasses can be used tomeasure this amount of time--see chartbelow.

Page 52: Math puzzles: classic riddles in counting, geometry, probability, and game theory

52/488

Page 53: Math puzzles: classic riddles in counting, geometry, probability, and game theory

The practical issue is how quickly studentswill realize the solution.

53/488

Page 54: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 9: Elevatormalfunctioning

An elevator in my office building of 65 floorsis malfunctioning.

Whenever someone wants to go up, the elev-ator moves up by 8 floors if it can. If the elev-ator cannot move up by 8 floors, it stays inthe same spot (if you are on floor 63 andpress up, the elevator stays on floor 63).

And whenever someone wants to go down,the elevator moves down by 11 floors if it can.If it cannot, then the elevator stays in thesame spot. (if you press down from floor 9,the elevator stays on floor 9).

The elevator starts on floor 1. Is it possible toreach every floor in the building?

Page 55: Math puzzles: classic riddles in counting, geometry, probability, and game theory

How many times would you have to stop toreach the 60th floor, if you started on floor 1?

55/488

Page 56: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 9: Elevatormalfunctioning

It is possible to reach every floor in thebuilding.

I used a spreadsheet to illustrate exactly howthis is possible.

On the table below, every floor can bereached by a combination of moving up by 8floors and moving down by 11 floors. (Forsimplicity, we can imagine the elevator hasan “UP” button and a “DOWN” button).

The horizontal rows show an elevator mov-ing up by 8 floors at a time, and the verticalcolumns are when the elevator moves downby 11 floors at a time.

Page 57: Math puzzles: classic riddles in counting, geometry, probability, and game theory

You can see that every floor is attainable.

The harder part is to see why this actuallyworks.

The reason has to do with number theory.We are essentially looking for integers solu-tions to the following equation:

8x– 11y = floor number

These types of equations are known as linearDiophantine equations. For a general equa-tion, ax+by = c, solutions exist if and only ifc is a multiple of the greatest common di-visor of a and b.

57/488

Page 58: Math puzzles: classic riddles in counting, geometry, probability, and game theory

In our case, 8 and 11 are relatively prime andhave a greatest common divisor of 1, thusthere are infinitely many solutions to theequation. The tricky part is verifying thatevery floor can be reached without goingabove floor 65 or going below floor 1, whichis what the table above demonstrates.

How many times would you have to stop toreach the 60th floor, if you started on floor 1?

I got the idea for this question when I no-ticed floor 60 is the farthest away from floor1 in the table.

I calculated the quickest route to get to floor60 is to take 24 stops along the way: goacross the first row, then move down in astep ladder fashion until you reach the bot-tom row of the table, and then move acrossthe last row.

58/488

Page 59: Math puzzles: classic riddles in counting, geometry, probability, and game theory

The floor sequence is: 1, 9, 17, 25, 33, 41, 49,57, 65, 54, 43, 32, 21, 10, 18, 7, 15, 4, 12, 20,28, 36, 44, 52, and finally 60.

That’s a long way to ride to get to yourfloor–that floor better hope someone fixesthe elevator quickly!

(Credit: this puzzle is adapted from here)

59/488

Page 60: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 10: Ants and honey

The shortest distance between two points ona plane is a straight line. But finding theshortest distance on other surfaces is a moreinteresting problem.

Here is a puzzle that is harder than it sounds.

In a rectangular box, with length 30 inchesand height and width 12 inches, an ant is loc-ated on the middle of one side 1 inch fromthe bottom of the box.

There is a drop of honey at the opposite sideof the box, on the middle of one side, 1 inchfrom the top.

Here is a picture that illustrates the positionof the ant and the honey.

Page 61: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Let's say the ant is hungry and wants foodquickly.

What is the shortest distance the ant wouldneed to crawl to get the honey?

61/488

Page 62: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 10: Antsand honey

If the ant crawls 1 inch down, then 30 inchesacross the bottom, then 11 inches up, it willtravel 42 inches. But this is not the shortestdistance.

The solution is found by unfolding the boxand then finding the shortest path betweenthe ant and the honey.

There are actually 4 ways to "flatten" the box(shown here). But only one method corres-ponds to the shortest distance as follows:

Page 63: Math puzzles: classic riddles in counting, geometry, probability, and game theory

The distance between the points can befound using the Pythagorean theorem. For atriangle with legs 32 and 24, the hypotenuse--and shortest distance--is 40 inches.

63/488

Page 64: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 11: Camel and bananas

This is a classic puzzle that I really enjoy.

You want to transport 3,000 bananas across1,000 kilometers. You have a camel that cancarry 1,000 bananas at most. However, thecamel must eat 1 banana for each kilometerthat it walks.

What is the largest number of bananas thatcan be transported?

Page 65: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 11: Cameland bananas

The camel cannot carry all the bananas as itwould eat them all in transport. Therefore,the bananas must be transported in shifts.

With 3,000 bananas, the camel will need todouble back two times to carry the three dif-ferent heaps of 1,000 bananas.

To carry the initial heap by 1 kilometer, thecamel will need to make 5 trips and eat 5 ba-nanas as follows:

--Carry 1,000 bananas by 1 kilometer(eats 1 banana)--Return 1 kilometer to the beginning(eats 1 banana)--Carry the next 1,000 bananas by 1kilometer (eats 1 banana)

Page 66: Math puzzles: classic riddles in counting, geometry, probability, and game theory

--Return again 1 kilometer to the begin-ning (eats 1 banana)--Carry the remaining bananas by 1 kilo-meter (eats 1 banana)

Notice that after moving 1 kilometer, thecamel has eaten 5 of the bananas.

This process can be repeated and the camelwill slowly transport and eat the bananas atthe rate of 5 bananas per kilometer.

But after 200 kilometers, something import-ant happens. At this point, the camel willhave eaten 200 x 5 = 1,000 bananas, leavingjust 2,000 remaining.

Because the camel can carry 1,000 bananasat a time, the camel will only need to doubleback once. To carry the remaining heap by 1kilometer, the camel will only need to eat 3bananas as follows:

66/488

Page 67: Math puzzles: classic riddles in counting, geometry, probability, and game theory

--Carry 1,000 bananas by 1 kilometer(eats 1 banana)--Return 1 kilometer to the beginning(eats 1 banana)--Carry the remaining bananas by 1 kilo-meter (eats 1 banana)

The second leg therefore requires just 3 ba-nanas per kilometer.

How long will this be necessary? Notice thatafter 333 1/3 kilometers, the camel has de-voured another 1,000 bananas.

At this point, there are just 1,000 bananasleft: the camel can make the remaining jour-ney without doubling back. This means thecamel can carry all the remaining 1,000 ba-nanas and complete the trip.

How much of the trip remains? The camelwent 200 kilometers and then 333 1/3

67/488

Page 68: Math puzzles: classic riddles in counting, geometry, probability, and game theory

kilometers, so there are 466 2/3 kilometersremaining.

Thus, the camel will devour 466 2/3 bananasto complete the journey, meaning 533 1/3bananas can survive and be transported.

Here is a visual representation of thejourney:

(credit: graphic inspired by this graphic)

68/488

Page 69: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 12: Coin tossing carni-val game

In one carnival game, you are to toss a coinon a table top marked with a grid of squares.You win if the coin lands without touchingany lines–that is, the coin lands entirely in-side one of the squares, as pictured below.

Page 70: Math puzzles: classic riddles in counting, geometry, probability, and game theory

If the squares measure 1.5 inches per side,and the coin has a diameter of 1 inch, what isthe chance you will win? Assume you can al-ways get the coin to land somewhere on thetable.

70/488

Page 71: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Extension: find a formula if the squaresmeasure S inches per side and the coinmeasures D inches in diameter.

71/488

Page 72: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 12: Carni-val coin tossing game

The correct answer for this game is 1/9.

Let us solve the general case to see why. Forthe coin not to intersect any part of the grid,it must be the case that the circle's center islocated sufficiently far enough away from thegrid lines. These are all winnable points.

We can find the area of the winnable pointsand divide that by the total area of a squarefrom the grid to calculate the probability ofwinning.

Here is a diagram that can help.

Page 73: Math puzzles: classic riddles in counting, geometry, probability, and game theory

The winning points are the square with sideS – D. This is found because the circle's cen-ter must be more than D/2 distance from allsides of the edge of a gridline. Hence we seethe circle's center must lie in a square withside S - 2 (D/2) = S – D.

The area of the square for winning points is

(S – D)2. The area of a square for a gridline is

S2

73/488

Page 74: Math puzzles: classic riddles in counting, geometry, probability, and game theory

The probability of winning is the ratio of

these areas, which is [(S-D)/S]2.

For a square of 1.5 inches, and a circle of dia-meter 1 inch, we find the probability of win-

ning is ((0.5)/1.5)2 = 1/9

74/488

Page 75: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 13: Rope around Earthpuzzle

This is a fun problem that first appeared in a1702 book written by the philosopher Willi-am Whiston.

This problem is about two really, really longropes A and B.

Rope A is long enough that it could wraparound the Earth’s equator and fit snugly,like a belt (let’s say 25,000 miles).

Rope B is just a bit longer than rope A. RopeB could wrap around the Earth equator from1 foot off the ground.

How much longer is rope B than A?

(assume the earth is a perfect sphere)

Page 76: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Extension: let’s say that rope C can wraparound an equatorial line for a sphere that’sas big as the planet Jupiter (about 273,000miles). Rope D is just a bit longer, and it cando the same thing from 1 foot off the ground.

How much longer is rope D than C?

76/488

Page 77: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 13: Ropearound Earth puzzle

The surprising part is that both questionshave the same answer!

To see why, suppose that r is the radius ofthe Earth. Then, according to the setup, thelarger rope B would have a radius of r + 1.

Page 78: Math puzzles: classic riddles in counting, geometry, probability, and game theory

We can calculate how much longer rope B isby subtracting the difference of the circum-ferences of the two circles. The larger ropehas circumference 2 π (r+1) and the smallerrope has one of 2 π r

2 π (r +1) – 2 π r = 2 π = about 6.28 feet

Therefore, rope B is longer by 6.28 feet.

78/488

Page 79: Math puzzles: classic riddles in counting, geometry, probability, and game theory

But notice the remarkable thing: the answerdoes not depend on the radius of the circle!This means we have solved the problem forany size sphere (or one might say for everyplanet or spherically shaped object).

Hence, for Jupiter, rope D is also longer thanC by about 6.28 feet.

79/488

Page 80: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 14: Dividing a rectan-gular piece of land

A father is splitting up land among his twosons in estate planning. How can he dividethe land fairly?

One approach is to split the land evenly. Buteven this method can get complicated if weadd some realistic assumptions. This puzzleillustrates why splitting land can be a mind-boggling exercise.

Suppose your father owns a rectangularpiece of land, but the city has bought a smallrectangular patch of it for its public use.

You and your brother are to split up the landequally using only a single straight line to di-vide the area. How can this be done?

Page 81: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Trivia

As a bit of history, this puzzle is sometimesused as an interview brain teaser or technicalquestion when testing job seekers on theirproblem solving ability.

It is sometimes stated in the following terms:how can you split in half a rectangular pieceof cake, with a small rectangular piece re-moved, using a single cut from a knife?

81/488

Page 82: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 14: Dividinga rectangular piece of land

The elegant mathematical solution requires asmall trick about geometry. The trick is thatany line passing through the center of a rect-angle bisects its area.

(A line through the center of a rectangleeither creates two equal triangles--if it is adiagonal--or it creates two equal trapezoidsor rectangles)

The original rectangular plot of land has in-finitely many lines passing through the cen-ter that bisect its area. But once you removea small rectangular plot, there is only oneline that bisects the area--namely, the linethat passes through the centers of both rect-angles. This line bisects both the original plotand the removed rectangular plot, and con-sequently splits the land evenly.

Page 83: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Another creative way was thought up by oneof the Mind Your Decisions readers. Joe ex-plained how he solved the puzzle on the spot.

I was asked this question during a recent jobinterview. My way of coming up with a solu-tion was to rephrase the original puzzle byreplacing rectangles with circles - i.e., a circlewithin a circle. When looking at the puzzle inthis way, it's more intuitive to see a line con-necting the two centers being the best an-swer, and then you can extend the analogy tothe rectangles.

83/488

Page 84: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Now that's definitely what I call out of thebox thinking.

84/488

Page 85: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 15: Dividing landbetween four sons

This is one of my all-time favorite puzzles.Give it an honest effort before reading theanswer.

A father dies and wants to divide his landevenly amongst four sons. The plot of landhas the following unusual shape:

Page 86: Math puzzles: classic riddles in counting, geometry, probability, and game theory

How can you divide the land into four equalparts, using only straight lines?

86/488

Page 87: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 15: Dividingland between four sons

I came across this puzzle when it was presen-ted to gifted math students.

Several of the high school students then wereable to come up with the following solution.

I feel like this is the type of solution onemight come up with–it is symmetric andsomehow “makes sense.”

Page 88: Math puzzles: classic riddles in counting, geometry, probability, and game theory

One of the students had shown a lot of cre-ativity in his work. He came up with theabove solution, but he also submitted asecond answer that definitely took me bysurprise.

Here's the solution that he came up with:

88/488

Page 89: Math puzzles: classic riddles in counting, geometry, probability, and game theory

It is amazing to see how the shape can be di-vided into four parts using scaled down ver-sions of itself! Well done if you came up withthis answer on your own.

I had wondered what it would be like if theprocess was repeated: that is, if you continueto divide the subdivisions into 4 small ver-sions of itself.

89/488

Page 90: Math puzzles: classic riddles in counting, geometry, probability, and game theory

One reader of Mind Your Decisions, V PaulSmith took up the challenge and did a manu-al tessellation. Here is what it looks like. It’sabsolutely beautiful.

(Visit this page for the full-scale version ofthe tessellation: http://dl.dropbox.com/u/3990649/Tesselation 01.jpg)

90/488

Page 91: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 16: Moat crossingproblem

A castle is surrounded by a rectangular moatthat measures 20 feet in width: see imagebelow.

Page 92: Math puzzles: classic riddles in counting, geometry, probability, and game theory

You have two planks of 19 feet each, but noway to nail them together.

How can you cross the moat if you start fromthe outside of the moat and want to reach thecastle?

Extension: what’s the largest rectangularmoat you can cross from the outside withtwo planks of length L?

92/488

Page 93: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 16: Moatcrossing problem

The answer to the puzzle

You can cross the moat by arranging oneplank along the corner of the moat, and put-ting the other on top, as follows:

Page 94: Math puzzles: classic riddles in counting, geometry, probability, and game theory

As you can check, the planks will cover a dis-tance of 28.5 feet across the diagonal, whichmeasures just a tad less at 28.3 feet. Thus,you have just enough plank to cross.

Using geometry, we can figure out the largestmoat that can be traversed with a plank oflength L.

We will solve for the longest width that cor-responds to the planks in their optimal posi-tion. The answer is: L/√2 + (L/2)/√2

94/488

Page 95: Math puzzles: classic riddles in counting, geometry, probability, and game theory

95/488

Page 96: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 17: Mischievous child

At a dinner party, there are two large bowlsfilled with juice. One bowl holds exactly 1gallon of apple juice and another has 1 gallonof fruit punch.

A mischievous child notices the bowls anddecides to have a little fun. The child fills upa ladle of apple juice and mixes it into thebowl with fruit punch. Not content to stophere, he decides to do the reverse. He fills upa ladle of the fruit punch/apple juice mixtureand returns it to the apple juice bowl.

The child would proceed further, but hismother notices what he is doing and makeshim stop. The child apologizes to the hosts,who decide to shrug off the matter as littleharm was done.

Page 97: Math puzzles: classic riddles in counting, geometry, probability, and game theory

But an interesting question does arise aboutthe two mixtures of juice.

In the end, the two bowls ended up withsome of the other juice. The question is:which bowl has more of the other juice? Thatis, does the fruit punch bowl have moreapple juice or does the apple juice bowl havemore fruit punch?

Assume the ladle holds a volume of 1 cup andthe juices were mixed thoroughly when thechild transferred the juices.

97/488

Page 98: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 17: Mis-chievous child

The hard way to solve this problem is doingthe math. You can calculate that both juicebowls end up with an equal concentration ofthe other juice, and thus the transferredvolumes must be equal.

The easier way is to think logically. Noticethat both bowls begin and end up with ex-actly 1 gallon of liquid. This means thatwhatever apple juice ended up in the fruitpunch bowl must have been replaced by thesame volume of fruit punch that went intothe apple juice bowl. Therefore, the twovolumes must be equal!

The problem is known as the wine/waterpuzzle. If you'd like a more detailed solution,I found a nice explanation here: wine/waterproblem solution

Page 99: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 18: Table seating order

A table seat choice can be the differencebetween a boring, wasted night and a fun,profitable one. I can recall two exampleswhere seat choice made a big difference.

The first was a student-faculty dinner atStanford where I had invited a math profess-or. The etiquette was to accompany a pro-fessor while getting food and walk to a table.The natural instinct, therefore, was to sit dir-ectly next to the invited professor. But thiswas a bad choice, as it was difficult to makeeye contact and direct conversation. It alsoled to awkward moments where studentsspilled food and drinks on their professor.Lesson learned: always sit across the table!

The second came in a friendly poker game.After playing a few times, we quickly learnedthe importance of seating order, particularly

Page 100: Math puzzles: classic riddles in counting, geometry, probability, and game theory

when betting in no-limit Texas Hold’em. Wehave since paid careful attention to rotateseats for fairness.

The games of course led to a natural ques-tion: exactly how many different betting or-ders are possible? (that is, how many wayscan people sit around a table, if only their re-lative position matters?)

100/488

Page 101: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 18: Tableseating order

There are a handful of ways to determine theanswer. Here are a few that I like.

Method 1: Converting linear permuta-tions into circular permutations

The case of two people is trivial: there is onlyone way.

How many ways can three people sit arounda table? One way is to count permutations.

The easiest type of permutation to count is a“linear” list. Say the people around the tableare sitting as person A, then person B, and fi-nally person C. We can represent this orderin a linear list as ABC.

Page 102: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Using this notation, we can count the num-ber of possible lists. We simply note thereare:

3 possible choices for the first spot (A, B, orC)2 choices for the second1 choice for the last spot

This means there are 3 x 2 x 1 = 6 = 3! waysto write the list. Specifically the list can bewritten as:

ABCACBBACBCACABCBA

But this list is not our answer. At least someof these permutations represent the same

102/488

Page 103: Math puzzles: classic riddles in counting, geometry, probability, and game theory

seating order on a circular table. We can seethis graphically:

The image above shows that the list ordersABC and CAB are the same arrangement ona circular table.

So we ask: what’s the relation between linearpermutations and the circular ones we wishto count.

103/488

Page 104: Math puzzles: classic riddles in counting, geometry, probability, and game theory

The relationship can be illustrated asfollows:

Evidently, each circular permutation for athree-person group can be written in 3

104/488

Page 105: Math puzzles: classic riddles in counting, geometry, probability, and game theory

different ways. This makes sense: for eachcircular permutation, there are three differ-ent choices for the first letter of the linearpermutation representation.

Thus, we can convert the number of circularpermutations into linear ones by multiplyingby 3. Or working in reverse, we can convertthe number of linear permutations into cir-cular ones by dividing by 3.

Combing all of this, we can deduce there are3! / 3 = 2 ways to seat three people on atable. (The answers are ABC and ACB)

We can expand this logic to more people. Wefirst count the number of linear permuta-tions and then convert to circular ones.

For four people, the number of linear per-mutations can be counted. There will be 4choices for the first spot, 3 choices for thesecond, 2 choices for the third, and 1 choice

105/488

Page 106: Math puzzles: classic riddles in counting, geometry, probability, and game theory

for the last. Therefore there will be 4 x 3 x 2 x1 = 4! linear permutations.

We can then convert this into the number ofcircular permutations. As there are 4 peoplein the group, there will be 4 ways that eachcircular permutation can be written as a lin-ear permutation–any of the four people canbe written first in the list. So now to convertlinear into circular we divide by 4 (again thenumber of people in the group).

Thus there will be a total of 4! / 4 = 6 ways toseat this group.

To generalize even further, we can see a pat-tern for n people. We can write the linearpermutation in n! ways, but we have to di-vide by n to convert the linear permutationsinto circular ones.

In the end, the formula simplifies as:

106/488

Page 107: Math puzzles: classic riddles in counting, geometry, probability, and game theory

And viola, we have our answer.

Method 2: induction

An alternate way of solving this problem ismathematical induction.

Listing out a few cases of two, three, and foursuggests the general formula (n– 1)! Now wecan prove it.

Consider a group of n– 1 people who areabout to get seating at a table in a restaurant.Let’s say at the very last minute one extraperson comes. How many ways can thegroup be seated?

By the induction hypothesis, we know thereare (n – 2)! ways for the initial group to sit.Where can the additional person sit? For anyof these (n – 2)! arrangements, he can

107/488

Page 108: Math puzzles: classic riddles in counting, geometry, probability, and game theory

obviously sit between the first and secondperson, or between the second and third, orso on until the last position of being betweenthe n – 1 person and the first person.

This is a total of n – 1 spots he can sit for anyof those (n – 2)! arrangements. Therefore,this group of n people has this manyarrangements:

And like mathemagic, induction proves theformula.

Method 3: seat-changing permutations

A final way I like to visualize the answer is aparty-game type approach.

Consider for a moment that n people havesat at a circular table. How many ways canthey switch seats and have at least one

108/488

Page 109: Math puzzles: classic riddles in counting, geometry, probability, and game theory

person sitting with different neighbors onleft and right sides? This is another way ofasking the number of circular permutations,so the answer to this question will answerour original question.

Some ways people switch will obviously notchange the seating order. If everyone movesone seat to the right, then each person hasthe same neighbors and so the seating ar-rangement is the same.

Such rotations do not change the order ofseating.

And this demonstrates a principle: motion isalways relative to a reference point. To countthe number of distinct seat trades, we musthave a fixed reference point. Without loss ofgenerality, we can choose any one person tobe a reference point.

109/488

Page 110: Math puzzles: classic riddles in counting, geometry, probability, and game theory

With one person firmly seated, every uniquelinear ordering of the remaining peoplechange seats will be a unique circularpermutation.

In other words, we want to know the numberof linear permutations for n - 1 people. Theanswer is (n – 1)! and we’ve found the an-swer again.

110/488

Page 111: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 19: Dart game

Alice and Bob play the following game withtheir friend Charlie.

Charlie begins the game by secretly picking aspot on the dartboard. The spot can be any-where on the board, but once picked it doesnot change.

Then Alice and Bob each get to throw onedart at the board.

At this point, Charlie reveals the position heinitially picked. The winner of the game isthe person whose dart is closest to the spotCharlie picked.

For example, if Charlie picked the spotmarked with an “x”, and Alice and Bob shotas follows, then Alice would win the game:

Page 112: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Put yourself in the shoes of Alice or Bob.What strategy is best for playing this game?

112/488

Page 113: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 19: Dartgame

The best strategy is fairly intuitive: Alice andBob should each shoot for the center of thedartboard.

One way to think about this is probabilistic-ally. Because Charlie is essentially picking arandom position anywhere on the board, thebest spot to pick would be the average posi-tion, which is the center of the dartboard.

Another way to think about this is geometric-ally. Suppose Alice hits the center of thedartboard and Bob hits somewhere else. Wecan ask: what is the set of all points that arecloser to Alice’s dart than to Bob’s?

The answer can be found by remembering afact from geometry. The set of all points thatare equidistant from Alice’ and Bob’s darts is

Page 114: Math puzzles: classic riddles in counting, geometry, probability, and game theory

defined by the perpendicular bisectorbetween the two points (the line that goesthrough the midpoint of the two points, isperpendicular to the line connecting thepoints).

The perpendicular bisector separates all thepoints that are closer to the different darts.All the points to one side of the perpendicu-lar bisector must be closer to Alice’s dart,and all the points on the other side are closerto Bob’s.

If Alice hits the center, and Bob hits any-where else, then the perpendicular bisectorwill always be some chord of the circle notgoing through the center. Geometrically,there will be more points closer to Alice’sdart than to Bob’s dart. Therefore Alice’sdart "covers more ground" and she will havea higher chance of winning the game.

114/488

Page 115: Math puzzles: classic riddles in counting, geometry, probability, and game theory

In the following diagram, all points to the leftof the perpendicular bisector are closer toAlice’s dart, and that covers more than halfthe board.

Locational games like this can prove usefulin military settings or business settings whentwo competing parties need to position

115/488

Page 116: Math puzzles: classic riddles in counting, geometry, probability, and game theory

themselves closer to an unknown target(consider two hostile nations, one trying tocapture and another trying to protect a ter-rorist hiding out in an unknown location).

This dart game is also a two-dimensionalversion of Hotelling’s game, in which two hotdog vendors compete to locate closer to cus-tomers on a beach. In that game too it is thebest strategy for each vendor to locate cent-rally. I explained more details in this postthat shows why gas stations locate next toeach other.

116/488

Page 117: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 20: Train fly problem

This is another classic math puzzle.

Two trains that are 60 miles apart areheaded towards each other. Each train ismoving at 30 miles per hour.

A speedy fly can travel at 60 miles per hourleaves from the front of one train and headstowards the other train. When it gets to thefront of the other train, it instantly turnsback towards the original train. This contin-ues until the two trains pass each other, atwhich point the fly stops.

The question is, how far did the fly travel?

Page 118: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 20: Trainfly problem

The story goes this puzzle was asked to poly-math John von Neumann at a party. Hequickly gave the right answer and explainedhe knew no trick, he just summed up the in-finite series.

There is a really neat trick to solving thispuzzle that does not involve infinite series.

The shortcut is to think about the problem interms of speed and time. The distance the flytravels can then be obtained by multiplyingthose two quantities.

We know the fly travels at 60 miles per hour,so we have it’s speed. Let’s figure out thetime.

Page 119: Math puzzles: classic riddles in counting, geometry, probability, and game theory

The two trains are 60 miles apart, and theyare traveling towards each other at 30 milesper hour each, to make for a combined speedof 60 miles per hour. Therefore, the trainswill meet in 1 hour (both trains will havetraveled 30 miles to the center).

Since the fly was moving for 1 hour at 60miles per hour, that means the fly must havetraveled 60 miles in all. Note this calculationignores the actual flight path of the fly, whichis precisely the trick.

Solving the problem using an infinite seriesis much harder: here’s one derivation. I don’tknow anyone who could have done the infin-ite series using mental math–heck, it’s hardenough on paper. But von Neumann’s calcu-lating abilities were so impressive that it wasactually plausible.

119/488

Page 120: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 21: Train stationpickup

Mr. Smith, a commuter, is picked up eachday at the train station at exactly 5 o'clock.One day he arrived at the train station unan-nounced at 4 o'clock and began to walkhome. Eventually he met the chauffeur driv-ing to the station to get him. The chauffeurdrove him the rest of the way home, gettinghim there 20 minutes earlier than usual.

On another day, Mr. Smith arrived at thetrain station unexpectedly at 4:30, and againbegan walking home. Again he met thechauffeur and rode the rest of the way withhim. How much ahead of usual were theythis time?

(Assume constant speeds, and that no time islost turning the car around and picking upMr. Smith.)

Page 121: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 21: Trainstation pickup

The first time I solved the problem I wroteout several equations and solved foreverything algebraically. When I figured outthe answer, I realized the puzzle can besolved much easier!

When Mr. Smith arrived at the train station 1hour early, and started walking home, he wasable to save 20 minutes of commute. This isdue to two reasons: the driver met him closerto home (by 10 minutes), and the drive homewas shorter (by 10 minutes).

So if Mr. Smith arrives 30 minutes early, orhalf of 1 hour, we can deduce he only tra-verses half the distance as before. Thus, thetime savings are halved: he meets the drivercloser to home by 10/2 = 5 minutes, and hedrive home is shorter by 10/2 = 5 minutes.

Page 122: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Therefore, Mr. Smith arrives home 10minutes ahead of schedule.

(credit: puzzle from this website)

122/488

Page 123: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 22: Random sizeconfetti

Professor X teaches a probability class. Heassigns a holiday-themed project to hisstudents.

Each student is to create a 500 rectangular-shaped confetti pieces, with length and widthto be random numbers between 0 and 1inches.

Alice goes home and gets started. She inter-prets the assignment as follows. Alice gener-ates two random numbers from the uniformdistribution, and then she uses the first num-ber as the length and the second as the widthof the rectangle.

Bob interprets the assignment differently.He instead generates one random numberfrom the uniform distribution, and he uses

Page 124: Math puzzles: classic riddles in counting, geometry, probability, and game theory

that number for both the length and width,meaning he creates squares of confetti.

Clearly Alice and Bob will cut out differentshapes of confetti. But how will the averagesize of the confetti compare?

That is, will the average area of the shapesthat Alice and Bob cut out be the same? Ifnot, whose confetti will have a larger averagearea?

124/488

Page 125: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 22: Ran-dom confetti

Let X be a random variable with a uniformdistribution.

Bob takes one realization of X, so the area he

cuts out will be distributed as X2, and the

expected area is E(X2)

Alice instead takes two realization of X. Thearea she cuts out will be E(X)*E(X), or

E2(X).

The difference between Bob's expected areaand Alice's is:

E(X2) - E2(X) = Var(X) >= 0

Page 126: Math puzzles: classic riddles in counting, geometry, probability, and game theory

The difference between Bob's expected areasand Alice's is equal to the variance of X,which is always a non-negative number.Notice this formula holds for random vari-ables of other distributions too, like normaldistributions or discrete distributions.

In the case of the uniform distribution from0 to 1, the variance is 1/12.

So Bob's areas will always be at least as largeor larger than Alice's. So Bob may need alittle bit more paper than Alice when cuttinghis confetti.

126/488

Page 127: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 23: Hands on a clock

The long hand of a very accurate timepiecepoints exactly at a full minute, while theshort hand is exactly two minutes away.What times of day could it be?

Page 128: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 23: Handson a clock

The trick is realizing there are limited timesthat the hour hand lands exactly on one ofthe minute markings. Since the hour handmoves from one hour number marking to thenext (5 minute markings) in a span of 60minutes, that means the hour hand is onlyon minute markings every 12 minutes of thehour, corresponding to the minute times 00,12, 24, 36, and 48.

From here it is just an exercise in trial an er-ror to figure out the right times. If theminute hand is at 00, the hour has to be near11, 12, or 1 to solve the puzzle. But in thesetimes the two hands are separated by either5 or 0 markings.

For the minute hand at 12, the candidatetime would have the hour nearby at the

Page 129: Math puzzles: classic riddles in counting, geometry, probability, and game theory

number 2. But at 2:12, the hour hand hasmoved one marking, and the minute hand istwo markings past the number 2. The twohands are separated by just one minutemarking.

We can proceed to figure out the minutehand at 24 will work. If the minute hand is at24, the candidate hour hand would benearby at 4. We can check 4:24 exactlyworks: the hour hand is 2 markings past theclock "4", and the minute hand is 4 markingspast the clock "4". So does the next candidateof 7:36.

Finally, you can check that the minute handat 48 does not work.

So the two times are 4:24 and 7:36, eitheram or pm.

129/488

Page 130: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 24: String cuttingproblem

An interviewer gives you a string that meas-ures 4 meters in length. The string is to becut into two pieces. One piece is made intothe shape of a square, and the other into acircle. (picture of this below)

Page 131: Math puzzles: classic riddles in counting, geometry, probability, and game theory

131/488

Page 132: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Your job is to make the total enclosed area aslarge as possible.

The interviewer hands you a piece of paperand a pencil so you can do the math (youonly get one chance to cut the string so youwant to be sure your first attempt is correct).

1. How should you cut the string tomaximize the area?

If you are able to figure out the answer, theinterviewer has a couple follow-up questionsto test your skills.

2. How should you cut the string if youwant to minimize the enclosed area?

3. Imagine the string is cut randomly.What is the average value of the en-closed area? (When you cut the string,there is one piece to the left of the cut andanother to the right. Suppose the left piece is

132/488

Page 133: Math puzzles: classic riddles in counting, geometry, probability, and game theory

always made into a circle and the right into asquare)

133/488

Page 134: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 24: Stringcutting problem

1. How should you cut the string tomaximize the area?

This is something of a trick question. For agiven length, the circle is the shape that en-closes the largest area. So you want to makethe whole string be the circle. (This is knownas the isoperimetric inequality and it is not atrivial thing to prove!)

As you must cut it into two pieces, youshould try to cut as close to one end as pos-sible to make the rectangle small.

2. How should you cut the string if youwant to minimize the enclosed area?

This can be solved using calculus. If you letone side of the string be called x for the circle

Page 135: Math puzzles: classic riddles in counting, geometry, probability, and game theory

and the other side be called 4 - x, then youcan find a formula for the area of the twoshapes as follows:

Area =x2/(4 π) + (1 -x/4)2

The first term is the area of the circle, andthe second the square.

The formula is for a parabola.

Using calculus (skipping steps here) we canfind the minimum happens at (4 π)/(4 + π).

3. Imagine the string is cut randomly.What is the average value of the en-closed area?

As stated in step 2, the area function is de-scribed by the equation:

f(x) =x2/(4 π) + (1 -x/4)2

135/488

Page 136: Math puzzles: classic riddles in counting, geometry, probability, and game theory

We can take the average value by calculatingan integral: you integrate the function from0 to 4 (which gives the area under the curve)and then you divide by the length of the in-terval (4) to arrive at the average value:

Average value = 0.25 integral (f(x), x, 0,4)

Using calculus this is computed as 0.758

136/488

Page 137: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 25: One mile South,one mile East, one mile North

This is a very classic puzzle, a fitting end.

I first read about this in the fun puzzle bookHow Would You Move Mount Fuji?

Years ago, Microsoft apparently used to askthis puzzle as an interview question.

Here is the problem: how many points arethere on the earth where you could travelone mile south, then one mile east, then onemile north and end up in the same spot youstarted?

Page 138: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 25: Onemile South, one mile East,one mile North

This puzzle is much harder than it seems atfirst.

The easy but wrong answer

The place that comes to mind is the NorthPole.

This is, in fact, one of the correct spots.

You can trace out the path on a globe. Fromthe north pole, you can move your fingersouth one mile. From there, you will go eastone mile and move along a line of latitudethat is exactly one mile away from the northpole. You finally travel one mile north, andyou will exactly end up in the north pole.

Page 139: Math puzzles: classic riddles in counting, geometry, probability, and game theory

The route you travel will look like a triangleor a piece of pie, as seen in this rough sketchI made:

139/488

Page 140: Math puzzles: classic riddles in counting, geometry, probability, and game theory

This is one correct answer. But it is not theonly one.

The harder spots

The other spots on the earth all involve trav-eling near the South Pole.

The trick to these solutions is that you endup in the same spot after traveling one mileeast.

How can that be?

One way this is possible is if you are on a lineof latitude so close to the South Pole that theentire circle of latitude is exactly one milearound. We will label this circle C(1) forconvenience.

With this circle in mind, it is possible to fig-ure out a solution.

140/488

Page 141: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Let us begin the journey from a point exactlyone mile north of C(1). Let’s trace out thepath of going one mile south, one mile east,and one mile north again.

To begin, we travel one mile south to pointon the circle C(1). Then, we travel east alongthe circle C(1), and by its construction, weend up exactly where we began. Now wetravel one mile north, and we reach the start-ing point of the journey, exactly as wewanted.

The trip will look something like this roughsketch I made:

141/488

Page 142: Math puzzles: classic riddles in counting, geometry, probability, and game theory

This demonstrates there is a solution in-volving a circle near the South Pole.

In fact, the circle C(1) is associated with afamily of solutions. Any point one mile northof C(1) will be a possible solution. Thismeans the entire circle of latitude one milenorth of C(1) is a solution. This means there

142/488

Page 143: Math puzzles: classic riddles in counting, geometry, probability, and game theory

are an infinite number of solutions associ-ated with the circle C(1)!

That alone seems remarkable. But what ismore interesting is that there are even moresolutions.

The circle C(1) was special because we tra-versed it exactly once, and ended where westarted from, when we went one mile east.

There are other circles with the same prop-erty. Consider the circle C(1/2), a similarlydefined circle of exactly 1/2 mile in circum-ference. Notice that traveling one mile eastalong this circle will also send us back to thestarting point. The only difference is that wewill have traversed the circle two times!

Thus we can construct solutions using thecircle C(1/2). We start one mile north fromC(1/2) and every point along this line of

143/488

Page 144: Math puzzles: classic riddles in counting, geometry, probability, and game theory

latitude is a solution. There is an infinitenumber of solutions associated with thecircle C(1/2).

Naturally, we can extend this process tomore circles. Consider the circle C(1/3), sim-ilarly defined with exactly 1/3 mile in cir-cumference. It would be traversed threetimes if we travel one mile east along it, andwe would end in the same place we startedfrom. This circle too will have an infinite setof solutions–namely the line of latitude onemile north of it.

To generalize, we can construct an infinitenumber of such circles. We know the circlesC(1), C(1/2), C(1/3), C(1/4), … C(1/n), … willbe traversed exactly n times if we travel onemile east along them. And there are corres-ponding starting points on the lines of latit-udes one mile north of each of these respect-ive circles.

144/488

Page 145: Math puzzles: classic riddles in counting, geometry, probability, and game theory

In summary, there are an infinite number ofcircles of latitudes, and each circle of latitudecontains an infinite number of startingpoints.

The correct answer, therefore, is one point atthe North Pole, plus two infinite set of pointsof circles near the South Pole.

145/488

Page 146: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Section 2: Probabilityproblems

Life is often said to be a game of chance. Thefollowing 25 puzzles deal with probability.

Page 147: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 1: Making a fair cointoss

Alice and Bob play a game as follows.

Alice spins a coin on a table and waits for itto land on one side.

If the result is heads, Alice wins $1 from Bob;if tails, Alice pays $1 to Bob.

While the game sounds fair, Bob suspects thecoin may be biased to land on heads more.The problem is he cannot prove it.

Being diplomatic, Bob does not accuse Aliceof trickery. Instead, Bob introduces a smallchange in the rules to make the game fair toboth players.

What rule could Bob have come up with?

Page 148: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 1: Making afair coin toss

Bob worries the coin may be biased to landon heads more often than tails. The trick Bobcomes up with is a way to turn a biased coininto having fair tosses.

The technique is referred to as the von Neu-mann procedure, and it works as follows:

----

Step 1. Spin the coin twice.

Step 2. If the two results are different,use the first spin (HT becomes “heads”,and TH becomes “tails”).

Step 3. If the two results are the same(HH or TT), then discard the trial andgo back to step one.

Page 149: Math puzzles: classic riddles in counting, geometry, probability, and game theory

----

In other words, Bob has redefined the payoutrule to ensure the odds are fair to bothparties.

Why does the von Neumann procedureworks? The procedure takes advantage thatHT and TH are symmetrical outcomes andwill thus have equal probability.

To see this, suppose the outcome heads oc-curs with probability 0.6 and tails with prob-ability 0.4. Then we can directly calculate theprobability of the pairs as:

–HT occurs (0.6)(0.4) = 0.24–TH occurs (0.6)(0.4) = 0.24

These events are equally likely, and henceboth players have an even chance of winningthe game.

149/488

Page 150: Math puzzles: classic riddles in counting, geometry, probability, and game theory

The von Neumann procedure takes advant-age that each coin flip is an independentevent, and so both mixed pairs of tosses willhave equal chances.

Appendix: spinning vs tossing

Observant readers may have noticed thegame is about coin spinning rather than cointossing.

Why the distinction? It’s a small bit of triviathat coin tossing is not easily biased:

“The law of conservation of angular mo-mentum tells us thatonce the coin is in the air, it spins at anearly constant rate(slowing down very slightly due to airresistance). At any rateof spin, it spends half the time withheads facing up and half the

150/488

Page 151: Math puzzles: classic riddles in counting, geometry, probability, and game theory

time with heads facing down, so when itlands, the two sidesare equally likely (with minor correc-tions due to the nonzerothickness of the edge of the coin)”

via Teacher’s Corner: You Can Load aDie, But You Can’t Bias a Coin

The theory is only slightly modified in real-life. In practice, there is still a small bias to-wards one side of a coin.

I will refer you to this article which summar-izes the results from an academic paper thatpoints out coin flipping is almost alwaysslightly biased.

A few of the results are:

--"If the coin is tossed and caught, it hasabout a 51% chance of landing on the

151/488

Page 152: Math puzzles: classic riddles in counting, geometry, probability, and game theory

same face it was launched. (If it startsout as heads, there’s a 51% chance it willend as heads)"

--"If the coin is spun, rather than tossed,it can have a much-larger-than-50%chance of ending with the heavier sidedown. Spun coins can exhibit “huge bi-as” (some spun coins will fall tails-up80% of the time)"

--A coin will land on its edge around 1 in6000 throws, creating a flipisticsingularity.

The lesson is that coin flips are better thancoins being spun.

But a coin flip will still exhibit some bias, soto be fair, it may be best to use the von Neu-mann procedure or another choice mechan-ism (like a computer random numbergenerator).

152/488

Page 153: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 2: iPhone passwords

This is based on a question my friend askedme.

Presh, real-life question for you: What isthe safest way to lock my iphone?

Let me explain.

A friend unlocked his phone once and Igrabbed it and said "so, 9,6,0, and 1,huh?" because the bulk of "tap prints"were on those numbers and, I rightlypresumed, correlated to his password.He freaked out because were I a thief, Icould unlock his phone pretty easily asI'd know all four numbers and that theyare only used once each within the four-digit code. Not terribly safe, is it?

So when setting my password, I opted torepeat a number (e.g. 1-2-3-1). That way,

Page 154: Math puzzles: classic riddles in counting, geometry, probability, and game theory

someone would look at my phone andeven if they could figure the three num-bers I use, they would either have toguess at the fourth number (whichdoesn’t exist) or, should they rightly fig-ure out that I only use three independ-ent numbers, they would have to try allpossible permutations of those three dif-ferent numbers within a four-digit code.

Question: is it harder to guess a passwordthat uses only 3-digits or one that uses a 4distinct digits?

Would it be harder to guess if one only useda passcode containing 2-digits?

154/488

Page 155: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 2: iPhonepasswords

We need a way of counting possible pass-words. The easiest case is when someoneuses 4 unique numbers for the 4-digitpasscode. Each number is used exactly oncein the passcode, and hence the problem re-duces to counting the number of ways to re-arrange 4 objects. This is solved by countingthe number of permutations. For a passwordusing 4 digits, there are exactly 4! = 4 x 3 x 2x 1 = 24 ways to have this kind of password.

But what happens when you have a passwordlike 1231? That is, how can you count pass-words in which one or more numbers areused multiple times? You have to count thenumber of combinations.

The way to solve this is by using an extensionof permutations known as the multinomial

Page 156: Math puzzles: classic riddles in counting, geometry, probability, and game theory

coefficient. The multinomial coefficient iscalculated as the total number of permuta-tions divided by terms that account for non-distinct or repeated elements. If an elementappears k times (i.e. has a multiplicity of k),then the factor to divide by is k!

A simple example from Wikipedia’s entrycan illustrate. Let’s say we want to figure outthe number of distinct ways to rearrange theletters in the word MISSISSIPPI. There are11 letters but some of the letters are re-peated. There are 1 Ms, 4 Is, 4 Ss, and 2 Ps.The number of distinct rearrangements ofthe letters is the number of permutations(11!) divided by the factors for the elementsaccounting for their multiplicity (1! x 4! x 4!x 2!). The multinomial coefficient is thus 11 !/ (1! x 4! x 4! x 2!) = 34,650.

Am I helping myself by using three numbersin a four-digit code?

156/488

Page 157: Math puzzles: classic riddles in counting, geometry, probability, and game theory

There are 4! = 24 possible ways a passwordcan be formed from four distinct and knownnumbers. Will using just three numbers in-crease the number of possibilities?

The surprising answer is that yes, it does. Itseems counter-intuitive at first so let’s gothrough an example.

Suppose you see an iPhone where the “tapprints” are on the numbers 1, 2, and 3. Howmany possibilities are there for the four-digitpassword to unlock the phone?

There’s a simple observation needed to goon. In order that three numbers are all usedin a four-digit password, it must be the casethat some digit is used twice. Perhaps thenumber 1 appears twice, or the number 2, orthe number 3.

Suppose the number 1 is used twice. Howmany passwords are possible? We can use

157/488

Page 158: Math puzzles: classic riddles in counting, geometry, probability, and game theory

the multinomial coefficient to figure it out.We know the total number of permutationsis 4! and we must divide by 2! to account forthe number 1 being used twice. Thus, thereare 4! / 2! = 24 / 2 = 12 different passwords.We can list these out:

112311321213131212311321211321312311311231213211

But we are not done yet. We must similarlycount for the cases in which the number 2 isused twice, or the number 3 is used twice. By

158/488

Page 159: Math puzzles: classic riddles in counting, geometry, probability, and game theory

symmetry it should be evident that each ofthose cases yields an additional 12passwords.

To summarize, there are 12 passwords whena given number is repeated, and there arethree possible numbers that could be re-peated. In all, there are thus 12 x 3 = 36passwords.

Notice there were just 24 passwords whenusing four distinct numbers.

This trick of using three numbers does in factincrease the set of possible passwords. Whileeach case of three digits only gives 12 pass-words, the gain to this method is that theother person doesn’t know which number isrepeated. And so they have to consider allpossibilities which becomes 36 possiblepasswords.

159/488

Page 160: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Would it be even safer if I only mixed two in-dependent numbers?

If three is better than four, then is two betterthan three?

Unfortunately it is not.

There is just not enough variety when usingtwo numbers. The gain in ambiguity of mul-tiplicity is simply not enough to counteractthe lack of passwords.

With two distinct numbers, there are only 14possible passwords. This is found since thetwo numbers either have multiplicities as (1,3), or (2, 2) or (3, 1). We can add up the mul-tinomial coefficients to get 4! / (1! x 3!) + 4! /(2! x 2!) + 4! / (3! x 1!) = 4 + 6 + 4 = 14.

We can also list them out:

1112

160/488

Page 161: Math puzzles: classic riddles in counting, geometry, probability, and game theory

1121121121111222212222122221112212212211121221212112

In conclusion, using two numbers ends upreducing the possible number of passwords.

Additional ways to help

If that weren’t enough, my friend actuallybrainstormed a couple of other ways to im-prove the password.

161/488

Page 162: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Actually now I can think of all kinds ofbrilliant maneuvers… like using threedigits but tapping a phantom fourthnumber once the code is entered…. sothere are four “tap prints” but only threewhich are relevant!

Or, by the same measure, you could usefour independent numbers and then tapa fifth time to have 5 options for fourspaces.

I think these are interesting possibilities too,but they hit me as a little less practical sinceyou’d have to diligently tap those extra num-bers to make the smudge marks.

I’ll leave it to you to figure out how manypasswords those methods will yield.

162/488

Page 163: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Perhaps an equally valuable suggestion is tosimply clean the touch-screen intermittentlyto erase the finger print marks and leave noclue.

163/488

Page 164: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 3: Lady Tasting Tea

The problem is based on an incident at a1920s tea party in Cambridge. The story goesone lady claimed the ability to distinguishbetween tea made by pouring tea to milk orby adding milk to the tea.

Everyone questioned the claim, but one per-son decided test it out. He created an experi-ment with 8 tea cups, consisting of 4 cups ofeach preparation.

The lady was remarkably able to identify all8 cups, raising the issue of whether she justgot lucky.

What are the odds that the lady identified all8 cups by chance?

The problem is known as the Lady TastingTea, and it brought about the more modern

Page 165: Math puzzles: classic riddles in counting, geometry, probability, and game theory

analysis of testing random experimentaldata.

165/488

Page 166: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 3: LadyTasting Tea

This is a classic question of combinations.We know there are 8 items, of which 4 willbe one type, and 4 the other.

Therefore there are "8 choose 4" or 70 differ-ent combinations that are possible. (See theiPhone password puzzle for an explanationof counting possibilities with repeatedelements)

The probability of identifying all of the cupsby chance is a mere 1/70 (around 1.4 per-cent). We can conclude the lady likely had arefined palette.

Page 167: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 4: Decision bycommittee

Imagine you face a very difficult decision andthere is a low probability of making the rightchoice. (p < 0.5)

What would you rather do: ask a single per-son to decide or instead send it to a three-person group where the majority choicewins? Assume the three-person committeepeople are independently voting, with eachhaving the same chance of determining thecorrect decision.

Page 168: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 4: Decisionby committee

The situation can be modeled using probab-ility. We can say that each person has an in-dependent probability p of making the rightchoice. Since the problem is difficult, we willsay p < 0.5. (Imagine each person is equallylikely to choose among three or more pos-sible alternatives).

What’s the success of the individual versusthe group?

The individual is easy: the probability ofmaking the right decision is p.

The three-person group is a little harder. Thegroup will find the right answer whenevertwo or more of the people vote for the rightoption. Since each person can vote “right” or“wrong,” there are 8 possible ways to vote:

Page 169: Math puzzles: classic riddles in counting, geometry, probability, and game theory

RRRRRWRWRRWWWRRWRWWWRWWW

The first, second, third, and fifth items listedare the 4 ways the group can come to theright decision. Adding the probabilities forthese events gives the chance the group willcome to the correct decision.

When all three are right, RRR, that is p3.

When two are right, say RRW, that is p2(1-p)and there are three such events like this.

The probability that a majority find the rightdecision is the sum of these events, which is

p3+3p2(1-p) = 3p2 – 2p3

169/488

Page 170: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Since p < 0.5, we can see this final expres-sion is less than p. In the following chart, thedotted line shows the probability the com-mittee comes to the right decision is lessthan the probability an individual finds theright decision.

170/488

Page 171: Math puzzles: classic riddles in counting, geometry, probability, and game theory

The moral: committees may not be the bestfor making tough choices!

That’s not to say committees are useless.They will of course exist to diffuse risk and

171/488

Page 172: Math puzzles: classic riddles in counting, geometry, probability, and game theory

for the purpose of brainstorming (which mayincrease the odds of success over an indi-vidual). But this does show committees areill-suited for the type of hard problem theyare meant to address.

172/488

Page 173: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 5: Sums on dice

With two dice, you can roll a 10 in two differ-ent ways: you can either roll 5 and 5, or youcan roll 6 and 4. Similarly, you can roll a sumof 5 in two different ways: as the rolls and 1and 4, or as 2 and 3.

But the two events "roll a 10" and "roll a 5"will not occur with equal frequency. Whynot?

(credit: Luck, Logic, and White Lies)

Page 174: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 5: Sums ondice

The trick is all about the wording of thepuzzle which creates a mystery where thereis none.

The sum 10 can be obtained in three ways bydice roll: namely (5,5), (4,6), and (6,4); thesum 5 in four ways: (1,4), (4,1), (2,3) and(3,2).

So the sum 10 is obtained with probability3/36 versus the sum 5 with probability 4/36.

Pictorially:

Page 175: Math puzzles: classic riddles in counting, geometry, probability, and game theory

The puzzle demonstrates that it’s always im-portant to consider the events in probability.Sly wording, like this puzzle’s ways describ-ing sums rather than pairs of rolls, can easilyconfuse.

175/488

Page 176: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 6: St. Petersburgparadox

You are offered an unusual gamble.

A fair coin is tossed until the first heads ap-pears, which ends the game. The payoff toyou depends on the number of tosses. Thepayoff starts at 2 dollars and doubles on eachsuccessive toss.

That means you get 2 dollars if the first tossis a head, 4 dollars if the first toss is a tailsand the second is a heads, 8 dollars if thefirst two tosses are tails and the third is ahead, and so on. In other words, you get paid

2k where k is the number of tosses for thefirst heads.

Page 177: Math puzzles: classic riddles in counting, geometry, probability, and game theory

The question to you is how much should yoube willing to pay to play this game? In otherwords, what is a fair price for this game?

177/488

Page 178: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 6: St.Petersburg paradox

The typical way to answer this question is tocompute the expectation (or the “average”)of the payouts. This is done by multiplyingthe various payouts by their probability ofoccurrence and adding it up. To say it anoth-er way, the payouts are weighted by theirlikelihood.

The respective probabilities are easy to com-pute. The chance the first toss is a heads is1/2, the chance the first toss is a tails and thesecond is a heads is 1/2 x 1/2, and the thirdtoss being the first heads is 1/2 x 1/2 x 1/2,so the pattern is clear that the game ending

on the k toss is (1/2)k

So with probability 1/2 you win 2 dollars,with probability 1/4 you win 4 dollars, with

Page 179: Math puzzles: classic riddles in counting, geometry, probability, and game theory

probability 1/8 you win 8 dollars and thusthe expectation is:

The surprising result is the expectation is in-finity. This means this game–if played ex-actly as described–offers an infinite payout.With an astronomical payout, a rationalplayer should logically be willing to pay anastronomical amount to play this game, likepaying a million dollars, a trillion dollars,and so on until infinity.

The fair price of infinity is paradoxical be-cause the game does not seem like it is worthmuch at first. Few would be willing to paymore than 10 dollars to play this game, letalone 100 dollars or 1,000 dollars.

179/488

Page 180: Math puzzles: classic riddles in counting, geometry, probability, and game theory

But expectation theory seemingly says thatany amount of money is justifiable. Banksshould be willing to offer loans so peoplecould play this game; venture capital firmsshould offer more money than they do tostart-ups; individuals should be willing tomortgage their house, take a cash advance ontheir credit card, and take a payday loan.

What’s going on here? Why is the expecta-tion theory fair price so different from com-mon sense?

It turns out there are a variety ofexplanations.

Resolution 1: Payouts should berealistic

Imagine you are playing this game with afriend. You hit a lucky streak. The first ninetosses have been tails and you’re still going.If the tenth toss is a heads, then you get

180/488

Page 181: Math puzzles: classic riddles in counting, geometry, probability, and game theory

1,204 dollars as a payout. If it’s a tails, youhave a chance to win 2,408 dollars, and evenmore.

At this point your friend realizes he’s made amistake. He thought he’d cash out with your10 dollar entry fee, but he now sees he can-not afford to risk any more.

He pleads with you to stop. He’ll gladly payyou the 512 dollars you’ve earned–so long asyou keep this whole bet a secret from hiswife. What would you do in this situation?

Most of us would take the cash and showsome mercy here. There is no joy in winningif it means crippling a friend financially. Andthis concocted scenario leads to one of theunrealistic assumptions of the St. Petersburgparadox.

In the hypothetical coin game, you’re sup-posed to believe the other side can pay out

181/488

Page 182: Math puzzles: classic riddles in counting, geometry, probability, and game theory

infinitely large sums of money. It doesn’thappen often, but if you get to 20 coin tosses,you fully expect to be paid 1,048,576 dollars.

This is unrealistic if you’re playing with afriend or even a really, really rich friend. Itmight be possible with a casino, but even acasino may have a limited bankroll.

The truth is that payouts cannot be infinite.If such a game were to exist in our reality,there must be a maximum, finite payout.

This means the expectation is not an infinitesum but rather a finite sum of several terms.Depending on the size of the bankroll, the StPetersburg gamble has a finite payout.

I will spare you the details, but here are a fewexamples of the expectation when using amaximum payout using numbers from aWikipedia table for illustration):

182/488

Page 183: Math puzzles: classic riddles in counting, geometry, probability, and game theory

(small note: these calculations are based onpayouts of 1, 2, 4, etc so it's slightly differentthan the game I set up of 2, 4, 8, etc.)

As you can see, expectation theory now im-plies the fair price of the game is somethinglike 25 dollars or less. With a more realisticmodel of the game, the expectation resultmatches common sense.

183/488

Page 184: Math puzzles: classic riddles in counting, geometry, probability, and game theory

This should settle matters for anyone con-cerned with reality and practice, but thereare people who don’t accept this explanation.Such philosophers think an infinite payout ispossible and so the paradox still exists.

So for these people, I will offer the followingalternate resolutions that don’t rely on limit-ing the bankroll.

Resolution 2: diminishing marginalutility

A quantity like 1,000 dollars has meaning tomost people. If you were to ask a friend forsuch a loan, they would ask how you can payit back, what you would use it for, and so on.

But there are times when 1,000 dollarsseems to lose its value. I like to think aboutthe show Deal or No Deal where contestantsplay a multi-stage lottery to win 1,000,000dollars. At various points in the game the

184/488

Page 185: Math puzzles: classic riddles in counting, geometry, probability, and game theory

contestants can either keep pursuing the bigprizes or they can accept smaller consolationprizes. As the prospect of a big prize in-creases, the contestants start to care less andless about smaller prizes like 1,000 dollars.

This is an example of the famous concept ofdiminishing marginal utility–the idea that atlarger levels of consumption, incrementalunits are worth less. The concept is applic-able for wealth decisions because at somepoint incremental earnings mean less to aperson.

What this means for the St. Petersburg Para-dox is that the payouts should be altered.The payouts should not be measured in dol-lars but rather as the utility that wealth willprovide.

One way to model this is to use a logarithmfunction. Instead of saying the payout for thefirst toss is 2 dollars, we will say it is log(2)

185/488

Page 186: Math puzzles: classic riddles in counting, geometry, probability, and game theory

units of utility, and accordingly for the otherpayouts.

Using a log utility function, the St Petersburggame now has a finite payout. Here is myhand-written derivation:

186/488

Page 187: Math puzzles: classic riddles in counting, geometry, probability, and game theory

This is a small payout but the actual quantitydoes not matter: it is just that the payout isless than infinity, showing again, that thereis no real paradox here.

187/488

Page 188: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 7: Odds of a comebackvictory

Consider two teams A and B that are com-pletely evenly matched. Given that a team isbehind in score at halftime, what is the prob-ability that the team will overcome the deficitand win the game?

Assume there are no ties, and the result ofthe first half does not affect how players per-form in the second half (that is, the first andsecond half are taken to be independentevents).

(credit: problem based on page 11, “Probabil-ity: the language of randomness,” by Jeffry S.Simonoff)

Page 189: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 7: Odds of acomeback victory

Because the teams are evenly matched, youmight mistakenly think the answer is 50 per-cent. But that is the probability the teamwould win overall. If a team is down at half-time, the chances of winning will be less. Solet us try to calculate the odds.

We have to think about how a team couldhave a comeback victory if it is down athalftime.

Let us first write down the possible outcomesof the game, broken down by halves. Sincethe two teams are evenly matched, there arefour different possibilities for who is leadingduring each half (ignore the case of a tie):

(first half, second half):AA

Page 190: Math puzzles: classic riddles in counting, geometry, probability, and game theory

ABBABB

Because the teams are evenly matched, theseevents are all equally likely so each occurswith probability 1/4 = 25 percent

In two of the cases, one team scores morepoints in both halfs of the game, and there isno come from behind victory: AA and BB.This means 50 percent of the games the teamthat lags behind at half ends up losing thegame.

The other two possibilities are times when ateam could have a comeback victory. In thesecases, one team leads at the half, but getsoutscored by the other in the second half: ABand BA. In order for a team to get acomeback victory, it must overcome the defi-cit from the first half. How often does thathappen?

190/488

Page 191: Math puzzles: classic riddles in counting, geometry, probability, and game theory

The answer can be calculated by the follow-ing logic: since the two teams are evenlymatched, it is equally likely that the team willscore enough points to overcome the deficitor that it will not score enough points. (Forinstance, the event of falling behind 6 pointsin one half happens with the same probabil-ity of gaining 6 points in a half). Therefore,in the event AB, it will be equally likely thatB scores enough to eventually win, or that itwould not score enough and it loses.

Therefore, B ends up winning in half of thecases, or 12.5 percent of the time (take 1/2 of25 percent). The same logic applies for theevent BA: there is a 12.5 percent chance thatteam A ends up winning.

Putting this all together, we have:

Probability(team having comeback vic-tory) = P(AB)*Pr(B wins) + Pr(BA)*Pr(Awins) = 12.5 + 12.5 = 25 percent

191/488

Page 192: Math puzzles: classic riddles in counting, geometry, probability, and game theory

So under these assumptions, a team willhave a 1 in 4 chance of making a comebackvictory.

Now you may point out this is not realistic asthe model does not take into account qualityof teams and things like home field advant-age. Nor does it take into account psycho-logy: a recent study shows that teams with aslight deficit at halftime end up winningmore often than teams with a slight edge athalftime. Here is the remarkable study basedon 18,000 professional basketball games and45,000 college games.

However, even though the assumptions are abit off, the overall league statistics seem tomirror the probability model.

In the National Football League, a smallsample of games in 2005 showed this trend:

192/488

Page 193: Math puzzles: classic riddles in counting, geometry, probability, and game theory

"Joe Gibbs is not telling his troops theyhave a 23 percent chance of winning. Ofthe 88 games observed, 68 of the teamsthat went in at halftime with the leadwent back to the locker room at the endof the game with the lead and the win.That's right 77 percent of the time if ateam had a lead at halftime, it won thegame. [And thus 23 percent of the time,the team facing a deficit came back for avictory]"

I found the same pattern was shown to hap-pen in the National Basketball League(though granted this is 20 year old data; I'dlove to see whether the pattern holds true formore recent seasons):

"Professor Hal Stern of the University ofCalifornia at Irvine examined 493 Na-tional Basketball Association gamesfrom January to April 1992, and foundthat in 74.8% of the games, the team

193/488

Page 194: Math puzzles: classic riddles in counting, geometry, probability, and game theory

that was ahead at halftime ultimatelywon the game [and thus the losing teamat halftime came back with probability25.2 percent]"

This is either a pure coincidence or there issomething to be said about the simple prob-ability model. It's fascinating to me eitherway.

194/488

Page 195: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 8: Free throw game

Alice and Bob agree to settle a dispute byshooting free throws.

The game is simple: they take turns shoot-ing, and the first one to make a shot wins.

Alice makes a shot with probability 0.4 whileBob makes his shots with 0.6.

To compensate for the skill difference, Alicegets to shoot first.

Is this a fair game?

Extension: if Alice makes a shot with prob-ability p and Bob with probability q, for whatvalues of p and q would the game be fair?Solve if q = 1 – p

Page 196: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 8: Freethrow game

There are many methods to solving the prob-abilities of winning. The one I like is a tech-nique of backwards induction.

The free throw game seems hard to figureout because a round could end with no onemaking a shot, and then the game wouldcontinue. Solving for the winning probabilityseems like you'd need to use an infiniteseries.

But that's not the case. The trick is seeingthat each round is really an independentsub-game. The fact that the previous roundended without a winner does not affect thewinner of the current round or any futureround. This means we can safely ignore out-comes without winners.

Page 197: Math puzzles: classic riddles in counting, geometry, probability, and game theory

The probability of winning depends only onthe features of a single round.

This simplifies the problem to a more tract-able one. So now, assume that one of theplayers did win in a round, and then calcu-late the relative winning percentages.

We can use a little trick to visualize the prob-lem. Because Alice makes a shot with prob-ability 0.4, and Bob with 0.6, we can imaginethe two are not shooting free throws but in-stead rolling a 5 sided die.

Let's say that Alice makes her shot for rollingthe numbers 1 and 2, and Bob makes his shotfor the other three numbers 3, 4, and 5.

So Alice wins if she rolls one of her winningnumbers. If she does not, then Bob gets achance to roll and he wins the game forrolling his numbers. All other combinations

197/488

Page 198: Math puzzles: classic riddles in counting, geometry, probability, and game theory

of the rolls means they both miss their shots,so the round is a draw and they go again.

Here is a diagram illustrating the outcomesof a round, illustrating the events for whichAlice will win:

To calculate the winning percentage, we cansimply count out the number of ways thatAlice wins. In the grid, there are 10 squaresthat she wins, and only 9 that Bob wins.

198/488

Page 199: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Therefore, Alice wins with probability 10/19= 53 percent and Bob only with 9/19 = 47percent.

Although Bob is a better shooter, Alice has aslight edge in the game because she gets toshoot first.

Answer to extension: generalizing theprobabilities

The numbers we used made it convenient toconvert the game into rolling a 5-sided die.

But we can generalize the process.

Notice that Alice won on 0.4 percent of thesquares, which is the same as her shootingpercentage.

The percentage of squares for when eitherperson won the game was 0.76, which isequal to the chances Alice makes her shot

199/488

Page 200: Math puzzles: classic riddles in counting, geometry, probability, and game theory

(0.4) or she misses her shot (1 - 0.4) and Bobmakes his (0.6). The sum of this is 0.4 + (1 -0.4) * 0.6.

Thus the probability Alice wins a game is:(SP for shooting percentage)

(Alice's SP) / (Alice's SP + (1 - Alice's SP) *Bob's SP)

If we say that Alice's SP is p and Bob's is q,then this becomes:p / (p + (1 - p) * q)

The game is fair if this term equals 0.5. Skip-ping some of the algebra, this simplifies to:(p - q) -pq = 0

We can plot out all values for which thisequation is true, remembering that p and qare probabilities so they are between 0 and 1.The dotted line corresponds to setting thecondition q = 1 - p

200/488

Page 201: Math puzzles: classic riddles in counting, geometry, probability, and game theory

If we give the additional restriction that q = 1- p, then we can uniquely solve that p isabout 0.382, which is plotted above.

201/488

Page 202: Math puzzles: classic riddles in counting, geometry, probability, and game theory

So Alice at 0.4 shooting percentage is just atad higher than the fair shooting percentageof 0.382.

202/488

Page 203: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 9: Video roulette

Bob loves the TV show Law & Order. Eachday he picks an episode at random andwatches it. Given there are 456 episodes ofthe show, how many days will it take Bob towatch the entire series on average?

Extension: Figure out a formula for a showthat has n episodes.

Page 204: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 9: Videoroulette

Consider smaller cases to get an idea.

If a series has just 1 episode, it will take 1 dayto watch the entire series.

What about 2 episodes? On the first day, Bobwill watch one of the episodes. How long willit take him to watch the remaining episodeon average?

We can solve for the number of days N as asum of two conditional events. If he picks theepisode he has not seen (with probability0.5), then the conditional expectation is 1day. If he instead picks the episode he hasseen, then he essentially loses a day, and heis back to the starting point–so the expecta-tion is N + 1.

Page 205: Math puzzles: classic riddles in counting, geometry, probability, and game theory

In other words,

N = 1 * Pr(picks episode he has not seen) +(N + 1) * Pr(picks episode he has seen)

N = 1 * 0.5 + (N + 1) * 0.5 = 0.5 N + 1

N = 2

Note that it takes Bob 2 days on average towatch the unique episode that he picks withprobability 1/2.

Thus, it takes Bob an average of 3 days (1 dayfor the first episode, 2 days for the second) towatch a series with two episodes.

Solution

We can think about the problem in terms ofrolling a die. Each day Bob picks a new epis-ode randomly is essentially like Bob rolling adie where each face represents an episodenumber.

205/488

Page 206: Math puzzles: classic riddles in counting, geometry, probability, and game theory

The question is: how many times on averagemust a 6-sided die be rolled until all sidesappear at least once?

The first roll can be any of the faces. On thesecond roll, there are 5 remaining uniquefaces out of 6. Using the logic above, we canconclude it will take an average of 1 / (5/6) =6/5 rolls until one sees a different face.

We continue the logic to calculate the num-ber of rolls until a new face. As there are 4remaining out of 6, this will take 6/4 rolls onaverage. Continuing the logic, we can con-clude the total number of rolls it will take onaverage to reveal every face at least once is:

1 + 6/5 + 6/4 + 6/3 + 6/2 + 6/1 = 147/10 =14.7

In other words, for a series with 6 episodes,it will take Bob about 15 days to watch everyepisode.

206/488

Page 207: Math puzzles: classic riddles in counting, geometry, probability, and game theory

For a series with n episodes, the similarseries is:

For n = 456, this sum is roughly 3,056.

For very large n, the series sum is roughly n*ln(n)–though this approximation for 456yields 2792 so it is a very roughapproximation.

207/488

Page 208: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 10: How often does itrain?

In Mathland, the weather is described eitheras sunny or rainy, nothing in between.

On a sunny day, there is an equal chance itwill rain on the following day or be sunny.On a rainy day, however, there is a 70 per-cent chance it will rain on the following dayversus a 30 percent chance it will be sunny.

How often does it rain in Mathland, onaverage?

Page 209: Math puzzles: classic riddles in counting, geometry, probability, and game theory

209/488

Page 210: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 10: How of-ten does it rain?

Here are a couple of ways I solved thisproblem.

Method 1: Let R denote the average propor-tion of rainy days and S of sunny days. Usingthe law of total probability, we know that:

R = E(rains tomorrow | sunny today) *Pr(sunny today) + E(rains tomorrow | rainytoday) * Pr(rainy today)

We can know use a clever trick. On average,the probability it is sunny or rainy on a par-ticular day is S and R, respectively. And wealso know a day is either sunny or rainy, so S= (1-R). Hence we get the following:

R = E(rains tomorrow | sunny today) * (1-S)+ E(rains tomorrow | rainy today) * R

Page 211: Math puzzles: classic riddles in counting, geometry, probability, and game theory

We can simplify this because we know therules of weather. The first conditional ex-pectation is 50 percent and the second is 70percent.

R = 0.5(1-R) + 0.7(R)

This can be solved to find out R = 0.625.

Method 2: The weather can be modeled asa regular or ergodic Markov chain. This is farbeyond the scope of this puzzle book, so seesection 11.3 of this pdf for a reference onlong-run averages.

From that reference it is shown that for aregular transition matrix A, there is a uniquerow vector w called the probability vectorsuch that wA = w. This is the probability ofbeing in those states.

Let us set up the transition matrix:

211/488

Page 212: Math puzzles: classic riddles in counting, geometry, probability, and game theory

A =[0.7 0.5][0.3 0.5]

If w = (R S), and we set wA = w, we get theequations:

0.7 R + 0.5 S = R0.3 R + 0.5 S = S

These equations can be solved to find R =0.625, just as before.

212/488

Page 213: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 11: Ping pongprobability

Suppose A and B are equally strong pingpong players. Is it more likely that A will beatB in 3 out of 4 games, or in 5 out of 8 games?

(credit: problem in this math book)

Page 214: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 11: Pingpong probability

It is more likely that A will beat B in 3 out of4 games than in 5 games out of 8. It's asimple application of binomial probabilitydistributions.

The equation for A winning exactly r games

out of n is "n choose r" times 0.5n

We can calculate the chance of A beating B inexactly 3 games out of 4 is 25% and the oddsof A winning exactly 5 games out of 8 equals7/32 or roughly 21.8%.

Why is this the case? The counter-intuitivepart is the wording of the question. If we in-stead consider A to win at least 3 out of 4games, or at least 5 out of 8 games we have adifferent situation.

Page 215: Math puzzles: classic riddles in counting, geometry, probability, and game theory

In that case, we find that the probability ofwinning 3 or more games out of 4 increasesto 31.25%. All we need to do is add the prob-ability of winning exactly 3 games out of 4,which equals 25%, to the probability of win-ning all 4 games, which is (.5)^4= .0625, or6.25%.

The probability of winning 5 or more gamesout of 8 is equal to (7/32)+ .1094+.0312+.0039 = .3632, or 36.32%.

So in this problem it's important that wewant to know A is winning exactly a certainnumber of games, rather than winning atleast some number of games.

215/488

Page 216: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 12: How long toheaven?

A person dies and arrives at the gates toheaven. There are three identical doors: oneof them leads to heaven, another leads to a1-day stay in limbo, and then back to thegate, and the other leads to a 2-day stay inlimbo, and then back to the gate.

Every time the person is back at the gate, thethree doors are reshuffled. How long, on theaverage, will it take the person to reachheaven?

Page 217: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 12: Howlong to heaven?

Let N denote the average number of days ittakes to get to heaven.

The trick to solve for N is to rewrite the aver-age using symmetry of the game.

N is equal to the average number of days re-gardless of which door you enter first. Thissplits up into three cases:

Case 1: One-third of the time you go directlyto heaven, and that’s 0 days.

Case 2: One-third of the time you pick thedoor that adds 1 day. In this case, you end upin heaven in N + 1 days.

Page 218: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Case 3: The remaining one-third you pick thedoor that adds 2 days. In this case, you endup in heaven in N + 2 days.

These observations lead to the followingequation and answer:

N = 1/3 * 0 + 1/3 * (N + 1) + 1/3 * (N + 2)

N = 1/3 * N + 1/3 + 1/3 * N + 2/3

N = 2/3 * N + 1

1/3 * N = 1

N = 3

218/488

Page 219: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 13: Odds of a badpassword

This is a problem that I was asked by areader.

The problem is as follows: A system has 100accounts, two of which have bad passwords(let’s call these bad accounts). If someonecould only test 20 accounts, what are thechances that one will net a bad account?

Extensions:

1. What is the probability of netting both badaccounts in the sample of 20? What aboutexactly one bad account?

2. What is the probability of netting a bad ac-count if you have k bad accounts, there are Ntotal accounts, and you can sample n ac-counts at one time?

Page 220: Math puzzles: classic riddles in counting, geometry, probability, and game theory

3. Go back to the problem with 100 accounts,and 2 bad accounts. Suppose you can varyhow many accounts you can sample. If youwant a 50 percent chance of netting a bad ac-count, what’s the minimum sample sizeneeded?

220/488

Page 221: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 13: Odds ofa bad password

The answer can be found using the hyper-geometric distributrion.

The same problem can be restated as fol-lows: if you are drawing 20 balls from an urnof 98 white balls and 2 black balls, what arethe chances of drawing a black ball?

The way I calculated this is to find thechance of drawing only white balls and find-ing the complement event. Thus the chanceis:

1 - (2 choose 0)(98 choose 20)/(100choose 20) = 36 percent.

1. What is the probability of nettingboth bad accounts in the sample of 20?What about exactly one bad account?

Page 222: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Two bad accounts is:

(2 choose 2)(98 choose 18)/(100 choose20) = 19/495 or about 4 percent

One bad account is:

(2 choose 1)(98 choose 19)/(100 choose20) = 32/99 or about 32 percent

2. What is the probability of netting abad account if you have k bad ac-counts, there are N total accounts, andyou can sample n accounts at onetime?

You find the chance of getting no bad ac-counts and then find the complement.

This is:

1 - (k choose 0)([N - k] choose n)/(Nchoose n)

222/488

Page 223: Math puzzles: classic riddles in counting, geometry, probability, and game theory

3. Go back to the problem with 100 ac-counts, and 2 bad accounts. Supposeyou can vary how many accounts youcan sample. If you want a 50 percentchance of netting a bad account,what’s the minimum sample sizeneeded?

I used a numerical method to vary thesample size and found out the answer is 30.

It's interesting that you only need to sampleabout a third of the population to have a bet-ter than even chance of finding both badaccounts!

223/488

Page 224: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 14: Russian roulette

Can probability theory save your life? Per-haps not in usual circumstances, but it surewould help if you found yourself playing agame of Russian roulette.

Let’s play a game of Russian roulette. Therules are this: I have a gun that has six emptychambers. Now watch me as I put a singlebullet in the gun. I close the cylinder andspin it. I point the gun to your head and,click, it turns out to be empty.

Now I’m going to pull the trigger one moretime and see if you are really lucky. Whichwould you prefer, that I spin the cylinderfirst, or that I just pull the trigger?

(credit: I’m not sure of the original source ofthis puzzle, but the wording is similar to a

Page 226: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 14: Russianroulette

The problem can be solved by calculating theprobability of survival for the choices.

First, consider the odds of survival if the cyl-inder is spun. The cylinder is equally likely tostop at any of the six chambers. One of thechambers contains the bullet and is unsafe.The other five chambers are empty and youwould survive. Consequently, the probabilityof survival is 5/6, or about 83 percent.

Next, consider the odds if the cylinder is notspun. As the trigger was already pulled, thereare five possible chambers remaining. Addi-tionally, one of these chambers contains thebullet. That leaves four empty or safe cham-bers out of five. Thus the probability of sur-vival is 4/5, or 80 percent.

Page 227: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Comparing the two options it is evident thatyou are slightly better off if the cylinder isspun.

227/488

Page 228: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 15: Cards in the dark

You are given pack of cards has 52 cards in acompletely dark room. Inside the deck thereare 42 cards facing down, 10 cards facing up.

Your task is to reorganize the deck into twopiles so that each pile contains an equalnumber of cards that face up. Remember,you are in the darkness and can’t see.

How can you do it?

Page 229: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 15: Cards inthe Dark

Take any ten cards from the original deck.Create a new deck by flipping over each cardone by one. The two decks will contain thesame number of cards facing up.

Why is that?

Verifying this is a relatively simple countingexercise. Suppose, for example, the 10 cardsyou took consisted of three face up cards andseven face down cards. Since every facedown card gets flipped in the new deck, thenew deck will therefore consist of 7 face upcards. This exactly matches the original deckwhich has 7 remaining face up cards (sincethree face up cards were removed for thenew deck).

Page 230: Math puzzles: classic riddles in counting, geometry, probability, and game theory

The idea is this: removing a card and flippingit is a matching action. When you remove aface down card in the original deck, the num-ber of face up cards is unaffected, which ismatched by the new deck getting a face upcard. When you remove a face up card, thenumber of face up cards is subtracted by one,which is matched by the new deck getting aface down card. By repeating the matchingaction ten times (the number of cards facingup in the original deck), you guarantee thatboth the new deck and the old deck will havethe same number of face up cards.

The general proof goes something like this.Of the 10 cards you remove, suppose thenumber of face up cards removed is x. Thatleaves the original deck with 10 –x face upcards. Correspondingly the new deck con-tains those x cards with a face down orienta-tion. Thus the remaining 10 – x are face upcards and the two decks match.

230/488

Page 231: Math puzzles: classic riddles in counting, geometry, probability, and game theory

(You can extend the problem too. If the ori-ginal deck had 15 face up cards, then you cre-ate a new deck by choosing 15 cards and flip-ping them over. The proof is analogous.)

This puzzle generated a lot of comments on-line, incidentally. My favorite comment:"The existentialist’s solution: throw all thecards in the trash and make two piles ofzero."

231/488

Page 232: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 16: Birthday lineprobability

During a probability course, the professorannounces a chance for the students to getextra credit.

First, the students are to form a single-fileline, without knowing the rules of the game.

Then, the professor announces the rule. Theperson who gets the extra credit is the firstperson to have a matching birthday ofsomeone in front of them in the line.

The poor first person has no chance of win-ning. But which person in line has the bestchance of winning? What is that probability?

Assume birthdays are distributed uniformlyacross the year, and the students formed the

Page 233: Math puzzles: classic riddles in counting, geometry, probability, and game theory

line randomly because they did not know therules.

(credit: adapted from website braingle)

233/488

Page 234: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 16: Birth-day line probability

The answer is the 20th person in line has thebest chance of winning at 3.23%.

The puzzle can be solved analytically, andthe algebra is written over at braingle.

But this is in fact a perfect problem to use anumerical method. Here is how I solved theproblem.

Clearly the first person in line has 0 percentchance of winning. The second person in linewins if he matches the first person, whichhappens with probability 1/365. Let’s denotethe probability the second person wins asp(2).

What about the third person? He can onlywin if two things happen. One, the first two

Page 235: Math puzzles: classic riddles in counting, geometry, probability, and game theory

people cannot have matching birthdays. Thisprobability is (1 – p(2)). Two, he has tomatch one of the two previous birthdays.Since the first two did not match, there are 2possible birthdays the third person couldhave.

Putting this together, we have

p(3) = (1 – p(2)) * 2/365

We can generalize this formula. The probab-ility the fourth person wins is the probabilitythe first three people did not win times theprobability he matches any of 3 birthdays. So

the probability the nth person wins is equalto:

p(n) = (1 – p(2) – … – p(n-1)) * (n – 1)/365

This recurrence relation is easily pro-grammed into a spreadsheet. Have onecolumn that lists the position of the person

235/488

Page 236: Math puzzles: classic riddles in counting, geometry, probability, and game theory

n, another that has the formula (n – 1)/365,and a final column for the cumulative sum ofwinning probabilities for the n– 1 peopleahead in line.

Here is an illustration of the probabilitydistribution:

236/488

Page 237: Math puzzles: classic riddles in counting, geometry, probability, and game theory

The peak probability happens at position 20,with value 3.23 percent. Nearby positionslike 19 and 21 are almost the same probabil-ity, so in this case it does help if you are closeto the correct answer.

237/488

Page 238: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 17: Dealing to the firstace in poker

In Texas Holdem poker, sitting in the dealerposition is a strategic advantage. The dealerposition generally acts last in betting and isnot forced to post blinds.

For a game in progress, the dealer positionrotates around the table after each hand. Butat the start of the game, the dealer position issimply assigned to one player.

So who gets to be dealer initially?

In poker tournaments, the dealer position ischosen by a random process so everything isfair.

In home games, people do not always userandom number generators. One of the com-mon methods is dealing to the first ace. It

Page 239: Math puzzles: classic riddles in counting, geometry, probability, and game theory

works like this: the host deals a card to eachplayer, face up, and continues to deal untilsomeone receives an ace. This player gets tostart the game as dealer.

The question is: does dealing to the first acegive everyone an equal chance to be dealer?Is this a fair system?

239/488

Page 240: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 17: Dealingto the first ace in poker

Dealing to the first ace is not a fair system.The distribution of the first ace appearing on

the kth card is not completely random.

To solve the problem, it is helpful to solve arelated question: what is the probability thatthe first time an ace is dealt from the deck is

the 1st, or 2nd, or 3rd, or the kth card?

Once this distribution is known, it will thenbe possible to calculate the odds a personwill get the dealer by summing up the pos-sible “winning” positions. But more on thatlater. For now, let’s calculate the probabilitydistribution of the first ace being dealt in po-sition k.

To begin, note that a standard deck has 52total cards of which 4 are aces.

Page 241: Math puzzles: classic riddles in counting, geometry, probability, and game theory

What are the odds an ace will be the 1st; carddealt? The probability is readily calculated asthe number of aces divided by the total cardswhich is 4/52.

So far easy enough. Continuing, what are the

odds an ace will first be dealt as the 2nd cardfrom the deck? This happens only if the fol-lowing two events occur:

(i) the first card dealt was not an ace (48/52)AND(ii) the second card dealt is an ace (4/51)

I have written the probabilities at the end ofeach condition. The probability for (i) is thenumber of non-ace cards divided by thenumber of total cards, or 48/52. The probab-ility for (ii) is similarly calculated but justslightly more complicated. The numerator isthe number of aces which is obviously 4. Thedenominator is the number of cards still leftin the deck. As one card was dealt for event

241/488

Page 242: Math puzzles: classic riddles in counting, geometry, probability, and game theory

(i), there are 51 cards remaining. And hencethe probability for (ii) becomes 4/51.

Therefore, the probability for the first ace be-

ing dealt as the 2nd card from the deck is theproduct of these two events, which is (48 x 4)/ (52 x 51).

We can continue the exercise to calculate the

first ace appearing on the 3rd card. This onlyhappens when three events occur:

(i) the first card dealt was not an ace (48/52)AND(ii) the second card dealt was not an ace (47/51) AND(iii) the third card dealt is an ace (4/50)

The probabilities for each event are calcu-lated in the same fashion as above: the onlytricky part is remembering to decrement thenumerators and denominators to account forthe cards already dealt out.

242/488

Page 243: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Putting these together, the probability for

the 3rd card being the first ace is (48 x 47 x 4)/ (52 x 51 x 50).

By now it is evident the probability calcula-tion has a pattern. We can thus generalizethe logic to calculate the first ace appearing

on the kth card.

The specifics for this to happen are the fol-lowing events:

(i) the first card dealt was not an ace (48/52)AND(ii) the second card dealt was not an ace (47/51) AND…

(k) the kth card dealt is an ace [4/(52-k + 1)]

This calculation is straight-forward andagain the only tricky part is the diminishingnumerators and denominators.

243/488

Page 244: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Multiplying these event probabilities togeth-er yields the chance as [48 x 47 x ... (48 -k +2) x 4] / [52 x 51 x 50 x (52 – k + 1)], for 1 > k> 49

There is a restriction on k because the pro-cess can theoretically continue until thereare just 4 cards left in the deck, all of whichare all aces. And then the next card must bean ace.

I went ahead and calculated the probabilityfor each k and I thought a graph would be in-structive. Here is what the distribution lookslike:

244/488

Page 245: Math puzzles: classic riddles in counting, geometry, probability, and game theory

The distribution is very gently falling be-cause it is less and less likely it will take somany turns for the first ace to appear.

Solving the original problem

245/488

Page 246: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Now that we have the complete distribution,we can solve for the probability a particularplayer is assigned the dealer.

To see how this works, consider a pokergame with just two players. Let’s say the firstperson dealt a card face up is “player 1″ andthe other person is “player 2.”

When will player 1 be dealer? Player 1 isdealer if the first ace is dealt to him and notplayer 2. Which cards are potentially dealt toplayer 1? Player 1 gets the first card, then onecard goes to player 2, but then he gets thethird card, and so on. In other words, player1 is the dealer precisely if the first ace ap-pears in the odd-numbers positions 1, 3, 5,…, 47. And correspondingly, player 2 is thedealer if the first ace appears in any of theeven-numbered positions 2, 4, 6, …, 48.

Using a spreadsheet it is easy enough to sumup those entries to find the probabilities. It

246/488

Page 247: Math puzzles: classic riddles in counting, geometry, probability, and game theory

turns out that player 1 gets to be dealer al-most 52 percent of the time versus 48 per-cent for player 2. This might seem like asmall edge, but realize this is worse of a biasthan most casino games! Player 1 has a greatadvantage in this system.

The entire distribution

Similar calculations can be performed if thegame starts with a different number of play-ers. For illustration, I extended the calcula-tions for games of 3 players up to 9 players (afull ring game).

The probability is again calculated based onthe distribution of the first ace. In a 3-han-ded game, for example, the first person dealtis the dealer if the first ace appears on theturns 1, 4, 7, etc.; the second on turns 2, 5, 8,etc.; and the third on turns 3, 6, 9, etc. (Thiscalculation was automated as I used a handy

247/488

Page 248: Math puzzles: classic riddles in counting, geometry, probability, and game theory

spreadsheet array formula to sum up theprobabilities based on the turn modulo).

Here are the results.

The first table is about the probability thefirst player receiving a card gets the ace.Notice there is a definite edge over the fairodds of anywhere from 2 to 4 percent.

The advantage becomes exceeding large ingames with 7, 8, and 9 players where the first

248/488

Page 249: Math puzzles: classic riddles in counting, geometry, probability, and game theory

person receiving a card has almost doublethe chance of getting to be dealer initiallycompared to the last player.

249/488

Page 250: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 18: Dice brain teaser

You and I play a game where we take turnsrolling a die. I win if I roll a 4. You win if youroll a 5.

If I go first, what’s the probability that I win?

Here are some clarifying notes about thegame:

–If I don’t get a 4, and you don’t get a 5, wekeep rolling until one of us does get a win-ning number.

Page 251: Math puzzles: classic riddles in counting, geometry, probability, and game theory

–The order of play matters. If I roll a 4, I winand the game ends. You roll only if I fail toget a 4.

–Someone will ultimately win the game(there is no draw). This means the probabil-ity I win is the same as the probability thatyou lose.

251/488

Page 252: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 18: Dicebrain teaser

This dice problem is mentally tricky becausemany rounds end without a winner. It wouldseem necessary to keep track of an infiniteseries to arrive at an answer.

But that’s not the case. The trick is seeingthat each round is really an independentsub-game. The fact that the previous roundended without a winner does not affect thewinner of the current round or any futureround. This means we can safely ignore out-comes without winners.

Method 1: conditional probability

The probability of winning depends only onthe features of a single round.

Page 253: Math puzzles: classic riddles in counting, geometry, probability, and game theory

This simplifies the problem to a more tract-able one. So now, assume that one of theplayers did win in a round, and then calcu-late the relative winning percentages.

In other words, calculate the probability thefirst player wins given the round definitelyproduced a winner.

To do that, we look at the distribution of out-comes. In any given round, the first playercan roll six outcomes, as can the second play-er. How many of those thirty-six outcomesproduce a winner, and how many are fromthe first player?

This diagram illustrates the answer:

253/488

Page 254: Math puzzles: classic riddles in counting, geometry, probability, and game theory

There are exactly 11 outcomes where some-body wins, of which 6 belong to the firstplayer. Therefore, the first player wins with a6/11 chance, or about 54.5 percent of thetime.

254/488

Page 255: Math puzzles: classic riddles in counting, geometry, probability, and game theory

The first-mover advantage is caused by thefact the first player wins even if both were toroll winning numbers.

But there are a couple of other ways to thinkabout the problem too. The next method isespecially interesting.

Method 2: Symmetric Thinking

This method is about using a mental trick. Iparticularly find it satisfying, though I canhonestly say I would not have come up withthis on my own.

Here is the solution from a comment by Mjaat Reasonable Deviations:

Let p denote the probability that “I” (the firstplayer) win. Since all games ultimately pro-duce a winner, the second player wins withthe complementary probability 1 - p.

255/488

Page 256: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Let’s figure out the chance that I win. On myroll, I have a 1/6 chance of winning thegame. What happens in the 5/6 of caseswhen I don’t win?

If I don’t win, the second player gets achance to roll. Now, it’s the other person thatgets to roll first and I have to wait.

This means if I do not win on my first roll,the game is the same but I take on the role ofthe player that rolls second.

Hence, if I do not win on my first roll, mywinning chances become 1 – p.

Algebraically, this can be written as:

p = Pr(win 1st roll) + Pr(not win 1st roll)

Pr(win | not win on 1st roll)

p = Pr(roll 4) + Pr(not roll 4)Pr(secondperson rolling wins)

256/488

Page 257: Math puzzles: classic riddles in counting, geometry, probability, and game theory

p = 1/6 + 5/6 (1 –p)

p = 1 - 5p/ 6

11p / 6 = 1

p = 6/11, or about a 54.5 percent chance

I can’t think of immediate applications be-sides puzzles, but the symmetry is beautiful.This is one of those solutions seekingproblems.

Method 4: Infinite Series

This is the conventional solution method formath classes. It works, but I certainly findthe other methods to be more interesting.

To start, we draw an infinite the game tree il-lustrating the outcomes for each round of thegame:

257/488

Page 258: Math puzzles: classic riddles in counting, geometry, probability, and game theory

The first player’s winning percentage is thesum of all branches that lead to a win. Theseare all the odd-numbered branches in thisdiagram.

The first branch is reached with probability1/6, the third branch is reached with probab-ility 1/6 times 5/6 squared, and eachsubsequent odd-branch has an extra factor of5/6 squared.

258/488

Page 259: Math puzzles: classic riddles in counting, geometry, probability, and game theory

The task is solving the following infiniteseries:

Using the formula for geometric series, thesolution is:

So we again arrive at 6/11, or about 54.5 per-cent, just as before.

259/488

Page 260: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 19: Secret Santa math

Suppose N people put their names into a hat,then they all draw a name. The draw is suc-cessful if no one draws his or her own name.How likely is that?

The puzzle was perhaps inspired by SecretSanta, a gift exchange in which everyonedraws a name to give a gift to. The assign-ment is legal if no one draws his own name(gifting to oneself is not much fun). Thepuzzle is alternately stated as: how likely is itthat a Secret Santa draw is a permissibleassignment?

Page 261: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 19: SecretSanta math

Let’s try to figure out a pattern from analyz-ing a few small cases.

A bit of notation can help. We can arbitrarilylabel the people with numbers 1, 2, …, n. Fur-ther, we can think about a draw as a per-mutation of these numbers.

I’ll use the following shorthand (which isstandard permutation notation). If there arethree people, for example, then the notation312 means “the first person drew name 3, thesecond person drew name 1, and the thirdperson drew name 2.”

Let us consider the case of n = 3. The pos-sible number of draws is the number of per-mutations of three items, or 3! = 6. Howmany of these draws are permissible–that is

Page 262: Math puzzles: classic riddles in counting, geometry, probability, and game theory

no one chooses his own name? We can dir-ectly list these out:

231312

You can verify these are the only two de-rangements. Thus, we can conclude for n = 3that the probability is

Probability(3) = 2 / 3! = 2 / 6 = 1/3 =.33333….

From this case we have figured out a solutionmethod. We need to find the number of per-missible solutions and divide it by the num-ber of total draws (which will be equal to n!)

So what happens with four people? How dif-ferent is the probability then?

The total number of draws is 4! = 24. Thenumber of permissible draws can be figured

262/488

Page 263: Math puzzles: classic riddles in counting, geometry, probability, and game theory

out by direct counting, and we find there are9 of them:

2143, 2341, 2413,3142, 3412, 3421,4123, 4312, 4321

So this time the calculation is:

Probability(4) = 9 / 4! = 9 / 24 = 1/3 = .375

It’s interesting the probability did not changeby very much from the case of n = 3.

It would be unwise to proceed in higher andhigher cases by direct counting. We alreadyhave a formula for the total number of casesin the denominator (n!). What we need is aformula for the number of permissible casesin the numerator.

The general solution

263/488

Page 264: Math puzzles: classic riddles in counting, geometry, probability, and game theory

How many ways can a set of objects be re-arranged such that no object remains in itsinitial position?

There is a special name for this kind of per-mutation. It is known as a derangement.Also, because of its relation to permutations,there is a special notation for derangements.A derangement of n objects is abbreviated as!n with the exclamation point appearing be-fore the symbol.

Counting the number of derangements canbe done in a couple of ways, beyond thisbook's scope, and their detailed proofs arehere.

I will mention that the method I prefer usesthe inclusion-exclusion principle. The idea isto count the total number of permutations(n!) and then subtract out any permutationthat fixes one or more points. The tricky partis to make sure you don’t double count,

264/488

Page 265: Math puzzles: classic riddles in counting, geometry, probability, and game theory

which is where the inclusion-exclusion for-mula comes in. The formula specifies how toadd and subtract various subsets (like fixingone point, two points, three points, etc) sothat the resulting figure does not doublecount.

Using the inclusion-exclusion formula, theformula for the number of derangements is:

!n = Total permutations – permutationsfixing 1 point + permutations fixing 2points …. +/- permutations fixing npoints

which can be simplified as

The interesting part is the summation term.This is familiar as the partial sum for the

265/488

Page 266: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Taylor series expansion of 1/e – quite an in-teresting development!

Thus, the number of derangements is well-approximated by !n =n! / e (the exact for-mula is !n = floor(n! / e + 1/2) since youneed to round up for even numbers andround down for odd numbers).

So we can now solve the puzzle as n ap-proaches infinity. The probability is:

Probability(n) = !n /n! ~ (n! / e) / (n!) = 1/e= 0.3679

It’s again remarkable that e appears in aprobability problem, and the answer isroughly 37 percent which is reasonably high.

266/488

Page 267: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 20: Coin flipping game

Let’s play a coin flipping game. You get toflip a coin, and I’ll pay you depending on theresult.

Here are the rules:

–you first flip a coin and we record theoutcome (H or T)

–you keep flipping until the first out-come is repeated, ending the game

–you get paid $1 for each time youflipped the opposite outcome

–for instance, if you flip H first, and thesequence of tosses ends up as HTTTH,you will get paid $3 for the three T‘s thatappeared. If you flip HH, by contrast,then you will get $0

Page 268: Math puzzles: classic riddles in counting, geometry, probability, and game theory

–analogous payout rules apply if you flipT first: if you flip TT you get $0, but ifyou flip THHHHT you will get $4

(an equivalent way of saying this is if youmake a total of n tosses, you get paid n – 2dollars because you don’t get paid for thefirst or final flips)

I am going to offer you a chance to play thisgame for 75 cents. But there is one catch: Iadmit I may have biased the coin, so headsappears with probability p which may or maynot be 1/2. (though it is not a two sided coin,because at p = 0 or p = 1, you obviously losethe game every time)

Should you be willing to play this game?Why or why not?

(credit: the puzzle is a problem from one ofmy college math books, Apostol CalculusVolume II)

268/488

Page 269: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 20: Coinflipping game

It turns out I was being charitable, and youshould definitely play the game. As derivedbelow, the expected value of the game is $1.The remarkable part is this is true regardlessof the value of the chance of getting a headsp!

Let’s calculate the expected value of thegame.

To begin, let’s write out a table of possibleoutcomes to the game, split up by whetherthe first toss is an H or a T

Page 270: Math puzzles: classic riddles in counting, geometry, probability, and game theory

The expected value will be the sum of all ofthese individual outcomes.

We can conveniently break the game downinto two contingencies, each of which is aninfinite sum:

270/488

Page 271: Math puzzles: classic riddles in counting, geometry, probability, and game theory

This is going to be a tricky infinite series toevaluate. We will need to use a neat trick.Note that for 0 < x < 1

We now substitute using x = 1 – p and x = p(from the two infinite series above) to findthe value of the game.

The game has an expected value of 1, whichis what we intended to prove.

271/488

Page 272: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 21: Flip until heads

In mathland, one day the king asks all hissubjects to perform an experiment.

He wants them to find a regular coin and re-cord the result of its flips, under the follow-ing condition.

Each person is to flip the coin until theresult is a heads.

So one person might record a result of Hif he flips heads right away, but anotherperson might record the result TTH if aheads came on the third toss.

All of the million subjects are to sendthe record of their tosses to the king foranalysis.

A royal counter will tally up the number ofheads and tails from all the records. What do

Page 273: Math puzzles: classic riddles in counting, geometry, probability, and game theory

you expect the proportion of heads to tails tobe?

273/488

Page 274: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 21: Flip un-til heads

It is tempting to think there will be moretails than heads, as each person is flippinguntil a heads is seen. But remember that halfof the people flip heads right away, whichwill change the outcome.

An expected value calculation will show theproportion of heads to tails is even at 50/50for each.

Here is the calculation:

1/2 get a heads and stop: 0 tails1/4 get a heads, then a tails: n/4 tails1/8 get a heads, then a tails: 2n/8 tails1/16 get a heads, then a tails: 3n/16 tails1/32 get a heads, then a tails: 4n/32 tails…Total: n heads and the number of tails is

Page 275: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Therefore, we expect the same number ofheads and tails in the population, so the pro-portion is 50/50.

(solution from here: boys and girls problem)

This question was once used as a Google in-terview puzzle, phrased in terms of familieshaving a child until they had a boy and ask-ing for the proportion of boys and girls in thepopulation. I preferred to avoid the geneticsof gender determination and so I used a coinflip.

The reason the question seems counter-intu-itive is because the proportion of tails (orgirls) in ONE family is equal to log(2) orabout 31 percent. In fact, I did an experimentof my own to confirm this.

275/488

Page 276: Math puzzles: classic riddles in counting, geometry, probability, and game theory

I ran 2,000 trials in a spreadsheet of havinga child until the first boy, and I did two cal-culations. The first calculation is equal to theratio of the total number of girls to the totalnumber of children across all experiments.This is roughly 50 percent we calculatedabove.

For the second calculation I did the follow-ing. For each trial, I divided the number ofgirls by the total number of children. I thentook the average across all the trials of thisratio. The calculation is to the average of theproportion of girls for each trial. This comesin at around 31 percent (it is preciselylog(2)).

276/488

Page 277: Math puzzles: classic riddles in counting, geometry, probability, and game theory

As you can see, the proportion of girls expec-ted in a specific family is a biased estimatorof the proportion of girls in the totalpopulation.

The issue is that the average of the propor-tion for each family is not equal to the aver-age proportion across all families.

It’s very important to know what is beingasked for in probability questions!

277/488

Page 278: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 22: Broken stickspuzzle

A warehouse contains thousands of sticks,each 1 meter long. One day a bored workerbreaks each of the sticks in two, with each ofthe breaks happening at a random positionalong each stick. (random here means “uni-form distribution”)

There are three questions:

(1) What is the average length of theshorter pieces?

(2) What is the average length of thelonger pieces?

(3) What is the average ratio of thelength of the shorter piece to the longerpiece?

Page 279: Math puzzles: classic riddles in counting, geometry, probability, and game theory

I will give a hint that questions (1) and (2)are easier to solve. It is much harder to solve(3) as it requires calculus.

279/488

Page 280: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 22: Brokensticks puzzle

The first two questions can either be solvedby considering symmetry, or they can besolved using calculus.

One might think the third question followsas a simple division from questions 1 and 2.This is not true! The average ratio is NOT theratio of the averages! I’ll explain why below.

Answer to (1)

By definition, the smaller piece will be lessthan half the length (0.5 meters).

The smaller sticks, therefore, will range inlength from almost 0 m up to a maximum of0.5 meters, with each length equallypossible.

Page 281: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Thus, the average length will be about 0.25meters, or about a quarter of the stick.

A more rigorous way of solving this, thoughless intuitive, is to set up an expectation andsolve.

Suppose the stick is broken at point x, mean-ing the two pieces will be of length x and 1 –x.

We can denote the shorter piece by the for-mula min(x, 1 –x).

Now we can solve for the average value bysetting up an integral that ranges from 0 to 1.You will find this equals 0.25.

Answer to (2)

If the average of the smaller piece is 0.25,then it would only make sense the average ofthe larger piece is 0.75.

281/488

Page 282: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to (3)

This is the most interesting piece of thepuzzle.

If the smaller pieces average 0.25 meters,and the larger pieces average 0.75 meters,then wouldn’t the ratio of the lengths be thedivision? That is, shouldn’t the answer be 1/3= 0.25 / 0.75 ?

The surprising result is no! The average ratiois not equal to the ratio of the averages.

This can be demonstrated by directcalculation.

If the stick is broken at point x, then the ratioof the shorter to the longer piece will dependon the value of x. When x is between 0 and0.5, then the ratio is x / (1 – x). When x isbetween 0.5 and 1, the ratio will be the recip-rocal (1 - x) / x.

282/488

Page 283: Math puzzles: classic riddles in counting, geometry, probability, and game theory

When these two pieces are integrated, here isthe result:

The average ratio is not 1/3, but it is rather abit higher at 0.386 (or more exactly 2 log(2)– 1, where we are using the natural log).

This itself is a rather surprising result:Euler’s constant e comes out of nowhere!

It is seemingly paradoxical that the averageratio (shorter / longer) is not the ratio of theaverage of shorter to longer pieces.

The answer lies in the distribution of the ra-tio. Notice the chart for the ratio bows to-ward the center, or in other words, the peakat 0.5 seems a little "fat" in the followinggraph:

283/488

Page 284: Math puzzles: classic riddles in counting, geometry, probability, and game theory

The ratio of the shorter to longer piece isslightly skewed toward the value of 0.5, andthat is why the average is slightly higher at0.386 instead of 0.333.

284/488

Page 285: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 23: Finding true love

Here is a statistical model of dating.

In this statistics game, you search for yourtrue love with sequential dates. Your onlygoal is to find the best person willing to dateyou–any thing less is a failure.

Here are some ground rules:

1. You only date one person at a time.

2. A relationship either ends with you“rejecting” or “selecting” the otherperson.

3. If you “reject” someone, the person isgone forever. Sorry, old flames cannotbe rekindled.

4. You plan on dating some fixed num-ber of people (N) during your lifetime.

Page 286: Math puzzles: classic riddles in counting, geometry, probability, and game theory

5. As you date people, you can only tellrelative rank and not true rank. Thismeans you can tell the second personwas better than the first person, but youcannot judge whether the second personis your true love. After all, there arepeople you have not dated yet.

How does the game play out?

You can start thinking about the solution bywondering what your strategies are. Ul-timately, you have to weigh two opposingfactors.

–If you pick someone too early, you are mak-ing a decision without checking out your op-tions. Sure, you might get lucky, but it’s a bigrisk.

–If you wait too long, you leave yourself withonly a few candidates to pick from. Again,this is a risky strategy.

286/488

Page 287: Math puzzles: classic riddles in counting, geometry, probability, and game theory

The game boils down to selecting an optimalstopping time between playing the field andholding out too long. What does the mathsay?

287/488

Page 288: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 23: Findingtrue love

The basic advice: Reject a certain number ofpeople, no matter how good they are, andthen pick the next person better than all theprevious ones.

The idea is to lock yourself in to search andthen grab a good catch when it comes along.The natural question is how many peopleshould you reject? It turns out to be propor-tional to how many people you want to date,so let’s investigate this issue.

To make this concrete, let’s look at an ex-ample for someone that wants to date threepeople.

Example with Three PotentialRelationships

Page 289: Math puzzles: classic riddles in counting, geometry, probability, and game theory

A naive approach is to select the first rela-tionship. What are the odds the first personis the best?

It is equally likely for the first person to bethe best, the second best, or the worst. Thismeans by pure luck you have a 1/3 chance offinding true love if you always pick the firstperson. You also have a 1/3 chance if you al-ways pick the last person, or always pick thesecond.

Can you do better than pure luck?

Yes, you can.

Consider the following strategy: get toknow–but always reject–the first person.Then, select the next person judged to bebetter than the first person.

289/488

Page 290: Math puzzles: classic riddles in counting, geometry, probability, and game theory

How often does this strategy find the bestoverall person? It turns out it wins 50 per-cent of the time!

For the specifics, there are 6 possible datingorders, and the strategy wins in three cases.

(The notation 3 1 2 means you dated theworst person first, then the best, and thenthe second best. I marked the person that thestrategy would pick in bold and indicated awin if the strategy picked the best candidateoverall.)

1 2 3 Lose

1 3 2 Lose

2 1 3 Win

2 3 1 Win

3 1 2 Win

290/488

Page 291: Math puzzles: classic riddles in counting, geometry, probability, and game theory

3 2 1 Lose

You increase your odds by learning informa-tion from the first person. Notice that in twoof the cases that you win you do not actuallydate all three people.

As you can see, it is important to date peopleto learn information, but you do not want toget stuck with fewer options.

So do your odds increase if you date morepeople? Like 5, or 10, or 100? Does thestrategy change?

The answer is both interesting andsurprising.

The Best Strategy for the General Case

From the example, you can infer the beststrategy is to reject some number of people

291/488

Page 292: Math puzzles: classic riddles in counting, geometry, probability, and game theory

(k) and then select the next person judgedbetter than the first k people.

When you go through the math, the odds donot change as you date more people. Al-though you might think meeting morepeople helps you, there is also a lot of noisesince it is actually harder to determine whichone is the best overall. So here is theconclusion.

The advice: Reject the first 37 percent of thepeople you want to date and then pick thenext person better anyone before. Surpris-ingly, you’ll end up with your true love 37percent of the time.

The advice is unchanged whether you plan todate 5, 10, 50, 100, or even 1,000 people.Here is a table displaying specific numbers:

292/488

Page 293: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Now I was simplifying matters just a bit be-cause “rejecting 37 percent” is an approxima-tion. There is some math that goes into theexact answer.

To be precise, the exact answer is to find firstvalue of k such that

293/488

Page 295: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 24: Shoestringproblem

This is a question one of my blog readers gotin an interview. It's a very hard probabilitypuzzle to figure out on the spot.

You have a box with 30 shoe laces (orstrings) in it. You can only see the ends of thestrings sticking out, so you see 60 string endstotal. Now you start tying them together un-til all ends are tied to another.

How many ways can you tie the shoe lacestogether?

What is the expected number of loops?

For instance there could be at least 1 big loopconsisting of all the 30 strings but at most 30individual loops when each end is tied to theend of the same string.

Page 296: Math puzzles: classic riddles in counting, geometry, probability, and game theory

296/488

Page 297: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 24: Shoes-tring problem

With math problems and interview brainteasers, there are often problem solving tech-niques that can help you get to the rightanswer.

My first thought was that working out theanswer for 30 shoelaces would be hard. Iwould instead tackle smaller cases like con-sidering 2 or 3 shoelaces and seeing if thereis a pattern.

How many ways can you tie 2 shoelacestogether?

I drew a figure like this and I counted thenumber of ways.

Page 298: Math puzzles: classic riddles in counting, geometry, probability, and game theory

I noticed the leftmost shoelace end couldconnect to at most 3 spots: it could tie to theend of its own shoelace, or it could tie to oneof the other two ends on the other shoelace.

After that, there would be just two ends re-maining, making just 1 way to connect theloops.

This means there are exactly 3 x 1 = 3 waysto connect the ends when there are 2shoelaces.

298/488

Page 299: Math puzzles: classic riddles in counting, geometry, probability, and game theory

What about 3 shoelaces?

I tackled this case by drawing out the follow-ing diagram.

For the leftmost end, there are 5 differentshoelace ends that it could connect to: eitherit could connect to the other end of its ownshoelace, or it could connect to the four endsof the other shoelaces.

Once that end is tied, we have to considerhow many ways the remaining 4 shoe laceends could be tied. But in fact we have solvedthis problem already! This is exactly the

299/488

Page 300: Math puzzles: classic riddles in counting, geometry, probability, and game theory

number of ways 2 shoelaces could be tied to-gether, which we found was 3 x 1 = 3.

Thus, the total number of ways for 3shoelaces is 5 x 3 = 15.

Part 1: How many ways can you tie theshoe laces together?

We can deduce a general pattern from thesecases. If there are n shoelaces, then there are2n shoelace ends.

The first shoelace end can be connect to anyof the other (2n – 1) ends.

Tying one end to another removes 2 ends.Thus, the next shoelace end can be connec-ted to any of the remaining (2n – 3) shoelaceends, the one after that to the remaining (2n– 5) ends, and so on.

300/488

Page 301: Math puzzles: classic riddles in counting, geometry, probability, and game theory

The general formula for n shoelaces is theycan be tied together in:

Ways to tie n shoelaces = 1 x 3 x 5 … x(2n – 1)

In other words, we have a product of the oddnumbers up to (2n – 1). For 30 shoelaces thiswill be a very big number:

29,215,606,371,473,169,285,018,060,091,249,259,296,875

Part 2: How many expected loops willyou get?

I spent a long time trying to figure this partout. One of the comments from this puzzleshowed an amazingly elegant solution.

What about this: You have 60 ends and youstart tying laces, two at a time. Each time youtie a knot, you either make a loop or youdon't, and you take 2 ends out of the pool.

301/488

Page 302: Math puzzles: classic riddles in counting, geometry, probability, and game theory

For each iteration, you take one end (e1) andthen tie it to another end (e2). That otherend is either the other end of e1 or it isn't,and you just extend the length of e1. Thechance e2 is tied to the other end of e1 is1/(n-1) where n is the number of ends in thecurrent pool.

The expected number of loops made after thefirst iteration is then 1/59. For the next itera-tion, it's 1/57, and so on until you get to 1/1.

So the total number of expected loops issum(1/59+1/57+...+1/1)=2.682.

Or in general, the expected number of loopsis (1/1 + 1/3 + 1/5 + ... 1/(2n-1)). Quite an el-egant solution!

302/488

Page 303: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 25: Christmas trinkets

Assume you are running a business that sellsa seasonal Christmas trinket. You can buythe trinket at $3 and sell it for $4. You canonly buy the trinket once a year and cannotreplenish till next year.

From experience, you have some idea abouthow much product will sell. Every year, thedemand for the trinket from your shop willbe of an equal probability between 0 and 100(that is, there is a 1/101 chance that 0 unitswill sell, a 1/101 chance that 1 unit will sell,…, and a 1/101 chance that 100 units willsell).

You have a choice to buy between 0 and 100units of the product. After the holiday seasonis over, no one wants the trinkets, and you’llhave to discard any unused products at yourloss.

Page 304: Math puzzles: classic riddles in counting, geometry, probability, and game theory

How many Christmas trinkets should youbuy?

Clarification note for the probability: if youbuy too few trinkets, then you simply sellout. Let’s say you buy 10 trinkets, but thatyear the demand happened to be for 100trinkets. In that case, you sell out of your 10trinkets, and you missed out on the chanceto profit on high demand.

(credit: this puzzle came from a questionasked on Math Reddit)

304/488

Page 305: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 25: Christ-mas trinkets

I will break the answer down into a somemanageable steps.

Step 1: figuring out the probabilitydistribution

The key to the problem is figuring out theprobability distribution if you buy n units.

If you buy all 100 units, then you safely knowthat you have 1/101 probability of sellingeach unit. But what if you buy fewer units,like say 50 or 30 units? You have to derivethe probability distribution from the theoret-ical demand.

For all units less than n, the probability thatyou sell that many units is simply 1/101. Butfor your last unit, you have to include the

Page 306: Math puzzles: classic riddles in counting, geometry, probability, and game theory

instances when people demand more than nunits. To do that, you want to add in theprobabilities like follows:

I will put the distribution in text as well forreference.

306/488

Page 307: Math puzzles: classic riddles in counting, geometry, probability, and game theory

If you buy n units, then the probability youwill sell units is given by:

–1/101 chance sell 0 units–1/101 chance sell 1 unit–1/101 chance sell 2 units…–(101-n)/101 chance sell all n units

The reason the last probability is higher isthis: if the demand for units is higher than n,then you only get to sell n units. So you haveto lump the probability of selling n or moreunits into one term.

Step 2: writing the expected profit

The expected profit will be given by the ex-pected revenue (number sold times $4) sub-tracted by the cost (this part is easy: youspent $3 * n for the units, whether they sellor not).

307/488

Page 308: Math puzzles: classic riddles in counting, geometry, probability, and game theory

So the expected profit is given by:

Profit = (selling price)(expected sales) –(cost)(units bought)Profit = 4(expected sales) – 3nProfit = 4[1/101 (0 + 1 + 2 + ... + n -1) +(101-n)n/101]- 3n…(lots of algebra)…

Profit = 1/202 (198 n – 4n2)

Now that you have the expected profit, therest of the problem should bestraightforward.

Step 3: maximizing profits

The amount you want to buy is the numberof units that maximizes profits.

To maximize profits, we take the derivativeof the profit equation and set it equal to zero.

308/488

Page 309: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Then we verify the amount we solved for is amaximum.

So we get:

derivative of profit = 198/202 – 8n /202 = 0

n = 24.74

Since we cannot buy fractional amounts, weneed to check whether 24 or 25 is the rightanswer. You can find that 25 gives the max-imum of $12.13 of expected profit.

In the end of the day, you ultimately want tohedge your bet and not buy too much of thesupply. You buy a decent amount so you canmeet demand, but if you buy too much you’llend up taking a hit on the loss.

The extension of the problem

309/488

Page 310: Math puzzles: classic riddles in counting, geometry, probability, and game theory

When I solved the problem, I was curious ifit meant anything that the optimal answerwas buying 25 percent of the availablesupply.

I noticed that 25 percent was related to themargin: you make $1 profit on a $4 product,so that’s a 25 percent margin.

This turns out to be exactly the case. Here’sthe general case.

Let’s suppose you can sell a product for P,you buy it for C, and the available supply is S.Additionally, the demand for the product isgiven by:

–1/(S+1) chance sell 0 units–1/(S+1) chance sell 1 unit–1/(S+1) chance sell 2 units…–(S-n+1)/(S+1) chance sell S units

310/488

Page 311: Math puzzles: classic riddles in counting, geometry, probability, and game theory

We can proceed as above to find out the ex-pected profit of buying n units with theseconditions.

I will spare you the algebra and just cut tothe answer. The optimal number of units tobuy is:

optimal number = S(1 –C/P) – 0.5 + (1– C/P)

Now we have the answer, let’s interpret it.

The first thing we can do is ignore the addit-ive term 0.5 + (1 – C/P). Both of these arefractions, so the term will be between 0 and1. Ultimately this will only affect the optimalanswer by 1 unit, so for the sake of estimat-ing, let’s ignore this term.

So what we end up with is this:

optimal number estimate = S (1 – C/P)

311/488

Page 312: Math puzzles: classic riddles in counting, geometry, probability, and game theory

The answer can be interpreted as follows:you should buy a percentage of supply equalto the term (1 – C/P).

And what is that term (1 – C/P)? This is pre-cisely the margin of the product: it’s theamount of profit you make as a percentage ofthe price of the product.

In other words, the percentage amount ofsupply you should buy is equal to the marginof the product. That’s quite a big simplifica-tion considering all the optimization mathyou see above.

Another implication of the model is this:you’ll rarely want to buy all of the availablesupply, unless your margin is off the wall.Like if you could buy something at $1 andsell it for $100, then you’re at a point whereit could make sense to buy all the supply.

I love it when math works out so nicely.

312/488

Page 313: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Section 3: Strategy and gametheory problems

Can you outthink your opponent?

The following 20 puzzles deal with strategyand game theory.

Page 314: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 1: Bar coaster game

Here is how the game works:

–Someone goes first and places a coast-er anywhere on the table

–The other person goes by placing acoaster anywhere else that’s open on thetable

–The game continues with each playermoving in turn to place a coaster on thetable

–The winner of the game is the personwho puts down the last coaster, i.e.,there is no more open space on the table

To make it interesting, you can play with arule that the loser has to buy the next round.

Page 315: Math puzzles: classic riddles in counting, geometry, probability, and game theory

It’s a simple game, so what’s the best way toplay? Is it better to go first or second? Isthere a winning strategy?

I don’t think it matters if the table is roundor rectangular, nor does it matter if thecoaster is round or a square.

315/488

Page 316: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 1: Barcoaster game

There is a winning strategy for the first play-er in a 2-person contest. Here is what to do:

Your first move is to place a coaster in thecenter of the table. Now, wherever your op-ponent places the coaster, you place yourssymmetrically on the other side of the table.If they place a coaster in the southwestcorner, you place yours in the analogous spotin the northeast corner. (If you imagine thecenter of the table as the origin, this is math-ematically a reflection about the origin).

This strategy means you can always matchyour opponent's move. The game ends whenyour opponent runs out of open sports,which equivalently means you have placedthe last coaster.

Page 317: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 2: Bob is trapped

A villian has captured Bob and Alice. Hecould kill the dynamic duo, but he decides tohave some fun while they are hostage. So hetells them they will play a game, with theirlives on the line. Here is the game: Bob andAlice will be held captive in two separate fa-cilities, under constant surveillance. Everyday, each will flip a coin. Each person mustthen guess the result of the other person’scoin (Bob has to guess Alice’s toss and viceversa).

As long as one of them guesses correctly,they will both get to live for another day. Butif ever both should guess wrong, then the vil-lian will end things once and for all.

The villian smiles and then instructs theguards to proceed. Just as Bob and Alice are

Page 318: Math puzzles: classic riddles in counting, geometry, probability, and game theory

being taken away, Bob whispers somethingto Alice.

How long can Bob and Alice survive thisgame, on average? What must they do?

(credit: This is a puzzle adapted from MaxSchireson’s blog.)

318/488

Page 319: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 2: Bob istrapped

Bob, super-genius that he is, devised astrategy that could allow them to survive in-definitely. The trick is the two will not be try-ing to guess correctly individually, but theywill work as a team in their guesses.

Bob told Alice the following: every day, Alicewill guess the same outcome as his flip, andBob will guess the opposite outcome as hisflip. Since the two flips will either show thesame face, or the opposite face, at least oneof them must be right!

To see this explicitly, here are the possibleoutcomes:

(Bob’s flip, Alice’s flip)

Page 320: Math puzzles: classic riddles in counting, geometry, probability, and game theory

(H, H) –> same outcomes, Alice guessescorrectly(T, T) –> same outcomes, Alice guessescorrectly(T, H) –> opposite outcomes, Bobguesses correctly(H, T) –> opposite outcome, Bobguesses correctly

Bob and Alice will keep on winning, whichwill no doubt provide them with enough timeto devise an escape plan.

320/488

Page 321: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 3: Winning at chess

Alice is a great chess player, and she occa-sionally taunts Bob, who barely knows therules.

One day Bob got fed up and challenged Aliceto a contest. Bob challenged Alice to play twogames simultaneously, and he declared hewould either win one of the games, or hewould draw both of the games–in no casewould he lose both games.

Bob only asked they follow a couple ofground rules. First, Bob would play black onone board and white on the other. Second, toavoid one game progressing faster than theother, they would alternate playing movesbetween the two boards. Bob said Alice couldhave the first move too.

Page 322: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Alice was sure she could win, and she gotthings going by playing her white move first.

In the end, Bob was able to draw in bothgames in spite of his poor skill level. Howwas Bob able to match wits with Alice?

322/488

Page 323: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 3: Winningat chess

Alice fell right into Bob's trap, as she ex-citedly made the first move. On board 1,Alice opened with her move for white. So onboard 2, Bob copied that move for his turn aswhite. Then on board 2, Alice made her replyin black. And accordingly, on board 1, Bobcopied that move for his turn as black.

You can see what Bob's strategy was: he justkept copying Alice's moves for the rest of thegames. Alice quickly realized that Bob wascopying her moves, and that she was essen-tially playing against herself. If she won onone board, then Bob would surely win on theother. There was no way Bob could lose inboth games. So Alice gave up and quicklymoved both games into drawing positions.

Page 324: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Note: I suppose this strategy of copyingmoves could also be used for other boardgames of pure skill with sequential moveslike connect 4, Go, checkers, etc.

One of the comments from a reader namedPaul indicated this is sort of attack can hap-pen in the real world:

In computer security this is a well-known situation and has even been giv-en a (gender biased) name: man-in-the-middle attack. It can be very difficult toprotect against. In this chess situation,Alice would have to follow a piece of ad-vice Presh likes to give: change thegame!

324/488

Page 325: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 4: Math dodgeball

Let’s analyze a math game called dodgeballthat’s a sort of twist on tic-tac-toe.

Here is how the game works. It’s a two playergame with the following set-up.

Player 1 gets a 6×6 grid of squares as follows:

Page 326: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Player 2 gets a 6×1 grid of squares:

326/488

Page 327: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Here are the rules:

1. Player 1 begins the game by filling outthe entire first ROW of his 6×6 grid,marking each square with either an X oran O.

2. Player 2 then goes by marking the justfirst SQUARE in his 6×1 grid, witheither an X or an O.

3. On each subsequent turn, player 1 fillsout the entire next row of his 6×6 gridwith any combination of X’s and O’s. Inturn, player 2 marks the next square ofhis 6×1 grid.

327/488

Page 328: Math puzzles: classic riddles in counting, geometry, probability, and game theory

4. The game ends on the sixth roundwhen both players have filled out theirgrids.

At this point, notice player 2′s grid has sixsquares filled with X’s and O’s. Player 1 hassix such rows in his grid.

The winner is decided as follows: if player 2′sgrid exactly matches one of the six rows inplayer 1′s grid, then player 1 wins. Otherwise,player 2 wins the game.

If you were given the choice, would yourather be player 1 or player 2? What is yourstrategy to win the game? Is the strategyfoolproof meaning it will guarantee avictory?

328/488

Page 329: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 4: Mathdodgeball

It turns out player 2 can always win the gamebecause he goes second and has anadvantage.

This is not a hard game, but I will explainhow it is interesting mathematically.

How can player 2 guarantee he is making asequence that is not the same as any of play-er 1′s rows?

Player 2 does the following: on turn n, he

looks at what player 1 writes in for the nth

square of the current row. Then player 2marks exactly the opposite. For example, ifplayer 1 begins the game by writing X in thefirst square, then player 2 should write O forthe first square, and vice versa.

Page 330: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Here is an example for the 6×6 grid. Afterplayer 1 writes out a row, player 2 looks atthe appropriate square and marks in the op-posite. Here is what the two grids look likewhen the game is complete.

330/488

Page 331: Math puzzles: classic riddles in counting, geometry, probability, and game theory

331/488

Page 332: Math puzzles: classic riddles in counting, geometry, probability, and game theory

We can readily see that player 2′s row doesnot match any of the rows in player 1′s grid.

The reason is that player 2′s sequence differs

from row n on the nth spot, and hence the se-quence must be different from any of therows that player 1 created.

The same argument can be used to showplayer 2 can win for a row of any size. It evenworks for an infinite size grid! So even whenplayer 1 writes an infinite number of se-quences, player 2 can still make a uniquesequence.

332/488

Page 333: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 5: Determinant game

Alan and Barbara play a game in which theyalternately write real numbers into an ini-tially blank 1000 x 1000 matrix.

Alan plays first by writing a real number inany spot. Then Barbara writes a number inany spot, and they move in turn. The gameends when all the entries in the matrix arefull.

Alan wins if the determinant of the final mat-rix is nonzero; Barbara wins if it is zero. Whohas the winning strategy?

(credit: This problem appeared in the 2008Putnam exam)

Page 334: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 5:Determinant game

The answer is that Barbara will be able towin the game. Here is one way to see this,courtesy of the Putnam exam solutions.

The trick is to realize that the determinant ofa matrix will be zero if any two rows areidentically the same. Barbara can alwaysforce this to happen. How is that?

One way is for Barbara to make the first andsecond rows identical. If Alan writes a num-ber in the first row, then Barbara writes thesame number directly below it in the secondrow. If Alan writes a number in the secondrow, then Barbara rights the same numberdirectly above it in the first row.

Page 335: Math puzzles: classic riddles in counting, geometry, probability, and game theory

If Alan writes in any other row, then Barbaraalso writes a number anywhere else but rows1 and 2.

The final matrix will have rows 1 and 2 be thesame, and so Barbara will win the game.

It turns out Alan is facing a very biasedgame--best if he realizes this and chooses notto play.

335/488

Page 336: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 6: Average salary

Three friends want to know their averagesalary for negotiating purposes. How canthey do it without disclosing their own salar-ies to each other?

Page 337: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 6: Averagesalary

The friends can calculate the averagethrough a clever encoding process. The ideais that each person encodes their salary byadding a random number to it. These en-coded salaries can be added together andthen the random numbers can be subtracted.The resulting figure is the sum of the threesalaries from which the average can beobtained.

Since additions and subtractions are easy todecode, however, the tricky part is imple-menting a solution where no person obtainsknowledge of the other two party’s randomnumbers, for that would reveal enough in-formation to obtain individual salaries. Todo that, one can sequence the additions andsubtractions carefully.

Page 338: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Another method is more direct and workslike a secret ballot, mentioned as a commentby Rajesh on my blog.

Let a pencil be a substitute for $10,000 (orsome reasonable amount of money). Eachperson translates their salary into number ofpencils, so someone making $90,000 wouldneed 9 pencils. Then let each person droptheir respective number of pencils into asealed box. Once the three people are done,they can count the total number of pencilsand find the average.

338/488

Page 339: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 7: Pirate game

Three pirates (A, B, and C) arrive from a luc-rative voyage with 100 pieces of gold. Theywill split up the money according to an an-cient code dependent on their leadershiprules. The pirates are organized with a strictleadership structure–pirate A is strongerthan pirate B who is stronger than pirate C.

The voting process is a series of proposalswith a lethal twist. Here are the rules:

1. The strongest pirate offers a split ofthe gold. An example would be: “0 tome, 10 to B, and 90 to C.”

2. All of the pirates, including the pro-poser, vote on whether to accept thesplit. The proposer holds the castingvote in the case of a tie.

Page 340: Math puzzles: classic riddles in counting, geometry, probability, and game theory

3. If the pirates agree to the split, ithappens.

4. Otherwise, the pirate who proposedthe plan gets thrown overboard from theship and perishes.

5. The next strongest pirate takes overand then offers a split of the money. Theprocess is repeated until a proposal isaccepted.

Pirates care first and foremost about living,then about getting gold. How does the gameplay out?

340/488

Page 341: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 7: Pirategame

At first glance it appears that the strongestpirate will have to give most of the loot. But acloser analysis demonstrates the oppositeresult–the leader holds quite a bit of power.

The game can be solved by thinking aheadand reasoning backwards. All pirates will dothis because they are a very smart bunch, atrait necessary for surviving on the high seas.

Looking ahead, let’s consider what wouldhappen if pirate A is thrown overboard.What will happen between pirates B and C?It turns out that pirate B turns into a dictat-or. Pirate B can vote “yes”? to any offer thathe proposes, and even if pirate C declines,the situation is a tie and pirate B holds thecasting vote. In this situation, pirate C has novoting power at all. Pirate B will take full

Page 342: Math puzzles: classic riddles in counting, geometry, probability, and game theory

advantage of his power and give himself all100 pieces in the split, leaving pirate C withnothing.

But will pirate A ever get thrown overboard?Pirate A will clearly vote on his own propos-al, so his entire goal reduces to buying asingle vote to gain the majority.

Which pirate is easiest to buy off? Pirate C isa likely candidate because he ends up withnothing if pirate A dies. This means pirate Chas a vested interest in keeping pirate Aalive. If pirate A gives him any reasonable of-fer–in theoretical sense, even a single goldcoin–pirate C would accept the plan.

And that’s what will happen. Pirate A will of-fer 1 gold coin to pirate C, nothing to pirateB, and take 99 coins for himself. The planwill be accepted by pirates A and C, and itwill pass. Amazingly, pirate A ends up withtremendous power despite having two

342/488

Page 343: Math puzzles: classic riddles in counting, geometry, probability, and game theory

opponents. Luckily, the opponents dislikeeach other and one can be bought off.

The game illustrates the spoils can go to thestrongest pirate or the one that gets to actfirst, if the remaining members have con-flicting interests. The leader has the meansto buy off weak members.

343/488

Page 344: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 8: Race to 1 million

Alice and Bob start with the number 1. Alicemultiplies 1 by any whole number from 2 to9. Bob then multiplies the result by anywhole number from 2 to 9, and the gamecontinues with each person moving in turn.

The winner is the first person to reach 1 mil-lion or more.

Who will win this game? What is thestrategy?

Page 345: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 8: Race to 1million

My first attempt to solve this game demon-strated a common mistake in solving thistype of puzzle. My initial attempt was to sim-ulate the game and look for a pattern in howBob might be able to force a certain product.This is not wrong necessarily, but it is a lotharder to see the pattern.

I then realized the game should be solved inreverse using backwards induction. Thethought process is like this.

Let’s imagine that we win the game, and thatwe are the player that sends the total beyond1 million. The question is this: if we wereable to bring the total above 1 million, whatpossible move could have gotten us there?That is, what number did we use to multiply

Page 346: Math puzzles: classic riddles in counting, geometry, probability, and game theory

the previous total by, and what previoustotals would have allowed us to win?

Clearly one possibility is 500,000. If we werepresented with that number, we could mul-tiply it by 2 and get to 1 million. In fact, if wewere presented with any total 500,000 orhigher, then we could win by multiplying by2. This shows that if we receive a number500,000 or higher, then we can win thegame. We can thus say that any number500,000 or higher is a winnable number.

We can then ask, what other numbers arewinnable numbers? In the game, we are al-lowed to pick any whole number from 2 to 9.Since the highest number we can pick is 9,we will use this to find the lowest numberthat will let us win. We can calculate that111,112 times 9 is just over 1 million.

Therefore, any number from 111,112 to999,999 is a winnable number.

346/488

Page 347: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Repeat the logic to solve the game

Now comes the interesting part. We knowthat if we begin a turn with any of those win-nable numbers, WE win the game. The ques-tion is: what numbers came before that?What numbers, for which our opponent be-gins a turn, would force them to bring thetotal to a winnable number for us?

One example readily comes to mind: 111,111.If our opponent started with this number,the only options are to multiply it by a num-ber from 2 to 9. The lowest total that will res-ult is 222,222 and the highest total is999,999. Regardless of what the opponentdoes, the resulting number is a winnablenumber for us. We can say therefore that111,111 is a losable number.

What other numbers are losable numbers?We are looking for a range of numbers thatwill force someone to produce a result in a

347/488

Page 348: Math puzzles: classic riddles in counting, geometry, probability, and game theory

winnable number range. As each player hasto multiply by a minimum of 2, we can findthe lower range. We can calculate that 55,556is half of 111,112.

Therefore, any number from 55,556 to111,111 is a losable number.

Generalizing the process

We can continue reasoning. If we know thenumbers 55,556 to 111,111 are losing num-bers, what number range would allow a play-er to bring an opponent into the losablenumber range? These numbers would there-fore also be winnable numbers.

As we reasoned above, to calculate winnablenumbers we divide the lower bound by 9,and to calculate losable numbers we dividethe lower bound by 2. (We need to round upafter any division since the game will onlyhave integers)

348/488

Page 349: Math puzzles: classic riddles in counting, geometry, probability, and game theory

We find the following ranges are winnableand losable:

111,112 to 999,999 –> winnable55,556 to 111,111 –> losable6,173 to 55,555 –> winnable3,087 to 6,172 –> losable343 to 3,086 –> winnable172 to 342 –> losable20 to 171 –> winnable10 to 19 –> losable2 to 9 –> winnable1 –> losable

Solution: Alice should always lose

Alice begins the game with 1 which wereasoned above was a losable number. Whenshe presents any of the numbers 2 to 9 toBob, he can force the total into the losingrange of 10 to 18. Whatever Alice does, Bobcan continue to control the resulting total sothat he will win.

349/488

Page 350: Math puzzles: classic riddles in counting, geometry, probability, and game theory

That’s not to say that Bob will win definitelywin the game. With sloppy play, Bob canmake a mistake and let Alice win.

For instance, suppose Alice starts with 9. IfBob multiplies that total by 9 to get to 72,then he has given Alice a winnable numberwhich would allow her to control the game.

350/488

Page 351: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 9: Shoot your mate

You are undercover and about to make abreakthrough with a mob boss. But yourpartner, not knowing your mission, tries tosave you and gets captured.

The boss suspects you might be working withthe authorities. He asks you to prove your al-legiance. He gives you a gun and requestsyou shoot your partner. If you don’t fire, youwill surely be caught.

Do you do it? Why or why not? Use gametheory reasoning to figure it out.

Page 352: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 9: Shootyour mate

Let’s think about the problem strategically.The boss either trusts you, or he does not,and he has either handed you a loaded gunor not.

Imagine for a second the boss has in facthanded you a loaded gun. That would onlybe reasonable if he truly trusted you. Right?After all, if he handed you a loaded gun butthought you were a spy, then he would haveto be worried you could fire the gun at him.

It only makes sense to give a loaded gun tosomeone you deeply trust. But in that case,there is no reason to test the person’s loyalty!

The very fact you are being tested means theboss does not trust you. And in that case, the

Page 353: Math puzzles: classic riddles in counting, geometry, probability, and game theory

only sensible thing for the boss is to handyou an unloaded gun.

We can write out a matrix that shows hand-ing you a loaded gun is a weakly dominantstrategy. It is simply safer to do, whether hetrusts you or not.

Therefore, if you are asked to shoot yourmate, you can be reasonably sure the gun isnot loaded. You should shoot at your partnerto keep your cover and pray the boss was notcrazy enough to hand you a loaded gun (of

353/488

Page 354: Math puzzles: classic riddles in counting, geometry, probability, and game theory

course, a villain as sadistic as the Jokermight do this).

Examples in the show 24 (mildspoilers)

Jack Bauer is a game theorist. There are acouple of memorable instances of this tropethat I want to mention here. (There areplenty of other examples in tv, movies, andliterature at tvtrope.org)

Example from Season 4

In Season 4, a Muslim terrorist Dina defectsto the American side to protect her son. Shehelps Jack Bauer to find the terrorist leaderMarwan, who then questions her trust.

Marwan offers Dina a gun and tells her toshoot Jack to prove her loyalty. Dina getsnervous, because if she kills Jack then shewould risk the federal protection on her son.

354/488

Page 355: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Dina shoots at Marwan only to find the gunis not loaded. Her deception is revealed andMarwan orders her to be shot.

Example from Season 3

Another instance happens in Season 3 whenJack was in deep cover with the Salazarbrothers. Jack’s partner, Chase, does notrealize this and he makes a heroic effort torescue Jack.

Unfortunately Chase is apprehended and itraises doubts whether Jack is secretly work-ing with authorities. Ramon Salazar handsJack a gun and tells him to shoot Chase toprove he is trustworthy. Jack takes fire, andit turns out the gun was not loaded so Chasesurvives. Jack keeps his cover and eventuallysaves the day as usual.

Chase later finds out Jack was undercover,and he is deeply angry that Jack took aim.

355/488

Page 356: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Jack reveals his game theoretic thinking allalong, in Season 3, episode 13.

Chase: You put a gun to my head, andyou pulled the trigger.

Jack: I made a judgment call that Ra-mon Salazar would not give me a loadedweapon–that he was testing me.

Chase: And what if it is was loaded?Then what?

Jack: Then I’d have finished mymission.

It is not an easy thing to shoot at your mate,but it is a judgment call that fits in line withstrategic thinking.

356/488

Page 357: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 10: When to fire in aduel

What’s the right time to shoot in a duel?

A simple dueling game

Consider a duel between two players A andB, in which each person has one bullet.

A and B start the duel at a distance t = 1 fromeach other. They approach each other at thesame speed, and each has to decide when toshoot.

As they get closer to each other, their accur-acy increases. At distance t, the player A hasa probability a(t) of killing his opponent, andfor player B it is b(t). Assume both playersare aware of the other’s skill.

Page 358: Math puzzles: classic riddles in counting, geometry, probability, and game theory

In this duel, missing your shot is very costly.If a player shoots and misses, then the otherplayer keeps approaching until he gets topoint blank range and shoots with completeaccuracy.

What is the optimal strategy of this game?That is, at what point should each playershoot?

358/488

Page 359: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 10: When tofire in a duel

We will separately solve for the best time foreach player to shoot.

When player A should fire

The tricky part to the game is balancingwhen to shoot. If you fire too early, then youropponent kills you for sure. If you wait toolong, then you can also get beaten if your op-ponent is a good shot.

We can think about when player A shouldfire by listing out the chance of surviving inthe different possibilities of firing at point t.

If player A fires first: Player A will sur-vive only if he hits, which happens withprobability a(t)

Page 360: Math puzzles: classic riddles in counting, geometry, probability, and game theory

If player A waits to fire: Player A sur-vives only if player B misses, which hap-pens with probability 1 – b(t)

Now we can reason out player A's strategy.Player A will want to fire first if his probabil-ity of hitting is greater than player B's prob-ability of missing:

a(t) ≥ 1 – b(t)

But he must also be careful not to fire tooearly. He should always wait if his probabil-ity of hitting is smaller than player B’s prob-ability of missing:

a(t) ≤ 1 – b(t)

Putting those two equations together, we cansee that Player A should shoot at the timewhen he is at distance t* where

a(t*) = 1 – b(t*)

360/488

Page 361: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Or alternately written,

a(t*) + b(t*) = 1

Solution: when player B should fire

We can do the same exercise for player B.Notice the same conditions are true:

If player B fires first: Player B will sur-vive only if he hits, which happens withprobability b(t)

If player B waits to fire: Player B sur-vives only if player A misses, which hap-pens with probability 1 – a(t)

Now we can reason out player B's strategy.Player B will fire first, if his chance of hittingis better than his opponent’s probability ofmissing:

b(t) ≥ 1 – a(t)

361/488

Page 362: Math puzzles: classic riddles in counting, geometry, probability, and game theory

But he must also be sure not to fire too soon.He needs to wait so long as his chance of hit-ting is smaller than his opponent’s probabil-ity of missing:

b(t) ≤ 1 – a(t)

Putting those two equations together, we cansee that Player B should shoot at the timewhen he is distance t* where

b(t*) = 1 – a(t*)

Or alternately written,

a(t*) + b(t*) = 1

Solution: they fire at the same time!

From the equations, you’ll notice that bothplayers find their optimal firing times satisfythe same equation. That is, they both chooseto fire at the same time! There is one specific

362/488

Page 363: Math puzzles: classic riddles in counting, geometry, probability, and game theory

time and distance which is optimal for bothplayers.

This would not be surprising if the two play-ers had the same accuracy level. But wesolved this game using the assumption theiraccuracy levels were different.

So why do they end up shooting at the sametime?

We can reason why this must be the case. Ifone person chose to fire earlier than another,say 5 seconds earlier, then he would be bet-ter off waiting. His opponent is not shootingfor another 5 seconds, so he might as wellwait a few more seconds to get closer and in-crease his accuracy.

As the equations show above, the right timeto shoot is just when your chance of hittingequals your opponents chance of missing.And since one person’s failure is another

363/488

Page 364: Math puzzles: classic riddles in counting, geometry, probability, and game theory

person’s success, this means both playerschoose the same time when they are a dis-tance such that their accuracy functions sumto a probability of 1.

364/488

Page 365: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 11: Cannibal gametheory

A traveler gets lost on a deserted island andfinds himself surrounded by a group of ncannibals.

Each cannibal wants to eat the traveler but,as each knows, there is a risk. A cannibal thatattacks and eats the traveler would becometired and defenseless. After he eats, he wouldbecome an easy target for another cannibal(who would also become tired and defense-less after eating).

The cannibals are all hungry, but they cannottrust each other to cooperate. The cannibalshappen to be well versed in game theory, sothey will think before making a move.

Does the nearest cannibal, or any cannibal inthe group, devour the lost traveler?

Page 366: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 11: Canni-bal game theory

I find the problem interesting because thesolution uses two types of induction: thestrategy depends on backwards induction,and the proof is based on mathematicalinduction.

The short answer is the traveler's fate de-pends on the parity of the group. If there isan odd number of cannibals, the traveler willbe eaten, but if there is an even number, thetraveler will survive.

To prove this, we will consider small groupsand use mathematical induction to explainthe solution for larger groups.

Case n = 1: this is an obvious case. If thereis one cannibal, the traveler will be eaten. Itdoesn't matter that the cannibal will get tired

Page 367: Math puzzles: classic riddles in counting, geometry, probability, and game theory

because there are no other cannibals aroundas a threat.

Case n = 2: this is a more interesting case.Each cannibal wishes to each the traveler,but each knows he cannot. If either cannibaleats the traveler, then he will become de-fenseless and the other one will eat him. Soeach cannibal uses backwards induction torealize that the only strategy is to not eat thetraveler. The hapless traveler finds a bit ofluck, therefore, and actually survives.

Case n = 3: this is where the problem getsinteresting. The best strategy is for theclosest cannibal to make a move and eat thetraveler. The cannibal will be defenselessafter eating, but ultimately he will be safe.Why is that? The reasoning is due to induc-tion: once the cannibal eats the traveler, theresulting situation has 2 unfed cannibals andthe 1 defenseless cannibal. But as we justshowed above, when there are 2 unfed

367/488

Page 368: Math puzzles: classic riddles in counting, geometry, probability, and game theory

cannibals, neither will make a move for fearof being eaten by the other! Thus the firstcannibal to make a move will be safe as theremaining 2 cannibals block each other.

We can prove the higher cases using math-ematical induction. If the number n is odd,then the closest cannibal can safely eat thetraveler because the remaining number ofunfed cannibals is even (and by induction,with an even number of unfed cannibals noone makes a move). If the number n is even,then no cannibal will eat the traveler, for ifhe did, the remaining number of cannibalswould be odd, meaning he will get eaten bythe induction hypothesis.

I should point out this problem highlightsone of the problems with game theory andbackwards induction.

If a group had 20 cannibals, the travelerwould be safe. But if the group had 19, the

368/488

Page 369: Math puzzles: classic riddles in counting, geometry, probability, and game theory

traveler would die. That's all fine in theory,but that's a HUGE difference in outcomes fora detail like group size.

What if some of the cannibals countedwrong, or if as the action took place anothercannibal appeared to throw off the rationaloutcome?

So unfortunately there are games that havemathematical elegance but shed light on howseemingly minor details can have profoundeffects on the game theory prediction.

369/488

Page 370: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 12: Dollar auctiongame

A teacher holds up a dollar bill to a class andannounces the money is up for sale.

Bidding starts at 5 cents and bids will in-crease by five cent increments.

There are two rules to when the game ends.

1. The auction ends when no one bidshigher. The highest bidder pays theprice of his bid and gets the dollar as aprize.

2. The second highest bidder is alsoforced to pay his losing bid (5 cents lessthan the winning bid) but gets nothingin return.

Page 371: Math puzzles: classic riddles in counting, geometry, probability, and game theory

How will this game play out? What is yourbest strategy?

371/488

Page 372: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 12: Dollarauction game

Like many economic students, I learnedabout this game first-hand. My teacher de-scribed the game as a chance for us poor stu-dents to make a small profit, if we weresmart enough. Little did we know how muchhe was tricking us.

The bidding began at 5 cents and a hand shotup to claim the bid. Would anyone pay 10cents? Another hand shot up.

What about 15 cents? Again, another handshot up. Bidding at this stage seemed harm-less because it’s an obvious deal to buy a dol-lar for any amount less.

The twist became clear about when the highbid was 75 cents. Many students started tothink about how the second rule–the one

Page 373: Math puzzles: classic riddles in counting, geometry, probability, and game theory

requiring the loser to pay–would affectincentives.

What might the second highest bidder thinkat this stage? He was offering 70 cents butbeing outbid. There were two choices hecould make:

--do nothing and lose 70 cents if theauction ended

--bid up to 80 cents, and if the auctionended, win the dollar, and profit 20cents

It’s also possible a third person comes andtakes the top spot, but that’s not an actionone can necessarily depend upon. So ignor-ing this option, the better choice is to bid 80cents rather than do nothing.

But this action has an effect on the personbidding 75 cent, who is now the second

373/488

Page 374: Math puzzles: classic riddles in counting, geometry, probability, and game theory

highest bidder. This person will now make asimilar calculation. He can either stand patand stand to lose 75 cents if the auction ends,or he can raise the bid to 85 cents and have achance of profiting 15 cents. Again, biddinghigher makes sense. Thinking more gener-ally, it always make sense for the secondhighest bidder to increase the bid.

Such strategy is why the game unraveledpretty quickly. Soon cash-strapped studentswere bidding more than one dollar and fight-ing over who would lose less money.

It is the incentives that dictate this weirdoutcome. Consider an example when thehighest bid is $1.50. Since the high bid isabove the prize of $1, it is clear no new bid-der will enter. Hence, the second bidderfaces the two choices of doing nothing andlosing $1.45, or raising the bid to $1.55 tolose only 55 cents if the auction ends.

374/488

Page 375: Math puzzles: classic riddles in counting, geometry, probability, and game theory

In this case, it makes just as much sense tolimit loss as it does to seek profit. The secondhighest bidder will raise the bid. In turn, theother bidder will perform a similar calcula-tion and again raise the top bid. This biddingwar can theoretically continue indefinitely.In practical situations, it ends when someonechooses to fold.

In my class, the game ended around $2 whenone player decided to end the madness. Buttalk to economics professors and you’ll hearthat it is not unusual for the game to end atanywhere from $5 to $10. It’s especially juicyif the two bidders dislike each other in socialcircles, and that adds its own element of en-tertainment. As a side note, the game can beplayed in other bid increments too, like 1cent or 10 cents.

I think the game offers two insights. First, itis best to avoid such games from the outset.And second, if you find yourself in one, cut

375/488

Page 376: Math puzzles: classic riddles in counting, geometry, probability, and game theory

your losses early. It is better to lose at 2 centsthan at 2 dollars.

Can the auction be gamed?

At this point you might be asking if the prob-lem is competition. Could cooperation leadto a good outcome? In theory, yes. It is pos-sible to cut a deal with others to avoid thebidding war. Imagine a class of 9 studentswho wanted to embarrass a professor. Oneperson could bid a single penny, everyonecould agree not to bid higher, ending thegame, and the profit of 99 cents could beshared as 11 cents per person.

The solution is promising but the problem isgetting everyone to cooperate. Every personhas incentive to deviate. Imagine one personwho wants to show up the leader. If he bet 2cents, he has a chance of getting 98 cents forhimself rather than settling for the meagersplit of 11 cents.

376/488

Page 377: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Nothing holds players to their words, andwhen strangers are involved, there is reallyno guarantee or time to plan in advance. Thisis why a large lecture hall or sizeable dinnerparty provide suitable locations to play thisgame.

I’ve been talking about the game very negat-ively so far, but there is always another sideto the story. Although buyers fare poorly, theauctioneer makes out like a bandit. It’s atrick that makes even rational buyers over-spend vast amounts. It’s no wonder that eco-nomics professors love to hold this auction.

377/488

Page 378: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 13: Bottle imp paradox

A stranger catches your attention one day.He offers you an interesting proposition.

He wants to sell you a bottle that contains agenie that will grant you any wish you want.

There is only one catch: you must sell thebottle at a loss within one year, or you'll becondemned to misery in Hell for the afterlife.

The stranger asks you what you would like todo.

–Do you buy the bottle?

–What price do you pay?

–What is the lowest price one should buy thebottle for?

Page 379: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 13: Bottleimp paradox

You first consider the price. On the onehand, you do not want to pay too high aprice. You worry about shelling out cashwhich you cannot recover until you sell. Onthe other hand, you do not want to pay toolow a price, or else you risk not finding an-other buyer.

What price is sensible? Let’s start from thebeginning and work our way up. Supposeyou offer to pay only one cent. This turns outto be a very bad price. The reason is there isno lower denomination and hence it will beimpossible to find another buyer. You will bestuck with the bottle. Buying the bottle atone cent is equivalent to buying your owneternal damnation. So clearly this is a badprice.

Page 380: Math puzzles: classic riddles in counting, geometry, probability, and game theory

But what about two cents? At first, thisseems okay. If you buy at two cents, then youcould theoretically sell for one cent. Theproblem is that you will be hard pressed tofind a buyer. The reason is the person whobuys from you is buying at one cent. And asargued just above, it is stupid to buy thebottle at one cent. Therefore, no one wouldwant to buy the bottle at two cents.

Indeed, this logic can be extended. No oneshould want to buy at three cents, or fourcents, and so on. Inductively one can reasonthere is no “safe”? price to buy the bottle.Thus, the bottle should never be bought be-cause it will be hard or impossible to find abuyer.

But in practice, this conclusion feels wrong.You would expect a buyer at a high enoughprice. If you buy the bottle for $100, for ex-ample, you can likely find someone who willwant to buy at $99.99. And they will feel

380/488

Page 381: Math puzzles: classic riddles in counting, geometry, probability, and game theory

safe, reasoning that they can find someonewilling to pay $99.98, and so on.

The bottle imp paradox is that inductivereasoning and practical reasoning come tocontradictory conclusions. Is the bottle neverto be bought, or is there some high enoughprice range?

How can we resolve this paradox? I’ll presenttwo reasonable resolutions.

Resolution 1: the sinner saves the day

The paradox could be readily resolved withthe existence of an atheist buyer. There couldbe someone who buys the bottle without ex-pecting to sell it. This may be someone whodoes not believe in a supernatural afterlifewith damnation.

Or alternately, it could be a buyer who is asinner that cannot be saved. Since his life is

381/488

Page 382: Math puzzles: classic riddles in counting, geometry, probability, and game theory

already destined for damnation, having thebottle does not add an additional penalty.

The latter situation is more or less the resol-ution offered in Stevenson’s story The BottleImp, on which this puzzle is based.

Resolution 2: foreign currencies

Another trick is that are currencies withmoney worth less than one penny. In Steven-son’s story, the protagonist travels to Tahitiin search of a coin worth one-fifth of anAmerican penny.

Introducing foreign currencies also allowsfor the bottle to be sold indefinitely. Thereason is that currencies fluctuate in valueson the foreign exchange market. One couldbuy the bottle for a low price in one cur-rency, and sell it when the currency appreci-ates. The bottle could be sold back and forthin accordance with the swings of the market.

382/488

Page 383: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Of course, now we are back to the situationof betting on the market and the madness ofmen, which is not all that comforting.

383/488

Page 384: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 14: Guess the number

On a game show, two people are assignedwhole, positive numbers. Secretly each istold his number and that the two numbersare consecutive. The point of the game is toguess the other number.

Here are the rules of the game:

–The two sit in a room which has a clockthat strikes every minute on the minute

–The players cannot communicate inany way

–The two wait in the room untilsomeone knows the other person’s num-ber. At that point, the person waits untilthe next strike of the clock and can an-nounce the numbers

Page 385: Math puzzles: classic riddles in counting, geometry, probability, and game theory

–The game continues indefinitely untilsomeone makes a guess

–The contestants win $1 million if cor-rect, and nothing if they are wrong

Can they win this game? If so, how?

(Credit: I came across a highly amusingpuzzle in Impossible?: Surprising Solutionsto Counterintuitive Conundrums)

385/488

Page 386: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 14: Guessthe number

At first it seems like the contestants can dono better than chance. If a contestant has thenumber 20, for instance, there is no way totell if the other person has 19 or 21.

The naive strategy is to wait a bit and thentake a guess at the other number, yielding a50 percent chance of success.

But can they do better?

The solution

The answer lies in the subtle rule about an-nouncing the number once the clock strikes.It turns out that two players who reason cor-rectly can win every single time, if they thinkinductively.

Page 387: Math puzzles: classic riddles in counting, geometry, probability, and game theory

To see why this is so, think about a casewhere the players can win for sure. If one ofthe players gets the number 1, then he can besure the other player has the number 2.There is no other possibility because the twoassigned numbers are consecutive and posit-ive. Therefore, this player will immediatelydeduce the answer and announce the num-bers during the first strike of the clock.

Now consider when the players are assignedthe numbers 2 and 3. The player with 2 canreason as follows. "I know my partner caneither have 1 or 3. But if he has 1, then heshould know it and will announce it at thefirst strike of the clock. So if the clock strikesonce and nothing happens, I can be sure thatI have the lower number. Therefore ournumbers must be 2 and 3." So what will hap-pen is this player will announce the numbersat the second strike of the clock.

387/488

Page 388: Math puzzles: classic riddles in counting, geometry, probability, and game theory

This reasoning can naturally be extended byinduction. The general statement is the play-er with the number k will realize the otherhas k + 1 and can announce this information

at the kth strike of the clock.

They can win every time!

Final thought: the connection withcommon knowledge

The puzzle illustrates the game theoryconcept of common knowledge which is dis-tinguished from the weaker concept of mutu-al knowledge.

Roughly speaking, an event is mutual know-ledge if all players know it. Common know-ledge also requires that all players know theevent, all players know that all players knowit, and so on ad infinitum.

388/488

Page 389: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Here is how the two concepts work in thegame. When a player has the number 20, it ismutual knowledge that neither player hasthe number 1, or 2, or so on up to 18. Butthat deduction is not good enough to solvethe game.

And that is where the clock provides a help-ing hand. When the clock strikes once, andno one answers, the fact that neither playerhas 1 transforms from mutual knowledge in-to common knowledge. This alone is trivialgiven the numbers are consecutive, but asshown above, this stronger set of knowledgecan build up on consequent strikes of theclock. Each time the clock strikes the set ofexcluded numbers is included as commonknowledge and eventually the players canwin.

389/488

Page 390: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 15: Guess 2/3 of theaverage

A teacher announces a game to the class.Here are the rules.

1. Everyone secretly submits a wholenumber from 0 to 20.

2. All entries will be collected, and theguesses will be averaged together.

3. The winning number will be chosenas two-thirds of the average, rounded tothe closest number. For instance, if theaverage of all entries was 3, then thewinning number would be chosen as 2.Or if the average was 4, the winningnumber would be 3 (rounded from2.6666…).

Page 391: Math puzzles: classic riddles in counting, geometry, probability, and game theory

4. Entries closest to the winning numberget a prize of meeting with the professorover a $5 smoothie. (In the academicversion of the game, multiple winnerssplit the prize, but this teacher is beinggenerous).

What guess would you make? What if every-one were rational?

391/488

Page 392: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 15: Guess2/3 of the average

The game is called a "p-beauty contest." The"p" refers to the proportion the average ismultiplied by–in this case, p is two-thirds. Ifyou’re wondering, the game has the same fla-vor for any value of p less than 1. Why is itcalled a beauty contest? It’s because thegame is the numbers-analog to a beauty con-test developed by John Maynard Keynes.

Here is the beauty contest that Keynespondered. Imagine that a newspaper runs acontest to determine the prettiest face intown. Readers can vote for the prettiest face,and the face with the most votes will be thewinner. Readers voting for the prettiest facewill be entered in a raffle for a big prize.

How does the game play out? Keynes wantedto point out the group dynamics. The naive

Page 393: Math puzzles: classic riddles in counting, geometry, probability, and game theory

strategy would be to pick the face you foundto be the most attractive. A better would beto picking the face that you think otherpeople will find attractive.

The number "beauty contest" has the samekind of logic. You don’t pick a number youlike. You pick a number that’s closest to two-thirds of the average of everyone else. Thetwist of both games is that your guess affectsthe average outcome. And each person is try-ing to outsmart everyone else.

My experience with the game

The puzzle is based on my own experience ina game theory course.

Given the subtlety of the game, my professorwas banking on paying out to only a few win-ners. Although it was mathematically pos-sible for each of us to win, and he was takingthat risk. In fact, he knew that if we were all

393/488

Page 394: Math puzzles: classic riddles in counting, geometry, probability, and game theory

rational, we would all win. He would have topay out a $5 smoothie to 50 students–that is,he made a $250 gamble playing this game.

Why was he so confident? Let’s explore thesolution to the game and see why it’s hard tobe rational.

Numbers You Shouldn’t Pick

Even though it’s not possible to know whatother people are guessing, this game has asolution. If everyone acts rationally, thereare only two possible winning numbers. Ittakes some crafty thinking, but it is reallybased on two principles I think you willaccept.

Principle 1: Don’t Play StupidStrategies (Eliminate DominatedStrategies)

394/488

Page 395: Math puzzles: classic riddles in counting, geometry, probability, and game theory

The first principle is that players shouldavoid writing down numbers that could nev-er win. That sounds logical enough, but it’snot always the case. We all can agree thatwriting a number that could never win is justa dumb, stupid strategy. You are picking anoption that’s inferior to something else, andhence is known as a dominated strategy.

Are there any dominated strategies in thebeauty contest?

To start answering that question, we need tofigure out which numbers will never win. Anatural question is what is the highest win-ning number? You would never want to picka number larger than that, unless you wantto lose.

You know that the highest number anyonecan pick is the number 20. If every singleperson picked 20, then the average would be

395/488

Page 396: Math puzzles: classic riddles in counting, geometry, probability, and game theory

20. The winning number would be two-thirds of 20, which is 13 when rounded.

Should you ever find yourself submitting 20?

The answer is no–there is always a betterchoice, say the number 19. The only time 20wins is precisely when everyone else picks itand everyone shares the prize. In that case,you would be better off writing 19 to win theprize unshared. Plus, by writing 19, you canpossibly win in other cases, like when every-one picks 19. You are always better off writ-ing 19 than 20. The guess of 20 is domin-ated–it’s dumb.

You should never choose 20. And your ra-tional opponents should be thinking thesame way. So here’s the big result: you canreason that no player should ever choose 20.

396/488

Page 397: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Principle 2: Trim the Game, and ApplyPrinciple 1 Again (Iterate the Elimina-tion Process)

By principle 1, no player will ever choose 20.Therefore, you can essentially remove 20 asa choice. The game trims to a smaller beautycontest in which everyone is picking a num-ber between 0 and 19. The smaller game hassurvived one round of principle 1.

Now, repeat! Ask yourself: in the reducedgame, are there any dominated strategies?

Now 19 takes the role of 20 from the lastanalysis. Since 19 is the highest possible av-erage, it will never be a good idea to guess it.Applying principle 1, you can reason that 18is always a better choice than 19. Thus, 19 isdominated and should be eliminated as achoice for every player.

397/488

Page 398: Math puzzles: classic riddles in counting, geometry, probability, and game theory

The game is now trimmed to picking num-bers from 0 to 18. This is the result of two it-erations of principle 1.

There’s no reason to stop now. You can iter-ate principle 1 to successively eliminatechoices of 18, 17, 16, and so on. The onlynumbers remaining will be 0 and 1. (This re-quires 19 iterations of principle 1.)

There is a name for this thought process. It’saptly named, but a mouthful: iterated elim-ination of dominated strategies (IEDS). Theidea is to eliminate bad moves, trim thegame, and iterate the process to find the sur-viving moves.

These remaining strategies are considered tobe rationalizable moves, that is, moves thatcan possibly win.

The Equilibria

398/488

Page 399: Math puzzles: classic riddles in counting, geometry, probability, and game theory

The only reasonable choices are to pick thenumbers 0 and 1. Is either a better choice?This is unfortunately where IEDS cannotgive insight.

It’s possible to have 0 as a winning num-ber–imagine all players picked 0. (The win-ning number will be 0).

It is also possible to have 1 as a winningnumber–imagine all players picked 1. (Thewinning number is 2/3, which rounds to 1.)

The answer will depend on what peoplethink others will be guessing. Both equilibri-ums–all 0 and all 1–are achievable.

Back to the Classroom

None of us in the class had this deep under-standing of IEDS. We were just learninggame theory–it was actually our third

399/488

Page 400: Math puzzles: classic riddles in counting, geometry, probability, and game theory

lecture. My professor was pretty sure ourguesses would be all over the place.

But Stanford kids can be crafty. One studentused some sharp thinking and realized thatcoordination would help; he asked if wecould talk to each other. The professor, stillfeeling we were novices, confidently repliedwith a smile, “Sure. Go ahead.” We only had10 seconds to write down our answersanyway.

Before the professor could change his mind,the student quickly shouted to all of us, “Ifwe all write down 0, we all win.”

It was remarkable. He figured out the equi-librium and told us what to do! He couldn’tbe tricking us because the math was clear: ifwe all picked 0, we would all have winningnumbers.

400/488

Page 401: Math puzzles: classic riddles in counting, geometry, probability, and game theory

My professor’s face seemed to drop. That’s$250 on the line. (He never let future yearstalk before their bids).

How Smart Are Stanford Kids?

The professor was relieved after he talliedthe votes. He told us that admirably most ofus wrote down the number 0 (I was amongthose who did). But there were larger an-swers too, ranging from 1 to 10.

Someone actually wrote down 10! And thiswas after being told the answer.

After all was said and done, the winningnumber turned out to be 2, and the prize wasawarded to three students. Thanks to our ir-rationality, my professor only paid out $15.

It was even better. My professor grilled thestudents who wrote down larger numbers.They all squirmed, as he was physically

401/488

Page 402: Math puzzles: classic riddles in counting, geometry, probability, and game theory

intimidating, and explained reasons like “itwas my lucky number” or “I don’t know. Iwasn’t really thinking.”

The Practical Lesson

What is going on? This is a group of smartstudents that was told the answer to thegame.

The example illustrates a flaw of IEDS. It canget you reasonable answers if you think play-ers are reasoning out further and further innested logic. We don’t have infinite rational-ity, only bounded rationality.

The practical answer to what you shouldwrite depends on the book answer plus yoursubjective beliefs about what other peopledo. It’s the combination of book smarts plussocial smarts that matters.

402/488

Page 403: Math puzzles: classic riddles in counting, geometry, probability, and game theory

The people who wrote down the winningnumbers told the class they suspected somepeople would deviate for irrational reasons.And they were rewarded for not confusingtheory and practice.

403/488

Page 404: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 16: Number elimina-tion game

Bored at the airport, Alice and Bob decide toplay the following mathematical game.

Alice writes the numbers 1, 2, . . . , N on apiece of paper.

Bob goes first, and he picks two numbers xand y from the list. Bob crosses out thesenumbers from the sequence, and he includesa new number equal to their positive differ-ence (in other words, he puts |x – y| on thelist).

Alice takes her turn and does the exact samething with the remaining numbers on thelist.

Bob and Alice continue to play, in turn, untilthere is only one number left.

Page 405: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Alice wins if the final number is odd, andBob if even.

1. What strategy should Alice and Bobhave for the game?

2. Is there a winning strategy?

405/488

Page 406: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 16: Numberelimination game

Let’s work through an example to see howthe game might play out.

Suppose Alice just writes the numbers 1, 2,and 3 in the initial list.

Bob can choose any two numbers, whichmeans he can make any of the followingthree moves:

–if he chooses (1, 2) the resulting list is1, 3

–if he chooses (1, 3) the resulting list is2, 2

–if he chooses (2, 3) the resulting list is1, 1

Page 407: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Alice will simply have to pick the two num-bers that are remaining, and the results willbe as follows:

–if the list was 1, 3 the resulting numberis 2 (which is even so Bob wins)

–if the list was 2, 2 the resulting numberis 0 (which is even so Bob wins)

–if the list was 1, 1 the resulting numberis 0 (again an even number, so Bobwins)

This worked example shows Alice will losethe game regardless of how she or Bobchoose to play.

But why is that? And are there games thatAlice can win?

The trick to solving the game

407/488

Page 408: Math puzzles: classic riddles in counting, geometry, probability, and game theory

The trick is to notice what is happening oneach turn of the game.

In the version with the numbers 1, 2, 3worked out above, we can notice somethinginteresting about the sum of the numbers inthe list.

The original sum of all the numbers is 6, aneven number.

When Bob moves, the resulting sums caneither be 4–if he picks (1, 2) or (1, 3)–or thesum can be 2–if he picks (2, 3). In eithercase, the sum of the numbers is even.

And after Alice moves, we showed the result-ing number must be even as well, which iswhy she loses.

This suggests a pattern: the final number, aswell as every intermediate sum, will have the

408/488

Page 409: Math puzzles: classic riddles in counting, geometry, probability, and game theory

same parity (the property of being odd oreven) as the sum of the original list.

If true, that means Alice wins if the originallist has an odd sum, and Bob wins if the ori-ginal list has an even sum.

But how can we prove this is true?

Proof that parity is unchanged /invariant

Suppose the original sum of the numbers islabeled S.

On Bob’s turn, he removes two numbers x >y from the list, and he writes another num-ber (x – y).

This means Bob’s action reduces the originalsum S by the following:

x + y – (x – y) = 2y

409/488

Page 410: Math puzzles: classic riddles in counting, geometry, probability, and game theory

The thing to notice is that 2y is an even num-ber, which means the parity of the sum is un-changed by a move in the game. In otherwords:

–If the original sum S was even, then eachturn it is reduced by an even number. As aneven minus an even is also an even number,this means every intermediate sum will be aneven number. Hence, the final number mustbe even as well.

–If the original sum S was odd, then eachturn it is reduced by an even number. As anodd minus an even is an odd number, thismeans every intermediate sum will be an oddnumber. Hence, the final number must beodd as well.

Answering the original questions

1. What strategy should Alice and Bobhave for the game?

410/488

Page 411: Math puzzles: classic riddles in counting, geometry, probability, and game theory

This is something of a trick question.

Alice and Bob have no particular strategy forplay: the game is decided by the parity of thesum of the initial list.

Note that if the initial list is 1, 2, 3, . . ., N,then its sum is N(N+1)/2. The parity of thisnumber decides who wins the game.

2. Is there a winning strategy?

Again this is a trick question as the movesare irrelevant to the outcome.

Arguably, the winning strategy is to influencethe choice of the initial list, and hope theother person doesn’t notice.

411/488

Page 412: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 17: Hat puzzle

There are three players in this game. Eachplayer has either a blue or red hat placed ontheir head, determined randomly.

Each player can see the colors on the othertwo player's hats, but not the color of theirown hat.

Each person in the group must simultan-eously write the color of their own hat on apiece of paper, or they can write "pass". Thegroup loses if someone writes a wrong guess,or if they all write "pass."

No communication is allowed, except for aninitial strategy session.

What strategy should the group use, andwhat is their chance of success?

Page 413: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 17: Hatpuzzle

The Basic Strategy (50 percent winning)

The rules heavily penalize incorrect guesses.A single incorrect guess makes the grouplose–even if the other two players guess cor-rectly. A single incorrect guess is the applethat spoils the bunch.

So it’s important the rules allow for playersto pass. If a player doesn’t have a good guess,it would be a good idea to pass.

Page 414: Math puzzles: classic riddles in counting, geometry, probability, and game theory

A basic strategy would be to minimize therisk of bad guesses. Force two players to passin every game and make one person the offi-cial guesser. The group wins exactly whenthis person guesses correctly.

How often will the group succeed? Since thehat color is chosen by a coin flip, there is a50 percent chance of guessing the correctcolor.

414/488

Page 415: Math puzzles: classic riddles in counting, geometry, probability, and game theory

But can the team do better than randomchance?

The trick is figuring out the players do have away of coordinating as a group. Doing this,they can make winning an amazing 75 per-cent chance. Let’s investigate why.

One Optimal Strategy (75 percentwinning)

Motivating question: does observing the oth-er two hat colors tell you anything aboutyour own hat color? In other words, if yousee two red hats, does that make your hatmore likely to be blue?

The answer is no, and that’s a potential road-block. Regardless of what you see, your hatcolor is determined by a coin flip. Fair coinsare never “due” for a particular out-come–each toss is independent.

415/488

Page 416: Math puzzles: classic riddles in counting, geometry, probability, and game theory

But don’t get caught up in probability–thefact is that seeing the other hat colors doesconvey information. The problem is the fig-uring out how to transmit that informationto the other players.

To get around that, players need to coordin-ate guesses based on what they see. If pos-sible, they still want to minimize bad guessesby having two people pass and one personguess. What’s needed now is a groupstrategy.

How can they do that? It starts by taking astep back and considering the possible distri-butions of hat outcomes. With three playersand two hat colors, there are a total of eightequally likely outcomes:

RRR, RRB, RBR, RBB, BBB, BRR, BRB,BBR

416/488

Page 417: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Is there anything special about thedistribution?

One feature is that most outcomes–six ofthem–include at least one hat of both colors.Only two extreme outcomes don’t–the oneswith all red hats or all blue hats.

We can analyze further. Among outcomeswith both hat colors, there logically has to betwo hats of one color (the “majority” color)and one hat of another color (the “minority”color).

417/488

Page 418: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Here’s the kicker: by looking at the otherhats, players can identify whether they arewearing a majority color or a minority color.

418/488

Page 419: Math puzzles: classic riddles in counting, geometry, probability, and game theory

For instance, if a player sees both a red andblue hat, then the player must be wearing themajority color (which could be red or blue).

If a player sees two blue or two red hats, thenthe player must be wearing the minority col-or, which will be the opposite color of whatthe player sees.

Now the idea is to get the player with theminority hat color to guess and force the oth-er people to pass.

So here is the strategy:

if you see both a red and a blue hat, then“pass”

if you see two red hats, then guess “blue”

if you see two blue hats, then guess “red”

This strategy wins in all six cases with atleast one hat of each color. It only loses in

419/488

Page 420: Math puzzles: classic riddles in counting, geometry, probability, and game theory

the two cases of all-red or all-blue, in whichall players guess incorrectly.

Here is how players would guess:

420/488

Page 421: Math puzzles: classic riddles in counting, geometry, probability, and game theory

All told, the group wins in six of eight pos-sible outcomes–a whopping 75 percentchance.

Extension: The host can learn

If you’re playing rock-paper-scissors againsta computer that mixes randomly, you couldwin 1/3 of the time simply by picking onestrategy, say rock. But if the computer couldlearn and analyze your pattern, it might re-spond by countering with paper and startwinning a lot. To maintain your 1/3 winningchance, you need to randomize your choicesamong rock, paper, and scissors.

In the hat game, the players have a 75 per-cent chance of winning, but the strategy hasa pattern. It loses every time the hat colorsare all the same. A responsive host, like thecomputer in rock-paper-scissors, would seethe pattern and respond by assigning hats tobe the all one color more frequently. To keep

421/488

Page 422: Math puzzles: classic riddles in counting, geometry, probability, and game theory

the host honest, the players need torandomize.

Is there some a way the players can win,without creating a pattern of outcomes inwhich they all lose?

Amazingly, yes there is! Even more surpris-ing, the winning percentage stays at 75percent.

The Random Optimal Strategy (75 per-cent winning)

The random strategy is a refinement on thestatic one given above. The key to the abovestrategy is that players essentially bet againstthe outcome being all-red or all-blue. Know-ing that, it was possible to coordinateguesses so only one person guessed and gavea correct answer.

422/488

Page 423: Math puzzles: classic riddles in counting, geometry, probability, and game theory

There’s nothing special about picking all-redor all-blue.

The players can randomly pick any colorcombination and its “opposite” configuration(red-blue-red and blue-red-blue are oppos-ites) as outcomes to bet against. The remain-ing six outcomes can be coded based on thehat colors that each player sees.

Why would this work, and why does it haveto be “opposite” combinations?

The eight outcomes of the hat game can bevisualized as vertices of a cube. Adjacent ver-tices differ by changing only a single “co-ordinate,” that is, the color of one player’shat.

423/488

Page 424: Math puzzles: classic riddles in counting, geometry, probability, and game theory

The graphical interpretation is as follows:can the players identify which vertex they be-long to? The information they are given isthe other two hat colors they see–that is,they are effectively placed at midway pointsalong the adjacent edges.

Each player can see the coordinates of theother two players, but is unsure about theown coordinate–that is, the player is unsurewhich of the two possible endpoints thegroup belongs to.

424/488

Page 425: Math puzzles: classic riddles in counting, geometry, probability, and game theory

We want a situation where exactly two play-ers will not be able to tell the vertex (theywill “pass”) and the remaining player willknow the location (and guess correctly).

Such a unique coding occurs when playersbet against a random vertex and the “oppos-ite” one–a limitation that gives maximal loc-ation information.

425/488

Page 426: Math puzzles: classic riddles in counting, geometry, probability, and game theory

In any of these cases, players only lose if infact the outcome is one of the two they betagainst, meaning they have a 75 percentchance of winning.

The 75 percent chance of winning applies toevery time the game is played but the losingoutcomes are randomized. Hence, the hostwon’t be able to exploit any particular colorcombination.

Appendix: The coding for betting againstred-blue-red and blue-red-blue outcomes(others can be found similarly)

Strategies:

Player 1:If see blue-red, then pick red.If see red-blue, then pick blue.Else pass.

Player 2:

426/488

Page 427: Math puzzles: classic riddles in counting, geometry, probability, and game theory

If see red-red, then pick blue.If see blue-blue, then pick red.Else pass.

Player 3:If see red-blue, then pick red.If see blue-red, then pick blueElse pass.

427/488

Page 428: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 18: Polynomial guess-ing game

Alice and Bob decide to play a math game.Alice secretly writes down any polynomialp(x) of one variable that she wants. The poly-nomial can be of any degree, but to limit thescope somewhat, the polynomial can onlyhave nonnegative integer coefficients.

Thus, Alice can pick polynomials like 2x2 + 1

or 3x100 + 2x2, but she cannot pick polynomi-

als with negative coefficients like -x2 + x, or

non-integer coefficients such as 0.5x2.

Bob has to guess the polynomial. He gets toask two questions of Alice. First, he gets topick any number a and ask Alice for thevalue of p(a). Then, he gets to pick anothernumber b and ask for the value of p(b).

Page 429: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Bob wins if he can guess the polynomial; oth-erwise Alice wins.

After playing the game for several rounds,Bob announces that he has a winningstrategy. Can you figure out what it is?

(Credit: the puzzle was originally submittedas “A Perplexing Polynomial Puzzle” in Col-lege Mathematics Journal, March 2005, p.100.)

429/488

Page 430: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 18: Polyno-mial guessing game

Before I explain the answer, let's see thestrategy in action.

Alice picks a polynomial, and then Bob asksfor the value of p(1). Let's say that Alicereplied p(1) = 4.

Bob then asks for the value of p(5). Alicereplies the answer is 36.

Bob thinks for a moment, and then an-

nounces polynomial must be x2 + 2x + 1. Andhe's right!

How did Bob do this?

Rather than explain the answer right away, Iwant to do one more example.

Page 431: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Alice comes up with another polynomial andBob again picks the number 1. Alice repliesthat p(1) = 9.

Bob then picks the number 10, and he learnsthat p(10) = 432.

Suddenly Bob exclaims the answer must be

4x2 + 3x + 2, and he's right again!

This example is the secret to the wholepuzzle. The interesting part is that Bob'ssecond question led to the answer 432, andthe polynomial had coefficients of 4,3, and 2for its descending powers.

Why did this happen?

The short answer is this. What Bob is doingis: he is first learning the value to p(1), andthen he asks for the value of p(1)+1. It turnsout every time that the digits of this answer,

431/488

Page 432: Math puzzles: classic riddles in counting, geometry, probability, and game theory

p(p(1)+1) in the numerical base of p(1)+1 areprecisely the coefficients of the polynomial.

Why is that? Let's think critically about whatis happening in each step.

The polynomial p(x) can be written as p(x) =

an xn + an-1 xn - 1 + ... + a0

When Bob asks for the value of p(1), he willend up with the sum of the coefficients be-cause p(1) = an + an-1 + ... + a0

Now comes the neat trick. When Bob asksfor the value of p(p+1), he ends up with thefollowing term:

p(p+1) = an (p+1)n + an-1 (p+1)n - 1 + ... + a0

Notice anything interesting about thisseries?

432/488

Page 433: Math puzzles: classic riddles in counting, geometry, probability, and game theory

The trick is this: each coefficient is uniquelyattached to a different power of p + 1. Byconstruction, each coefficient is smaller thanthe attached term p + 1. Therefore, the seriesis a unique representation of the number p(p+ 1) in the number base p + 1!

That is, if we write p(p+1) in the numberbase p + 1 we get the number:

an an-1 ... a0 (base p + 1)

This representation is not possible if youhave negative or non-integer coefficients,and hence the restriction.

(Notice we could equivalently use any num-ber larger than p + 1, or simply any numberlarger than the maximum coefficient. But p +1 is the smallest value guaranteed to work)

In the example above, when we found p(10)was 432, we could view the number in base

433/488

Page 434: Math puzzles: classic riddles in counting, geometry, probability, and game theory

10 as the coefficients of the polynomial. Inother words, we could deduce the polynomi-al must have been of degree 2, and the coeffi-cients of the polynomial were 4, 3 and 2 indescending order.

In the other example when p(5) was 36, weneeded to do a little more work. We neededto take the number 36 in base 5. This turns

out to be 121: 1*52 + 2*51 +1*50. Thus wecould deduce the polynomial had coefficients1, 2, and 1.

So to summarize, Bob's winning strategy isthis:

1. Ask for the value of p(1)2. Ask for the value of p(p(1)+1)3. Convert the value into base p(1)+14. The digits of the number are the coeffi-cients of the polynomial in descending order

434/488

Page 435: Math puzzles: classic riddles in counting, geometry, probability, and game theory

It's quite a remarkable and ingeniousstrategy.

435/488

Page 436: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 19: Chances of meetinga friend

On a Friday night, two friends agree to meetup in a bar between midnight and 1 am. Eachforgets the exact time they are supposed tomeet, so each shows up at a random time.

Suppose that after arriving randomly, eachwaits 10 minutes for the other person beforeleaving. What is the chance the two will meetat the bar?

Game theory extension

If both friends are rational, and they want tomaximize the chance of meeting the other,what strategy should each pursue? If theyplay optimally, what is the chance they willmeet each other? (Assume each person isaware the other will wait 10 minutes beforeleaving.)

Page 437: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 19: Chancesof meeting a friend

I will present a few solutions to the problem.

Solution part 1: geometric probability

I feel this is the most elegant way to solve theproblem.

If we let x denote the time one person arrivesat the bar, and y the other, we can use thenotation (x, y) to denote the time in minutes,after midnight, that each person arrives atthe bar.

The trick now is that we can model the situ-ation geometrically in the Cartesian plane.The x-axis can be labeled from the time 0minutes until 60 minutes, as can the y-axis.

Page 438: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Now any coordinate in the 60×60 squarerepresents a time that the pair arrives at thebar. The coordinate (0,9) means one personshows up at midnight, the second at 12:09,and clearly they will meet because the timesare within 10 minutes of each other. The co-ordinate (1, 51), on the other hand, corres-ponds to one showing up at 12:01 and theother at 12:51, a time the two will not meet.

What is the set of coordinates for which thetwo will meet?

The notation affords a very simple way to de-scribe the event. We want the two coordin-ates to be within 10 minutes of each other.We either want the x-coordinate to be 10units smaller than y, or 10 units bigger thany. The succinct way of writing that is wewant all coordinates such that |x –y| ≤ 10.

438/488

Page 439: Math puzzles: classic riddles in counting, geometry, probability, and game theory

We will draw the lines y = x – 10 and y = x +10 and shade the area in between these twolines to denote the event.

The resulting figure is as follows:

439/488

Page 440: Math puzzles: classic riddles in counting, geometry, probability, and game theory

The probability of meeting is precisely theratio of the shaded area to the total square.

This is fairly easy to calculate. The big squareis 60×60 = 3,600 in area. Rather than find-ing the shaded area, let us calculate the un-shaded area and subtract. The unshadedarea consists of two isosceles right triangleswith sides of 50. This means each trianglehas an area of (0.5) x (50×50) = 1,250 andthe total unshaded area is double that,2,500.

The shaded area is found by subtracting theunshaded area from the total : 1,100 = 3,600– 2,500.

Thus we conclude the chance the friends willmeet is 1,100 / 3,600 =11/36, or about 30.6percent.

Having nearly a one in three chance to meetis actually not that bad!

440/488

Page 441: Math puzzles: classic riddles in counting, geometry, probability, and game theory

I find the geometric solution to be the mostelegant, but it should not surprise you thereare other ways to solve this puzzle.

Later in the article I will explain two othersolution methods.

For now, I want to highlight another inter-esting fact. The math shows that even twomindless friends have a rather good chanceof meeting up with each other.

In the game theory extension, I asked howlikely it would be if the friends were com-pletely rational and reasoned carefully. Thesurprising thing is the friends, if they reasoncarefully, are guaranteed to meet!

Here is why.

Game theory solution

441/488

Page 442: Math puzzles: classic riddles in counting, geometry, probability, and game theory

I credit my aunt for offering a strategic an-swer to this mathematical problem, inspiringthis extension.

In the real world, people don’t show up ran-domly. They will use some heuristics andreason out a strategy to increase the chancesof meeting their friend.

I’ve asked this puzzle to many people, andtheir reactions are quite interesting. The firstthing that people notice is that it’s a bad ideato show up too early or too late. Why is that?

You probably figured this logic out whensolving the puzzle. If you show up right atmidnight, you will only win if your friendends up showing up after you. If you show upsomewhere in the middle, you win if yourfriend shows up 10 minutes or less after youAND if your friend had happened to show up10 minutes or less before you.

442/488

Page 443: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Similarly, you can reason it’s a bad idea toshow up at 1 am or near the end, in whichcase you win only if your friend showed upbefore you.

So which times are not good strategies? Let’sbe specific and list the out.

Dominated strategies

One time that is very stupid to show up isright at midnight. You will only win if yourfriend shows up during the first tenminutes–we can denote this as the interval[0, 10] for shorthand.

Rather than showing up right at midnight,you would do better to show up at 12:01. Inthis case you still win if your friend shows upat midnight, as he will be waiting for you.But you will also win if he shows up any timebefore 12:11. In short, that means you win ifhe shows up during the first 11 minutes of

443/488

Page 444: Math puzzles: classic riddles in counting, geometry, probability, and game theory

the night–corresponding to the interval[0,11].

Notice that by picking 12:01 instead of 12:00exactly, you’ve increased your chances ofmeeting without sacrificing anything–youget an extra minute of time you will meet.

This argument shows that 12:00 is not agood strategy–it performs worse than 12:01REGARDLESS of when the other personshows up.

We casually say arriving at 12:00 is a stupididea. In game theory jargon, such a stupidstrategy is dubbed as a dominated strategy.

(Note: it is vital that each person is aware theother person will wait 10 minutes beforeleaving–the rules of the game should becommon knowledge)

Elimination of dominated strategies

444/488

Page 445: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Obviously dominated strategies should neverbe played. They perform worse than someother strategy, and hence they can be re-moved from consideration.

The above logic showed that 12:00 was dom-inated by 12:01. We can similarly show that12:01 is dominated by 12:02, and in fact wecan ultimately prove that showing up anytime before 12:10 is a bad idea.

By exactly symmetric reasoning, we canprove that showing up any time after 12:50 isa dominated strategy. You are better offcoming just a bit earlier to increase yourodds of meeting up.

So that leaves us with the 40 minute intervalfrom 12:10 to 12:50 in which both playerscould arrive.

If we assume the players show up randomlyin this interval, then we can use a geometric

445/488

Page 446: Math puzzles: classic riddles in counting, geometry, probability, and game theory

argument as in Solution 1 above to find theprobability of meeting jumps up to 7/16 =43.75 percent.

But can the players do even better?

In fact they can! Here is why.

ITERATED elimination of dominatedstrategies

Surely the friends have reasoned this far,they are not going to stop thinking now.

We can continue to apply the same logic asbefore to try to trim the scope of goodstrategies. I mentioned this idea in the"guess 2/3 the average" puzzle.

But I will go through the reasoning again forthe sake of completeness.

Remember we argued that 12:00 was a badtime to show up because it was the earliest

446/488

Page 447: Math puzzles: classic riddles in counting, geometry, probability, and game theory

possible time. So we concluded it was never agood idea to show up before 12:10.

That means in this reduced game that 12:10is now the earliest time either friend wouldever show up. Both friends should realizethis, and we can repeat or iterate the logicagain! The logical process is known as themouthful iterated elimination of dominatedstrategies.

Basically 12:10 in this reduced game is verysimilar to 12:00 in the original game. Sinceno person shows up before this time, youonly win if a friend shows up after you. Itwould make more sense to choose 12:11 toincrease your chances of meeting yourfriend.

You are probably getting the idea, so I’ll skipa few steps and get to the end result.

447/488

Page 448: Math puzzles: classic riddles in counting, geometry, probability, and game theory

In the reduced game, we can prove thatshowing up any time before 12:20 is a badidea. Similarly, we can prove that showingup any time after 12:40 is a bad idea.

By iterating the process of removing badstrategies, we have derived a smaller strategyspace and come up with a sharper predictionof play.

The solution: iterate one more time

Notice we are down to a 20 minute intervalof time from 12:20 until 12:40. There’s noreason to stop here–let’s iterate the decisionprocess one more time to see if we can getany better.

In this reduced game, the earliest time one ofthe players will show up is 12:20. Again, wecan demonstrate it’s a bad idea to show uptoo close to the starting point of the interval.

448/488

Page 449: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Using the same logic as before, we can see itis best to show up only at 12:30 or later.

Using similar logic, the latest time a friendwill show up is 12:40. You can see what’scoming here: we can reason that it’s never agood idea to show up at 12:30 or later.

Putting these two facts together, we end upwith a remarkable conclusion: 12:30 is theunique arrival time (i.e. Nash equilibrium)that the friends will show up!

This solution is absolutely marvelous to me,and it even has a few other interestingproperties:

–this is an efficient time, as wait time isZERO

–showing up at the middle is an obviouspoint (known in game theory as a focalor Schelling point)

449/488

Page 450: Math puzzles: classic riddles in counting, geometry, probability, and game theory

–the friends are GUARANTEED to meetup: probability of meeting is 100 percent

So two friends who are reasonable enough tothink can figure out how to meet for surewithout relying at all on cell phones. You cansee why the world of game theory is so se-ductively attractive to thinking people.

I feel the fact that people cannot arrive atsimilar success in the real world sayssomething about the human condition.

But anyway, let me get to some other math-ematical solutions to the non-game theoryversion. I find these are also very satisfying.

(Extra credit: The logic is not only for 10minutes. This would also apply for 1 minute.In fact, you can show that if each personwaits for any time t > 0, then the uniqueequilibrium strategy is arrive at 12:30, lead-ing to the outcome both people meet)

450/488

Page 451: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Method 2: Conditional probability

My uncle came upon this analytic solution.For narration sake, I will give a less thanformal explanation–I am sure you can fill inthe details.

Let’s consider the game from one friend’sperspective. We know the other player canshow up at any time on the interval (remem-ber in the non-game theory version any timeis possible).

How likely are we to meet the other player?We can split up the cases in terms of condi-tional probability.

Case 1: If the other person shows up inthe first 10 minutes (10/60 = 1/6 of thetime), the average time of showing up is12:05. We will meet if I show up anytime from 12:00 to 12:15. This interval is15 minutes out of 60, or 1/4 of the time.

451/488

Page 452: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Case 2: Similarly, if the other personshows up in the last 10 minutes (10/60= 1/6 of the time), the average time ofshowing up is 12:55. We will meet if Ishow up any time from 12:45 to 1:00.This interval is 15 minutes out of 60, or1/4 of the time.

Case 3: Finally, if the person shows upin the middle 40 minutes (40/60 = 2/3of the time), the average time of show-ing up is 12:30. We will meet if I showup any time from 12:20 until 12:40. Thisinterval is 20 minutes out of 60, or 1/3of the time.

These three cases cover the various condi-tional events. We can thus compute theprobability of meeting as:

Pr(meeting) = Pr(Case 1) * Pr(meetingin Case 1) + Pr(Case 2) * Pr(meeting in

452/488

Page 453: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Case 2) + Pr(Case 3) * Pr(meeting inCase 3)

Pr(meeting) = (1/6)(1/4) + (2/3)(1/3) +(1/6)(1/4) = 11/36

Again, we arrive at the same solution of 11/36.

Method 3: Combinatorics

This is a solution I came upon when I wasconsidering the practical implications of thegeometric solution above.

I loved how elegant the geometric solutionwas, but the fact that time had to be continu-ous was something odd to me. I mean it ispossible to show up at 12:33 and 1.14159seconds, but who keeps track of time that ac-curately? And would you really be able toleave exactly 10 minutes later at 12:43 with1.14159 seconds?

453/488

Page 454: Math puzzles: classic riddles in counting, geometry, probability, and game theory

No, in the real world we are going to do somerounding, probably to the level of minutes.

So I set up a combinatorial problem as fol-lows. Suppose each player can pick one ofthe minutes to arrive randomly from 0, 1, 2,…, 60, and each person waits 10 minutes forthe other person. What is the chance theywill meet then?

This is a discrete version of the continuousgeometric problem, so let’s solve it.

Solution to discrete problem in minutes

We can proceed simply by counting the num-ber of pairs (x, y) such that |x – y| ≤ 10 as inthe continuous case.

For simplicity, let’s consider the perspectiveof the person showing up first and count thenumber of integers the other person can

454/488

Page 455: Math puzzles: classic riddles in counting, geometry, probability, and game theory

arrive after. This will count half the cases,and we can double the result to count allcases.

–If the first person picks 0, then the per-son arriving second can pick times 0, 1,2, …, 10–there are 11 times correspond-ing to 0

–If one person picks 1, then the personarriving second can pick times 1, 2, …,11–there are 11 times corresponding to 1

–If the first person picks anything from2 to 50, there will be 11 possible timesfor the person arriving second

–If the first person picks 51, the personarriving second can pick 51, 52, … 60, or10 cases

455/488

Page 456: Math puzzles: classic riddles in counting, geometry, probability, and game theory

–If the first person picks 52, the personarriving second can pick 52, 53, …, 60,or 9 cases

–This pattern will continue so we have53 having 8 cases, 54 having 7 cases andso on.

To summarize, for the person arriving first,there are this many ways for the person ar-riving second to choose:

–For the numbers 0 to 50, there will be11 cases

–For the numbers 51 to 60, there will be10, 9, 8, 7, …. 1 cases, respectively

We need to double this to find the total num-ber of winning pairs. Thus we have:

Number of times friends meet = 2[ (50)(11) +10 + 9 + 8 + ... + 1] = 2(616) = 1,232

456/488

Page 457: Math puzzles: classic riddles in counting, geometry, probability, and game theory

This has to be divided by the total number ofpairs. As each person can pick among 61numbers, the total number of pairs is 61 x 61= 3,721.

Thus the probability the friends meet in thediscrete case is 33.1 percent = 1,232 / 3721.

This is actually pretty close to the continuouscase. Could there be a relation between thetwo problems?

Solution to discrete problem in arbitraryinterval

I got to thinking, what would happen if weinstead split up the interval into finer points,like into seconds or so on?

I did the calculation for seconds, and I willspare you the details, but it ends up atroughly 30.6 percent. This is very, very closeto the answer of the continuous model.

457/488

Page 458: Math puzzles: classic riddles in counting, geometry, probability, and game theory

What would happen if the interval was di-vided into N pieces? And what would happenif we let N go to infinity?

If the interval was divided up as 0, 1, 2, … ,N, then we need to remember that 10minutes corresponds to 1/6 of the total time,which means it will translate into (1/6) N in-tervals (for simplicity, let N be a multiple of6).

Using the same logic as in the discrete caseof minutes, we can count the number of waysthe person arriving second could meet theperson arriving first. It is:

–For the numbers 0 to (5/6)N, therewill be (1 + (1/6)N) integers of times forthe person arriving second so they meet

–For the numbers (5/6)N + 1 to N, therewill be (1/6)N, (1/6)N – 1, …. 1 times,respectively

458/488

Page 459: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Again, we need to double this number to ac-count for the symmetric case. This means wehave in all:

We need to divide this by the total number of

cases which is (N+1)2 = N2+ 2N + 1. So thelimiting case is:

When we take the limit as N goes to infinitythis is 11/36, just as in the continuous case!

For some people it will just seem “obvious”that the discrete problem converges in limitto the continuous problem.

459/488

Page 460: Math puzzles: classic riddles in counting, geometry, probability, and game theory

But anyone who has studied financial modelsknows that discrete versions are not thesame and may not converge to the same ascontinuous models.

So this is an interesting result, and it’s amaz-ing how many different ways this puzzle canbe solved.

460/488

Page 461: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 20: Finding the rightnumber of bidders

Alice wants to auction off a rare collector’sitem. She knows the item is worth some-where between $500 and $1,000, but shehas had trouble finding interested buyers.

A company offers to find interested parti-cipants at the rate of $10 per bidder. (Sothey’ll find one bidder for $10, and ten bid-ders for $100)

How many bidders should Alice tell the com-pany to find?

A couple of points:

–Assume the bidders have valuationsrandomly drawn from the uniform dis-tribution on [500,1000]

Page 462: Math puzzles: classic riddles in counting, geometry, probability, and game theory

–Suppose Alice holds an eBay style auc-tion and she will sell the item for a priceequal to the second highest valuation ofthe bidders*

(*this is a standard result in auction the-ory, though technically it’s for one bidabove the second highest valuation. Anexample: if bidders had valuations of$500, $600, and $700, the person whovalues the item at $700 would win theauction. The price he would pay in aneBay style auction with dollar bid incre-ments is $601–just enough to outbid theperson with the second highestvaluation)

The puzzle is about two conflicting forces:Alice wants more bidders to bring her higherbids, but she faces a tradeoff in the cost ofacquiring bidders.

462/488

Page 463: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Can you figure out the optimal number ofbidders?

463/488

Page 464: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 20: Findingthe right number of bidders

Alice wants to maximize her expected auc-tion profits. The equation for profits for nbidders is something like this:

Profit(n)= E(revenue n) – Cost(n)

The cost part is easy to figure out. Alice pays$10 per bidder, so her cost is 10n.

The harder part is figuring out the expectedrevenue for n bidders. What we want toknow is the following. If we take n drawsfrom a uniform distribution, what is the ex-pected value of the second-highest draw?

This question is actually part of a larger topicin probability called order statistics. One canexplicitly solve for the expected value of anydistribution.

Page 465: Math puzzles: classic riddles in counting, geometry, probability, and game theory

I will not go through the math here. But Iwill mention the order statistics for the uni-form distribution are easy to visualize. Whathappens is that if you take n draws from theuniform distribution, the expected value ofthe n draws can be visualized as n points be-ing evenly spaced on the interval.

Here is a picture to illustrate what I mean:

465/488

Page 466: Math puzzles: classic riddles in counting, geometry, probability, and game theory

So the n points separate themselves alongthe interval. So you divide the interval into n+ 1 segments, and the points will be at the

466/488

Page 467: Math puzzles: classic riddles in counting, geometry, probability, and game theory

fractions 1/(n + 1) along the way for the min-imum, then 2/(n + 1) along the way for thesecond lowest point, etc., until the maximumdraw which has an expected value of n/(n +1).

By this logic, the second highest draw is ex-pected to be at (n – 1)/(n + 1) along the wayfrom 500 to 1000. This means the secondhighest valuation is expected to be:

500 + 500 * (n – 1)/(n + 1)

This is our formula for expected revenue. Sowe can substitute this expression back intothe formula for profits:

Profit(n)= E(revenue n) – Cost(n)Profit(n) = 500 + 500 * (n – 1)/(n + 1) –10n

467/488

Page 468: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Now we need to solve for the profit maximiz-ing point. I will skip the calculus and get tothe point.

The profit maximizing point happens at n =9 bidders, and Alice can expect $810 ofprofit.

The lesson is that more bidders is not alwaysoptimal: you capture much of the expectedrevenue from the first few bidders, and thenthe returns are diminishing (unless somebidder is a big outlier and you can extractmoney from him).

Extension: suppose Alice earned thehighest valuation

As an extension, let’s imagine that Alicesomehow was able to extract the highest bid-der to pay his entire valuation. This is not anassumption used in theory, but let’s say it

468/488

Page 469: Math puzzles: classic riddles in counting, geometry, probability, and game theory

happens because of some irrational biddingwar.

In that case, Alice would expect to earnslightly more revenue (the term (n – 1)/(n +1) becomes n/(n+1)), meaning her profitfunction is:

Profit(n) = 500 + 500 * n/(n + 1) – 10n

How will that change the number of bidders?

We can solve for the profit maximizing pointand find that n = 6.

So Alice will only need to acquire 6 bidders,but she will earn nearly $870. This is 3 fewerbidders than above and she gets about $60more.

This is, of course, exactly what we would ex-pect: if Alice can extract more money fromthe bidders–the highest valuation instead of

469/488

Page 470: Math puzzles: classic riddles in counting, geometry, probability, and game theory

the second–she does not need as many bid-ders and in this case she can earn moreprofits.

This is common sense, but it’s useful tocheck the theory matches intuition.

470/488

Page 471: Math puzzles: classic riddles in counting, geometry, probability, and game theory

More puzzles!

If you liked these puzzles, you will definitelylike to read my blog Mind Your Decisionswhere I post a new math puzzle everyMonday.

Page 472: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Table of Contents

Section 1: Counting and geometry problemsSection 2: Probability problemsSection 3: Strategy and game theory

problemsSection 1: Counting and geometry problemsPuzzle 1: Ants on a TriangleAnswer to Puzzle 1: Ants on a TrianglePuzzle 2: Three brick problemAnswer to Puzzle 2: Three brick problemPuzzle 3: World's best tortilla problemAnswer to Puzzle 3: World's best tortilla

problemPuzzle 4: Slicing up a pieAnswer to Puzzle 4: Slicing a piePuzzle 5: Measuring ball bearingsAnswer to Puzzle 5: Measuring ball bearingsPuzzle 6: Paying an employee in goldAnswer to Puzzle 6: Paying an employee in

goldPuzzle 7: Leaving work quickly

Page 473: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 7: Leaving work quicklyPuzzle 8: Science experimentAnswer to Puzzle 8: Science experimentPuzzle 9: Elevator malfunctioningAnswer to Puzzle 9: Elevator malfunctioningPuzzle 10: Ants and honeyAnswer to Puzzle 10: Ants and honeyPuzzle 11: Camel and bananasAnswer to Puzzle 11: Camel and bananasPuzzle 12: Coin tossing carnival gameAnswer to Puzzle 12: Carnival coin tossing

gamePuzzle 13: Rope around Earth puzzleAnswer to Puzzle 13: Rope around Earth

puzzlePuzzle 14: Dividing a rectangular piece of

landAnswer to Puzzle 14: Dividing a rectangular

piece of landPuzzle 15: Dividing land between four sonsAnswer to Puzzle 15: Dividing land between

four sons

473/488

Page 474: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 16: Moat crossing problemAnswer to Puzzle 16: Moat crossing problemPuzzle 17: Mischievous childAnswer to Puzzle 17: Mischievous childPuzzle 18: Table seating orderAnswer to Puzzle 18: Table seating orderPuzzle 19: Dart gameAnswer to Puzzle 19: Dart gamePuzzle 20: Train fly problemAnswer to Puzzle 20: Train fly problemPuzzle 21: Train station pickupAnswer to Puzzle 21: Train station pickupPuzzle 22: Random size confettiAnswer to Puzzle 22: Random confettiPuzzle 23: Hands on a clockAnswer to Puzzle 23: Hands on a clockPuzzle 24: String cutting problemAnswer to Puzzle 24: String cutting problemPuzzle 25: One mile South, one mile East,

one mile NorthAnswer to Puzzle 25: One mile South, one

mile East, one mile North

474/488

Page 475: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Section 2: Probability problemsPuzzle 1: Making a fair coin tossAnswer to Puzzle 1: Making a fair coin tossPuzzle 2: iPhone passwordsAnswer to Puzzle 2: iPhone passwordsPuzzle 3: Lady Tasting TeaAnswer to Puzzle 3: Lady Tasting TeaPuzzle 4: Decision by committeeAnswer to Puzzle 4: Decision by committeePuzzle 5: Sums on diceAnswer to Puzzle 5: Sums on dicePuzzle 6: St. Petersburg paradoxAnswer to Puzzle 6: St. Petersburg paradoxPuzzle 7: Odds of a comeback victoryAnswer to Puzzle 7: Odds of a comeback

victoryPuzzle 8: Free throw gameAnswer to Puzzle 8: Free throw gamePuzzle 9: Video rouletteAnswer to Puzzle 9: Video roulettePuzzle 10: How often does it rain?Answer to Puzzle 10: How often does it rain?

475/488

Page 476: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 11: Ping pong probabilityAnswer to Puzzle 11: Ping pong probabilityPuzzle 12: How long to heaven?Answer to Puzzle 12: How long to heaven?Puzzle 13: Odds of a bad passwordAnswer to Puzzle 13: Odds of a bad passwordPuzzle 14: Russian rouletteAnswer to Puzzle 14: Russian roulettePuzzle 15: Cards in the darkAnswer to Puzzle 15: Cards in the DarkPuzzle 16: Birthday line probabilityAnswer to Puzzle 16: Birthday line

probabilityPuzzle 17: Dealing to the first ace in pokerAnswer to Puzzle 17: Dealing to the first ace

in pokerPuzzle 18: Dice brain teaserAnswer to Puzzle 18: Dice brain teaserPuzzle 19: Secret Santa mathAnswer to Puzzle 19: Secret Santa mathPuzzle 20: Coin flipping gameAnswer to Puzzle 20: Coin flipping game

476/488

Page 477: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 21: Flip until headsAnswer to Puzzle 21: Flip until headsPuzzle 22: Broken sticks puzzleAnswer to Puzzle 22: Broken sticks puzzlePuzzle 23: Finding true loveAnswer to Puzzle 23: Finding true lovePuzzle 24: Shoestring problemAnswer to Puzzle 24: Shoestring problemPuzzle 25: Christmas trinketsAnswer to Puzzle 25: Christmas trinketsSection 3: Strategy and game theory

problemsPuzzle 1: Bar coaster gameAnswer to Puzzle 1: Bar coaster gamePuzzle 2: Bob is trappedAnswer to Puzzle 2: Bob is trappedPuzzle 3: Winning at chessAnswer to Puzzle 3: Winning at chessPuzzle 4: Math dodgeballAnswer to Puzzle 4: Math dodgeballPuzzle 5: Determinant gameAnswer to Puzzle 5: Determinant game

477/488

Page 478: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 6: Average salaryAnswer to Puzzle 6: Average salaryPuzzle 7: Pirate gameAnswer to Puzzle 7: Pirate gamePuzzle 8: Race to 1 millionAnswer to Puzzle 8: Race to 1 millionPuzzle 9: Shoot your mateAnswer to Puzzle 9: Shoot your matePuzzle 10: When to fire in a duelAnswer to Puzzle 10: When to fire in a duelPuzzle 11: Cannibal game theoryAnswer to Puzzle 11: Cannibal game theoryPuzzle 12: Dollar auction gameAnswer to Puzzle 12: Dollar auction gamePuzzle 13: Bottle imp paradoxAnswer to Puzzle 13: Bottle imp paradoxPuzzle 14: Guess the numberAnswer to Puzzle 14: Guess the numberPuzzle 15: Guess 2/3 of the averageAnswer to Puzzle 15: Guess 2/3 of the

averagePuzzle 16: Number elimination game

478/488

Page 480: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Table of Contents

Section 1: Counting and geometry problemsSection 2: Probability problemsSection 3: Strategy and game theory

problemsSection 1: Counting and geometry problemsPuzzle 1: Ants on a TriangleAnswer to Puzzle 1: Ants on a TrianglePuzzle 2: Three brick problemAnswer to Puzzle 2: Three brick problemPuzzle 3: World's best tortilla problemAnswer to Puzzle 3: World's best tortilla

problemPuzzle 4: Slicing up a pieAnswer to Puzzle 4: Slicing a piePuzzle 5: Measuring ball bearingsAnswer to Puzzle 5: Measuring ball bearingsPuzzle 6: Paying an employee in goldAnswer to Puzzle 6: Paying an employee in

goldPuzzle 7: Leaving work quickly

Page 481: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Answer to Puzzle 7: Leaving work quicklyPuzzle 8: Science experimentAnswer to Puzzle 8: Science experimentPuzzle 9: Elevator malfunctioningAnswer to Puzzle 9: Elevator malfunctioningPuzzle 10: Ants and honeyAnswer to Puzzle 10: Ants and honeyPuzzle 11: Camel and bananasAnswer to Puzzle 11: Camel and bananasPuzzle 12: Coin tossing carnival gameAnswer to Puzzle 12: Carnival coin tossing

gamePuzzle 13: Rope around Earth puzzleAnswer to Puzzle 13: Rope around Earth

puzzlePuzzle 14: Dividing a rectangular piece of

landAnswer to Puzzle 14: Dividing a rectangular

piece of landPuzzle 15: Dividing land between four sonsAnswer to Puzzle 15: Dividing land between

four sons

481/488

Page 482: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 16: Moat crossing problemAnswer to Puzzle 16: Moat crossing problemPuzzle 17: Mischievous childAnswer to Puzzle 17: Mischievous childPuzzle 18: Table seating orderAnswer to Puzzle 18: Table seating orderPuzzle 19: Dart gameAnswer to Puzzle 19: Dart gamePuzzle 20: Train fly problemAnswer to Puzzle 20: Train fly problemPuzzle 21: Train station pickupAnswer to Puzzle 21: Train station pickupPuzzle 22: Random size confettiAnswer to Puzzle 22: Random confettiPuzzle 23: Hands on a clockAnswer to Puzzle 23: Hands on a clockPuzzle 24: String cutting problemAnswer to Puzzle 24: String cutting problemPuzzle 25: One mile South, one mile East,

one mile NorthAnswer to Puzzle 25: One mile South, one

mile East, one mile North

482/488

Page 483: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Section 2: Probability problemsPuzzle 1: Making a fair coin tossAnswer to Puzzle 1: Making a fair coin tossPuzzle 2: iPhone passwordsAnswer to Puzzle 2: iPhone passwordsPuzzle 3: Lady Tasting TeaAnswer to Puzzle 3: Lady Tasting TeaPuzzle 4: Decision by committeeAnswer to Puzzle 4: Decision by committeePuzzle 5: Sums on diceAnswer to Puzzle 5: Sums on dicePuzzle 6: St. Petersburg paradoxAnswer to Puzzle 6: St. Petersburg paradoxPuzzle 7: Odds of a comeback victoryAnswer to Puzzle 7: Odds of a comeback

victoryPuzzle 8: Free throw gameAnswer to Puzzle 8: Free throw gamePuzzle 9: Video rouletteAnswer to Puzzle 9: Video roulettePuzzle 10: How often does it rain?Answer to Puzzle 10: How often does it rain?

483/488

Page 484: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 11: Ping pong probabilityAnswer to Puzzle 11: Ping pong probabilityPuzzle 12: How long to heaven?Answer to Puzzle 12: How long to heaven?Puzzle 13: Odds of a bad passwordAnswer to Puzzle 13: Odds of a bad passwordPuzzle 14: Russian rouletteAnswer to Puzzle 14: Russian roulettePuzzle 15: Cards in the darkAnswer to Puzzle 15: Cards in the DarkPuzzle 16: Birthday line probabilityAnswer to Puzzle 16: Birthday line

probabilityPuzzle 17: Dealing to the first ace in pokerAnswer to Puzzle 17: Dealing to the first ace

in pokerPuzzle 18: Dice brain teaserAnswer to Puzzle 18: Dice brain teaserPuzzle 19: Secret Santa mathAnswer to Puzzle 19: Secret Santa mathPuzzle 20: Coin flipping gameAnswer to Puzzle 20: Coin flipping game

484/488

Page 485: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 21: Flip until headsAnswer to Puzzle 21: Flip until headsPuzzle 22: Broken sticks puzzleAnswer to Puzzle 22: Broken sticks puzzlePuzzle 23: Finding true loveAnswer to Puzzle 23: Finding true lovePuzzle 24: Shoestring problemAnswer to Puzzle 24: Shoestring problemPuzzle 25: Christmas trinketsAnswer to Puzzle 25: Christmas trinketsSection 3: Strategy and game theory

problemsPuzzle 1: Bar coaster gameAnswer to Puzzle 1: Bar coaster gamePuzzle 2: Bob is trappedAnswer to Puzzle 2: Bob is trappedPuzzle 3: Winning at chessAnswer to Puzzle 3: Winning at chessPuzzle 4: Math dodgeballAnswer to Puzzle 4: Math dodgeballPuzzle 5: Determinant gameAnswer to Puzzle 5: Determinant game

485/488

Page 486: Math puzzles: classic riddles in counting, geometry, probability, and game theory

Puzzle 6: Average salaryAnswer to Puzzle 6: Average salaryPuzzle 7: Pirate gameAnswer to Puzzle 7: Pirate gamePuzzle 8: Race to 1 millionAnswer to Puzzle 8: Race to 1 millionPuzzle 9: Shoot your mateAnswer to Puzzle 9: Shoot your matePuzzle 10: When to fire in a duelAnswer to Puzzle 10: When to fire in a duelPuzzle 11: Cannibal game theoryAnswer to Puzzle 11: Cannibal game theoryPuzzle 12: Dollar auction gameAnswer to Puzzle 12: Dollar auction gamePuzzle 13: Bottle imp paradoxAnswer to Puzzle 13: Bottle imp paradoxPuzzle 14: Guess the numberAnswer to Puzzle 14: Guess the numberPuzzle 15: Guess 2/3 of the averageAnswer to Puzzle 15: Guess 2/3 of the

averagePuzzle 16: Number elimination game

486/488

Page 488: Math puzzles: classic riddles in counting, geometry, probability, and game theory

@Created by PDF to ePub