top of page

The Water Jug puzzle: logical solution

  • Writer: Physics  Core
    Physics Core
  • Feb 17
  • 4 min read

Updated: Apr 6


You probably remember the iconic scene from Die Hard with a Vengeance, where John McClane had 5 minutes to solve the Water Jug puzzle. The supercop completed the task successfully, demonstrating remarkable logical skills. The film brought this classic problem into popular culture, with numerous websites repeating his steps. However, a logical puzzle warrants more than just a simple rundown of moves. In this article, we use logic to show how to crack these puzzles fast. The method described will allow you to create and solve a puzzle of any complexity within minutes.



PROBLEM. You have an unlimited supply of water and two jugs: one holds 5 gallons, and the other holds 3 gallons. Using only these jugs, you must measure exactly 4 gallons of water in one of them.



Film still showing a man holding a telephone receiver with an overlay graphic of 5-gallon and 3-gallon water jugs, referencing the classic water jug puzzle
Fig.1. John McClane, played by Bruce Willis, receives the Water Jug challenge from the villain.


 LOGICAL SOLUTION 


We begin with one jug full of water and the other empty. Although the gallons of empty space might seem like nothing, in terms of measuring units, they are equivalent to gallons of water. By designating (+) for gallons of water and (-) for gallons of space, we can document each step of the solution in a simple format. Thus, if we fill the 5-gallon jug (5G) and leave the 3-gallon jug (3G) empty, the initial conditions can be denoted as: +5 -3. On the other hand, if we fill in the 3G and leave the 5G empty, the initial conditions are -5 +3.


As you can see, we merely flip the signs. Consequently, it doesn't matter which jug you fill to begin the puzzle. The solutions will mirror each other. I provide them both to demonstrate the equivalence and interchangeability of positive and negative signs. This puzzle illustrates the arithmetic principles formulated by Euclid in his Elements around 300 BCE. Exploring them at a fundamental level allows us to appreciate ancient wisdom and see how these principles work in practice.



SOLUTION A (used in the film)


Step 1. We begin with the 5G full (+5) and the 3G empty (-3). Expressing this situation in arithmetic form clearly indicates the next step:

+5 -3 = +2


Following this instruction, we pour water from the 5G jug (+5) into the empty 3G jug (-3) until the latter is full. This leaves the 5G with 2 gallons of water (+2). The new volume (+2) doesn't solve the puzzle. So we proceed to the next step. We can now discard water in the 3G as it is no longer needed.

Step 2. To advance the solution, we need to create another volume using (+2) and a jug. Always opt for the smaller jug, which in this instance is the 3G. This combination signifies the next step as:


+2 -3 = -1


Following this instruction, we transfer 2 gallons of water (+2) from the 5G to the empty 3G (-3). This step produces 1 gallon of free space (-1) in the 3G.



Step 3. The 1 gallon of free space (-1) solves the puzzle. The solution can now be described as:


+5 -1 = +4


All we have to do is fill the 5G with water (+5) and dump 1 gallon into the 3G that has 1 gallon of free space (-1). The 5G now holds 4 gallons of water as requested.




SOLUTION B (not featured in the film).


Step 1. Alternatively, we can begin with the 3G full (+3) and the 5G empty (-5), recoding it as:


+3 - 5 = -2


We pour water from the 3G (+3) into the empty 5G (-5). This operation results in the 5G having 2 gallons of space (-2). Compare this result with the previous one, where Step 1 produced 2 gallons of water (+2). This pattern will hold across all cases. The alternative solution merely reverses the signs.


Step 2. We now have 2 gallons of space (-2) in the 5G. This volume doesn't solve the puzzle, so we must use the (-2) and the smaller 3G jug. Writing this condition as an equation suggests the next action as:


+3 -2 = +1 


Accordingly, we fill the 3G with water (+3) and pour it into the 5G, which has 2 gallons of free space (-2). This results in 1 gallon of water (+1) remaining in the 3G. Note that the earlier solution made 1 gallon of space (-1) at this stage. We can now discard the water in the 5G.


Step 3. The 1 gallon of water (+1) solves the puzzle. The solution can now be written as:


+3 +1 = +4


To complete the puzzle, we transfer 1 gallon of water (+1) from the 3G to the empty 5G. Then we refill the 3G and add 3 gallons (+3) to the 5G. The 5G now holds the 4 gallons of water (+4) as requested.


CONCLUSION. You can tackle any puzzle of this nature fast by following these simple steps. They provide a direct path to the solution, removing the need for random moves. Mathematics was created for a purpose; even in its early stages, this discipline introduced structure and order to our chaotic world. Even the most complex puzzle can be solved quickly by running these simple steps. In our case, the steps are as follows:


Step 1: 5 - 3 = 2;

Step 2: 3 -2 = 1;

Step 3: 4 = 5 - 1 or 4 = 3 + 1.


Once the steps are identified, you can fill a container of your choice and then mark them both accordingly. The signs will guide you through the actions, indicating how you work with containers to make the volumes featured in the steps.





The enduring appeal of this Puzzle lies in its unique blend of mathematical formalism and cinematic drama. Popular culture often presents it as a feat of quick thinking. Yet its true value emerges when we recognize the underlying logic that can turn seemingly impossible tasks into predictable outcomes. You can relive this iconic scene in this YouTube video and enjoy the action all over again.

Comments


Don't miss a post

Thanks for submitting!

bottom of page