The Die Hard problem
This particular problem was debuted in the 1995 film Die Hard With a Vengeance, which featured a
riddle
where a jug must contain 4 gallons of water by only using a 3 gallon, and 5 gallon jug. The transitions
required
are described in this .
One way of visualising this problem is by shooting a laser around a 60° parallelogram, with the bottom right
and top left corner as the laser exit or origin. As it bounces across the table, we note
down the
coordinates to indicate the state of both jugs.
The coordinate system has two axes, Jug X represented by the bottom line and Jug Y being represented by the
left line.
Together they form a warped coordinate system (Jug X, Jug Y).
Let p, q, and r be natural numbers with p>q, r. If the antagonist Simon gives you a p-gallon jug and a q-gallon jug and then asks you to fill one of the jugs with r gallons of water, then our approach will save your life iff r is a multiple of the greatest common divisor of p, and q.
Let p, q, and r be natural numbers with p>q, r. If the antagonist Simon gives you a p-gallon jug and a q-gallon jug and then asks you to fill one of the jugs with r gallons of water, then our approach will save your life iff r is a multiple of the greatest common divisor of p, and q.
"On the fountain are two jugs. Do you see them? A 5 gallon and a 3 gallon. Fill one jug with exactly 4 gallons of water. Place it on the scale, and the timer will stop. You must be precise. 1 ounce or more or less will result in detonation."
If you wish to view all collisions, set the target value higher than Jug X. Check out other options within
settings, such as scaling, line thickness, step size and showing coordinates.
Find a solution to your jug problem!
Visualisation by William Zhang and Harris Perdikoyiannis
Information source: Mathologer
Page authors: Regan Harper, Harris Perdikoyiannis and William Zhang