# Measuring with Two Jugs

Measuring with Two Jugs

This Demonstration shows a graphic solution of the problem of measuring out liters of a liquid using jugs of capacity and liters, with integers. The solution seeks the minimal number of times jugs are to be filled and emptied. So we are looking for a solution (in integers) of the Diophantine equation with minimal . Another method for solving the equation can use two rulers with lengths that are multiples of and . The problem cannot be solved if does not divide .

c

a

b

a,b,c

ax+by=c

|x|+|y|

ax+by=c

a

b

gcd(a,b)

c