In the film Die Hard 3, the protagonists have been presented with a problem of how to fill a water can with exactly 4L using a 3L and a 5L tank with an unlimited supply of water [3]. Although the problem, increased in popularity with the film the problem has been around for a while in the psychology area. The problem is known as the water-jar problem and is normally applied with 3 jars [1][2]. However, for the purpose of this article the film line of using 2 water jars/cans is taken into consideration.
When looking at the problem with 2 jars from a Mathematical perspective 2 main questions arise:
- Are there any properties that define the problem?
- Is it possible to generate all positive numbers lower than the largest value using any combination of 2 numbers?
The answer to these questions is yes and no. The properties that the problem follows are:
- For any 2 numbers, s (for small jar) and l (for large jar)
\forall s,l \in\mathbb{N}\ | \ 1<s<l - If s and l have a common factor, which is not 1, or l is a multiple of s, then the multiples of the smallest common factor can be achieved
- Otherwise, all numbers from 1 up to l can be achieved.
“For any 2 numbers where n2 ÷ n1 leaves a remainder, then using combinations of adding and subtracting water across the 2 jars, all whole numbers (natural numbers) less than n2 can be achieved”
Why having a remaining water is important? The remaining water in any of the jars, as long as the other jar is empty will shift the value that can be achieved through the moving of water across jars.
Let’s take an example. Assuming we are provided with 2 jars, one 4 litres and the other is 15 litres.
Starting from the first point, the values 4 and 15 have no common factors. This means that all values less than 15 should be possible. Let’s have a look.
Step | 15 Litre Jar Capacity | 4 Litre Jar Capacity |
---|---|---|
Fill the 15L jar | 15 | 0 |
Pour water from the 15 L jar into the 4L jar | 15 – 4 = 11 | 4 |
Empty the 4L jar | 11 | 0 |
Pour water from the 15 L jar into the 4L jar | 11 – 4 = 7 | 4 |
Empty the 4L jar | 7 | 0 |
Pour water from the 15 L jar into the 4L jar | 7 – 4 = 3 | 4 |
Empty the 4L jar | 3 | 0 |
Now is where the remaining 3L in the 15L jar can be used to shift the values that can be obtained using the same process as above | ||
Pour water from the 15 L jar into the 4L jar | 3 – 3 = 0 | 3 |
Fill the 15L jar | 15 | 3 |
Now the 4L jar already contains 3L therefore only 1L can be poured from the 15L | ||
Pour water from the 15 L jar into the 4L jar | 15 – 1 = 14 | 4 |
Empty the 4L jar | 14 | 0 |
Pour water from the 15 L jar into the 4L jar | 14 – 4 = 10 | 4 |
Empty the 4L jar | 10 | 0 |
Pour water from the 15 L jar into the 4L jar | 10 – 4 = 6 | 4 |
Empty the 4L jar | 6 | 0 |
Pour water from the 15 L jar into the 4L jar | 6 – 4 = 2 | 4 |
Empty the 4L jar | 2 | 0 |
Pour water from the 15 L jar into the 4L jar | 2 – 2 = 0 | 2 |
Note that we are left with 2L now in the 4L jar which means that a new range of capacities can be achieved in the 15L jar | ||
Fill the 15L jar | 15 | 2 |
Pour water from the 15 L jar into the 4L jar | 15 – 2 = 13 | 4 |
Empty the 4L jar | 13 | 0 |
Pour water from the 15 L jar into the 4L jar | 13 – 4 = 9 | 4 |
Empty the 4L jar | 9 | 0 |
Pour water from the 15 L jar into the 4L jar | 9 – 4 = 5 | 4 |
Empty the 4L jar | 5 | 0 |
Pour water from the 15 L jar into the 4L jar | 5 – 4 = 1 | 4 |
Empty the 4L jar | 1 | 0 |
Pour water from the 15 L jar into the 4L jar | 1 – 1 = 0 | 1 |
Note that we are left with 1L now in the 4L jar leading to a new set of volumes | ||
Fill the 15L jar | 15 | 1 |
Pour water from the 15 L jar into the 4L jar | 15 – 3 = 12 | 4 |
Empty the 4L jar | 12 | 0 |
Pour water from the 15 L jar into the 4L jar | 12 – 4 = 8 | 4 |
Empty the 4L jar | 8 | 0 |
Pour water from the 15 L jar into the 4L jar | 8 – 4 = 4 | 4 |
Empty the 4L jar | 4 | 0 |
Pour water from the 15 L jar into the 4L jar | 4 – 4 = 0 | 4 |
At the end of all the movements all possible volumes have been achieved since once the 4L jar is emptied the values will start to repeat. Highlighting all the different volumes obtained in the 15L and putting them in sorting order, one can see that all values lower than 15 has been obtained.
The table below shows the values obtained in ascending order and the sequence they were achieved
Order in which they obtained | 15 Litre Jar Capacity |
---|---|
11th value | 1 |
7th value | 2 |
3rd value | 3 |
14th value | 4 |
10th value | 5 |
6th value | 6 |
2nd value | 7 |
13th value | 8 |
9th value | 9 |
5th value | 10 |
1st value | 11 |
12th value | 12 |
8th value | 13 |
4th value | 14 |
Another interesting observation is that the last cycle will always end up producing the multiples of the smallest jar. Why not try it out with a different combination and see the pattern?
The application of the aforementioned scope and properties, raise other questions to the curious mind:
- If more jars are added what properties can be observed? Is there a generic pattern?
- Looking at the sequences the different capacities are obtained. Do the values follow a pattern?
- Can the same properties be generalized to jars that hold half a litre, or rational values? Like using a 3.25L, or 5.5L jars.
- If the supply of water is limited:
- Are there evaluation properties that can optimise the way to arrive to needed values based on their characteristics?
- What is the minimum level of water needed based on the jars’ capacity?
References:
- Oxford Reference. 2022. water-jar problem. [online] Available at: <https://www.oxfordreference.com/view/10.1093/oi/authority.20110803121257782> [Accessed 15 January 2022].
- Theburningofrome.com. 2022. What is the water jar problem? – Theburningofrome.com. [online] Available at: <https://www.theburningofrome.com/blog/what-is-the-water-jar-problem/> [Accessed 15 January 2022].
- Wikihow.com. 2022. How to Solve the Water Jug Riddle from Die Hard 3 (with Pictures). [online] Available at: <https://www.wikihow.com/Solve-the-Water-Jug-Riddle-from-Die-Hard-3> [Accessed 15 January 2022].