These problems are aimed at junior high and high school students
with a flare for mathematics and logic.
TakeLessons math
tutors can help students solve these and other problems
that they may encounter in school, work, or recreational settings.
These are "real world" problems,
rather than abstract riddles about sets or trigonometry etc.
The questions should be accessible to a wide audience, even if the answers are not.
When you find a question that interests you,
it's tempting to just read the answer at the end of this web page,
but please don't 
that would spoil the fun.
Instead, think about the problem in your spare time for a few days.
Talk about it with your friends.
Then, if you're really not getting anywhere, or you think you've got the answer,
come back and read the answer.
Educators might want to present the problem on Friday,
let the students think about it over the weekend, and talk about it on Monday.

A school has 1,000 students and 1,000 lockers, all in a row.
They all start out closed.
The first student walks down the line and opens each one.
The second student closes the even numbered lockers.
The third student approaches every third locker and changes its state.
If it was open he closes it; if it was closed he opens it.
The fourth student does the same to every fourth locker, and so on through
1,000 students.
To illustrate, the tenth locker is opened by the first student,
closed by the second, reopened by the fifth, and then closed by the tenth.
All the other students pass by the tenth locker, so it winds up being closed.
How many lockers are open?

A checkerboard is missing two of its squares.
The lower left square and the upper right square are gone.
That leaves 62 squares on the board.
You are given 31 dominoes.
Each domino is a rectangle that can cover exactly two squares on the checkerboard.
Can you place all 31 dominoes on the checkerboard,
so that all 62 squares are covered?

There are six people at a party.
Prove that there are three people in this party who know each other,
or three people who are complete strangers to each other.

Horses cost $10, pigs cost $3, and rabbits are only $0.50.
A farmer buys 100 animals for $100,
How many of each animal did he buy?
There are two correct answers.
There are many variations floating around.
Another one sets horses at $5, pigs at $2, and rabbits at 10 cents a piece.
This configuration has only one answer.

You're on a high bridge one mile long.
In fact you are 3/8 of the way across.
If your life depends on it, you can sprint at 10 miles per hour (mph).
Indeed your life depends on it, because you look behind you and see a train coming.
If you run back to the beginning of the bridge you'll jump out of the way
just in time  just as the train reaches the bridge.
If you keep going across the bridge you'll reach the end of the bridge
just in time, just as the train reaches the end of the bridge.
How fast is the train going?

There are 3 cannibals and 3 missionaries on one side of a river.
They all want to get to the other side.
They must use a small, twoperson row boat.
They can't wade or swim across.
If cannibals ever outnumber missionaries,
on either side of the river, they will eat the missionaries,
and we don't want that.
For instance, if we begin by sending 2 missionaries across,
the remaining missionary will be eaten by the 3 cannibals.
How can all 6 people get across safely?

A toy boat floats in a bathtub full of water.
The boat contains a rock.
A child takes the rock out of the boat and drops it into the water,
whereupon the rock promptly sinks to the bottom of the tub.
Is the water level in the tub higher or lower than when the rock was in the boat?
Or is it the same?

You have a glass of water and a glass of wine.
Take a spoonful of water from the water glass and add it to the wine.
Stir the wine until the water is well mixed throughout.
Now take a spoonful of liquid from the wine glass and pour it back into the water glass.
Is there more water in the wine, or more wine in the water?
Or are the ratios the same?

Arrange the numbers 1 through 9 on a tictactoe board,
so that every row and every column and every diagonal
adds up to the same number.
Show that there is only one way (ignoring rotations and reflections) to do this.

A closed box is 4 feet long, 1 foot wide, and 1 foot high.
A spider sits on one of the square ends, 1 inch from the bottom and 6 inches from either side.
A fly is on the opposite end, 1 inch from the top and 6 inches from either side.
The spider can reach the fly by crawling straight up 11 inches to the top of the box,
then another 48 inches along the top,
then 1 inch down to reach his meal.
The length of this path is 60 inches.
The spider could also crawl down 1 inch,
then 48 inches along the bottom of the box (he doesn't mind the carpeting),
then 11 inches straight up to reach the fly.
This too gives a path of length 60.
But the spider hasn't eaten in weeks, and is exhausted.
He can only crawl for 56 inches.
How should he procede to obtain his fly?

Note, this problem was featured on an episode of Columbo,
though it is older than that.
You see 10 sacks of gold coins, all in a row.
Actually, only one of the sacks contains true gold coins;
the other 9 sacks are counterfeit.
Their coins are gold plated, and look the same, but are almost worthless.
You must identify the sack of pure gold coins.
A pure gold coin weighs 2 ounces, while a gold plated copper coin only weighs 1 ounce.
You have a scale, and are permitted exactly one weighing.
You might take a coin from bag number 7 and weigh it.
If it reads 2 ounces you've found the gold,
but if it reads just 1 ounce,
the gold coins are in one of the other 9 sacks.
How can you find the sack of gold coins with just one weighing?

Compute the sum of the first hundred numbers, 1+2+3+...+98+99+100,
without a calculater, in under three minutes.
In other words, find a shortcut.

A funhouse is a house where every wall is a mirror.
If you shine a flashlight directly into a wall, any wall,
the light beam bounces straight back to you.
If you point your flashlight at an angle, the beam of light bounces all around the house faster than you can imagine.
In fact it probably makes its way into every nook and cranny.
Assume the fun house is closed to the outside world, so that light never leaves the house.
Yet inside, none of the rooms are closed off.
In other words, every room has an open door leading to another room.
The interior forms a connected set.
There is one light bulb in the house.
When it is turned on, does light spread throughout the entire house?
Or is there a small room somewhere that remains in darkness?
If all the walls consist of straight lines,
we're pretty sure the entire house is lit.
Nobody has proved this yet, but that's the way it appears.
However, if some of your walls are curved,
e.g. circular arcs,
then some of the rooms might remain dark.
Construct a fun house with curved walls and a single light bulb,
so that some parts of the house remain dark.
There are many correct answers.

How many ways can you arrange 6 different books,
left to right, on a shelf?

You're standing on the planet Earth,
which we will assume is a perfect sphere.
You walk south 1 mile, east 1 mile, and north 1 mile,
and you wind up exactly where you started.
Where are you?
For extra credit, where else might you be?
There are actually many possible locations;
see if you can describe them all.

Color the entire plane, using 7 different colors,
so that points one inch apart always have different colors.
For instance, if the origin is red, the circle around the origin,
of radius 1, is limited to
orange yellow green blue indigo violet.
If one of the points on the circle is orange,
the two points one inch away on the circle, moving clockwise and counterclockwise,
are limited to
yellow green blue indigo violet.
Continue coloring points, or regions, under these restrictions, until the entire plane is colored.
Seven colors are sufficient; nobody knows if it can be done with 6.
Of course you don't have time to color an infinite plane,
so you'll probably want to establish a repeating pattern.
For instance, you might want to try an arrangement of squares, like an infinite checkerboard.
But the diagonal of the squares must not exceed 1 inch,
else a square could not be colored with one color.
With a diagonal between 0.633 and 1, the 9 squares in a 3 by 3 grid
each contain points one inch away from points in the other 8 squares.
This requires 9 colors.
Maybe smaller squares would lead to a solution,
or maybe you need to develop a complex pattern of irregular shapes with curved boundaries.
See what you can come up with.

You spend most of Wednesday hiking up a hill.
Your ascent begins at 6 AM, and you reach the summit at 6 PM.
Of course you stop to eat lunch and take rests along the way.
The next day, Thursday, you climb back down the hill.
Again, you start down at 6 AM and reach the bottom at 6 PM,
though you don't necessarily take the same path.
Show that there is a time of day,
1:09:43 for example,
and an elevation, 1,453 feet for example,
such that you were precisely that high, at that time, on both Wednesday and Thursday.
You're not going to know exactly when, or how high,
but you can show there is a time that produces the same elevation for both days.

How many numbers from 1 to 1 million are not perfect squares or perfect cubes?
Hint, if you come up with 998,900, you're missing something important.

What is the best possible score in bowling, assuming you never throw a strike?

Consider a traditional clock, with hands that go around the face.
If the two hands point to the same spot on the clock,
between the 3 and the 4, what time is it?

You have a bunch of plain wooden blocks that you would like to paint red and blue.
Every block is a perfect cube, and they are all the same size.
Each side is painted one color, either red or blue,
but different sides of a cube can have different colors.
For instance, there are two possible cubes with 3 red sides and 3 blue sides.
The three red sides could meet at a corner,
or they could wrap around the cube, looking a bit like the letter C.
How many different redblue cubes are there?
For extra credit, how many redblueyellow cubes are there?
When you take advanced combinatorics in college,
you'll discover general formulas for these kinds of problems.
If there are 59 colors, plug 59 into the formula,
and you'll find out how many cubes are possible.

On a map, two regions border each other if they touch at more than just a point.
For instance, Colorado and Arizona do not border each other,
but Colorado and Utah do.
Draw a map of for regions,
where each region borders the other three.
If you wanted to color your fourregion map,
so that each region had its own color,
and neighboring regions did not share the same color,
you would need four colors.
This makes sense, because each region borders the other three.
The United States does not have a group of 4 states that all touch each other,
so maybe you don't need 4 colors for this map.
See if you can color the states with 3 colors,
so that neighboring states always have different colors.
If 3 colors won't do, explain why, and try again with 4.

Is there a fraction x/y that is exactly the square root of 2?

Place a 3 by 3 grid of dots, 9 dots in all,
in the middle of a piece of paper.
Place your pencil on any one of these 9 dots
and draw 4 straight lines,
without lifting your pencil off the paper,
such that every dot has a line drawn through it.

You are in charge of a generator that supplies power to three different cities.
A giant magnet spins within a wire housing,
which is connected to the first city.
The positive terminal is just above the spinning magnet 
at 12:00 so to speak.
Alternating north and south poles of the magnet swing by this terminal,
producing alternating current (AC).
If we measure voltage and time in just the right way,
the first city sees a voltage of sin(t).
The second city is fed from a wire housing that is oriented at an angle to the first 
at 4:00 so to speak.
Its voltage is sin(t120°).
The third city is connected to wires at 8:00 on the spinning magnet.
Its voltage is sin(t240°).
The power consumed, and hence the work done by the generator,
is proportional to the voltage squared.
So the first city is pulling power at a rate of sin(t) squared, sometimes written sin(t)^{2}.
All three cities consume power at the following rate:
sin(t)^{2} + sin(t120°)^{2} + sin(t240°)^{2}
Simplify this expression  the answer may surprise you.

When three squares meet at a corner,
and all corners are indistinguishable (you can't tell one corner from another),
the shape is a cube, with six faces.
When three triangles meet at a corner the shape is a tetrahedron, with four faces.
(The triangles are of course equilateral  we're only dealing with regular polygons here.)
How many faces result when every corner consists of two hexagons and a pentagon?
What goes wrong when we try to build a shape where every corner consists of two pentagons and a hexagon?

Is it possible to construct a threeway coin
that lands on heads, tails, or other, with equal probability?

A mysterious box, contents unknown, might weigh anywhere from one to forty pounds,
though it definitely weighs a whole number of pounds (you don't have to worry about ounces).
You must determine its weight.
Instead of a scale, you are given a pan balance.
Furthermore, this party is byow, bring your own weights.
If you bring a 5 pound weight you can easily determine whether the box weighs 5 pounds.
If you also bring a 7 pound weight you can determine whether the box weighs 12 pounds, and so on.
Now the catch  you can only bring four weights.
Which weights should you bring?
Extend this result to weigh a box that is from 1 to 81 pounds.

Join three unit squares together in a row and place another square above the middle square.
This shape of area 4 is called a tetromino.
Can you cover a 10 by 10 square (area 100) with 25 tetrominoes?

For those of you who are old enough to remember,
this is the Let's Make A Deal problem.
You are presented with three boxes.
Two contain beautiful prizes,
while the third contains a pack of chewing gum, or something equally uninspiring.
You select a box, but before you can open it,
Monty Hall opens another box and shows you a beautiful European vacation.
Oh well, you didn't win that.
"Now," he asks, "do you want to keep the box you've chosen or do you want the third box instead?"
Of course you want the wonderful prize, not the chewing gum.
Should you keep the box you originally selected or switch?
Or is it all the same statistically?

Note, this problem was featured on an episode of Zoon.
Three buckets hold 10 quarts, 7 quarts, and 3 quarts respectively.
The first bucket is full of water, and the second and third are empty.
Since the buckets have no measuring lines on them,
a "transfer" consists of pouring the entire contents of one bucket into another,
or as much as will fit without overflowing.
Find a series of transfers that leaves 5 quarts of water in one of the first two buckets.

Take a traditional Battleship game
and place 25 pegs in the lower left quadrant,
rows F through J and columns 1 through 5.
(If you don't have a Battleship game,
place 25 pennies in the lower left corner of a checkerboard.)
A peg moves by jumping over another peg and landing in an empty hole,
whereupon the jumped peg is removed.
Moves are always vertical or horizontal.
Find a sequence of 20 moves that leaves a peg in row B.
I believe it is impossible to get a peg all the way up to row A,
no matter how many pegs you start with below row E,
though I've never seen a formal proof.

Suppose you are given an infinitely long sequence of real numbers
between 0 and 1.
The first number in the list might be 0.635,
the second 0.1314,
the third 1/7, the fourth sqrt(½),
the fifth π/5, and so on.
Construct a real number that is not on the list.

Mark two points on the x axis, having coordinates +4 and 4.
Mark two points on the y axis, having coordinates +2 and 2.
Connect these four points to form a diamond.
Technically it is a rhombus, but most people would call it a diamond.
This diamond has an area of 16.
What is the area of the largest ellipse that fits inside this diamond?
No  you don't need to use calculus  there's a better way.

If you've done all your cutting and pasting with a mouse,
you might have trouble with this one.
Cut 21 squares from a sheet of stiff cardboard.
The sides of the squares should have the following lengths, in units,
where one unit is approximately 1/8 inch or 3 mm.
Thus the first and largest square is 50 units on a side, or 6 ¼ inches, or 150 mm.
50 42 37 35 33 29 27 25 24 19 18 17 16 15 11 9 8 7 6 4 2
Assemble these 21 squares into a larger square, 112 units on a side.
This is the simplest example of a square that is made up of smaller squares,
such that no two squares are the same size.

Continuing the previous problem,
show that a cube cannot be completely filled with a finite number of smaller cubes,
such that no two cubes are the same size.
Hint, the floor of the cube looks like a square of squares,
as illustrated by the previous problem.
When you look at the smallest cube on the floor, something goes wrong.

Four houses are located at the corners of a square, one mile on a side.
You must connect these houses using a network of wires.
You can connect them to each other directly, or to switching stations inside the square.
The problem is, you only have 2.75 miles of wire.
How can you connect all four houses?
If you connect house A to house B to house C to house D,
¾ of the perimeter,
all the houses are connected,
but that consumes 3 miles of wire.
You will need one or more connecting points inside the square.

Two trains are traveling at 50 miles an hour.
They are 100 miles apart, and headed straight towards each other.
A fly can travel at 70 miles an hour.
He starts at one train and flies towards the other.
When he reaches the second train he turns around and heads back to the first.
He keeps flying back and forth until the trains meet.
How far has the fly traveled?

Mr Spock is captured and put in an alien prison.
There are exactly two exits from his cell, each guarded by an alien with a sword.
One of the guards is instructed to kill Spock if he tries to leave through
his exit; the other guard is instructed to let him go.
One guard is instructed to tell only lies, while the other is to only tell the truth.
Mr Spock is told he can ask exactly one question to one of the guards.
Assuming Spock does not know which guard is which, what should this question
be to ensure him safe passage out of the prison?
He tried the Vulcan mind meld; it didn't work.
The alien brain is incompatible.

Three kids each contribute $10 to purchase a $30 cd player.
(This is in Oregon; no sales tax.)
After they leave, the store owner realizes the item is marked down to $25.
He hands five singles to his clerk and tells him to run out and reimburse the kids.
The clerk catches up with the kids,
but he is less than honest, and besides, you can't divide 5 by 3.
So he gives them 3 dollars and pockets the remaining 2.
Now each kid has paid $9, for a total of $27, and the clerk has 2, making $29.
We started out with $30, what hapened to the last dollar?

Arrange 8 queens on a chess board, so that no two queens attack each other.
(As a warm up, place 4 queens on a 4×4 board.)

You are given 9 lattice points in 3 dimensional space.
A lattice point has integer coordinates.
An example might be x=7 y=3 z=29.
Prove that 2 of these 9 points produce a midpoint (halfway between) with integer coordinates.

Sally has three cubes made of modeling clay.
One was 3 centimeters on a side, one was 4 centimeters on a side, and one was 5 centimeters on a side.
She took the three cubes and smashed them together, then reshaped
the result into one single cube.
How many centimeters on a side is that one single cube?
(It is a full cube, not just the frame of edges.)

On a cold, windy day, ten year old Daniel went on a short walk with
his father and two uncles.
All four wore hats.
Only Daniel's hat was tied on.
A sudden gust of wind blew off the hats of the three adults.
Daniel retrieved the hats, but did not notice the differences among them.
He gave the hats back randomly.
What is the probability that exactly two of the men got their own hat back?

You have three lamps in the bedroom, controlled by 3 switches in the living room.
You can't see the lamps from the living room, and you don't remember which switch controls which circuit.
You are allowed to set the switches any way you like,
and then you may go over to the bedroom to observe the lamps.
You must then determine, from this one experiment, the switch / lamp connections.
These are traditional onoff switches; each one is on or off.
There are then 8 possibilities, as you go over to the bedroom to check out the lamps.
How can you map switches to lamps with just one trial?
Can you extend this result to four switches and four lamps?

What is the area trapped between three pairwise tangent circles in the plane?
In other words, put three pennies on a table and arrange them in a triangle.
Pretend like the radius of each penny is 1.
What is the area of the little 3pointed shape in the middle of the pennies?

Draw a figure in the plane and then stretch a taut rubber band around it.
The band is called the convex hull.
For example, the convex hull around the letter V is a triangle,
with the band closing off the top of the letter V.
The convex hull about X is a rectangle consisting of 4 smaller triangles,
and the convex hull about Y is an isosceles triangle consisting of 3 smaller triangles.
You have one meter of string.
You want to lay it out in the plane so that the convex hull
that surrounds it has the largest area.
You can cut it into pieces if you like, but you have to put the pieces
back together to make a connected set.
In other words, you can't chop it into 4 pieces and spread
them a mile apart to span a square mile.
So what is the best shape?
A straight line has no area  that's no good.
How about two segments that form two legs of a triangle, like the letter V?
Pivot one of the two legs and the best angle will be 90 degrees.
Any other angle gives a smaller altitude and the same base in the formula bh/2.
So 90 degrees it is.
From here some calculus shows the legs should be equal, each half a meter,
giving an area of 1/8.
If you don't know calculus, high school math will do;
write h = 1b and find the top of the parabola b×(1b)/2.
So that's the best we can do with an angle.
Now cross the two segments like the letter X.
As shown above, an angle of 90 degrees is best, like the + sign.
And the two lengths are equal.
This makes 4 small right triangles,
each having area 1/32, so the area is still 1/8.
How about the letter Y?
Make the three segments equal, each having length 1/3, and make the angles 120 degrees.
This spans an equilateral triangle with area sqrt(3)/12 = 0.1443.
That's better than 0.125.
I have come up with an arrangement that gives area 0.1591.
Can you find it, and is there a way to prove it is best?
Or is there something better?

A spider sits at one corner of a cube.
The spider can only travel along edges of the cube.
Think of the cube as a wire skeleton, a framework with no faces and no inside.
There are 12 wires corresponding to the 12 edges of the cube.
How can the spider start at one corner, travel along each edge exactly once, and wind up at another corner?

An idealized pool table is one meter square, with a pocket in each of the four corners.
Tha table is frictionless of course,
and a ball bounces off the side like a mirror,
with the angle of incidence equal to the angle of reflection.
There is one ball, and it is a point, just as the pockets are points.
The ball has to roll perfectly and exactly into a pocket;
if it is off by so much as an angstrum then it bounces off the side and continues on its merry way.
The ball is launched out of the lower left pocket at some prescribed angle.
Will it eventually fall into a pocket,
or can it bounce around the table forever?
Can it travel for an arbitrarily long time, and then fall into a pocket?
Can it fall into the lower left pocket from which it was launched?
The answers to these problems are given below.
If you know of other problems/puzzles that young students would enjoy,
please
send them along.

The n^{th} locker is opened or closed by student number k
precisely when k divides n.
So if student k changes locker n, so does student n/k.
They cancel each other out.
This always holds unless students k and n/k are precisely the same person.
That is, k = n/k.
The lockers that are exact squares will remain open.
These are lockers 1, 4, 9, 16, 25, etc.
How many of these are there in a row of 1,000?
You can go all the way up to 31×31 = 961, hence there are 31 lockers open.

Each domino covers one black square and one white square.
All 31 dominoes must cover 31 black squares and 31 white squares.
However, the modified checkerboard contains 32 black squares and 30 white squares,
or vice versa.
It cannot be covered with 31 dominoes.

Let's try to construct a party that does not have three mutual friends
or three mutual strangers.
Suppose you are one of the six people at the party.
Let's say you know three other people.
We'll call them Alice, Bob, and Carol.
If Alice and Bob also know each other, then we have three people,
you Alice and Bob, who know each other.
We're trying to construct a party where this doesn't happen,
so Alice and Bob don't know each other.
The same holds for Alice and Carol, and Bob and Carol.
Thus the three people that you know, don't know each other,
giving a triangle of strangers.
Now if you only know two people at the party, or one person, or perhaps nobody,
then there are three people at the party who are strangers to you.
Once again we'll call them Alice, Bob, and Carol.
If Alice and Bob don't know each other, we have a triangle of strangers.
So Alice and Bob do know each other, along with Alice and Carol,
and Bob and Carol.
These three form a triangle of friends.
No matter how we arrange things,
there will be three guests who know each other or three guests who are mutual strangers.

First we need to combine the two equations into one.
Let h be the number of horses, p the number of pigs, and r the number of rabbits.
Double the prices, just for a moment, so we can write
20h + 6p + r = 200.
At the same time, h + p + r = 100.
Subtract the second from the first to get 19h + 5p = 100.
Since h and p are integers, this is a Diophantine equation.
There are ways to solve these in general, but in this case we
can just try various values of h, to see if p winds up being a whole number.
For instance, if h = 0, p = 20, and that works.
The farmer buys 20 pigs and 80 rabbits.
The only other combination is 5 horses, 1 pig, and 94 rabbits.

Imagine there are two of you.
One runs forward and one runs backward.
The backwards runner reaches the beginning of the bridge just as the train reaches the bridge.
He has covered 3/8 of a mile.
At the same time the forward runner has covered 3/8 of a mile.
He is now 3/8 + 3/8 = 3/4 of the way across the bridge.
He runs the last quarter mile while the train moves across the entire one mile bridge.
Thus the train is moving four times as fast as the runner.
The train is traveling at 40 mph.

A cannibal and missionary go across, and the missionary comes back.
Two cannibals go across and one comes back.
Two missionaries go across and a missionary and cannibal come back.
Two missionaries go across and the cannibal comes back.
Two cannibals go across and one comes back.
Finally the last two cannibals go across.

In the beginning, the rock caused the water level to rise
by an amount that exactly compensates for the weight of the rock.
In the end the water level is increased by an amount equal to the volume of the rock.
The rock is heavier than water,
so its weight displaces more water than its volume.
The water level is lower after you throw the rock overboard.

At the end, each glass has the same amount of liquid.
If there were more water in the wine than wine in the water,
there would be more water, in the two glasses taken together, than wine.
Yet we started out with equal amounts of water and wine.
Both ratios must be the same.
Here is another way to visualize it.
Put the water (clear) on the left, and the wine (red) on the right.
After the experiment,
suppose the right glass is 8% water, and the left glass is 6% wine.
The total water is94 + 8 or 102%.
But it has to be 100%.
So if 8% of the water has moved to the glass on the right,
then 8% of the wine must have moved from right to left,
so that both glasses have the same amount of liquid.
and it doesn't really matter if you thoroughly mix the spoonful of water into the wine before carrying a spoonful back.
Stir it a lot, or don't stir it at all.
If you happen to scoop the same spoonful of water out of the wine (completely unmixed), and bring it back to the water, the ratios are still the same.

First figure out what the total is.
If each row adds up to t, then all three rows add up to 3t.
Yet this is all the numbers 1 through 9,
hence 3t = 1+2+3+4+5+6+7+8+9 = 45, and t is 15.
Next consider the for lines passing through the middle square.
Taken together, these numbers add up to 4×15 = 60.
Yet this is just the numbers 1 through 9,
where the middle entry is used another 3 times over.
Thus 3 times the middle is 60  45, and the middle square is 5.
Some trial and error reveals the pattern.
2 9 4
7 5 3
6 1 8

suppose you are looking directly at the spider, i.e. at his end of the box.
The spider must travel down and to the right,
then cut across the bottom of the box until he reaches the right edge.
He takes a long diagonal along the right side of the box, until he reaches the top.
He then cuts across the top at an angle,
and crawls down the far side until he reaches the fly.
This seems like a crazy crooked path until you unfold the box.
flip the spider's end down and the fly's end up,
cut open the left side, and lay the whole thing flat.
Now the spider's path becomes a straight line.
It is the hypotenuse of a right triangle with base 24 inches and height 50 inches.
The path length is 55.4 inches, well within the spider's range.

Take 1 coin from the first sack, 2 coins from the second, 3 coins from the third,
and so on up to 10 coins from the tenth sack.
Place them all on the scale and determine the weight of all 55 coins.
If they were all counterfeit, the weight would be 55 ounces.
If the first sack holds gold, one coin will be pure gold,
and the weight will be 55 + 1 = 56 ounces.
If the two coins from the second sack are gold, the weight will be 55 + 2 = 57 ounces.
Similar reasoning holds for the other sacks.
Subtract 55 from the total weight;
This gives the number of the sack that holds the gold coins.

Add the numbers up in a different order:
1+100 + 2+99 + 3+98 + ... + 50+51.
This produces 50 copies of 101, hence 50×101, or 5,050.

Place the light bulb at the center of your picture
and draw a circle of radius 1 around it.
Then draw another circle of radius 2 around the light bulb.
Beams of light leave the bulb, bounce straight back from the inner circle, and return to the bulb.
The outer room, the anulus between the two circles,
remains dark, but that's because it is closed off.
Cut a small door in the inner circle.
Light now streams out through this door,
bounces off the outer circle, and returns to the light bulb.
As long as you're not standing near the doorway, the outer room remains dark.
This is a simple construction in theory, but it is very hard to build in practice.
If a person or object is placed in the inner room,
some of the light bounces off that object and leaves the inner room at a different angle.
This light does not bounce straight back into the inner room.
Instead it bounces away and spreads throughout the anulus.
I like the following solution better,
because you could actually build it in a science museum, and it would work,
even if people were standing inside to watch the action.
Near the bottom of your paper, draw a horizontal line 6 inches long.
Then draw four vertical line segments
2 inches high,
standing up from your horizontal base at 2 inch intervals.
You have built three rooms, each room 2 inches square.
Now draw the top half of an ellipse, joining the two outer walls.
This closes off the house.
Let the two foci of the ellipse be the top end points of the two inner walls.
If a beam of light bounces off the end point of either of these inner walls,
it is actually leaving one focuse of the ellipse.
It bounces off the curve of the ellipes
and returns to the other focus, the other inside wall.
If a beam of light leaves the middle room in any other way,
passing between the two foci,
it bounces off the curve and returns to the middle room.
The left and right rooms remain dark.
Alternatively, place the light in the left room,
and it will bounce over to the right room,
and back again,
leaving the middle room in darkness.
For a great efect, place a red light in the middle room and a green light
in the left room.
Visitors will see either a green world or a red world,
depending on which room they are standing in.

You can place any of 6 books in the leftmost position.
No matter which book you select,
there will be 5 books to choose from as you make your next selection.
Once the second book is in position, there are four books to choose from.
This pattern continues down to the last book  no choice there.
Thus the answer is 6×5×4×3×2×1 = 720.

The simplest answer to this question is the north pole.
The other solutions are all in Antarctica.
Start approximately 1.16 miles north of the south pole,
and walk south for one mile.
You are now about 1/6 of a mile from the south pole.
As you walk east, you trace an exact circle around the south pole,
returning to your original longitude.
Walk north a mile and you're back where you started from.
If you move a little closer to the south pole,
your eastward trek takes you twice around the south pole.
A solution exists for every positive integer n.
Your starting location is 1 + 1/(2πn) miles north of the south pole.

The base cell is a regular hexagon, ½ inch on a side.
Note that the diameter of this hexagon is 1, hence it can be colored with one color.
Tile the entire plane with these hexagons.
As we move along one row of hexagons,
color the cells red orange yellow green blue indigo violet, and repeat.
The row just above this one is colored the same way, but shifted ober,
so that the red hexagon rests above yellow and green.
The row above this is colored the same way, with the same phase shift.
This pattern repeats as successive rows cover the entire plane.
Verify that the closes red hexagons are sqrt(7)/2 = 1.32 inches apart.
Therefore points that are 1 unit apart always have different colors.

Make a graph of height verses time.
Let the x axis run from 6 AM to 6 PM,
and let the y axis run from base to summit.
Using a blue pen, graph height, as a function of time, for Wednesday.
This curve generally rises, though there are flat sections,
when you stopped to eat lunch,
and there may even be a dip here and there, when you step down into a small valley.
Next, using a red pen, draw Thursday's graph.
This starts at the upper left and slopes down to the lower right.
No matter how strange these curves are, they must cross somewhere.
This is the point where your elevation was the same on both days.

There are 1,000 perfect squares between 1 and 1 million.
These are the squares of the first thousand numbers.
Similarly, there are 100 perfect cubes, the cubes of the numbers from 1 to 100.
Subtract squares and cubes from a million to get 998,900.
However, we have subtracted some numbers twice.
Every number that is a perfect sixth power has been subtracted twice,
so add these back in, giving 998,910.

The best possible score in a given frame is 19,
10 for the spare and 9 from the following frame.
This is even true for the tenth frame, which is a bit weird.
Thus the answer is 10×19 = 190.

Consider how much the two hands have moved since 3:00.
Let t be the angle between 12:00 (straight up) and the two hands.
The minute hand moves 12 times as fast as the hour hand,
but the hour hand had a 90° head start.
Thus we write t = 90 + t/12.
This sets t = 1080/11.
Now convert from degrees to minutes.
The minute hand moves 6 degrees per minute,
hence it has been traveling for 180/11 minutes.
The time is 03:16:21.818181…,
or 03:16:22 rounded to the nearest second.
You may also notice that the hands coincide 11 times in a 12 hour period.
Everything is linear, so the time we seek is 12 hours times 3/11, which gives the time shown above.

We already discovered there are 2 cubes with 3 red and 3 blue sides.
Let's see how many cubes have more red sides than blue.
The entire cube could be red, or one side could be blue (that's 2).
If two sides are blue, they could touch or they could be opposite (that's 2 more).
Now we have 4 cubes with more red than blue,
and that means there are 4 cubes with more blue than red.
Add these together and bring in the 2 cubes with equal amounts of red and blue.
There are 10 different cubes.
If we have 3 colors to choose from there are 3 cubes that are all one color,
and 6 cubes that have five faces painted one color and the sixth face another.
If a cube has four faces one color and two faces another,
those two faces could be together or opposite,
and there are 6 ways to assign the colors, giving another 12 cubes.
If the cube has three of one color and three of another,
the samecolor faces could meet at a corner or wrap around the cube,
and there are 3 ways to assign colors, giving another 6 cubes.
Those are all the cubes with two colors;
we must now consider the threeecolor cubes.
If four faces are one color, the two odd colors could be together or apart,
and there are 3 ways to assign the colors, giving another 6 cubes.
Oh well  I'll leave the rest to you.
If you got 57, you did it right.

Draw an inner circle of radius 1 and an outer circle of radius 2.
Then draw 3 lines connecting the inner circle to the outer circle.
This creates four regions, and each touches the other three.
Such a map requires 4 colors.
Actually this can be generalized.
Draw 5 lines connecting the inner and outer circles,
or 7 lines, or 9, or any odd number of lines.
As you walk all the way around the anulus between the two circles,
you step through an odd number of countries, forming a ring.
If you try to color them with just 2 colors,
the countries alternate red blue red blue red blue ...,
but when you get back to start, two red countries run into each other.
Thus you need 3 colors for this ring of countries,
and the country in the middle, the inner circle, requires a fourth color.
In the map of the United States, Nevada is surrounded by a ring of 5 states,
hence the map requires 4 colors.

suppose there is such a fraction.
We may as well reduce it, just as you would turn 6/8 into 3/4.
After this is done, x and y cannot both be even.
Now if x/y is the square root of 2,
Then x×x divided by y×y is exactly 2.
Put another way, x×x = 2×y×y.
This means x is even, so y is odd.
Now x×x is divisible by 4, but 2×y×y is not (since y is odd).
Therefore there is no fraction that is exactly the square root of 2.

If you try to stay entirely within the grid, you'll never make it.
Let's number the dots 1 through 9, like the buttons on a standard telephone.
Start at 7 and draw the first line straight up through 4 and 1, and past 1.
The next line runs down and to the right, through dots 2 and 6,
and on down to the level of the bottom row.
The third line runs left through 9 8 7,
and the fourth line runs up and to the right through 5 and 3.
This is where we get the phrase, "Think outside of the box."

Apply the angle addition formula.
Sin(t120°) is ½ (sin(t) + sqrt(3)×cos(t)).
To simplify notation, let x be the first term and y the second, giving ½ (x+y).
Now sin(t240°) expands into a similar expression, ½ (xy) to be exact.
We have to square these expressions and add them together, giving ¼×2×(x^{2}+y^{2}).
Substitute for x and y to obtain ½ + cos(t)^{2}.
Bring in sin(t)^{2} and the result is ½+1.
The power extracted from the generator is constant, perfectly balanced between the three cities.
If it weren't, the time varying megawatts of power would literally shake the generator to pieces.
This is surely the most useful trig identity of them all.
Large factories are sometimes given "three phase power",
so that the generator remains in balance as they turn on and off their machines.

Break each edge in half, at its midpoint,
whence each vertex accounts for 3 half edges.
Similarly, each vertex accounts for 1 sixth of a hexagon plus a sixth of a hexagon plus a fifth of a pentagon.
In euler's formula, ve+f = 2,
where v is the number of vertices, e the number of edges, and f the number of faces.
Write e = 3v/2, and f = 8v/15.
solve and get v = 60, e = 90, and f = 32.
The pentagons consume all the vertices,
and consume them without overlap,
hence there are 12 pentagons, leaving 20 hexagons.
If you don't feel like building your own paper model,
just pick up a soccer ball.
Every vertex joins two hexagons and a pentagon, and there are 32 faces.
The king of the Archemedian solids, with 92 faces,
Has a pentagon and four triangles at each vertex.
If you try to place two pentagons and a hexagon at each vertex,
just walk around the perimeter of a pentagon.
The shapes alternate pentagon, hexagon, pentagon, hexagon, pentagon, oops 
there's a vertex with three pentagons.
This generalizes to a rule about using oddnumberd gons at vertices.

Yes.
Standard currency is quite thin.
Toss a nickel 100 times; does it ever wind up standing on edge?
Only on the Twilight Zone.
(remember that episode?)
Now imagine stretching that nickel into a long rod with heads at one end and tails at the other.
If you toss this rod high into the air,
it certainly won't land on one of its ends (heads or tails) and stay there,
just as a dropped pencil won't stand up on its eraser.
Somewhere between these two extremes, there is an ideal thickness,
where heads, tails, and edge are equally likely.
In fact you can make a fair coin with equally likely outcomes for any modest value of n.
Start with a regular polygon with n2 sides,
then stretch it to an appropriate thickness,
so that heads and tails are just as likely as any of the n2 sides around the edge.
Determining these thicknesses is quite difficult in practice.
Of course when n = 6 you obtain the standard die (cube).

At first you are tempted to run up the powers of 2.
Weights of 1, 2, 4, and 8 pounds, in various combinations,
can weigh everything from 1 to 15 pounds,
but that's nowhere near 40.
The trick is, some of the weights can sit on the left pan, with the box.
Each weight can be on the left, the right, or not used at all.
This suggests powers of 3.
Using 1 and 3 pound weights, you see immediately how
to measure 1, 3, and 4 pounds.
If the box weighs 2 pounds,
put the 1 pound weight on the left pan with the box,
and the 3 pound weight on the right,
and everything is in balance.
Next, bring in a 9 pound weight and put it on the right.
We already showed we can add a net weight of 1 through 4 to the box,
so if the box weighs anywhere from 5 to 8 pounds,
we'll be able to balance it against the 9 pound weight.
Of course there is no trouble if the box weighs 9 pounds,
and if it weighs anywhere from 10 to 13 pounds,
we achieve balance by adding (net) 1 to 4 pounds to the right.
Now we've covered everything from 1 to 13 pounds,
and the last weight to bring in is 27 pounds.
This lets us weigh everything from 2713 pounds up to 27+13 pounds, or 40 pounds.
An inductive proof shows successive weights should always be powers of 3.
To weigh a box from 1 to 81 pounds, double the weights.
Thus the weights are 2, 6, 18, and 54 pounds.
If the weight of the box is even, you can determine it using the procedure outlined above.
If the weight is odd, the balance will always tip one way or the other.
Determine that the box is heavier than n and lighter than n+2.
For instance, the box might be more than 30 pounds and less than 32 pounds, whence it is 31 pounds.

Overlay a black and white checkerboard onto the 10 by 10 square
and note that there are just as many black squares as white.
Each tetromino, no matter how it is placed,
introduces either an excess or a deficiency of 2 black squares.
The "excess" tetrominoes must equal the "deficient" tetrominoes,
hence there must be an even number of pieces in the puzzle.
We can't tile any rectangle using an odd number of pieces.
The 10 by 10 board is out, as is the 6 by 14 board, and so on.
Similarly, you can't tile the 10 by 10 board with the 1 by 4 tetrominno
(a rectangle of length 4 and width 1).
This time the overlaid checkerboard has larger squares; each square is 2 pixels on a side.
There are 25 such squares.
If the lower left square is white, then there is an extra white square.
However, each piece, no matter how placed, consumes equal amounts of black and white.
It is not possible to cover more white than black;
it is not possible to tile the rectangle.
This is just the beginning of the wonderful world of polyominoes.

You'd think it didn't matter, one box or the other,
but actually you should keep the one you started with.
I could draw you a series of probability trees,
but that really doesn't help explain it.
Instead, let me illustrate by jumping to the extreme.
Monty shows you 500 boxes, you pick one,
and he opens 498, all with beautiful prizes.
That leaves only the one you selected and one other box.
Surely you didn't pick the joke box from the start.
but if you switch, you're definitely going to get the chewing gum.
Keep the one you have!
The math is not as extreme when there are only three boxes,
but the answer is the same.
If you stick with your first choice you'll win 2/3 of the time.
If you switch you'll only win 1/3 of the time.

If the buckets are labeled A B and C, holding 10 7 and 3 quarts respectively, here are the transfers.
A→B B→C C→A B→C C→A B→C A→B B→C

Here are the coordinates of the jumping pegs, in order.
G5 G4 E5 F3 H3 H5 I3 G3 E3 G2 G1 E1 I2 I1 G1 I5 J3 H3 F3 D3

Given the list, write the decimal expansion of a real number r as follows.
The first digit after the decimal point is anything other than 6,
because 6 is the first digit in the first number on the list.
The second digit of r is anything other than 3,
because 3 is the second digit in the second number on the list.
The third digit of r is anything other than 2, and so on.
If r is in position j on the list,
then the j^{th} digit of r must be something other than the j^{th} digit of r.
This is a contradiction.
Actually we need to be a bit careful here,
because some real numbers have two decimal representations.
Suppose you construct r = .3699999999[forever].
That same real number might be on the list, but in the form of .3700000000[forever].
This is easy to fix.
When you select the digits of r, never choose 0 or 9.
Thus r cannot be represented in any other way.
You can construct such an r for any list at all.
Thus there is no list that includes all the real numbers from 0 to 1.
This diagonalization argument shows
there are more real numbers than integers.
Both sets are infinite, but one is a larger flavor of infinity than the other.
There are infinitely many flavors of infinity, and even more beyond those.

Slide the left and right points of the diamond towards the origin,
shrinking the diamond along its horizontal dimension.
Stop when the left and right points have coordinates +2 and 2, just like the top and bottom points.
Now our diamond has become a square, standing on one corner.
Any ellipse that was drawn inside the diamond becomes an ellipse inside the square,
and its area has been reduced by half.
The largest ellipse that fits inside a square is a perfect circle.
In this case its radius is the square root of 2,
hence the area of the circle is 2π.
Now stretch the square back out into a diamond,
and the circle becomes the largest possible inscribed ellipse,
having an area of 4π.

Arrange the puzzle so that its lower left corner is at the origin.
For each of the 21 squares, I will give its length
and the coordinates of its lower left corner.
The big square, 50 units on a side, is at the lower left,
hence its lower left corner is at 0,0.
50@0,0
29@0,50
33@0,79
25@29,50
4@29,75
37@33,75
42@70,70
16@54,59
35@50,0
27@85,0
8@85,27
19@93,27
15@50,35
9@54,50
2@63,50
24@88,46
6@82,46
11@82,35
18@70,52
17@65,35
7@63,52.
My grandfather made this puzzle for me out of wood, using his jigsaw.
I enjoy it to this day.

Consider the smallest square in a square of squares.
If this smallest square is by an edge,
three larger squares surround it 
and one of these larger squares extends past the edge of the puzzle.
Similarly the smallest square cannot be in a corner,
else one of the two squares surrounding it extends beyond the puzzle.
The smallest square has to be in the interior.
If a large cube consists of smaller cubes, all of them different sizes,
then the floor of the cube is a square made up of smaller squares, all of them different.
Focus on the smallest square on the floor 
the smallest cube in the bottom layer.
It must be in the interior, not next to a wall.
It is completely surrounded by larger cubes 
cubes that rise higher than the smallest cube.
The top of this cube is an enclosed square that must be tiled
with a layer of even smaller cubes.
The smallest cube in this layer is somewhere in the interior,
and the top of this smallest cube must be tiled with yet another layer of even smaller cubes.
This continues forever,
hence a cube cannot be built from a finite number of smaller distinct cubes.

Your first impulse is to place a connect point in the center,
and connect all four houses to that.
However that consumes 2 diagonals, or 2 times the square root of 2, or 2.828 miles of wire.
This is still too much.
Connection points that reduce edge lengths are called steiner points,
and they always have three lines coming into them (not four),
and the angles are always 120°.
Place two steiner points halfway up the square,
approximately 0.288 miles from the left and right sides.
Connect the left point to the left houses and the right point to the right houses;
then connect them to each other.
The angles are all 120°,
and you only need 1 + sqrt(3), or 2.732 miles of wire.

It's tempting to solve this by constructing a geometric series,
but there's an easier way.
The trains collide in one hour, and in an hour the fly travels 70 miles.
That's it.

"Would you have to disobey orders,
if you told me I could pass through your exit unharmed?"
Try all the combinations, you'll see that it works.

There is no need to add $27 and $2, since the $2 is part of the $27.
In fact, the clerk has $2 and the store owner has $25, which makes $27, so it all works out.

Place the queens in the following squares, using algebraic notation.
A4 B7 C5 D2 E6 F1 G3 H8

Look at any one of the 9 points.
Its integer coordinates are even or odd.
So there are 8 combinations, as x y and z are even or odd.
Since there are 9 points, and 8 combinations, one of the combinations repeats.
Perhaps x is even and y and z are odd for the points A and B.
The midpoint of A and B is (A+B)/2,
and for all three coordinates, the result is a whole integer.

6 centimeters on a side.
It's an easy calculation; I include it because it's interesting that the sum of 3 consecutive cubes is another cube.
There are formulas out there for the sum of consecutive cubes being another cube.

Zero.
If 2 ment have their hats back, then the third must have his hat back as well.

Leave all the switches off for an hour.
Turn the first switch on and wait an hour.
Turn the second switch on and run over to the bedroom.
The first switch controls the hot lamp,
the second switch controls the lamp that is on but still cool,
and the third switch controls the lamp that is dark.
This was a great problem 20 years ago, before cfl bulbs,
which don't really get that hot.
I'm not sure if a modern bulb gets warm enough for this approach to work.
Probably it does, but not as pronounced.
Four lamps and switches are easily accommodated.
Leave switches 1 and 2 on for an hour,
turn switch 2 off and turn switch 3 on, then run to the bedroom.
The lamps will be on and hot, off and hot, on and cold, and off and cold, respectively.

This is one of those problems that is really hard if you try to use calculus,
but is quite easy with some high school geometry.
Draw the triangle determined by the centers of the pennies.
This has area sqrt(3).
Within the triangle, the pennies consume three wedges, each 60 degrees of arc.
This is an area of π/2,
hence the space between has area sqrt(3)π/2, or 0.161.

Don't use V W X Y or Z as your model, use the letter C.
Make it a perfect semicircle with radius 1/π,
and the enclosed area is 1/(2π).
I believe this is best, but a formal proof is beyond the scope of this article.
What about 3 dimensions?
The convex hull is created by stretching shrink wrap around the shape.
What is the largest volume?
Connect 3 segments of length 1/3 at the corner of a cube.
The shape is a right simplex with volume 1/(27×6).
Connect 4 sticks at a central point, like a methane molecule.
Use some geometry to find the volume of this shape.
For the moment, let the edge of a tetrahedron have length 1.
The base is an equilateral triangle.
The distance from its corner to its center is sqrt(1/3).
The altitude has height sqrt(2/3).
The volume is bh/3 = sqrt(2)/12.
The distance from the center of the tetrahedron to any of its 4 corners is sqrt(6)/4.
The total length of the 4 sticks, from center to corners, is sqrt(6).
Scale the shape so that this length is 1.
This divides volume by sqrt(6) cubed, giving
sqrt(3)/216 = 0.00801.
this is clearly better than 1/162.
Draw a semicircle in the plane and stand a goal post up at one end.
for completeness, draw in the other half of the circle.
The convex hull is determined by lines joining the top of the post to all the points around the circle.
I want to convince you that this is really the same as the cone with the post in the middle.
Let the top of the post be the origin, pointing up the z axis.
A linear transformation fixes the xy plane, and slides each plane above and below
to the left and right proportionally, according to the z coordinate.
Our circle slides over, and the goal post stands on the edge where it belongs.
This linear transformation maps lines to lines, and the transformed cone becomes our convex hull.
Thus the volume is the area of our semicircle times height divided by 3.
This is maximized when the semicircle has length 2/3 and the post has height 1/3.
The volume is 2/(81×π), or 0.00785.
This is surprising; I really thought it would come out better than the tetrahedron.
The same cone argument applies if we put the goal post anywhere along the semicircle.
Erect two goal posts at the ends of the semicircle.
At each level, the cross section starts at one post, travels a quarter circle,
moves in a straight line towards the other post, and runs a quarter circle to that post.
Combine the quarter circles and find the volume of the cone shown above.
This is πr^{2}h/6.
Then add the wedge, which is r^{2}h/3.
The best solution has r = 2/(3π) and h = 1/6,
giving a sad0.00643.
Join 3 quarter circles together at a point, with angles of 120 degrees,
so that they cradle a hemisphere.
Of course the convex hull is not a hemisphere;
each cross section is an inscribed equilateral triangle, rather than a circle.
Adjust the volume of the hemisphere by this ratio and get
4×sqrt(3) over 27π^{3} = 0.00827.
This is the best I have come up with so far.
I haven't had time to pursue this problem further, but it is fascinating.

He can't.
Such a path is called an Eulerian trail, after Leonhard Euler,
an eighteenth century mathematician.
When the spider passes through a node, or in this case a corner,
he consumes two edges,
the incoming edge and the outgoing edge.
If he passes through this point again another two edges are consumed.
Therefore each point has to have an even number of edges, except perhaps his start and end points.
If he wants to return to start, then every point has to have an even number of edges.
However, each corner of the cube has three edges incident to it; that's no good.
The octahedron, with four edges at each corner,
12 edges and 6 corners altogether, works perfectly.
Find a path such that the spider starts at the top, travels along every edge exactly once,
and returns to the top.

Let the pool table be the unit square in the xy plane,
with x running from 0 to 1 and y running from 0 to 1.
As a warmup, launch the ball out of the origin with slope 1/3.
It hits the right side of the table at the coordinates x = 1 and y = 1/3.
Then the ball bounces back, traveling to the left along a line whose slope is 1/3,
but instead, let the ball break through the right side and into a reflected copy of the pool table.
It is a mirror image of the original, reflected through the vertical line x = 1.
Now the ball can continue on its original trajectory with slope 1/3.
When x = 2, the ball hits the right side of the reflected pool table, which is the left side of the original pool table.
Instead of bouncing back, push the ball through into a third copy of the pool table,
which is a reflection of the second, and a direct copy of the first.
The ball continues on with slope 1/3 until it reaches the point x = 3 and y = 1.
This is a pocket in our pool table.
Returning to the original square, the ball launches out of the lower left corner,
bounces off the right wall, bounces off the left wall,
and lands in the upper right pocket.
Cover the plane with direct and reflected copies of the pool table, forming a checkerboard;
then launch the ball with slope p/q, where p and q are relatively prime.
Let the ball travle on in a straight line in the first quadrant,
corresponding to the ball bouncing around in the original pool table.
It lands in a pocket with integer coordinate x iff xp/q is an integer, iff x is a multiple of q.
If x is kq then the coordinates are kq and kp.
But the ball falls into the pocket at the first opportunity, so set k = 1 and the point is q,p.
Since q and p can be as large as you like, the ball can travel for as long as you like.
In the simplest example, the slope is 1/q, almost horizontal,
and the ball bounces back and forth across the table, slowly moving up to the top,
until it finally falls into the upper left pocket (q even), or the upper right pocket (q odd).
the pocket depends on the parity of p and q.
If both are odd then the ball lands in the upper right pocket.
If both are even then the ball lands in the lower left pocket from which it was launched.
However, p and q are relatively prime, and cannot both be even.
The ball can only land in one of the other three pockets.
If the slope is irrational then the x and y coordinates can never be integers at the same time.
that would produce a rational slope.
thus the ball bounces around the table forever.