How can you measure out six liters of water?

678 Views Asked by At

You want to prepare a tub for your favorite game, dunking for apples. You have two buckets. One of the buckets will hold $4$ liters of water and the other will hold $9$ liters. There are no markings on either bucket to indicate smaller quantities. How can you measure out $6$ liters of water using only these two buckets and the tub?

1

There are 1 best solutions below

0
On

This reduces to finding integer solutions in $a, b$ to the diophantine equation

$$4a + 9b = 6$$

We see that $(a,b) = (6,-2)$ is a solution, i.e. pour in $6\times4$ litres, and remove $2 \times 9$ litres. This pair can in fact be computed deterministically using the extended Euclidean Algorithm.

From this base pair of solutions it is possible to construct all the other possible solutions (as described here):

$$(a,b) = (6 + 9n, -2 - 4n)$$

for integers $n$.