# Riddles and Logic Puzzles

A collection of my favourite logic puzzles. Some of them are here because they’re fiendishly difficult, others because the solution is in some sense ‘cute’. Hover to see the solutions.

## Cutting Wood (Very Easy)

A lumberjack lives in a forest cutting logs with an axe. It takes him six minutes to chop a log into three pieces. How long would it take him to cut a log into five pieces?

### Solution

The obvious answer is ten minutes. Six minutes for three pieces means each piece takes two minutes. Multiply it out and five pieces will take ten minutes. Easy peasy, but wrong!

Think instead about the process of chopping up a log. It’s not the pieces that take time, but the cuts. Cutting a log into three pieces requires you to make two cuts. So our forester needs three minutes for each cut. Five pieces involves four cuts and hence it takes him twelve minutes.

Of course, as with any riddle, it’s easy to argue with the hypothetical but once it’s pointed out the answer should be obviously correct.

## Dynamite Fuse (Easy)

You are given two ropes, dosed in kerosene. One rope takes three minutes to burn end to end and the other four. Unfortunately they are fairly ragged and don’t burn at a steady pace, so half the rope wouldn’t burn in half the time. How could you burn these two ropes to time out five minutes?

### Solution

*This is a wonderful variation on the classic puzzles about filling water bottles of various sizes. That said it’s not really about the maths, but rather the physical situation. The solution requires you to think outside of the box and combine your tools in an interesting way.*

Instead of jumping straight to the solution, here are two easier problems that will get you a long way towards the answer.

- With the same two ropes as in the original problem, how do you measure seven minutes?
- With just a single rope which burns in two minutes, how do you measure one minute?

Adding the times is simple, just burn one rope then the other. Halving the time is a little more complicated. Because the ropes don’t burn evenly, you can’t cut the rope in half or fold it or wait until the flame reaches halfway. You can however light both ends of the rope simultaneously. When the two flames meet (not necessarily in the center) exactly one minute will have elapsed.

Now the final solution is straightforward. Light the four minute rope at both ends simultaneously. When the flames meet, light the three minute rope. After that has burnt through five minutes will have elapsed.

## Four Lines (Easy)

Connect nine dots in a three by three grid with four straight lines, drawn end to end without taking your pen from the page.

### Solution

*This one is a classic although rather simple. I like to pretend that this puzzle is where the expression ‘think outside the box’ comes from.*

The trick is to draw the lines beyond the grid.

## Chasm Crossing (Medium)

Four people are exploring a cave and hear a distant rockfall heading their way. To escape they must cross a precarious bridge over a nearby chasm. They only have half an hour before the rockfall will reach them. The four cavers are of various levels of fitness and would respectively require 2,5,11 and 13 minutes to cross the pit, although they have the endurance to cross back and forth as many times as needed. Unfortunately the bridge is rather old and will only hold the weight of two people at a time. Even worse, the cavers only have a single torch which they need to use while crossing the bridge. Can they make it?

### Solution

The intuitive answer is to use the fastest explorer to run the torch over and back but this takes 33 minutes. Once you notice the obvious approach it’s rather tricky to get your mind thinking through other ideas.

The trick is not to think about being quick, but instead to try and not waste time. It’s the two slowest cavers who delay the process the most. If you make sure to send the two slowest people across the bridge together then they will actually waste less time overall.

## Fun Geometry (Easy)

Two little geometry problems.

An astronaut has landed her spaceship on one corner of a strange square shaped moon. She has explored to the opposite corner but is beginning to run out of oxygen and needs to get back to the shuttle as quickly as possible. What path should she take?

A boy is standing in a field with a bucket. Nearby is a (dead straight) river and further away his home. He needs to walk down to the river and fill the bucket then walk home. What’s the shortest path he can take to do so?

### Solution

These two similar problems are very easy in hindsight. Once you know the solution it’s obvious, but when you don’t…

For the square moon, the shortest path between the two points is a straight line.

However the ‘straight’ line doesn’t go exactly where you’d think. Flatten the box into a net and then trace the line on the surface.

This gives a slightly unintuitive path across the surface of the moon.

There’s a similar geometric trick for the river. The shortest path will be a straight line to the river and then a straight line to the house, but where on the river should he aim for? You could use some maths and try solve the path as an optimisation problem, but the solution is actually much simpler. Treat the river as a mirror and reflect the position of the house. The shortest path to the reflected house is a straight line through the river and we can reflect this back to solve our problem!

## Division (Medium)

Cut the following shape into two identical pieces. You don’t have to follow the grid, it’s just there to help visualise the shape.

### Solution

The difficulty of this puzzle is working out how to match the concave and convex notches. Any cut is going to create a new notch of each type. Eventually you’ll realise the only way it’s possible is if one piece is flipped upside down after the cut. It may help to solve a slightly simpler version of the puzzle first.

After that the answer to the original should come quickly.

## My Number is 25 (Hard)

Alice, Bob and Carrol are sitting in a circle with positive whole numbers drawn on their foreheads. They can each see the other’s numbers but cannot see their own. Additionally they know that two of the numbers add up to the third, but not which is which. You observe the following conversation,

Alice: I don’t know my number. Bob: I don’t know my number. Carrol: I don’t know my number. Alice: My number is 25.

What were the other two numbers?

### Solution

There are two subtly different ways you can interpret the question: “what could the other two numbers be?” and “what must the other two numbers be?” The second of these is much harder to answer, in fact I don’t have a solution for it and I suspect one may not exist. Look around the internet and you can find variations of this problem, often with accompanying solution. Each of the ones that I found falls into the same subtle trap. If you manage to figure out a true solution, please email me at tom@jjdat.com, I’d love to hear it.

First off, let’s look at one option for what the numbers could be: 10 for Bob and 15 for Carrol. You can find these numbers either by guessing or with some algebra but for now we’ll just verify that they work. Let’s start by looking at what the three people determine about their numbers at each stage of the conversation. Write A, B and C for the numbers of Alice, Bob and Carrol.

Alice says she doesn’t know her number. If B and C were the same then their difference would be zero. That isn’t a positive number so in that case Alice would know that her number was the sum of B and C. She says she doesn’t know here number so we know that that didn’t happen, that is B ≠ C.

For the same reason as before we know A ≠ C.

For the same reason as before we know A ≠ B. Indeed all the numbers are different and Carrol knows this. There is another way in which Carrol might know her number. If one of the numbers she sees is twice the other, then the difference would be the same as the smallest number. Since all the numbers are different Carrol could then conclude that her number was the sum. This doesn’t happen so we must also have A ≠ 2B and B ≠ 2A.

On Alice’s second turn she knows that A ≠ B ≠ C, A ≠ 2B and B ≠ 2A. Using this information we can verify that if B = 10 and C = 15 Alice will be able to determine her number.

Alice’s number is either the sum or the difference of Bob and Carrol’s, A = B + C or A = |B-C|. If her number were the difference of the others, she would have A = |B-C| = 5. This contradicts B ≠ 2A and so she knows that her number must be the sum. Alice then knows and says A = B + C = 25.

What about the second question, we know 10 and 15 work, but are they the only such numbers? We could take the approach above a little further and work through all the cases algebraically. What you’ll find is that most of them give some sort of contradiction, either they imply one of the numbers is negative or give an equation which doesn’t divide into 25. There is one case which doesn’t cause a contradiction and solves to 10 and 15, indeed this is how I found the number in the first place.

Unfortunately this whole approach is fundamentally misguided. It rests upon a subtle assumption about the problem which we cannot make. We’re assuming that Alice’s sudden knowledge of her number must come from the pieces of information we’ve derived, that there is no other information Alice might come up with to work her number out that we haven’t thought of. We cannot knot this, in fact there are already a few extra pieces of information you can find out in step two above that I left out, who knows what more there could be. I hope that there’s a way to approach the problem directly which doesn’t fall prey to this tacit assumption, but I’m leaning towards it being impossible.

## Circular Road (Hard)

In a desert there is a long loop of road with several petrol stations scattered along its length. You have a car standing by and distributed amongst the petrol stations is exactly enough petrol to drive once around the entire road. Is there a point on the road where you can start driving and complete the entire circle without running out of petrol? (Assuming filling up the car doesn’t waste any fuel, you don’t crash, the world is perfect, blah, blah.)

### Solution

*This is by far my favourite logic puzzle of all time. It’s tricky and it requires you to think out the solution, you can’t just guess the answer and check.*

Given the way the question is worded the answer is obviously yes, the real trick is to give a compelling reason why. I actually have two completely different solutions using entirely different techniques, an algebraic and an analytic solution.

#### Inductive Solution

One way to solve the problem is to use recursion (or induction if you wish to write out a formal proof). At each petrol station write down the distance to the next station and the distance you can drive with the petrol at that station. If none of the petrol station had enough petrol to get to the next station then there wouldn’t be enough petrol overall. So (at least) one of the stations has enough fuel to reach the next station. We can then mentally combine these two stations and imagine that the first station also has the petrol from the second. This reduces our problem to one with one fewer stations.

We can do this process again and again until there is just one station left. This station has all the fuel to get around the road and so we can start here.

#### Analytic Solution

Another solution to the problem looks at the petrol consumption along the road.

Pick anywhere on the road and imagine that you drive the car around the loop. As you drive keep track of the amount of fuel in the tank. Now you will probably have picked a bad spot to start and won’t get very far before running out of gas. That’s ok, we’re just imagining the drive to begin with. Keep going all the way around using negative numbers to record the fuel consumption.

Because there is exactly the right amount of fuel along the track, when you get back to your starting point the fuel tank will once again be empty. Look at a graph of the fuel in the tank over the entire course and choose any one of the minima. (Bounded function over a compact domain, blah blah.) Starting at one of these points makes that minimal value your new ‘zero’ and so you can guarantee that you’ll always have fuel in the tank for the whole drive.