The Chameleon Puzzles
Solution


Puzzle 1: It is not possible for all the chameleons to have the same color.

One way to start thinking about this puzzle is to notice that when a yellow and blue chameleon meet and make two green chameleons, the numbers Y and B go down by 1, and the number G goes up by 2. In other words, the distance between G and either Y or B changes by 3. In other words, the transformation has left unchanged the quantities

mod ( G - Y, 3 )
mod ( G - B, 3 )

Now let's remain focused on just these two special quantities, and consider whether the other two kinds of meetings could change them. If a green and a yellow chameleon meet, making a blue one, then we have

mod ( ( G - 1 ) - ( Y - 1 ), 3 ) = mod ( G - Y, 3 )
mod ( ( G - 1 ) - ( B + 2 ), 3 ) = mod ( G - B - 3, 3 ) = mod ( G - B, 3 ).
so no change occurs there, and you can convince yourself that no change occurs when a pair of yellow chameleons is created either.

Now, suppose that, by some series of meetings, we were able to make all the chameleons green. Then it would have to be the case at this final state that the values of the two quantities would be

mod ( G - Y, 3 ) = mod ( 45 - 0, 3 ) = 0
mod ( G - B, 3 ) = mod ( 45 - 0, 3 ) = 0.

But we started out with

mod ( 15 - 17, 3 ) = mod ( -2, 3 ) = 1
mod ( 15 - 13, 3 ) = mod ( 2, 3 ) = 2,
and from what we said, neither of these numbers can ever change. Therefore, from the given initial setup, we cannot end up with all green chameleons. It turns out that similar arguments show that we can't get all yellow, nor all blue chameleons.


First, you should realize that the only thing that matters is how many times we apply each machine. In other words, if we know that someone has applied the dogmatizer, categorizer, and rationalizer a total of I, J and K times respectively, then we know what has happened to the dog, cat and rat populations, and we don't need to know the particular order in which the operations were carried out.

Also, keep in mind that a negative value of I, J or Kis possible, and indicates using the corresponding device in the "reverse mode".

If we let dD, dC and dR represent the changes in the populations, then we can write the relationship between the device applications and the population changes as

        (-1  2  3 )   ( I )   ( dD )
        ( 1 -1  1 ) * ( J ) = ( dC )
        ( 1  1 -1 )   ( K )   ( dR )
      
which has the form A*x=b.

Next we note that the matrix A is nonsingular, with inverse:

               (  0   5   5 ) 
       1/10 *  (  2  -2   4 )
               (  2   3  -1 )
      

Subpuzzle A: To ask for some rats, no dogs and no cats is to seek a solution with (dD,dC,dR) = (0,-1,N) where N is some positive integer. For any N, multiplying this vector by the inverse of A gives us the corresponding necessary applications:

        ( I )                   ( dD )   (  5 * N - 5 ) / 10
        ( J ) = inverse ( A ) * ( dC ) = (  4 * N + 2 ) / 10
        ( K )                   ( dR )   ( -1 * N - 3 ) / 10
      
It is natural to desire integer solutions, and this occurs for infinitely many N, with the smallest value being N = 7, requiring 3 applications of the dogmatizer, 3 of the categorizer, and one reverse application of the rationalizer to achieve the result of no dogs, no cats, and 7 rats.

Subpuzzle B: To ask for some dogs, no cats and no rats is to seek a solution with (dD,dC,dR) = (N,-1,0) where N is some positive integer. For any N, multiplying this vector by the inverse of A gives us the corresponding necessary applications:

        ( I )                   ( dD )     ( 0 * N - 5 ) / 10
        ( J ) = inverse ( A ) * ( dC ) =   ( 2 * N + 2 ) / 10
        ( K )                   ( dR )     ( 2 * N - 3 ) / 10
      
and it is clear that no choice of N will enable us to avoid the fact that a solution to this problem requires that I = -1/2, an unacceptable fractional value.

Subpuzzle C: To ask for more cats, no dogs and no rats is to seek a solution with (dD,dC,dR) = (0,N,0) where N is some positive integer. For any N, multiplying this vector by the inverse of A gives us the corresponding necessary applications:

        ( I )                   ( dD )   (  5 * N ) / 10
        ( J ) = inverse ( A ) * ( dC ) = ( -2 * N ) / 10
        ( K )                   ( dR )   (  3 * N ) / 10
      
And this is easily satisfied by N = 10 (or any multiple of this value), meaning 5 dogmatizers, -2 categorizers and 3 rationalizers will give us no dogs, 11 cats, and 0 rats.


Last revised on 20 April 2004.