In the New York Times’ Numberplay column yesterday, Gary Antonick presents an old but good logic puzzle:
There are twenty-six coins lying on a table in a totally dark room. Ten are heads and sixteen are tails. In the dark you cannot feel or see if a coin is heads up or tails up but you may move them or turn any of them over. Separate the coins into two groups so that each group has the same number of coins heads up as the other group. (No tricks are involved.)
I know it’s an old (and good) puzzle because I had read it before, and for this reason, some inkling of the solution was lurking in the back of my brain somewhere. I remember it being relatively simple but elegant. (It seems like the solution to every logic puzzle and half of mathematical proofs are elegant, and that “simple” solutions and “elegant” solutions are heavily overlapping subsets. But on second thought, maybe this one is merely cool or neat.)
My mostly faded memory of that solution involved moving the coins into two piles and turning over all of one pile, or 10 of one (or both) piles, or 16 of one (or both) piles, or maybe half of the coins, so I tried a few strategies in my head until I came across the right one.
You can’t see the coins, but you can feel them and count them as you move them and flip them. Clearly, you need to separate them into two groups before flipping them, because if you try a strategy of flipping and then grouping them, you won’t be able to tell which ones you’re moving!
Separate the 26 coins into a left and a right group of 10 and 16, respectively. The left group has between 0 and 10 coins that are heads up, and the right group has 10 minus that number heads up. Assume the left group has nothing but 10 heads-up coins, meaning the right group has 0 heads-up coins. Flip over all 10 coins in the left group, resulting in 0 heads-up coins, the same as the right group.
Or assume the left group has 9 heads-up coins and 1 tails-up coin. Flip all 10 over, resulting in 1 heads-up coin, the same as the right group.
Or assume the left group has 8 heads-up coins and 2 tails-up coins. Flip all 10 over, resulting in 2 heads-up coins, the same as the right group.
You can verify that this pattern continues all the way down to 0 heads-up coins in the left group, which, when flipped over, become 10 heads-up coins, the same as the right group.
So no matter how many heads-up coins start in the left group of 10, after flipping them all over, this number becomes the same as the number of heads-up coins on the right side!
The math behind it
I did not arrive at that solution by deduction or the use of any math or equations. Rather, I arrived at it by drawing on my vague memory of reading the solution two or three years ago and by performing a lot of trial and error in my head. When I pose this logic puzzle to my children several years from now, I will tell them what I think is the best way to solve this puzzle: to try a bunch of things until you come up with the winning strategy and explain why it works afterwards, not to come up with a theory to explain what should work and then verify it with several iterations.
But there is, of course, algebra to explain why that solution works:
In the left group of 10 coins, there are n heads and 10–n tails. In the right group, there are 10–n heads and 16–(10–n)=6+n tails. Of those four quantities, it is easy to notice that two of them are represented by the same expression: there are 10–n tails in the left group and 10–n heads in the second group. (This happens because we have chosen the group sizes wisely.) To take advantage of this fact, we need to perform some action that makes the two 10–n expressions refer to two sets of heads instead of one set of heads and one set of tails. As we now know, we must flip over all 10 coins in the left group. This converts the n heads to n tails (not entirely relevant) and the 10–n tails to 10–n heads. Now there are 10–n heads in both groups!