Tuesday, January 29, 2019

Water Jug Puzzles

Let me just begin by saying that I love mathematical puzzles. My favorite number is my favorite partly because it is the answer to the monkey problem. I love puzzles because they allow freedom to think and explore but have specific solutions. It's the process that is the fun part, though. And as the joke goes: "Q: How does a mathematician change a light-bulb? - A: They level the house thereby reducing it to a previously solved problem". One of my favorite parts about solving a puzzle is seeing all the solution processes and the mathematical basis that each process uses to find a single answer.

It follows that when I was reminded of the water pouring puzzle that I decided to dive deep into the mathematics of the problem. In order to keep this brief, I'll use a simpler 2 jug problem with virtual manipulatives rather than a traditional Tartaglian problem. (That and the 3 jug problem has been analyzed many times, with a variety of analyses: here is a single example.)

For those of you who are unfamiliar with the water pouring puzzle (and refused to follow the above links) here is a brief summary: You are given two jugs of different capacities (usually integer units) and an unlimited supply of water. You are asked to precisely measure a different amount (integer units of course) of water by filling jugs, pouring water between jugs, and emptying jugs. 

A simple example of this is when you are given a 5 liter jug, a 3 liter jug, and asked to measure 4 liters of water. Letting our 5 liter jug be F (for Five), our 3 liter jug be T (for Three), we show a solution:
Fill F, pour 3 liters into T, empty T, then pour 2 liters into T.
Fill F, pour 1 liter into T (which fills T), leaving F with 4 liters.
 












The solution process described is actually one that will work in all solvable cases. Fill the larger container, pour as much as possible into T, empty T, pour as much as possible into T [if T is full, empty T, and repeat until T is partially full], and repeat the cycle. This will cycle through all the possible combinations of water until we reach our desired amount. If the cycle repeats without us reaching the desired amount, the problem is unsolvable.

But WHY? Why does this always work? Or why are some problems unsolvable? [Prepare yourself for some house leveling...]

Since our jugs only contain finite amounts of water, this process of filling and pouring creates a cyclical group of amounts of water. I.e. If j and k are the water amounts of jugs with j > k, then j (mod k) is the amount left after one iteration of our solution process. After two iterations, we have 2j (mod k) liters of water. For any non-negative integer n, we can have nj (mod k) liters of water after n iterations. As k is finite, this creates a finite cyclical group with order (k / gcd(j, k)). 

Observe that if gcd(j, k) = 1, then we can get any amount of water up to k. Otherwise, we can only get multiples of gcd(j, k), which can be clearly seen by a simple example: Two even jugs can never measure an odd amount of water, because pouring will always yield an even amount in both jugs (an even minus an even is even). The same is true for any gcd(j, k) not equal to 1. Thus if we are asked to measure an amount of water where gcd(j, k) does not divide our desired amount this is an unsolvable problem. 

Side note: If you ever are asked by your students "When Will I Ever Use This" when learning about cyclical groups, just refer to this activity. Or read this article

But actually... What can we expect our students to learn if they were to do this activity? In my mind, I believe that we can probably expect students to recognize that there are some impossible problems. Depending on how long/how many problems our students are given, I feel that it is likely that students could recognize that the greatest common divisor has a role in which are possible and which are not. 

With digital manipulatives students are allowed to try a variety of different approaches. A few may try emptying and filling jugs randomly, but when given a sufficient amount of time and motivation, students tend to try to find patterns. This experimentation would help students to be more familiar with number patterns, how some numbers divide and leave remainders, or even provide a way that modular arithmetic might be introduced. 

Thus it has been shown. 

No comments:

Post a Comment