Three Jug Problem

Given three jugs with x pints in the first, y in the second, and z in the third, obtain a desired amount in one of the vessels by completely filling up and/or emptying vessels into others. This problem can be solved with the aid of trilinear coordinates (Tweedie 1939).

A variant of this problem asks to obtain a fixed quantity of liquid x using only two initially empty buckets of capacities b_1 and b_2 and a well containing an inexhaustible supply of water.

This two bucket variant is used in the film Die Hard: With a Vengeance (1995). The characters John McClane and Zeus Carver (played by Bruce Willis and Samuel L. Jackson) solve the two bucket variant with two jugs and water from a public fountain in order to try to prevent a bomb from exploding by obtaining 4 gallons of water using only 5-gallon and 3-gallon jugs.

General problems of this type are sometimes collectively known as "decanting problems."

Explore with Wolfram|Alpha


Ball, W. W. R. and Coxeter, H. S. M. Mathematical Recreations and Essays, 13th ed. New York: Dover, pp. 28 and 40, 1987.Bogomolny, A. "3 Glasses Problem in Barycentric Coordinates.", A. "Three Jugs Problem.", A. "Two Pails Puzzle.", P.; Santini, M.; and Vigna, S. "Measuring with Jugs." Theoret. Comput. Sci. 282, 259-270, 2002.Coxeter, H. S. M. and Greitzer, S. L. "The Three Jug Problem." §4.6 in Geometry Revisited. Washington, DC: Math. Assoc. Amer., pp. 89-93, 1967.Dudeney, H. E. Amusements in Mathematics. New York: Dover, p. 109, 1970.Eddy, R. H. and Fritsch, R. "The Conics of Ludwig Kiepert: A Comprehensive Lesson in the Geometry of the Triangle." Math. Mag. 67, 188-205, 1994.Hegde, S. M. and Kulamarva, S. "A Graph-Theoretic Model for a Generic Three Jug Puzzle." 26 Aug 2023., C. and Ramirez Alfonsín, J. L. "Sharing Jugs of Wine." Disc. Math. 125, 279-287, 1994.O'Beirne, T. H. "Jug and Bottle Department." In Puzzles and Paradoxes. New York: Oxford University Press, pp. 49-75, 1965.Perel'man, A. I. Zanumatel'naya Geometria. Moscow, 1958.Steinhaus, H. Mathematical Snapshots, 3rd ed. New York: Dover, pp. 61-63, 1999.Trott, M. The Mathematica GuideBook for Programming. New York: Springer-Verlag, p. 104, 2004., M. C. K. "A Graphical Method of Solving Tartaglian Measuring Puzzles." Math. Gaz. 23, 278-282, 1939.

Referenced on Wolfram|Alpha

Three Jug Problem

Cite this as:

Weisstein, Eric W. "Three Jug Problem." From MathWorld--A Wolfram Web Resource.

Subject classifications