November 26, 2013

Restroom Illusions

There's something to tickle the eye just about anywhere you go at San Francisco's Exploratorium—even the restrooms.

The entryway to the main pair of restrooms features a dramatic array of black and white ceramic tiles, carefully arranged to recreate an optical effect known as the Café Wall Illusion. Described and popularized by psychologist Richard Gregory, the illusion makes the parallel lines defining each row of tiles appear sloped at different angles to each other.

The tiles, alternating black and white, are in parallel rows, but because the rows are staggered, the dividing lines between the rows look slanted.

The effect is most dramatic when the grout between the tiles is an intermediate gray in color, rather than either black or white. In the Exploratorium installation, each of three walls features grout of a different color (gray in the middle, white on the men's side, and black on the women's side) so that viewers can judge the effect of grout color on the strength of the illusion.

The eye-dazzling show doesn't end there. Within the restrooms throughout the building, individual tiles feature other classic optical illusions—all shown in black against white.

The patterned tiles were custom manufactured, then scattered among the white tiles covering the walls.

That's quite a show for a simple rest stop.

Photos by I. Peterson

November 24, 2013

Counting on Success

The setup looks simple, but people attracted to the long row of nine-sided, wooden rings at the Exploratorium in San Francisco can't resist trying it—again and again.

Each ring bears the numbers from 1 to 9. You "shuffle" the rings, rotating them so that you can read a scrambled string of digits along the top of the row.

Starting at one end, you think of a number from 1 to 9, and you move along the top row from ring to ring according to the designated number. For example, if your chosen number is 4, you move over four rings along the row. The number on top of the ring on which you land gives you the number of steps for your next move, and so on. You continue in this way as far as you can go down the line and note the number on the ring where you end up.

Amazingly, when you do it again from the same end and with the same sequence of numbered rings but with a different starting number, you're almost sure to end up at the same ring.

Aptly titled "Sooner or Later," the Exploratorium exhibit is an ingenious variant of a card-guessing trick that magicians can use to show off their mind-reading prowess, even though its success is rooted in mathematical principle.

This particular prediction trick is known as the Kruskal count, named for physicist and mathematician Martin D. Kruskal.

The magician invites a subject to shuffle a standard deck of 52 playing cards and secretly pick a number between 1 and 10. The subject slowly and steadily deals out the cards one by one, face up, to form a pile. As she does so, she goes through the following counting routine: Suppose her secret number is 6. The sixth card that she deals becomes a "key" card, and its face value tells her how many more cards must be dealt to get to the next key card. For example, if the key card happens to be 7, she starts counting again, this time from 1 up to 7, to find the next key card. She repeats the procedure until all 52 cards are dealt. An ace counts as 1, and a king, queen, or jack count as 5.

At some point, she reaches a key card (perhaps the last card in the deck) that is not followed by enough cards for her to complete the count. This final key card becomes the subject's "chosen" card and the magician's mind-reading target.

No matter how steadily the subject deals out the entire deck (with no pauses at crucial moments or other hints of which cards are key), the magician still has a high probability of identifying the mystery card.

The reason is that, for many arrangements of the deck, every starting point leads to the same final key card. So, all a magician has to do is to select his own starting point, then count his way to the end while the subject is dealing the cards. He is very likely to end up at the same "chosen" card as the subject.

One way to see what is going on is to deal out a shuffled deck so that the cards form an array. I used colored chips to identify the key cards associated with each of the 10 possible starting points. Suppose the first card is a 10. The second chip goes on the 11th card in the array—an ace; the next chip goes on the adjacent card—a 7, and so on. Using chips of a different color, I started with the second card—a 5—and laid down a new trail. At some stage, the second trail happened to hit a card already marked by a chip. From that point on, the trails coincided.

The same behavior underlies the convergence of paths along the row of nine-sided rings in the Exploratorium exhibit. For typical "random" arrangements of the rings, you'll end up at the same ring, no matter what your starting number.

The trick doesn't work every time. For certain arrangements of the deck (or rings), one or two starting points may generate trails that never coincide with the others. In the case of a deck of 52 cards, however, the probability is about 5/6 that the magician ends up at the same card as the subject—assuming both magician and subject count accurately and correctly.

A magician can increase his chances of "guessing" correctly by starting with a card near the beginning of the deck. Giving royal cards a lower value (say, 2 instead of 5) and using two decks shuffled together also improve the odds of having trails intersect.

In 2001, Jeffrey C. Lagarias, Eric Rains, and Robert J. Vanderbei took a closer look at the Kruskal count. They used computer simulations and mathematical arguments to determine the effect of two parameters on the probability of success for the magician: the freedom to choose the initial key card and the freedom to assign values to the face cards. The researchers described their results in a paper titled "The Kruskal Count."

Lagarias, Rains, and Vanderbei compared three possibilities for assigning values to face cards. Suppose the values 11, 12, and 13 are assigned to the jack, queen, and king, respectively. In this case, the magician's probability of failure is about 0.34. Assigning the value 10 to all face cards lowers the failure probability to 0.29. Going with the usual rule of assigning the value 5 to face cards slashes the failure probability to 0.16. If the magician chooses the first card as his starting point, the failure probability drops further to 0.14.

"The magician should choose his key card value to be 1," the researchers concluded. "Assuming this strategy for the magician, the success probability of the original Kruskal count trick is just over 85 percent."

In general, "the effect of the choice of the magician's key card on the failure probability is small, at most 2.5 percent," they noted. "The choice to have face cards take the value 5 rather than 10 has a much larger effect on the failure probability than the magician's choice of first key card position."

The underlying mechanics of the Kruskal count also highlights how seemingly unrelated chains of events can lock together in sync after a while—a phenomenon worth watching for in other contexts.

It also calls to mind a comment by Sherlock Holmes in the story "The Disappearance of Lady Frances Carfax" by Arthur Conan Doyle: "When you follow two separate chains of thought, Watson, you will find some point of intersection which should approximate to the truth."


Gardner, M. 2000. Modeling mathematics with playing cardsCollege Mathematics Journal 31(May):173-177.

______. 1997. Sicherman dice, the Kruskal count and other curiosities. In Penrose Tiles to Trapdoor Ciphers. Mathematical Association of America.

______. 1956. Mathematics, Magic and Mystery. Dover.

Knopfmacher, A., and H. Prodinger. 2001. A simple card guessing game revisitedElectronic Journal of Combinatorics 8(No. 2):R13.

Mulcahy, C. 2000. Mathematical Card Tricks. American Mathematical Society. Oct. 1.

Photos by I. Peterson