Water-Jars Problem (Properties of using 2 Jars for the problem)

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 n­2 ÷ 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.

Step15 Litre Jar Capacity4 Litre Jar Capacity
Fill the 15L jar150
Pour water from the 15 L jar into the 4L jar15 – 4 = 114
Empty the 4L jar110
Pour water from the 15 L jar into the 4L jar11 – 4 = 74
Empty the 4L jar70
Pour water from the 15 L jar into the 4L jar7 – 4 = 34
Empty the 4L jar30
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 jar3 – 3 = 03
Fill the 15L jar153
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 jar15 – 1 = 144
Empty the 4L jar140
Pour water from the 15 L jar into the 4L jar14 – 4 = 104
Empty the 4L jar100
Pour water from the 15 L jar into the 4L jar10 – 4 = 64
Empty the 4L jar60
Pour water from the 15 L jar into the 4L jar6 – 4 = 24
Empty the 4L jar20
Pour water from the 15 L jar into the 4L jar2 – 2 = 02
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 jar152
Pour water from the 15 L jar into the 4L jar15 – 2 = 134
Empty the 4L jar130
Pour water from the 15 L jar into the 4L jar13 – 4 = 94
Empty the 4L jar90
Pour water from the 15 L jar into the 4L jar9 – 4 = 54
Empty the 4L jar50
Pour water from the 15 L jar into the 4L jar5 – 4 = 14
Empty the 4L jar10
Pour water from the 15 L jar into the 4L jar1 – 1 = 01
Note that we are left with 1L now in the 4L jar leading to a new set of volumes
Fill the 15L jar151
Pour water from the 15 L jar into the 4L jar15 – 3 = 124
Empty the 4L jar120
Pour water from the 15 L jar into the 4L jar12 – 4 = 84
Empty the 4L jar80
Pour water from the 15 L jar into the 4L jar8 – 4 = 44
Empty the 4L jar40
Pour water from the 15 L jar into the 4L jar4 – 4 = 04

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 obtained15 Litre Jar Capacity
11th value1
7th value2
3rd value3
14th value4
10th value5
6th value6
2nd value7
13th value8
9th value9
5th value10
1st value11
12th value12
8th value13
4th value14

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:

  1. Oxford Reference. 2022. water-jar problem. [online] Available at: <https://www.oxfordreference.com/view/10.1093/oi/authority.20110803121257782> [Accessed 15 January 2022].
  2. 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].
  3. 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].