### Magical Mathematics

Many book authors end their book Introduction expressing the hope that readers will enjoy reading the book as much as the author(s) enjoyed writing it. Persi Diaconis and Ron Graham do not. Nonetheless, their book - Magical Mathematics - oozes their enjoyment at writing it. The authors are master storytellers. Movingly, Martin Gardner wrote Foreword in April 2010 - probably just a month before he died - where he highly praised the book.

The book is about mathematics of some card tricks, shuffling and juggling. Curiously, one of the authors started his career as a magician, the other as a juggler. Both were drawn into mathematics while in search of explanation for the artistic acts.

After proving the book's first theorem that explained the workings of a card trick in Chapter 1, the authors remarked,

Did the proof we just gave ruin the trick? For us, it is a beam of light illuminating a fuzzy mystery. It makes us just as happy to see clearly as to be fooled.

Later on (p. 66) they relate to the kind of tricks highlighted in the book:

Often this principle is combined with some sleight of hand, making the trick unsuitable for this book.

Martin Gardner wrote in the Foreword,

Not only is this book a superb, informally written introduction to mathematical magic, but near the book's end the authors supply pictures and biographical sketches of magicians who have made the greatest contributions to mathematical magic, from the reclusive Charles Jordan to the eccentric Bob Hammer.

Best of all, you will be introduced to many little known theorems of advanced mathematics. The authors lead you from the delightful self-working magic tricks to serious math, then back again to magic. It will be a long time before another book so clearly and entertainingly surveys the vast field of mathematical hocus-pocus.

Chapters 2-4 devoted to the de Bruijn sequences are the case at hand. There are several transitions from card tricks to mathematics to tricks to mathematical conjectures and back to tricks. The de Bruijn sequences find applications in robotic vision, code making, DNA sequencing (plus philosophy), and numerous card tricks.

In Chapter 5 the authors introduce the *Gilbreath Principle* that asserts certain invariants under permutations (naturally called *Gilbreath permutations*) of a card deck induced by straight cuts, dealing a part of the deck and then riffle shuffling the two piles. Several card tricks exploit variants of this idea. Most surprisingly there is a connection between Gilbreath permutations and periodic points of the Mandelbrot set.

The Mandelbrot set consists of complex numbers c for which iterations _{n+1} = z²_{n} + c,_{0} = 0,

Chapter 6 is a comprehensive introduction into the magic and mathematical properties of various shuffles. The authors remark,

By the end (of the Chapter, AB), the reader will have a graduate course in the basic shuffles used in card magic. We sill also see that the different shuffles are all part of one picture, showing the power of mathematics.

As a basic example, a perfect shuffle requires to cut a deck into two equal size piles and then intermingle the piles card-by-card. There are two kinds of perfect shuffles: the out-shuffle leaves the top card on top; the in-shuffle places the top card second from the top. Is it possible to move the top card to position N from the top by successful shuffles? Yes. To this end, represent N-1 in binary arithmetic, interpret (left-to-right) the ones as in-shuffles and the zeros as out-shuffles, and perform those in a sequence. This was an early-1950s discovery of Alex Elmsey. The task of moving a card at position N to the top proved much more difficult and was only resolved in 1996.

Chapter 7 throws light on historical evolution of mathematical magic (including highlights on the authors' early math encounters.) They point to two 1584 books (one English, the other French) and then to Gaspard Bachet's *Problem Plaisants and Delectables Qui se sont par les Nombres* published in 1612. The common thread is formed by the 3-object divination trick. (Three spectators are given, say, 1, 2, and 3 pennies and choose one of three distinct objects each. Depending on the received object, the spectators are asked to add to their treasures the amount they have, or double as much, or 4 times as much. The magician then determines the objects the spectators chose.) Bachet appears to have proved the very first theorem of mathematical magic: there is no straightforward extension of the trick to four or more objects. But there are some, by Bachet himself, in particular.

Further research shows some magic-like exercises in the 1202 Leonardo Fibonacci's *Liber Abaci*. The authors characterize Fibonacci's examples just as plain arithmetic exercises not very suitable to be performed in public.

Based on the number of magical tricks contained in the two 1584 books, the authors derive an estimate (via the capture/recapture method) for the total number of tricks in common use at that time as 563!

Chapter 8 presents the ancient and mysterious *I Ching* - a book woven into Taoist and Buddhist religion. Besides describing several tricks of various degrees of ingenuity, the chapter deals with related arithmetic and probability questions. *I Ching* gives the authors a valid reason to wonder why the study of probability began so late in history; for, *the earliest known systematic probability calculations appeared around 1650 in the work of Pascal and Fermat*.

Chapter 9 is a gentle introduction into the art of juggling. The chapter ends with a juggling lesson, including extensive explanation and sequences of photographs to elucidate the theory. There is also a very nice piece of mathematics.

Balls go up and come down. The successive times of their staying in the air contain a significant amount of information about the juggling process. Commonly, the process is periodic and thus admits a short description by means of a finite sequence of the hanging-in-the-air times. Some sequences are *juggleable*, some are not. A sequence _{1}, t_{2}, ..., t_{n})_{i}_{1}, t_{2}, ..., t_{n})_{1}, t_{2}, ..., t_{n})_{1} + t_{2} + ... + t_{n})/n.

Chapter 10 contains biographical sketches (including their magic tricks) of seven outstanding magicians who spruced their trade with mathematical magic. All are fascinating, some eccentric, people. Before he grew famous and before he began turning *dozens of innocent youngsters into math professors*, Martin Gardner was poor but refused to take a corporate job; for, *he wanted to make it by writing his way*. Stewart James who was producing a column of card tricks did not own a real card deck. He explained: "After all, when Agatha Christie writes a murder mystery, she does not have to go out and kill somebody." Stewart James has invented a card trick that involved the Fibonacci numbers. (Read about this in an MAA column by Colm Mulcahy.)

Bob Neale - professor of psychiatry and religion - was a creator of topological tricks and a world famous paper folding master. The authors write of origami in a condescending tone and appear - if it were not for Bob Neale's magic creations - to have no appreciation for the art of paper folding. However, I suspect that they adopted this manner of writing to underscore their admiration for Bob Neale's art. Indeed, later on they mention the mastery of Robert Lang - by now a professional origami artist.

In Chapter 11, the authors offer an advice and recommendations for further pursuits in mathematics (recreational and otherwise), magic and juggling. The focus of Chapter 12 is on the oath of secrecy taken by every magician when accepted into the professional guild. How come there are books revealing magical secrets? According to the authors, it is now impossible - due to the spread of computers, the web, and youTube - to keep up the trade secrets. The *record of secrets exposed is permanent. It builds on itself.* Still, even if the secrets are somewhere there, one has to know where, how, and what to look for. It may be still more enjoyable to attend a magic performance by a professional master.