Information Entropy in Guessing Games: The Mathematics of 20 Questions

Mathematics & Algorithms · August 2026 · 7 min read

When you sit down to play a game of Twenty Questions, you are participating in a classic mathematical problem disguised as a parlour pastime. How can twenty simple yes-or-no queries reliably pinpoint one specific concept out of millions of possibilities? The answer lies in information theory, binary partitions, and a fundamental metric called Shannon entropy.

The Power of Binary Partitioning

Every yes-or-no question is a binary test. If an answerer responds to a question that splits the universe of remaining possibilities exactly in half, the search space shrinks by a factor of two. In mathematical terms, each ideal question provides exactly one "bit" of information.

With twenty ideal questions, the total number of distinguishable states is:

220 = 1,048,576 possibilities

This exponential scaling explains why a player or an algorithm can identify obscure historical figures, niche anime characters, or complex medical specialties in twenty steps or fewer. However, the catch lies in finding questions that consistently achieve that clean 50/50 division.

Measuring Uncertainty with Shannon Entropy

In 1948, mathematician Claude Shannon introduced entropy as a measure of uncertainty in a probability distribution. In the context of a deduction engine like SherlockAI, if there are N active candidates, each with an assigned probability P(ci), the total entropy H is defined as:

H(X) = - Σ P(ci) log2 P(ci)

When all candidates are equally likely, entropy is at its maximum. Every time a question is asked, the distribution updates, and the entropy decreases. The goal of the deduction engine is to select the question that maximizes the Expected Information Gain — the difference between current entropy and expected posterior entropy.

Why Naive Questions Fail

Human players often make the mistake of asking "needle-in-a-haystack" questions too early. For instance, asking "Is it Albert Einstein?" on question two gives an enormous amount of information if the answer is yes, but almost zero information if the answer is no (which happens 99.9% of the time). In information-theoretic terms, the expected information gain of such a question is minuscule.

Optimal play requires broad, high-entropy splits in the opening phase (such as distinguishing real people from fictional characters, or human from non-human), gradually transitioning to specific, low-entropy confirmatory questions in the endgame.

From Theory to Implementation

Modern deduction software models candidates, traits, and user uncertainty as a continuous probability matrix. By accounting for noisy answers (such as when a player answers "Probably" instead of "Yes"), the engine balances pure entropy reduction against resilience to errors. To see this in action, explore our character catalog or test your wits against the SherlockAI engine.