In Harry Potter and the Sorcerer’s Stone, just after the bit where the Scooby Gang Hogwarts Three (Harry, Ron, and Hermione) discover that evil forces are after the titular stone and before the bit where Harry vanquishes the face of Voldemort with the power of love (to the rejoicing of Huey Lewis fans everywhere), there is the bit where the kids must best a sequence of chambers guarded by homicidal three-headed dogs, homicidal shrubberies, homicidal flying keys, homicidal chess pieces, and a logic puzzle involving bottles.
If you don’t remember this last challenge, that’s probably because it didn’t make it to the movie, partly because watching someone solve a logic puzzle is only slightly less boring than reading about someone solving a logic puzzle, but mostly because the problem, as described in the book, is incomplete.

“Dude, Wizard Sudoku sucks.”
In the book, after the giant chess match, Harry and Hermione enter a room that immediately seals up both entrances with magical fire, purple flames on the door leading back out they way they came, and black flames on the door leading forward to the hiding place of the Sorcerer’s Stone. The room is empty except for a table with a line of seven potion bottles and a note that reads as follows (the line numbers are included by me):
(1) Danger lies before you, while safety lies behind,
(2) Two of us will help you, whichever you would find,
(3) One among us seven will let you move ahead,
(4) Another will transport the drinker back instead,
(5) Two among our number hold only nettle wine,
(6) Three of us are killers, waiting hidden in line.
(7) Choose, unless you wish to stay here forevermore,
(8) To help you in your choice, we give you these clues four:
(9) First, however slyly the poison tries to hide
(10) You will always find some on nettle wine’s left side;
(11) Second, different are those who stand at either end,
(12) But if you would move onward, neither is your friend;
(13) Third, as you see clearly, all are different size,
(14) Neither dwarf nor giant holds death in their insides;
(15) Fourth, the second left and the second on the right
(16) Are twins once you taste them, though different at first sight.
So one potion of the seven provides a means to exit through the black fire; one provides a means to exit through the purple fire; two do nothing; and three will kill you. However, as it turns out, the only way to know if the potion you’ve picked will work is to actually walk through the magic fire in question, so you risk char-broiling yourself if you pick the wrong potion (assuming, of course, you don’t straight-up die from the poison).
Hermione quickly realizes it’s a logic puzzle devised by the school’s resident potions master and all-around dick Severus Snape, and sets out to to use the clues to figure out which bottle will send her back through the purple fire (to alert the school officials) and which will send Harry forward through the black flames (to battle with He-Who-Had-Not-Yet-Become-Ralph-Fiennes).

“At least in this move I got to have a nose!”
I did the same thing, only to be befuddled by the fact that at no point does the novel tell the reader anything about the sizes of the bottles, which seems like a rather crucial piece of information what with it being the whole point of third clue in the poem.
Interestingly enough, though, on the assumption that Snape’s clues do, in fact, specify a unique solution to his potion puzzle, it is nevertheless possible to solve it — that is, to determine the precise locations of the Go-Back and Go-Forward potions!
Why don’t you give it try, and then I’ll show you the solution after the jump.
The solution to Snape’s Potion Puzzle is as follows:
- The Go-Back potion is the right-most potion in line, and
- The Go-Forward potion is in either the largest bottle or smallest bottle, whichever one of the two is closest to the center of the line bottles.
Let’s prove that this is the case, under the assumption that Snape has, in fact, concocted a true logic puzzle with a unique solution, or at the very least, a solution that uniquely locates the Go-Forward and Go-Back potions. (Given the general dickishness of Professor Snape, this may not be a reasonable assumption, but I digress.)
There are seven potions arranged in a line on a table; let’s label these positions as #1 (on the left) through #7 (on the right). Let’s go through the poem again, and suss out some facts. Lines 4-6 of the poem give the identities of the potions in the bottles, as well as their number:
Fact 1. The 7 potions consist of
- 1 “Go-Forward” potion (line 3), which we’ll label F.
- 1 “Go-Back” potion (line 4), which we’ll label B.
- 2 bottles of nettle wine (line 5), which is a kind of bland medicinal wine: it won’t kill you, but it won’t get you out of the room either. We’ll label them W.
- 3 bottles of deadly poison (line 6), which we’ll label P.
The poem also includes four clues as to the locations of the various potions. The first clue (lines 9-10) states that a bottle of poison always lies to the immediate left of a bottle of wine. Hence, if there is a W at position #4, then there must be a P at position #3. As a consequence, there cannot be a wine at position #1. To summarize:
- Fact 2: if W is at #n, then P is at #(n-1).
- Fact 3: there is no W at #1.
The second clue (lines 11-12) states that the potions at positions #1 and #7 are different, and neither is Go-Forward potion F:
- Fact 4: the potion at #1 is not same as the potion at #7
- Fact 5: there is no F at #1 or #7.
As a consequence of facts 3 and 5, we have
- Fact 6: the potion at #1 must be B or P.
The fourth clue (lines 15-16) states that the potions in positions #2 and #6 are the same. Since the only types of potions that appear in more than one bottle are wine and poison, we can conclude
- Fact 7: either W is at both #2 and #6, or P is at both #2 and #6.
From these seven facts, we can deduce the following:
- Fact 8: the potion at #7 must be B or W.
As proof, note that by Fact 5, the potion at #7 can only be B, W, or P; so we must argue that there cannot be a P at #7. Assume (to the contrary) that the there is a P at #7. According to Fact 7, that means the only two possible configurations are
1-P-3-4-5-P-P
or
1-W-3-4-5-W-P.
Both configurations are impossible by virtue of Fact 2. In the first, since all three Ps have been places, Fact 2 asserts that the only place a W can go is at #3… which means there cannot be two W’s, violating Fact 1. In the second, Fact 2 asserts that there must be a P in #1… which means the potions at either end are the same, violating Fact 4.
We’ll get back to the poem’s third clue in a second, but let’s see what we can deduce from the first 8 facts. From Fact 6, we know that potion #1 is either the Go-Back B or poison P. Let’s examine these two cases separately. If there is a B at #1, then Fact 2 forbids a W at #2, whence Fact 7 asserts a P at both #2 and #6; also, Fact 8 asserts there must be a W at #7. Thus, we have
B-P-3-4-5-P-W.
The remaining three bottles are F, P, and W, which can be configured (keeping Fact 2 in mind) exactly 4 ways:
B-P-F-P-W-P-W,
B-P-P-W-F-P-W,
B-P-W-F-P-P-W,
B-P-W-P-F-P-W.
If instead there is a P at #1, we have less to go on. Nevertheless, Fact 7 asserts that #2 is either P or W. Let’s investigate them. If #2 is a P, then by Fact 7 #6 is also a P. Since all three P’s are accounted for, Fact 2 forces the two W’s to be at #3 and #7, whence we have
P-P-W-4-5-P-W,
and the remaining potions F and B and appear in any order:
P-P-W-B-F-P-W,
P-P-W-F-B-P-W.
Alternatively, we must have a W at #2. Fact 7 asserts the second W is at #6, which means (by Fact 2) that a second P is at #5; moreover, since both W’s are accounted for, Fact 8 asserts that #7 is B, whence we have
P-W-3-4-P-W-B,
and the remaining potions F and B and appear in any order:
P-W-F-P-P-W-B,
P-W-P-F-P-W-B.
Thus, from these facts, we can deduce that there are only eight possible configurations of the potions:
Order 1: B-P-F-P-W-P-W,
Order 2: B-P-P-W-F-P-W,
Order 3: B-P-W-F-P-P-W,
Order 4: B-P-W-P-F-P-W,
Order 5: P-P-W-B-F-P-W,
Order 6: P-P-W-F-B-P-W,
Order 7: P-W-F-P-P-W-B,
Order 8: P-W-P-F-P-W-B.
We now turn our attention to the poem’s third clue (lines 13-14), which states that all seven bottles are of different sizes, but neither the largest nor the smallest contain any poison. Effectively, these two eXtremal bottles (which we shall label as X) are poison-free.
- Fact 9: P is in neither of the X bottles.
Unfortunately, the book gives us no information about the location of these two bottles, but there are some conclusions we could draw, such as
- Fact 10: X is not at #7.
which follows Fact 8.
Let us see which, if any, placement of the two X’s in various positions yield unique solutions. If, for example, the two extremal potions we placed at positions 1 and 3, then Orders 1, 3, and 4 would be valid solutions. Similarly:
Position of X’s | Valid solution orders |
1 and 2 | None |
1 and 3 | 1, 3, and 4 |
1 and 4 | 2 and 3 |
1 and 5 | 1, 2, and 4 |
1 and 6 | None |
2 and 3 | 7 only |
2 and 4 | 8 only |
2 and 5 | None |
2 and 6 | 7 or 8 |
3 and 4 | 3, 5 and 6 |
3 and 5 | 1, 4, 5, and 6 |
3 and 6 | 7 only |
4 and 5 | 2, 5, and 6 |
4 and 6 | 8 only |
5 and 6 | None |
Hence, the possible places the eXtremal bottles can be to produce a unique solution is one X at position #(2 or 6) and the second at position #(3 or 4). Note that the X in position #2 or #6 is necessarily a wine, whereas the X in position #3 or #4 must be the Go-Forward potion. That means the Go-Forward potion is in whatever eXtremal bottle is closest to the center of the line, whereas (regardless of the configuration of the largest and smallest bottles) we can be assured that the Go-Back potion is in position #7.
As a corollary to this, it’s worth noting that even the solution that Hermione gives in the novel is almost exactly this… and just as vague:
At last, she clapped her hands. “Got it,” she said.“The smallest bottle will get us through the black fire — toward the Stone.” Harry looked at the tiny bottle. “There’s only enough there for one of us,” he said. “That’s hardly one swallow.” They looked at each other. “Which one will get you back through the purple flames?” Hermione pointed at a rounded bottle at the right end of the line.