icon

Counter logic: Solution

Share this page

Counter logic: Solution

Counters

Imagine that I have three counters X, Y and Z. They are coloured red, white and blue, but not necessarily in this order. One, but only one, of the following statements is true:

X is red

Y is not red

Z is not blue

Can you work out the colours of the counters?

This puzzle was suggested to us by Ems Lord, as part of her wonderful article celebrating the bicentenary of the birth of George Boole.

Solution

We know that only one of the three statements is true. If we assume that each statement is true in turn we can see if that leads to a contradiction. Let's try the first statement. If "X is red" is true then "Y is not red" is false, forcing Y is be red — a contradiction since only one counter can be red. Now the second statement. If "Y is not red" is true then "Z is not blue" and "X is red" are both false. That forces Z to be blue and since X cannot be red, none of the counters is red — that's also a contradiction, since one of them must be red. Finally, consider the third statement to be true. If "Z is not blue" is true then "Y is not red" is false, making Y a red counter. The statement "X is red" is also false, leading to X being blue and Z being white as the solution.

We can also solve this puzzle using the binary algebra system developed by George Boole. A true statement comes with a truth value of 1 and a false statement with a truth value of 0. The AND operation is represented by multiplication and the OR operation by addition (see this article to find out more).

Let's write $X_r$ for the statement that counter $X$ is red, $Y_r$ for the statement that counter $Y$ is red, and so on. Here are some things we can deduce from the set-up. 1) Since one of the counters is definitely red, the statement "X is red OR Y is red OR Z is red" is true, so $$X_r + Y_r + Z_r = 1.$$ (The same is true for each of the other two colours.) 2) Since only one counter can be red, the statement "X is red AND Y is red" must be false, so $$X_r Y_r=0.$$ (The same is true for any pair of counters and for any colour.) 3) Since a counter can only have one colour, the statement "$Z$ is blue AND $Z$ is red" is false, so $$Z_bZ_r = 0.$$ (The same is true for any pair of colours and any counter.) Now suppose that the first statement is true, so $X_r = 1.$ This means that the second statement is false, so $$NOT(Y_r) = 0,$$ which means that $$Y_r = 1.$$ This implies that $$X_r Y_r=1,$$ contradicting fact 2) above. Hence the first statement is false. Suppose the second statement is true, so $$NOT(Y_r) = 1,$$ implying that $$Y_r = 0.$$ This means the other two statements are false, so $$X_r = 0\;\;\;\;\mbox{and}\;\;\;\;NOT(Z_b) = 0,$$ so $$Z_b=1.$$ By fact 3) above this means that $$Z_r = 0.$$ It follows that $$X_r + Y_r + Z_r = 0+0+0 = 0,$$ contradicting fact 1 above. Therefore, the second statement is false. It follows that the true statement must be the last one, so $$NOT(Z_b) = 1\;\;\;\;\mbox{which means that}\;\;\;\;Z_b = 0.$$ The first and second statements are false, so $$X_r = 0\;\;\;\;\mbox{and}\;\;\;\;Y_r = 1.$$ From fact 3) above it follows that $$Y_b = 0.$$ From fact 1) we have $$X_b + Y_b + Z_b = X_b + 0 + 0 =1.$$ Therefore $X_b = 1,$ which means that $Z_w = 1.$ Therefore, counter $X$ is blue, counter Y is red and counter Z is white.

Permalink
Comment

Even if his symbolism led to the logic gates of the modern computer, I still need someone to explain the precise advantages of the Boolean approach to this kind of puzzle over the succinct classical type of reasoning presented in the first paragraph in the above solution.

For one thing the original article on this website appears to promise us something better, and presumably quicker, than "trial and improvement". Yet both methods presented entail two steps: trying the first then the second statements to see what would follow from supposing them to be true, and finding them to result in contradictions. All that Boole seems to provide here is an extra layer of symbolism to decipher. How does it help specially, for example, to know that Xr + Yr + Zr = 1? And that it is contradicted by Xr + Yr + Zr = 0?

I could be missing the point of course, perhaps in hoping for some kind of algorithm or set of arithmetical rules that can be applied unthinkingly rather like steps in long division.

Chris G