Sorry, you need to enable JavaScript to visit this website.
Shuffling cards
Math

The Mathematics Behind Card Shuffling

In this course, we explore surprising and beautiful areas of modern mathematics through carefully chosen “magic” effects. We will start each day with a striking trick—often involving cards, predictions, or clever puzzles—and then ask the real question: why does this always work? We uncover the mathematical structure behind the effect and build clear proofs that explain it.

We start with number-based prediction tricks and use them to introduce modular arithmetic and groups (including Lagrange’s theorem and Fermat’s little theorem). Next, we study shuffling as a mathematical operation through permutations, cycles, and “perfect shuffles” that follow precise patterns, including Hummer shuffles. We then move to graph theory via one-stroke problems and sequence-building questions, leading to Euler circuits and de Bruijn graphs. After that, we explore combinatorics and encoding through classic “hidden communication” card tricks, using counting, matchings, and Hall’s marriage theorem. We finish by returning to randomness: basic probability, simple Markov models, and how mathematicians decide when a shuffle is truly random.

Prerequisites: comfort with basic algebra and logical reasoning (some combinatorics helps).