Water Jug Puzzles: How to Measure Exactly With Two Jugs
Water jug puzzles hand you two or more jugs with no markings except their full size and ask you to measure an exact amount. NRICH, the mathematics enrichment project at the University of Cambridge, has a version called Pouring the Punch Drink: start with a full 9 litre jug and empty 7, 4, and 2 litre jugs, then pour until three of the jugs hold exactly 3 litres each. Its second part asks what two jug sizes would let you measure every whole amount from 1 to 8 litres.
The simpler two-jug version comes first here: the allowed moves, a reliable method, a quick test for impossible targets, and three original puzzles. For each one, every possible sequence of moves was searched to confirm the fewest steps needed.
1. The rules
You have two jugs and an unlimited tap. A step is any one of these:
- Fill a jug completely from the tap.
- Empty a jug completely onto the ground.
- Pour from one jug into the other until the first is empty or the second is full, whichever happens first.
There are no markings, so you cannot fill a jug "halfway." The goal is to end with the target amount in one of the jugs.
2. The method: keep cycling in one direction
The most dependable approach uses one jug as the "source" and the other as the "sink":
- Fill the source jug.
- Pour it into the sink jug.
- Whenever the sink is full, empty it and keep pouring.
- Whenever the source is empty, fill it again.
Because each pour leaves a remainder, this cycle steps through a series of different leftover amounts. Sooner or later it lands on the target, if the target is possible. Running the cycle in the opposite direction (big jug as source instead of small) is sometimes shorter, so it is worth trying both. NRICH's guidance on working systematically recommends recording results in a structured way, and a two-column table of "small jug, big jug" after each step does exactly that.
3. The impossibility test
Find the largest whole number that divides both jug sizes exactly (the greatest common divisor). Every amount you can ever create is a multiple of that number. Fills and empties change a jug by a whole jugful, and a pour moves either everything in one jug or exactly the space left in the other, so a jug that starts at a multiple always stays at a multiple. If the target is not a multiple of it, no sequence of moves can reach it.
When the two sizes share no common factor other than 1, every whole amount up to the larger jug is reachable. A search of every reachable state confirms this for the sizes used below.
4. Puzzle 1
You have a 5 litre jug and an 8 litre jug. Measure exactly 2 litres. What is the fewest number of steps?
5. Puzzle 2
You have a 4 litre jug and a 9 litre jug. Measure exactly 6 litres. What is the fewest number of steps?
6. Puzzle 3
You have a 6 litre jug and a 10 litre jug. Can you measure exactly 3 litres?
7. Answers
Puzzle 1: 4 steps. Amounts are shown as (5 litre jug, 8 litre jug).
| Step | Move | 5 L jug | 8 L jug |
|---|---|---|---|
| 1 | Fill the 5 L jug | 5 | 0 |
| 2 | Pour 5 L into 8 L | 0 | 5 |
| 3 | Fill the 5 L jug | 5 | 5 |
| 4 | Pour 5 L into 8 L until full | 2 | 8 |
The 8 litre jug only had room for 3 more litres, so 2 litres stay behind. No sequence of 3 or fewer steps reaches 2 litres.
Puzzle 2: 8 steps. Amounts are shown as (4 litre jug, 9 litre jug).
| Step | Move | 4 L jug | 9 L jug |
|---|---|---|---|
| 1 | Fill the 9 L jug | 0 | 9 |
| 2 | Pour 9 L into 4 L | 4 | 5 |
| 3 | Empty the 4 L jug | 0 | 5 |
| 4 | Pour 9 L into 4 L | 4 | 1 |
| 5 | Empty the 4 L jug | 0 | 1 |
| 6 | Pour the 1 litre into the 4 L jug | 1 | 0 |
| 7 | Fill the 9 L jug | 1 | 9 |
| 8 | Pour 9 L into 4 L until full | 4 | 6 |
The key move is step 6: parking 1 litre in the small jug means the next pour only takes 3 litres out of the big jug, leaving 6. A full search found no route shorter than 8 steps.
Puzzle 3: No, it is impossible. The greatest common divisor of 6 and 10 is 2, so every amount you can create is even: 0, 2, 4, 6, 8, 10, and so on. Three litres is odd, so no sequence of fills, empties, and pours will ever produce it. Spotting this up front saves you from pouring forever.
8. Tips for harder versions
- Write the state after every step. Two numbers per line is enough, and repeated states tell you that you are going in circles.
- Look for a useful remainder. In Puzzle 2, the 1 litre left over after two pours was the stepping stone. Ask what small leftover amount, added to or taken from a full jug, would give the target.
- With three or more jugs, like NRICH's punch puzzle, there is no tap: you only pour between jugs, so the total volume never changes. Track the total as a check.
9. Key takeaways
- A step is a fill, an empty, or a pour that stops when one jug is empty or the other is full.
- Cycling water from one jug into the other, emptying and refilling as needed, eventually produces every reachable amount.
- Every measurable amount is a multiple of the greatest common divisor of the jug sizes, which gives a fast impossibility test.
- With 5 and 8 litre jugs, 2 litres takes 4 steps; with 4 and 9 litre jugs, 6 litres takes 8 steps.
- Writing down both jug amounts after every step keeps you from repeating states.