Water Jug Puzzles
Two jugs, an endless tap, and one exact target. Fill a jug, empty it, pour one into the other — and watch the amounts. Sixty puzzles across six jug pairs, each with a verified shortest solution and every step narrated: amounts, moves, and the reason the target is reachable at all.
Also known as the water pouring puzzle and the Die Hard jug riddle.
Every Move Changes The State
A water jug puzzle gives two jugs of fixed capacities and one target amount. Each move is one of six operations: fill a jug, empty a jug, or pour one jug into the other until the source empties or the target fills. The skill is tracking the state — the exact pair of amounts — and choosing operations that move the state toward the target.
How To Solve A Water Jug Puzzle
- Fill the big jug. Nearly every solution starts here.
- Pour into the small jug. The remainder left in the big jug is a new, smaller amount — the puzzle's real currency.
- Empty the small jug when it fills. The ground keeps the difference; the remainder survives.
- Repeat and watch the remainders. Each cycle produces a new remainder until one matches the target.
- Count your moves. The board compares your count with the shortest solution found by search.
The greatest common divisor decides everything. An amount is measurable only when it is a multiple of gcd(A, B). With 3-litre and 5-litre jugs the gcd is 1, so all amounts work. With 4-litre and 8-litre jugs the gcd is 4 — and only multiples of 4 can ever stand in a jug.
The Six Jug Pairs
| Pair | GCD | What makes it interesting |
|---|---|---|
| 3 L & 5 L | 1 | The classic pair — every amount reachable |
| 3 L & 7 L | 1 | Long lines make the counts run deep |
| 4 L & 7 L | 1 | No shared divisors, no easy repeats |
| 5 L & 8 L | 1 | The Die Hard pair — famous for one puzzle |
| 4 L & 9 L | 1 | The widest gap between the jugs |
| 5 L & 9 L | 1 | Long pours and large remainders |
Why The Remainder Is The Whole Puzzle
Pouring from a full big jug into an empty small jug leaves the big jug holding the difference — a new amount neither jug started with. Chain those remainders and every multiple of the gcd appears. The shortest solutions use this rhythm: fill, pour, empty, pour — the same four moves repeating with different numbers, until a remainder lands exactly on the target.
Water Jug Puzzles: Frequently Asked Questions
What is the water jug puzzle?
Two jugs of different capacities, an unlimited water supply, and a target amount. Fill, empty, and pour between them until exactly the target amount stands in one jug.
How do you solve the water jug puzzle?
Fill the big jug, pour into the small one, empty the small one when it fills, and keep the remainder moving. The state space is small, so the shortest solution is findable move by move.
Which amounts are possible in a water jug puzzle?
Exactly the multiples of the greatest common divisor of the two capacities. With 3 and 5 litres the gcd is 1, so every amount works; with 4 and 8 the gcd is 4, and only multiples of 4 are measurable.
What is the water jug puzzle in Die Hard with a Vengeance about?
The film's famous scene uses 5-litre and 3-litre jugs to measure exactly 4 litres: fill the five, pour into the three, empty the three, pour the remaining two across, refill the five, and top the three — four litres remain in the big jug. This site includes that exact puzzle.
How many puzzles are there?
There is no fixed number. Each puzzle is rebuilt from the short seed in the page address, so the supply is effectively unlimited. Copying the puzzle link saves that exact puzzle permanently.
Can I practise one pattern at a time?
Yes. Pick any pattern from the catalogue above and the board switches to that jug pair and depth only, with its own address you can bookmark or hand out.
Does the move order matter in water jug puzzles?
The goal is the amount, not the route. The board counts your moves against the shortest solution, and the hint names the next move of that shortest path from wherever you are.
Is the water jug puzzle good for learning maths?
Yes. It builds state-space thinking and leads naturally to the greatest-common-divisor rule: an amount is measurable exactly when it is a multiple of gcd(A, B).