If nowhere else, you might have come across this in the third “Die Hard” movie. We have 3 containers, of volumes 8, 5, and 3 gallons. The 8-gallon container is full. Using only the 3- and 5-gallon containers, split the contents evenly: 4 gallons in the 8-gallon container, and 4 gallons in the 5-gallon container.
If you don’t want to see a solution, move along, quickly.
(I found a missing graph-theory book – I thought I owned it, but couldn’t find it on my shelves, and I will eventually add it to the bibliography – and looked through it. It suggested that graphs could be used to work out puzzles like this. I hate to say it, but I found it more confusing to try to draw graphs for the first puzzle (a ferryman with dog, sheep, and cabbage; can’t leave the dog alone with the sheep, can’t leave the sheep alone with the cabbage – now get them all safely across the river in a tiny boat that carries the ferryman plus one), and I never even tried to draw graphs for this puzzle. After I got one solution, I persuaded Mathematica® to display the steps; and then I decided that it was okay to post recreational mathematics. It may be a stretch to call this “applied”, but I certainly enjoyed it. Yes, I’m sure I have solved this before, but I had to think about it….)
The key, as I saw it, was to get 1 gallon somewhere. It turns out, we really want 1 gallon missing from somewhere.
One possibility is to get 2 gallons in the 3-gallon container, and have a full 5-gallon container: then all we have to do is pour one gallon out of the 5- into the 3- and we will have 4 gallons in the 5-gallon container. That is the solution I show.
Another possibility is to get 7 gallons in the 8-gallon container, and have an empty 3-gallon container: then all we have to do is pour 3 gallons out of the 8- into the 3-, and we will have 4 gallons in the 8-gallon container. I’ll let you do that one.
Here we go. My goal is to get 2 gallons in the 3-gallon container. Black is liquid, white is empty volume.
We start with a full 8-gallon container….
We fill the 5-gallon container from the 8-….
Then we fill the 3-gallon container from the 5-. We’ve got our 2 gallons, now, but it’s in the 5-gallon container instead of the 3-….
No problem. Empty the 3- into the 8-….
Now we empty the 2 gallons from the 5- into the 3-….
Now we can do what we set out to do. We fill the 5- from the 8-….
Finally we can top-off the 3- from the 5-, which leaves us 4 gallons in the 5-gallon container. We are done in principle: we have 1, 3, and 4 gallons in the three containers….
To finish in practice, we empty the 3- into the 8-gallon container, and we have two containers each holding 4 gallons.