You have two jugs: one with 3 liters and one with 5 liters. You have a tap with unlimited water. How can you measure exactly 4 liters of water? There are no measurement marks on the jugs, you can just fill them completely or empty them completely.
Home > Riddles > The water jugs
The water jugs
Hints
Show hints
- Visual procedure: We pour into the small one (3L).
- Visual procedure: Empty 3L jug: 2.
- We are using Euclid's algorithm to generate linear combinations: 4 = 2 × 5 - 2 × 3
Solution
Show full solution
Answer: Get to 4 liters in the 5 liter jug.
Visual procedure:
| Step | Action | 5L jug | 3L jug |
|---|---|---|---|
| 0 | Initial state | 0 | 0 |
| 1 | Fill 5L jug | 5 | 0 |
| 2 | Pour from 5L → 3L | 2 | 3 |
| 3 | Empty 3L jug | 2 | 0 |
| 4 | Pour 2L from 5L → 3L | 0 | 2 |
| 5 | Fill 5L jug | 5 | 2 |
| 6 | Complete 3L jug with 5L | 4 | 3 |
Explanation:
Step 1-2: First transfer
- We fill the large jug (5L)
- We pour into the small one (3L)
- There are 2L left in the large jug
Step 3-4: Save the 2L
- We empty the small jug
- We transfer the 2L to the small jug
Step 5-6: Second transfer
- We fill the large jug again (5L)
- The small jug has 2L, it only fits 1L more
- We pour 1L from the large jug to the small one
- Result: There are exactly 4L left in the large jug
Mathematical concept:
We are using Euclid's algorithm to generate linear combinations:
$$4 = 2 \times 5 - 2 \times 3$$
Rule of thumb: With $a$ and $b$ size jars, you can measure any multiple of $\gcd(a,b)$.
Related riddles
Keep practicing
If you enjoyed this one, try more pure-logic riddles, explore this theme, browse the full archive, or read the riddle-solving guide.