Many of you might have heard about the famous problem of water and jugs. It goes as follows:

There are n jugs each having particular capacity (all unique) and unlimited supply of water. The problem is to find whether a particular value, say w, be measured from the given jugs.

To make it simple, say there are 2 jugs of capacity 5L and 3L each. The problem is  to find whether 4L can be measured?

Well many of you know the solution, and it can be found at many of the places!!!

* Fill the 3l, pour into 5l

* Fill the 3l, pour into 5l (1l remaining in 3l jug)

* Empty the 5l an pour into it the water from 3l, that is 1l

* Fill the empty 3l and pour into 5l jug and done.

What to do with diophantine equations?

I am not sure!!! but this one could be possible.

Let the capacities be a,b,c,d and the final quantity to be measured be p, consider the following equation.

ax + by + cz + dw = p…………………….(1)

The result which I am not sure of (:D) :

The problem (of water – jug ) has a solution if (1) has solution. (1) has a solution only when gcd (s,b,c,d) = kp, where k = 1,2,3,4,..

How do I verify both problems are the same ??