What Is a Logic Puzzle? Parts, Kinds and a Worked Example

This article was written with AI and may contain mistakes. Found one? Tell us.

By Riddle10 Editorial Published 9 min read

A logic puzzle is a problem that gives you a set of facts and a set of rules, and asks for an answer you can reach by deduction alone, with no guessing and no outside knowledge. A well-made logic puzzle allows exactly one answer, and every step that leads to it can be checked by anyone who follows the same reasoning.

That short definition hides a lot. It says what a logic puzzle is made of, what makes one fair, and why some famous examples are so hard. This article takes each part in turn, works through a classic example from start to finish, and shows how it differs from a riddle or a brain teaser.

What are the parts of a logic puzzle?

Almost every logic puzzle has the same four parts.

A cast or a board. These are the things the answer is about: a few people, a row of boxes, the squares of a grid, or a pair of unknown numbers.

The rules of the world. These fix what is possible before any clue is read. Each person holds exactly one item. A truth-teller only says true things. No two pieces may share a row.

The clues. These are the premises: statements about the cast that narrow the choices. Some are plain facts, some are things that people in the puzzle say, and some are statements about what someone knows.

The question. It names exactly what you must find, such as which chest is the right one, or which two numbers were chosen.

A paper published on 4 February 2020 gives a precise version of this picture for puzzles about truth-tellers and liars [1]. In that paper, a puzzle is a set of people together with the statements each of them made, and a solution is a way of labelling every person so that all of their statements fit their labels [1].

The same idea works for every logic puzzle: an answer is an assignment that breaks none of the rules and none of the clues.

What makes a logic puzzle a good one?

The 2020 paper names two properties worth aiming for: a clear puzzle needs nothing beyond its own statements, and a good puzzle has a single solution [1]. In that sense, being told how many people are liars counts as extra information [1].

Here is a tiny invented example that shows the tension between the two. Three people, A, B and C, each either always tell the truth or always lie. A claims that B is a liar. B claims that C is a liar. C stays silent.

Try both cases for A. If A tells the truth, B is a liar, so B's claim is false and C is a truth-teller. If A lies, B is a truth-teller, so C is a liar. Both stories fit every statement, so the puzzle has two answers.

Now add one more fact: exactly one of the three tells the truth. The first story has two truth-tellers, so it fails, and only the second survives. B is the truth-teller and the puzzle is good, but it is no longer clear, because it leans on a count of truth-tellers.

That trade-off is not an accident. The 2020 paper points out that in the simplest puzzles of this kind, where every statement only names some person as a truth-teller or as a liar, swapping every label gives a second solution whenever there is a first one [1].

The authors then showed that adding a third kind of speaker, one who only makes self-contradicting claims such as I am a liar, makes clear and good puzzles possible [1].

In the paper's own count, good puzzles were scarce [1]. When the authors counted every three-person puzzle of their extended kind, with each person saying at most one thing about each person, only 553 of 19,683 had exactly one solution [1]. In that count, most clue sets gave a puzzle with no answer at all [1]. So a clue set is worth testing for both problems before anyone else tries it.

What does pure deduction look like in practice?

The sum and product puzzle is one of the best examples of deduction from statements about knowledge. A paper published on 18 July 2023 states it in this form [2].

Two people, S and P, know that two whole numbers M and N were chosen, with M greater than 1, N greater than M, and M + N at most 100 [2]. S is told only the sum and P is told only the product [2]. Then they speak in turn [2]:

  1. S says that P does not know the two numbers.
  2. P says that now P knows them.
  3. S says that now S knows them too.

The puzzle has exactly one answer, M = 4 and N = 13 [2]. A short computer check that lists every allowed pair and removes pairs after each statement finds the same single pair. Here is the reasoning in words.

The first statement. S can only be sure that P is stuck if each way of breaking S's sum into two permitted numbers yields a product that more than one pair could produce.

Take any sum that equals two different primes added together: if that split were the real one, P would see a product of two primes and know the numbers at once. So S's sum cannot be written as two different primes. Other products that have only one split rule out still more sums, and after this statement just ten sums remain possible.

The second statement. P now knows the sum is one of those ten. If the true numbers are four and thirteen, P sees a product of fifty-two. At the start, fifty-two could have been four times thirteen or two times twenty-six. But two plus twenty-six is twenty-eight, and twenty-eight equals five plus twenty-three, two primes, so S could never have spoken as S did. Only four times thirteen is left, and P knows.

The third statement. S holds the sum seventeen. Of all the ways to split seventeen, only four plus thirteen leaves a product that P could have pinned down after the first statement. So S knows too.

Nobody in the puzzle ever says a number. Every clue is about what someone knows or does not know, and yet the answer follows with certainty. That is the essence of a logic puzzle: the information was there from the start, and deduction only brings it into view.

What kinds of logic puzzles are there?

This article sorts logic puzzles into six broad groups, by what you are given and what you must find.

KindWhat you are givenWhat you deduce
Statement puzzlesClaims made by people or labelsWho tells the truth, or which claim is true
Knowledge puzzlesStatements about what someone knowsHidden values that fit every statement
Grid deductionA short list of facts about people and itemsWhich item goes with which person
Placement puzzlesA board and rules on where pieces may goA layout that obeys every rule
Code and clue puzzlesHints about a hidden codeThe one code that fits every hint
Move puzzlesA starting state and the moves allowedThe move or sequence that reaches the goal

Statement and knowledge puzzles were covered above. In grid deduction, each person holds one item, and every clue rules some pairings out until only one complete matching is left. The riddle below is a very small one.

Placement puzzles ask where things can go. The classic case puts queens on a square board so that no two lie on a common row, column or diagonal, and a 2016 paper notes that hundreds of papers deal with it and its variants [3].

A small worked check shows why such puzzles need care. On a board of six rows and six columns there are exactly four layouts of six queens, so as a puzzle it has four answers. Require a queen in the top row, second from the left, and just one layout survives.

Code and clue puzzles, such as finding a lock code from a set of hints, work like grid deduction with digits. Move puzzles add time: you must find not only an end state but a route to it.

How is a logic puzzle different from a riddle or a brain teaser?

The three labels overlap, so this article uses working definitions of its own. The comparison below is a guide rather than a strict rule.

FeatureLogic puzzleRiddleBrain teaser
Where the answer comes fromDeduction from stated factsA double meaning or a hidden descriptionOften a catch or an unusual angle
What you need to knowNothing beyond the cluesEveryday words and thingsUsually nothing special
How you solve itStep by step, ruling options outA sudden insightSpotting the trick, sometimes with a little reasoning
Can you check the answerYes, against every clueYes, once the meaning clicksUsually, once it is explained
Typical lengthFrom a few lines to a full gridOne or two linesA few lines

A riddle describes something in a misleading way and waits for you to see through the description. Here, brain teaser is a looser label for any short, tricky problem, often one that turns on a hidden assumption. A logic puzzle hides nothing in its wording. All the information is on the page, and the challenge lies in combining it correctly.

That difference shows in how wrong answers look. A wrong answer to a riddle usually misses the joke. A wrong answer to a logic puzzle breaks a specific clue, and you can point to the clue it breaks.

How do computers solve logic puzzles?

A computer cannot read a puzzle the way a person does, so the first job is to restate the puzzle in a formal language.

The 2023 paper describes this as the real challenge of the sum and product puzzle: to express it so precisely that an automated reasoning tool can find or check the answer [2]. It mentions earlier solutions that used logic over possible worlds with a theorem prover, and a logic of public announcements with a model checker [2].

The 2023 paper used a chain of definitions instead [2]. One predicate holds the pairs still possible before anyone speaks, a second holds the pairs left after the first statement, and so on, with one stage for each statement [2]. The author turned these definitions into a logic program and ran an answer set solver, which found a single stable model whose last stage contained only the pair 4 and 13 [2].

Truth-teller puzzles can be turned into pictures as well as formulas. The 2020 paper draws each person as a point and each statement as an arrow from the speaker to the person described, with one style of arrow for a claim of truth-telling and another for a claim of lying [1]. Solving the puzzle then means labelling every point so that all the arrows fit [1].

Writing a puzzle out in full for a machine is also a strict fairness check, since any gap in the rules or any extra answer shows up as soon as the program runs.

How can you tell you have really solved one?

A correct answer to a logic puzzle comes with a proof. You should be able to go back through the clues one by one and show that your answer satisfies each of them. You should also be able to explain why every other option fails.

A useful habit is to test the answer from both sides. First confirm that it fits. Then try to build a second answer that also fits. If you cannot, and you can say why, you have solved the puzzle rather than guessed it.

Where can you try some logic puzzles?

Each puzzle below has a single answer that you reach by reasoning, not by guessing. Start with the lock, then try the grid of lanterns and the gear train.

References

  1. Alzboon, L., & Nagy, B. (2020, February 4). Truth-Teller–Liar Puzzles with Self-Reference. Mathematics, 8(2), 190. DOI 10.3390/math8020190
  2. Lifschitz, V. (2023, July 18). On Program Completion, with an Application to the Sum and Product Puzzle. Theory and Practice of Logic Programming, 23(4), 664-677. DOI 10.1017/S1471068423000224
  3. Chatham, D. (2016, December 8). The Maximum Queens Problem with Pawns. Recreational Mathematics Magazine, 3(6), 95-102. DOI 10.1515/rmm-2016-0010

logic puzzles puzzle definition deduction sum and product puzzle truth teller puzzles puzzle design

More reading