You have two containers, one that holds 3 liters and one that holds 5 liters, and access to a water source. Place exactly 4 liters of water into a third container (one that holds at least 5 liters, so that you can't simply fill the container to the brim and be done with it).
This puzzle dates back at least as far as the 1920s, and quite possibly earlier still.
One solution is as follows:
- Fill the 5-liter container.
- Fill the 3-liter container from the 5-liter container, leaving 2 liters.
- Empty the 3-liter container. Then, pour the remaining 2 liters from the 5- to the 3-liter container.
- Refill the 5-liter, then fill the 3-liter from the 5-liter container. Leaving 4 liters in the 5-liter container.
Another alternate solution, though this one requires several assumptions: The containers must have at least one line of symmetry when looking at them from the top, and they must have a constant width. (Cylinders or rectangular prisms meet this requirement.)
- Fill the 5-liter container, then place one part of the bottom down, and tilt it until the water level makes a straight line from the upper edge of the bottom to the bottom edge of the lip.
- Do the same thing with the 3-liter container, and pour it into the 5-liter container.
- 2.5 + 1.5 = 4
It bears noting that this puzzle, like many other stock puzzles, is usually difficult only because the solver is overthinking it. In practice, if you actually have the two jugs, and you just start filling one jug and pouring it into the other, the solution presents itself very quickly. (This is incorporated in some tellings of the riddle, which demand that you come up with the answer in less than a minute, as An Aesop about the value of trying things out rather than just sitting there thinking.)
Maths nerd bit: You're looking for the smallest x and y that satisfy 3x−5y=4; then fill the 3-liter x times, pouring it into the 5-liter when full, and emptying the 5-liter when it's full (which you'll do y times). The solution is x=3 and y=1. The alternate solution up there is the dual formulation, 5x−3y=4 (x=2, y=2). From here, two details present themselves: one, that it's easily adaptable to other values other than 3 and 5, and two, that a solution exists only if the target value is either a factor or a multiple of the highest common factor of the container sizes (e.g. you can't get 4 liters from 6- and 3-liter containers).
- Perplex City used this one on a card.
- In the movie Die Hard with a Vengeance, the two main characters must solve this type of puzzle in order to disarm a bomb near a public fountain.
- In the original script, the bomb was a Chekhov's Gun, as the movie would end with McClane planting the bomb on the bad guy's helicopter, and upon discovery one of them asks if anyone has a four gallon jug (in the final script the bomb was used for something else entirely without the puzzle being brought up again).
- The problem appears, at first, to be included in an I.Q. Test in Idiocracy, but as the world is inhabited by morons the actual question is, how many buckets do you have?
- This puzzle appears in Knights of the Old Republic on Manaan, and solving it is a prerequisite for the "good" ending on that planet.
- This puzzle and several variants appear in the Professor Layton series.
- A slight variant with different values in Zork Zero, a game almost entirely composed of stock puzzles.
- The Castle of Dr. Brain has a form of this with its hourglass puzzle. Measure 40 seconds with a 25 and 15-second hourglass.
- A variation of this puzzle occurs in Fatal Hearts, where you need ⅔ cup of flour but have only an 800ml cup and a 100ml cup. The puzzle's not too hard if you're good at conversions.
- An apparently more complex version of this classic puzzle appears at the end of Sherlock Holmes Versus Arsène Lupin, where you have to measure exactly 478cc of black powder with only 250cc, 80cc and 12cc containers at your disposal. I say apparently only, because 1×250 + 19×12=478, so you don't actually have to use the pour-bigger-into-smaller subtraction trick at all to solve it.
- It can be done much faster with the pour-bigger-into-smaller trick, though: 1x250 + 3x80 − 1x12=478.
- The original version also appears in "Sherlock Holmes and the Mystery of the Mummy" as well as "Sherlock Holmes and The Mystery of the Persian Carpet" (Which borrowed every other puzzle too)
- Rusty Lake Hotel has a puzzle like this, in order to pour a certain amount of water into a flask, for use in a distiller nearby.
- Appears in RuneScape, among other Stock Puzzles.
- Appears in Phantasmat as an unusual method of switching on a generator.
- Done with lava in the last chapter of the Wii Carmen Sandiego game.
- Myst IV: Revelation has a slight variation of this by rerouting Tomahna's backup power from two locations on the Age, to the two gates on its hydroelectric dam.
- In Sir Basil Pike Public School, if you pick the boy's path, you must solve this puzzle for the janitor before heading to the tennis court. (The girl's path has a Knights and Knaves puzzle instead.)
- The final level of Tomb Raider: The Last Revelation contains this exact puzzle and two variants.
- The Cave also has this puzzle but in a twist, or perhaps just an acknowledgment that such puzzle in video games are a waste of time, the game also gives you a URL where the player can simply find the answer to the puzzle.
- This is done with medicine for a sick elephant in one of the 12 minigames of the edutainment game Math Circus. This minigame is remade in Math Circus Act 4, throwing in multiple types of medicine that should not be mixed with the others.