Friday, December 5, 2008

Problem Solving

I decided to work on the piles of pennies problem this year. Here is my approach to the problem.

UNDERSTANDING THE PROBLEM
We have two drawers with pennies in them -- a left drawer and a right drawer. At the beginning, the left drawer contains 64 pennies while the right drawer contains none. We have two possible operations. If the left drawer contains an even number of pennies, then we may transfer half of them to the right drawer. Also, if the right drawer contains an even number of pennies, we may transfer half of them to the left drawer. Neither of these operations hold if the right drawer or the left drawer contain an odd number of pennies.

The problem requires us to find a way to get 48 pennies in one of the drawers (left or right).

DEVISING A PLAN
The first thing I notice when I look at the problem is that there is nothing we can do if either drawer contains an odd number of coins. Since the total number of coins in the drawers is even (64) then eventually we could get into a situation where each drawer contains an odd number of pennies (odd + odd = even). In this situation, there is essentially nothing we can do and we are in a deadlock.

For this problem, there are a number of paths we can take to come up with a solution. We can try to start at the solution and work our way backwards to the initial conditions of the problem (ie. go from having 48 coins in one drawer and 16 coins in the other drawer to having all 64 coins in one drawer and none in the other) or we can do a simple guess and check. My preferred plan is to do a guess and check with educated guesses (guesses that make sense given the situation we end up in) as it's gotten me quite far in similar problems in the past.

CARRYING OUT THE PLAN
We start with 64 coins in the left drawer and none in the right.

L R
64 0 (only one possible move since halving 0 is pointless)
32 32 (doesn't matter what move we make since we always get the same result)
16 48 (done!)

LOOKING BACK
Overall, this was a simple problem to solve but much more complex problems can be derived from it. We can make the problem different by changing the only real constants in the problem -- the total number of coins in the drawers and the number of coins we are trying to get into a single drawer. Say, for example, we had 100 coins in the left drawer at the beginning. Since 100 cannot be written in the form 2^n for some natural number n, it will definitely not be possible to get any number of coins less than or equal to 100 in either drawer. We can also extend the original problem to determine if it is in fact possible to come up with piles containing every possible number of pennies (every possible number of pennies = [0, 64]).

No comments: