Logic Puzzles

Conundrums, Enigmas, Posers, Riddles, Quandaries, Rebuses, Catches, Brain-Teasers... - there are many puzzles in the wider world beyond mechanical puzzles. I have added this section on logic puzzles so that I can document several puzzles that, while only occasionally presented as mechanical puzzles with physical pieces, have nevertheless provided some entertainment to me and my friends.

Many books over the decades have compiled logic puzzles. Among the most noted puzzle chroniclers of the Nineteenth Century are the Brits Henry Ernest Dudeney (1857-1930) (Amusements in Mathematics, 1917), Professor Hoffmann (pen-name of the Reverend Angelo John Lewis, 1839-1919) (Puzzles Old and New, 1893), and Walter William Rouse Ball (1850-1925) (Mathematical Recreations and Essays 1892), and the American Sam Loyd (1841-1911) (Cyclopedia of 5000 Puzzles 1914).

Modern chroniclers include Martin Gardner, Raymond Smullyan, Ivan Moscovich ( download and print some of Ivan's puzzles), Serhiy Grabarchuk, Ed Pegg, and Jim Loy.

Modern audiences still have a taste for logic puzzles, as evidenced by the current popularity of SuDoKu.

Online resources include:



Gridworks - Thinkfun

Chocolate Fix - Thinkfun

The Mensa "Challenge Your IQ Pack" contains several logic challenges. (Red version)

The classic game of logical deduction Clue has been simplified and turned into a solitaire puzzle game called Clue Suspects. Given six rooms, a body, up to 11 suspects, and a challenge card providing a set of clues, deduce who must be in the room with the body, and therefore be the murderer.

Logic Links
By Mindware.
Use given clues to deduce where to place colored chips.

River Crossing Puzzles

River Crossing puzzles begin with a river and a means of crossing the river. Some group of people, animals, and/or objects must be moved from one side of the river to the other, subject to various constraints on inter-relationships among them, and on the use of the conveyance. One must describe a sequence of crossings which get everyone from one bank to the other while obeying the constraints. It should be stated that none of these puzzles require or permit tricks such as ropes, swimming, reliance on currents, etc.

Some early U.S. patents on river-crossing puzzles include 232394 - Delan 1880, and 249963 - Loomis 1881.

Perhaps the most well-known puzzle of the River-Crossing variety is that of the Farmer, Wolf, Cabbages, and Goat. This has been issued in mechanical form - the French puzzle "La Chevre et le Chou" by Watilliaux circa 1885 is an example. I have the version with the nice wooden pieces (not just carboard cutouts). A Farmer is traveling with a Wolf, Cabbages, and Goat (don't ask why). There is a river to be crossed, and a boat which will accommodate only the farmer, who must row every trip, and one of the others. The goat cannot be left alone with the cabbages, which it will eat, and the goat cannot be left alone with the wolf, which will eat it. You can try this puzzle online here.

Mouseover the box below to see my answer of 7 crossings:

Here is another mechanical presentation: "Boo Boogy Mans" - a "Super Puzzle" from Sherms of Connecticut. The box contains six counters, 3 each of two different colors, A and B, and a small boat. The inside of the box has a drawing of a river. The problem is to use the boat, which can only hold two counters per trip, to get all of the counters across the river. At least one counter must be in the boat every crossing. At any time, the following constraint must be met: the number of A counters at either shore must always be zero, or greater than or equal to the number of B counters. In its original form, there are three missionaries and three cannibals. The cannibals must not be allowed to outnumber the missionaries. You can play a version online.

Mouseover the box below to see my answer of 11 crossings:


Dudeney gives problem #373: the boat can bear only weight 150. Four passengers must cross: weights 150, 150, 75, and 75.

Mouseover the box below to see my answer of 9 crossings:


Dudeney also gives problem #375: Five Jealous Husbands. Five jealous husbands traveling with their wives must cross, using a boat that can hold at most three people. Every husband was so jealous that he would not allow his wife to be in the boat or on shore with any other man unless he himself was present.

Measuring Puzzles

In these puzzles, one is presented with various containers of specific capacities, and some starting quantity and distribution of material among the available containers (sometimes an inexhaustible supply from a container of unspecified capacity is provided). The problem is to achieve some specific distribution and quantities among the given containers, by some sequence of transfers between containers. Usually none of the containers are graduated, and all transfers must either fill or empty a given container completely. Measurements of quantities besides the specific capacities of the given containers are achieved by remainders left during transfers between containers of unequal capacity. Sometimes one is required to empty the contents of a container back into the general supply, or discard it - any chemistry student will tell you the former is a bad idea, while any merchant would object to the latter - but there you have it.

One would think that by their nature, since they involve physical containers, these would appear as mechanical puzzles, but actually transferring some material, be it water, sand, etc. is much messier than simply working these out on paper.

I have, however, run across the French puzzle pictured at right, called either "La Maligne Laitiere" (The Ingenious Milkmaid) or "La Laitiere Avisee" (The Wise Milkmaid). (These names are reminiscent of the French edge-matching puzzle pair "Le Berger Malin" and "Le Fermier Avise.")

I don't have this, but it seems to come with three wooden towers which will contain specific numbers of marbles.


Given a full jug of unspecified capacity, and empty capacity-5 and capacity-3 containers, measure out 4 units.

Here is my six-step answer:

Fill the 5 from the jug. Fill the 3 from the 5 (leaving 2 in the 5). Discard the 3 (or empty it back into the jug). Transfer the 2 from the 5 to the 3 (now the 3 will take 1 more). Fill the 5 from the jug. Lastly, use the 5 to top off the 3, leaving behind the required 4.

One can depict the solution in a tabular format:

Jug cap-5
container
cap-3
container
action
inf. 0 0 start
5 0 fill 5 from jug
2 3 fill 3 from 5
2 0 empty 3
0 2 transfer 2 from 5 to 3
5 2 fill 5 from jug
4 3 top off 3 from 5


Dudeney states that Tartaglia (1500-1559) posed the following problem: Given a jug containing 24 units, and empty capacity-5, 11, and 13 containers, divide the 24 units into three equal parts (i.e. get 8 units into each of three different containers).


Dudeney poses the following in problem #365: Given two full capacity-10 containers, and empty capacity-4 and capacity-5 containers, end with exactly 3 units in each of the empty containers.


The Merchant of Bagdad (sic) appeared in Sam Loyd.

Weighing Puzzles

In these problems, you are given a collection of items and a weighing device which can either compare two quantities and tell which is heavier (or if they are equal), or a digital scale which can provide a quantitative weight in some units of the weighed item(s). You must sort the items in some way, using only a specified number of weighings.


The weighing problem I am most proud of solving on my own is as follows: You are given ten bags each containing ten marbles. All of the marbles weigh ten units each, except for one of the bags contains ten marbles from the wrong batch. Those ten marbles weigh only 9 units each. You do not know which bag contains the wrong marbles. In only one weighing using a scale which can read out digital weight, determine objectively which bag contains the wrong marbles.

Mouseover the box below to see the answer:


Given 12 identical-looking coins, 11 of which weigh exactly the same. The twelfth is a forgery and is either heavier or lighter, you don't know which. Using a balance scale, determine which coin is the forgery, and whether it is lighter or heavier, in the minimum number of weighings. It's a challenge to devise a way to do it in four weighings. However, it is possible to do it in only three!

See the answer to an equivalent puzzle here.

The Monty Hall Problem

An old game show called "Let's Make A Deal" was hosted by Monty Hall. A contestant was allowed to choose one of three curtains. Behind one of the curtains was a valuable prize, while behind the other two lurked booby prizes. After the contestant made a first choice, the host would reveal a booby prize behind one of the unchosen curtains, and then give the contestant a chance to stick with their first choice, or switch to the other curtain not yet revealed, "where Carol Merrill is now standing." Either way, the contestant's final choice was then revealed, to either applause or laughter.

The puzzle asks, "Which is the better strategy for the contestant: always stick with one's first choice, or always switch?" This question caused quite a stir in the press when it was answered by Marilyn vos Savant, a noted columnist. Educated people wrote in to vehemently disagree with her answer, though it was correct.

I believe the correct strategy is easy to deduce - look at the two tables below. In each table, I show the outcome of one of the two strategies, based on all the combinations of where the prize is versus the contestant's first choice. Remember, it is always possible for the host to show a booby prize behind one of the unchosen curtains.

Strategy:
Stick
Your 1st Choice
1 2 3
Prize
Behind
1 Shows: 2 or 3
You stick with 1
WIN
Shows: 3
You stick with 2
LOSE
Shows: 2
You stick with 3
LOSE
2 LOSE WIN LOSE
3 LOSE LOSE WIN
Probability of WIN = 3/9 = 1/3.

You stubbornly stick with your first choice no matter what the host reveals, so you win only when you picked the correct curtain on your first choice. Obviously your chances are 1 in 3.

Strategy:
Switch
Your 1st Choice
1 2 3
Prize
Behind
1 Shows: 2 or 3
You Switch from 1
LOSE
Shows: 3
You Switch 2 to 1
WIN
Shows: 2
You Switch 3 to 1
WIN
2 Shows: 3
WIN
LOSE Shows: 1
WIN
3 Shows: 2
WIN
Shows: 1
WIN
LOSE
Probability of WIN = 6/9 = 2/3.

This is the better strategy. You lose only when you picked the correct curtain on your first choice. The host kindly eliminates one of the booby prizes for you, and by switching you end up winning 2 out of 3 times. This is counter-intuitive enough to make people want to argue about its validity.

You can pretend to be a contestant online here. The website tracks win/lose statistics, and they correlate well with the expectations noted above. Jim Loy also discusses the Monty Hall problem.

The Two Fuses

A friend told me this logic puzzle question was posed during a job interview. You are given two 60-second fuses, and a lighter. Using only this equipment, time 45 seconds exactly. You cannot assume that the fuses burn at a steady rate throughout their lengths, only that they will each be completely consumed in exactly 60 seconds. You cannot cut the fuses - it would do you no good anyway, since by the previous statement there is no dependable correlation between any partial length and time.

Mouseover the box below to see the answer:

Aligning the Planets

This is a logic puzzle that asks you to achieve a specific goal ordering of objects given an initial ordering and constraints on moving the objects.

The set of objects are the nine ("traditional") planets and the initial ordering from left to right is:

[Earth Venus Pluto Jupiter Mars Uranus Neptune Saturn Mercury]

The goal ordering is the “natural” ordering:

[Pluto Neptune Uranus Saturn Jupiter Mars Earth Venus Mercury]

The rules for movements are as follows:

For example, a legal first move would be to take the subset (Venus Pluto Jupiter) and move it to the left, resulting in the new state: [Venus Pluto Jupiter Earth Mars Uranus Neptune Saturn Mercury]

The Exhaustive Method

One approach to a solution is an exhaustive search of all possible moves. This entails exploring all the possible legal moves (many of which will not be smart moves) while not missing any, and ideally also not unnecessarily repeating any. The search can be organized as a tree, with the initial state as the root, each node representing a particular ordering/state, and each edge representing a specific legal move. The limit of four moves defines the exact depth at which all branches must terminate. On termination, each leaf node will be either a solution equal to the goal ordering or a non-solution indicating an unsuccessful sequence of four moves. The search may terminate when the first leaf node equal to the goal state is found, unless an enumeration of all possible solutions is required in which case the entire tree must be realized.

The size of this tree can be determined as follows. From the initial state, there are 6 possible moves - you can choose any group of 3 adjacent planets beginning with the second from the left (Venus) and ending with the third from the right (Neptune). In fact, at each level of the tree, from each node, there will always be 6 possible moves. In four moves, there will be 6*6*6*6 = 1296 possible branches. While the exploration of this tree can be automated, doing it by hand will be tedious and time-consuming (unless by luck a solution branch is found early). However, the problem can be approached heuristically using some puzzle-solving techniques I’ll explain below.

Working Backwards

First, one should look at the goal state and work backwards to see if additional constraints can be deduced which can serve to reduce the search space. This technique is sometimes fruitful when solving mazes, for example, especially mazes constructed by hand since often the psychology of the maze-maker leads them to unconsciously build in more choices near the entrance and fewer near the exit.

In the case of the Aligning the Planets puzzle, we have the following. Examining the goal state we can deduce with certainty that the last (4th) move must put the leftmost 3 planets into their proper positions. This means that the 4th move must take the subset (Pluto Neptune Uranus) from somewhere in the sequence and move it to the left end intact. Furthermore, at that point the rest of the sequence must also be in its final goal form. This means that prior to this 4th move, Saturn must be on the left end.

What must be to the immediate right of Saturn at this time (i.e. prior to the 4th move but after the 3rd move)? There are only two possibilities: either the (Pluto Neptune Uranus) subset must itself have come from there, or the required Jupiter must already be there, since only the 4th move remains so there would be no other way to get Jupiter to where it is needed.

Let’s find a helpful way to diagram what we’ve deduced so far:

Initial state: [Earth Venus Pluto Jupiter Mars Uranus Neptune Saturn Mercury]

Possible States after 1st move: (6 of them)…
Possible States after 2nd move: (36 of them)…
Viable States after 3rd move:

Goal state after 4th move: [Pluto Neptune Uranus Saturn Jupiter Mars Earth Venus Mercury]

Viable means that the state can lead to the required next state - in this case the goal state - in one move.

Simplifying the Problem

To make further progress, we employ the mathematical technique of making an assumption, then showing that either the assumption leads to a contradiction or absurdity, in which case it must be false, or that we can prove the assumption true.

The assumption I’ll investigate is as follows. Note that in the initial state, Earth Venus and Mercury, though not yet adjacent, are already in the correct order. Is it possible that the only planets that must be moved are the middle six (Pluto Jupiter Mars Uranus Neptune Saturn)? Note that moving them would ensure that they end up to the left of Earth and Venus, and we leave Mercury where it is, eventually resulting in Earth Venus Mercury in order on the right as required.

If we look at only these middle six planets, we have effectively reduced the search space - we have simplified the problem to finding a way to order just these six planets correctly. The size of the search tree is more tractable since now within these six planets there are only three possible moves at any time.

Bear in mind that if our assumption is false - i.e. that the true solution in fact requires moves that involve any of Earth Venus Mercury, then we will have to explore the entire tree for the six planets and show there are no solutions within it to this reduced problem. However, this smaller tree for the six planets has 3*3*3*3 = only 81 branches.

We can employ the same strategy of looking backwards from the goal on this subset as we did on the whole set. By working simultaneously forward from the initial state and backwards from the goal we might be able to see a solution more easily.

Our diagram now looks like the following.

Initial state: [Pluto Jupiter Mars Uranus Neptune Saturn]

All Possible States after 1st move:

Possible States after 2nd move: ?

Viable States after 3rd move:

Goal state after 4th move: [Pluto Neptune Uranus Saturn Jupiter Mars]

Bridging the Gap - An Intuitive Leap

Now our problem is to find a (or show there is no) second move and resulting state that bridges the gap from one of the 3 possible states a-c shown after the 1st move, to one of the 3 viable states x-z shown after the 3rd move.

A methodical exploration begins with an examination of the 3 possible 2nd moves and resulting states available from (a):

Are any of these states 1-3 one legal move away from any of the 3 viable states x-z?

By inspection, we can find that, yes, in fact #3 is. From #3, we can make the move (Saturn Jupiter Mars) to end up with (x) the first viable alternative: Saturn Jupiter Mars Pluto Neptune Uranus.

We have found our bridge and validated our assumption. In fact, if we now piece together our conclusions, we have solved the puzzle by finding a sequence of four moves that accomplishes the goal.

Granted, it was fortunate that we only had to examine part of even the reduced six-planet tree before running across a solution. If the puzzle had been constructed so that our assumption was false, we would have had more work to do to prove that. In fact, puzzle makers do this to increase the difficulty and/or “elegance” of their puzzles - deliberately craft the puzzle conditions and constraints so that a solution does not arise by chance easily.

A Solution

The solution we’ve found is as follows. The subset of planets to be moved is enclosed in parenthesis in each state, beginning with the initial state. Per our assumption, Earth Venus and Mercury are never moved. The last state is the goal.