The Mad Hatter's Secret Ingredient: Math

The Tea Party. John Tenniel/
John Tenniel/

The first numbers that come to mind when thinking about Tim Burton's Alice in Wonderland might be how much money the movie is raking in at the box office.

But numbers also appear to be woven in among the talking rabbits and smoking caterpillars of the original stories. Author Lewis Carroll was also a math teacher in Oxford, England, and mathematicians say the Alice books are full of algebraic lessons — such as why a raven is like a writing desk.

That's the riddle the Mad Hatter asks Alice. And, as Weekend Edition Math Guy Keith Devlin tells NPR's Jacki Lyden, "That particular scene — and lots of other scenes in Alice in Wonderland — were a reflection on the increasing abstraction that was going on in mathematics in the 19th century."

Carroll, whose real name was Charles Dodgson, was a very conservative, traditional mathematician, Devlin says, and he didn't like the changes some were bringing to the discipline of mathematics.

"To him, algebra was all about numbers," Devlin says. But in the 19th century, people were developing all kinds of bizarre new algebras, where x times y was not equal to y times x.

So why is a raven like a writing desk? Because the new mathematics didn't make sense to Carroll. "Lots of things that every common-sense person would say are different in this new mathematics turned out to be the same," Devlin says — a point Carroll found ripe for satire.

Missing Time At The Tea Party

So underneath the madness of the Wonderland tea party lies math — and some snark. Alice finds the Mad Hatter, the March Hare and the Dormouse at their tea party, but Devlin says Carroll deliberately left out one character.

Johnny Depp plays the Mad Hatter in Tim Burton's Alice In Wonderland.

Courtesy of Disney Enterprises, Inc.

"One of the big developments that was going on at that time ... was work by an Irish mathematician called William Hamilton," Devlin explains. Carroll wasn't a fan of Hamilton's work, a new arithmetic called quaternions. "Quaternions were numbers — not to deal with counting things, but to deal with understanding rotations.

"Back in Victorian times, when Hamilton himself was doing this work, he tried to understand his new arithmetic in physical terms," Devlin says. "He said one of the four terms that was involved in these numbers had to be time. So time was inexplicably, inescapably bound up with these new numbers."

Yet it's the Mad Hatter, the March Hare and the Dormouse at the tea party — the character Time is absent. (You can read the chapter here if your memory needs refreshing.)

"What Hamilton said was if you take this time parameter out of these new numbers, then the numbers would just keep rotating around — they won't go anywhere," Devlin says. "It was just like the characters rotating round and round the tea party, round and round the table."

"In fact, when the Hatter and the Hare try to squeeze the Dormouse into the teapot, they're trying to somehow get away from this complexity — throw away another of the parameters, if you like — so that life can resume as normal."

Devlin says Carroll's message is that we "get rid of all of this complexity in the first place, and let's just go back to the familiar old geometry that we've had since Euclid for 2,000 years."

Fictional Math

The hidden math in Alice may come as a surprise to many, but mathematicians have always known Carroll was slipping some numbers into his fiction.

"We knew that Carroll was actually a mathematician," Devlin says. "Last year, in fact, a scholar in Oxford called Melanie Bayley wrote a complete dissertation analyzing Alice In Wonderland, and she identified a number of mathematical allusions in the story."

Without Carroll's secret ingredient, Alice might never have achieved her fame. "The very first version of [the] Alice in Wonderland story — that he wrote for the real Alice — had none of the mathematics," Devlin says. "He added a lot of new material and it's all of that new material where you find the mathematical allusions.

"Almost certainly what he did was said, 'Here's this cute story that I've written for this real Alice. I'm going to take that and I'm going to use it to do this wicked satire of what I think are these crazy, stupid developments in mathematics that are getting us away from the real, solid mathematics that I've loved all my life.' "