- Membership
- Publications
- Meetings
- Competitions
- Community
- Programs
- Students
- High School Teachers
- Faculty and Departments
- Underrepresented Groups
- MAA Awards
- MAA Grants

- News
- About MAA

**December 2010**

Hand out a blue-backed deck of cards for thorough shuffling. Take it back and fan it face-up, commenting on how randomly mixed it now is. Then say, "Actually, I was hoping for something less predictable. I just noticed that these cards are all facing the same way." With the deck still face-up, take off the top quarter to a third, flipp those cards over, and shuffle them into the remainder. "That's more like it," you say with satisfaction, as you demonstrate how truely jumbled the cards are now. If anyone wants to shuffle more, that's fine. (Perhaps a deck mixed such as we suggest here should be called a *shuduled* deck, which sees the same-way facing FF replaced by DU, the result having twice as many U's as D's.)

Rummage through the deck and casually drop several clumps of cards on the table, setting the rest of the deck aside. Straighten up the clumps of cards into a four by four grid, which may look something like this:

Address one of your audience. "I now want you to go through the rest of the deck and pick out a special card of your choice. Do not let me influence you in any way, and don't show it to me either." While this is being done, and until we indicate that it's safe to turn back, avert your eyes. Next request that this special card be placed on top of any card in the grid, face-up or face-down, in such a way that these two cards are not "in like states."

For the sake of argument, let's assume the special card is Black, say A♣. It could be placed face-down on top of any face-up card, or face-up on top of either a face-down card or a face-up Red card.

Finally, have the card which is now under the special card slid out, and pushed into the remainder of the deck. It's now safe for you to turn back.

"I honestly don't recall the state of the grid before you concealed your special card in it," you say, honestly. "So I have little chance of being able to pick out your special card now," you add, conveniently omitting to mention that there is a mathematical principle at work here which would indeed permit such a feat. Continue, truthfully, "Wouldn't it be impressive if somebody who has seen none of what has just happened could identify your card?"

Without further ado, have your mathemagical accomplice Matthew—whose existence was previously unknown to all assembled—summoned from a nearby room. Matthew surveys the scene, smiling mysteriously, and soon points to the special card. (If it's face-down, he can say if the card it replaced had been Black or Red, and if it's face-up, he can say if the card it replaced was of the opposite colour or face-down.)

As usual, the communication is entirely mathematical, and has nothing to do with any spoken or physical cues. This effect may be repeated--the grid will look different each time.

The card values play no role here, all that counts is whether a given card is seen to be Red, Black, or Blue. When you first get the shuffled deck back, and scan the card faces, seek four (preferably different) runs of consecutive cards of any of the eight types which appear as rows of the following table.

Down | Black | Black | Black |

Down | Red | Red | Red |

Black | Down | Black | Red |

Black | Black | Red | Down |

Black | Red | Down | Black |

Red | Down | Red | Black |

Red | Black | Down | Red |

Red | Red | Black | Down |

It's quite likely that you will be able to locate four such runs, in which case casually drop these as clumps on the table. If not, simply drop smaller clumps on the table in such a way that the rows of the displayed grid form the desired runs. The grid shown earlier shows examples of rows 4, 1, 3, and 8.

The above table could be memorized like a nursery rhyme, but we don't recommend that. Here instead are some tips for being able to find such runs fast, whose underlying logic (which becomes clear after the mathematics involved is explained later) is easy to remember.

Runs of the first two types are easy to spot. To locate runs of the other types, focus on the last three cards in the desired runs, as shown in the table: seek three cards in a row which are in different states, i.e., one Blue, one Black and one Red. Now consider these, in whatever order they are found, as looping in a 3-cycle, from left to right, and note what is to the immediate left of the face-down card in this loop. If it's Black, and the card to the left of the group of three being considered is Red, you have found a run such as in rows 3--5 in the above table. If it's Red, and the card to the left of the group of three being considered is Black, you have found a run such as in rows 6—8 in the above table.

The mathematics underlying this month's effect combines ideas from both the February 2010 *Card Colm* and the November 2010 *Card Colm*. We are using a *ternary* linear (2,2,4) error correcting code in which 2-trit messages *(a, b)* are encoded as 4-trit codewords *(a, b, a + b, b - a)*. Here *a* and *b* are *0, 1*, or *-1* (the last playing the role of *2*), and the rules of balanced ternary arithmetic apply, so that *1 + 1 = -1* and *-1 - 1 = 1*. The card effect uses the convention that *-1* = Red, *0* = Down, and *1* = Black.

There are *3 ^{2} = 9* possible codewords:

0 | 0 | 0 | 0 |

0 | 1 | 1 | 1 |

0 | -1 | -1 | -1 |

1 | 0 | 1 | -1 |

1 | 1 | -1 | 0 |

1 | -1 | 0 | 1 |

-1 | 0 | -1 | 1 |

-1 | 1 | 0 | -1 |

-1 | -1 | 1 | 0 |

The last eight rows of this should look familiar when expressed as follows. We didn't suggest the all Blue card back possibility earlier—the first row below—for "(too) obvious" reasons.

Down | Down | Down | Down |

Down | Black | Black | Black |

Down | Red | Red | Red |

Black | Down | Black | Red |

Black | Black | Red | Down |

Black | Red | Down | Black |

Red | Down | Red | Black |

Red | Black | Down | Red |

Red | Red | Black | Down |

We are relying on probability to enable you to locate four "already encoded" runs of four cards in a shuffled deck of face-up and face-down cards. The impact of the "special card" being switched for a card in the grid is to insert a single error, which this type of code can locate and correct.

There was a reason we recommended shuffling a quarter to a third—as opposed to to a half—of the deck into the remainder flipped over at the outset above: to result in a deck with a high probability of your being able to extract four rows with desirable runs.

There are alternatives for those who are concerned that the audience will spot that each row in your grid has exactly one Blue face-down card—corresponding to *0* in the ternary code, and that this somehow makes it easy for your accomplice. By displaying the grid with rows and columns transposed, this fact is disguised; another option is to use another ternary matching convention, such as one in which Blue corresponds to *1*. (In the latter case you should cut the deck into halves before shuffling to mix face-up and face-down cards. The resulting grid will have exactly one Black card in each row, but that's less likely to be spotted.)

In repeated performances of the effect as suggested, the audience will soon realize that while a grid with three or five face-down cards may speedily tip off your accomplice to something, that alone hardly makes it obvious how to identify exactly which card is the special one.

Which brings us to the task facing your accomplice: how does he "decode"? Namely, how does he survey the grid (post change) and identify the location and nature of the single switch in one row? An algebraic algorithm may be devised, and is fun to explore, but in keeping with the spirit of the earlier explanation of how to "encode" we now present an equation-free approach which lends itself to real life performance. We leave it to the keen reader to figure out how to speed this up in the case where the accomplice notices that there are not four face-down cards.

Note that he sees four rows, three of which are consistently coded, and one of which contains exactly one error. He must first identify which row contains the error, and then correct it.

Recall that in the last six rows of the tables above, there are three distinct states displayed in the last three slots, and a face-up card in the first slot, whereas in the earlier rows there are three face-up cards of the same colour in those final three slots, and a face-down card in the first slot. These reflect the status of the rows in which no switch was made, and limit the possibilities for the post-switch status of the row in which the special selected card has been placed.

It follows that if your accomplice sees three face-up cards of the same colour in the last three positions of any row, then he checks the first position. That row is error-free if and only if the first card is face-down, and so if the first card is face-up then it's the special card (occupying a position which was previously face-down).

It also follows that if your accomplice sees three face-up cards in three different states (one Red, one Black, one face-down) in the last three positions of any row, then once more there is no way that any of those could be the special card, and the question of whether that card is present in this row at all hinges on the first position. If the first card is face-down then of course it's the special card (but that still leaves open the question of whether that position was originally occupied by a Red or Black card).

Again, considering the three cards in different states as looping in a 3-cycle, your accomplice must note what is to the immediate left of the face-down card in that loop. There is no error in this row if and only if that card has opposite colour (in the Red/Black sense) to the card to the left of the group of three being considered. It should now be clear how to complete the decoding in the case where an error is detected.

What if your accomplice sees exactly two cards in the same state among the last three in some row? If the first card in that row is face-down, then the odd card out among the last three is at fault; it should agree with its neighbours. If the first card is face-up, then one of the two cards in the same state is at fault. There's only one change of state that could be made to one of those cards to restore the correct 3-cycle status to the last three cards, i.e., the one that puts a card of opposite colour to the first face-up one to the left (with respect to the loop) of the the face-down card among the last three: that nails the position of the special card as well as the original state of the card in that position.

Applying all of this to the display below, your accomplice should rapidly come to the conclusion that the error is in the third row.

Furthermore, since the first card in the third row is face-up, it's not the case that all three cards to its right are supposed to be Black; they should all be in different states. Finally, sinen the first card in the row is in fact Black, we should have a Red card to the left (with respect to the loop of three) of the current face-down one, namely where the Ace is. This confirms that the A♣ is the special card (where a Black card used to be).

One presentational option which avoids the need to rely on probability is to have a spectator deal two cards left to right, over and over, from the shuffled (or *shuduled*) deck to form two columns of any length. You then casually append two more cards to each of the resulting rows, ternary coding in real time. This also requires some fast thinking, and a modicum of luck, but you should have no trouble locating, say, a Black card followed by a face-down Blue one, to append to two Red cards, as needed.