logo
Interesting Math Problem   Math Problems Home  |  Home  |  Send Your Feedback

The Old Water Jugs Problem

Given two unmarked jugs, one which holds 7 liters,
and another which holds 11 liters,
an unlimited supply of water, and no need to conserve,
how do you measure exactly 6 liters?

Problems of this type have been around for a long time,
but only recently did I realize that they are Diophantine equation
problems in disguise.

If we add 7's and subtract 11's, eventually we'll get to 6, or whatever other number is desired.

We just need to solve 7x - 11y = 6

I have another page which does that, but here I'll work this one out.

7 (x - y) - 4y = 6.
Let w = (x-y)
7w - 4y = 6
3w + 4 (w - y) = 6
Let v = w - y
3w + 4v = 6
We can solve this by inspection: v = 0, w = 2.
Then work backwards:
0 = 2 - y
y = 2
x - y = 2, x = 4
7 * 4 - 11 * 2 = 28 - 22 = 6.

If we fill the 7 liter jug 4 times,
and empty the 11 liter jug twice,
we'll have our 6 liters.

We proceed as follows:
ActionCount 7L jug11L jug
Start 0 0
Fill 7 (1) 7 0
Pour into 11 0 7
Fill 7 (2) 7 7
Pour into 11 3 11
Empty 11 [-1] 3 0
Pour into 11 0 3
Fill 7 (3) 7 3
Pour into 11 0 10
Fill 7 (4) 7 10
Pour into 11 6 11
At this point we have our 6, and don't need to carry out the last step, but it fits the equation better if we do.
Empty 11 [-2] 6 0