*Steve Butler explains the math behind card tricks at the Iowa State Fair.*

Mathematics can be magical, which Steve Butler proved to those who attended his “Mathematics and Cards” presentation at the Iowa State Fair last week.

Butler, an associate professor of mathematics, demonstrated a few card tricks to those who attended STEM Day at the Iowa State Fair. But unlike a magician, he explained the secret behind the tricks — mathematical patterns.

“The patterns in card tricks usually involve looking for ways to encode information efficiently,” he said. “There are ways to create the illusion of randomness by letting people do operations to the cards that feel random but actually do not change an important aspect: what mathematicians would call an ‘invariant.’”

Patterns are entertaining from magicians, but they are also useful to scientists, engineers, artists, analysts, and many others. Mathematicians are the pattern experts. “De Bruijn sequences,” named after the mathematician who described them, are key to one of the card tricks demonstrated by Butler. They are also used for applications such as DNA sequencing.

“Math is not about numbers and computation, it is about patterns and thinking,” Butler said. “I want people to learn that math can be fun, and that all of us are mathematicians. Patterns are around us and we should keep looking for them.”