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 either 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) or the 5-liter container (depending on the version).
This puzzle dates back at least as far as the 1920s, and quite possibly earlier still. Some versions replace the jugs with sand timers for cooking eggs and the liters with minutes.
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. You will be left with 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 integer 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 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 values other than 3 and 5, and two, that a solution exists only if the target value is 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).
Not necessarily related to Solve the Soup Cans.
Examples:
- 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).
- In Fermat's Room, there's a variant with two hourglasses: one of four minutes and one of seven minutes, and the goal is to time nine minutes. Answer is to start both hourglasses at once (t=0), turn the four-minute one over once it runs out (t=4), then once the seven-minute one runs out (t=7) start counting — there's one minute of sand left in the smaller one at that point, then just flip it two more times to get the other eight minutes needed.
- In an episode of Zoom, Jessie and Zoe are challenged to divide 10 quarts of water into two equal parts using only a 10-quart bucket, a 7-quart bucket, and a 3-quart pitcher, leaving 5 quarts each in the two buckets and the pitcher empty (5/5/0). To start, all 10 quarts are in the larger bucket (10/0/0). When transferring water from one container to another, they must fill that container all the way, or use the entire remaining volume of the container they're pouring from, whichever comes first. Zoe keeps track of the three volumes on an easel. After at least 20 transfers (with Zoe's chart now on a second page), they eventually get to 1/7/2. It is at this point that Jessie figures out how to reach the goal of 5/5/0: transfer the 7 quarts to the 10-quart bucket (8/0/2), then the 2 quarts into the empty 7-quart bucket (8/2/0), then use the 8 quarts to fill the empty 3-quart pitcher (5/2/3), and finally, pour the 3 quarts into the 7-quart bucket, adding to the 2 quarts already in there.
- In Knights of the Old Republic on Manaan, this puzzle appears in the form of pressurized doors, where you must transfer water back and forth between a series of rooms until the left-side passage is open and you can go through. Solving it is a prerequisite for the "good" ending on that planet.
- This puzzle and several variants appear in the Professor Layton series. The Curious Village has three variations: "Juice Pitcher", which is as described above but involving a full 8-quart/litre pitcher of tomato(?) juice; "Milk Pitchers", where you have to use a 7- and 3-quart/litre pitchers to distribute 10 litres of milk in two parts of 5; and "Water Pitchers", which asks you to divide a 16- and 9-quart/litre pitchers until they each hold 8 quarts/litres of water.
- In Zork Zero, one puzzle involves obtaining 6 "gloops" of water using a 9-gloop vial and a 4-gloop vial. Obtaining the 4-gloop vial is a multi-stage puzzle in itself.
- 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.
- A 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. While pouring powder back and forth is an option (1x250 + 3x80 − 1x12=478), there are other ways to solve the puzzle, such as: 1x250 + 19x12=478.
- 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: During the Fremennik Trials, among the series of tasks to get a Frozen Key in Peer the Seer's portion is measuring 4 units of water from a 5-unit bucket and 3-unit jug and then pouring that amount of water into a vase.
- In Phantasmat, this puzzle appears in a chapter where you must switch on a generator. Part of the tasks involves putting a jug of 4 units of liquid on a weight, and you only have a 5-unit bottle and 3-unit bottle to get 4 units.
- 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 the 2006 spiritual successor of Safe Cracker, this must be done to turn on the fountain in Duncan W. Adams' mansion, by rerouting water between three pistons.
- The final level of Tomb Raider: The Last Revelation contains a portion with two instances of the puzzle. In the first, Lara uses two waterskins, a 5-liter and a 3-liter, to pour 2 liters of water into a pitcher on a scale, opening a grate in the floor. In the second, she uses the same two waterskins to pour 4 liters of water, opening another grate.
- Club Penguin: EPF mission 10, Waddle Squad, has Jet Pack Guy running out of fuel for his jet pack. He can make some emergency fuel with cream soda, and two containers of 4 are needed. You have to distribute the cream soda between glass containers of 8, 5, and 3.
- Poptropica: On Wimpy Wonderland Island, you have to distribute some wiper fluid between a 10 liter bottle, 5 liter cup, and 3 liter dog dish. You need to move the wiper fluid around until you end up with 4 liters.
- In one episode of Cyberchase, the kids and Digit have to input exactly one cup of sand into a device to open a castle gate. Digit has a 2-cup and 3-cup measure, but is missing his 1-cup measure. At first they try filling the 2-cup halfway, but are unable to get it precise enough. Then they figure out they can fill the 3-cup measure, pour enough sand from it to fill the 2-cup, and be left with exactly one cup.