Devlin's Angle

March 2010

The Hidden Math Behind Alice in Wonderland

Like James Cameron's recent blockbuster movie Avatar, Tim Burton's Alice in Wonderland, released this month, is in 3D. Also like Avatar, I suspect audiences will be uniformly thrilled with the visual spectacle, yet be divided when it comes to the story. Millions loved Cameron's tale, but personally I (and apparently many others) thought that, although it had all the plot ingredients to have been good, it ended up annoyingly adolescent and cloyingly banal. As for Alice? Well, I'll let you make up your own mind.

For mathematicians, the real story is not so much whether Burton's movie will be a hit, rather it's not often that a mathematical allegory makes it to Hollywood blockbuster status in the first place! So I can't let the release of Alice go unnoticed in the mathematical literature - to whit Devlin's Angle. For, as readers of MAA Online will doubtless know, Lewis Carroll was the pen name of the Reverend Charles Lutwidge Dodgson, a mathematician at Christ Church College, Oxford, and most mathematicians are probably aware that elements of the Alice story were inspired by mathematics. (At least, that is the entirely reasonable assumption everyone makes; Dodgson himself provided no commentary to that effect.)

Before I go any further, I should note that the new Alice movie is not based on Lewis Carroll's original book. (Actually, the memories of the Alice story we all have from our childhood are based on two books, Alice in Wonderland and the later Alice Through the Looking Glass.) Rather, Burton takes as his inspiration a computer game called American McGee's Alice. In the film, an adult Alice, now a disturbed young woman mourning the death of her parents, returns to the land we are familiar with from Carroll's original tale, a strange place where animals talk, the Cheshire Cat has a grin, and the Queen of Hearts is wicked. (Or was it the Red Queen? Carroll's two books had different queens that over the years tend to merge in our memories.)

Though others had looked for political and social allusions in the Alice books, most notably Martin Gardner, whose The Annotated Alice was published in 1960, followed by a sequel More Annotated Alice in 1990, perhaps the first scholar to look in depth for possible mathematical inspirations for Alice was Helena Pycior of the University of Wisconsin-Milwaukee, who in 1984 linked the trial of the Knave of Hearts with a Victorian book on algebra. Now Melanie Bayley, of the University of Oxford in England, has taken the analysis a lot further. She described her findings (well, since we are in the realm of literary interpretation here, I'd better say "her theory") in an article titled Alice's adventures in algebra: Wonderland solved, published in New Scientist, 16 December 2009.

Before I relate what Bayley has to say, let me summarize the history of Carroll's Alice in Wonderland.

In 1862, Dodgson, together with the Reverend Robinson Duckworth, rowed in a boat up the River Thames with three young girls, Lorina Charlotte Liddell, aged 13, Alice Pleasance Liddell, aged 10, and Edith Mary Liddell, aged 8, the daughters of Henry George Liddell, the Vice-Chancellor of Oxford University and Dean of Christ Church College, as well as headmaster of the nearby, private, Westminster School.

The journey started at Folly Bridge near Oxford and ended five miles away in the village of Godstow. As they rowed, Dodgson made up and told the girls a story about a bored little girl named Alice who goes looking for an adventure. The three girls loved it, and Alice Liddell asked Dodgson to write it down for her. Two years later he did just that, and on 26 November 1864 he gave Alice the handwritten manuscript of what he then called "Alice's Adventures Under Ground," illustrated by his own drawings.

Most of the story was based on situations and buildings in Oxford and at Christ Church. For example, the "Rabbit Hole" down which Alice descends to begin her adventure symbolized the actual stairs in the back of the college's main hall.

A year later, Dodgson - now masquerading as Lewis Carroll - published a greatly expanded version under the title "Alice's Adventures in Wonderland," with illustrations drawn by John Tenniel. It is in the new material he added, which includes the Cheshire Cat, the trial, the Duchess's baby, and the Mad Hatter's tea party, that we find allusions to mathematics. (Tweedledum, Tweedledee, Humpty Dumpty and the Jabberwock appear in the sequel, Alice Through the Looking-Glass.)

The book rapidly became a bestseller, it has never been out of print since it first appeared, and it has been translated into well over 100 languages.

So what does Bayley tell us about the mathematical ideas that Dodgson took inspiration from?

Now we get to the math part

First, we have to remind ourselves of what was going on in mathematics in the latter half of the nineteenth century, when Dodgson wrote his story. It was a turbulent period for mathematicians, with the subject rapidly becoming more abstract. The discoveries of non-Euclidean geometries, the development of abstract (symbolic) algebra that was not tied to arithmetic or geometry, and the growing acceptance - or at least use - of "imaginary numbers" were just some of the developments that shook the discipline to its core. By all accounts, Dodgson held a very traditionalist view of mathematics, rooted in the axiomatic approach of Euclid's Elements. (He was not a research mathematician, rather he tutored the subject.) Bayley describes him as a "stubbornly conservative mathematician," who was dismayed by what he saw as the declining standards of rigor. The new material Dodgson added to the Alice story for publication, she says, was a wicked satire on those new developments.

Perhaps the most obvious example is the Cheshire Cat, which disappears leaving only its grin, an obvious reference - critical in Dodgson's case - to increasing abstraction in the discipline.

For a more focused example, take the chapter "Advice from a caterpillar." Alice has fallen down the rabbit hole and eaten a cake that has shrunk her to a height of just 3 inches. The Caterpillar enters, smoking a hookah pipe, and shows Alice a mushroom that can restore her to her proper size. But one side of the mushroom stretches her neck, while another shrinks her torso, so she must eat exactly the right balance to regain her proper size and proportions. Bayley believes this expresses Dodgson's view of the absurdity of symbolic algebra.

The first clue, she says, may be the pipe. The word "hookah" is of Arabic origin, like "algebra". More to the point, the original Arabic term for algebra, widely known and used in the mathematical community in Dodgson's time, was al jebr e al mokabala or "restoration and reduction" - which exactly describes Alice's experience. Restoration was what brought Alice to the mushroom: she was looking for something to eat or drink to "grow to my right size again," and reduction was what actually happened when she ate some: she shrank so rapidly that her chin hit her foot.

Bayley suggests that the overall madness of Wonderland reflects Dodgson's views on the dangers of this new symbolic algebra. Alice has moved from a rational world to a land where even numbers behave erratically. In the hallway, she tries to remember her multiplication tables, but they have slipped out of the base-10 number system she is used to.

In the caterpillar scene, Alice's height fluctuates between 9 feet and 3 inches. Alice, bound by conventional arithmetic where a quantity such as size should be constant, finds this troubling: "Being so many different sizes in a day is very confusing," she complains. "It isn't," replies the Caterpillar, who lives in this absurd world.

The Caterpillar's warning, at the end of this scene, is perhaps one of the most telling clues to Dodgson's conservative mathematics, Bayley suggests. "Keep your temper," he announces. Alice presumes he's telling her not to get angry, but although he has been abrupt he has not been particularly irritable at this point, so it's a somewhat puzzling thing to say. But the word "temper" has another meaning of "the proportion in which qualities are mingled." So the Caterpillar could well be telling Alice to keep her body in proportion - no matter what her size. This may be another reflection of Dodgson's love of Euclidean geometry, where absolute magnitude doesn't matter: what's important is the ratio of one length to another. To survive in Wonderland, Alice must act like a Euclidean geometer, keeping her ratios constant, even if her size changes.

Of course, she doesn't. She swallows a piece of mushroom and her neck grows like a serpent with predictably chaotic results - until she balances her shape with a piece from the other side of the mushroom. This is an important precursor to the next chapter, "Pig and pepper", where Dodgson parodies another type of geometry. By this point, Alice has returned to her proper size and shape, but she shrinks herself down to enter a small house. There she finds the Duchess in her kitchen nursing her baby, while her Cook adds too much pepper to the soup, making everyone sneeze except the Cheshire Cat. But when the Duchess gives the baby to Alice, it turns into a pig.

According to Bayley, the target of this scene is projective geometry, a subject that involved concepts that Dodgson would have found ridiculous, particularly the "principle of continuity." Jean-Victor Poncelet, the French mathematician who set out the principle, described it as follows: "Let a figure be conceived to undergo a certain continuous variation, and let some general property concerning it be granted as true, so long as the variation is confined within certain limits; then the same property will belong to all the successive states of the figure."

When Poncelet talked of "figures", he meant geometric figures, of course, but Dodgson playfully subjects Poncelet's description to strict logical analysis and takes it to its most extreme conclusion. He turns a baby into a pig through the principle of continuity. Importantly, the baby retains most of its original features, as any object going through a continuous transformation must. His limbs are still held out like a starfish, and he has a queer shape, turned-up nose and small eyes. Alice only realizes he has changed when his sneezes turn to grunts.

The baby's discomfort with the whole process, and the Duchess's unconcealed violence, signpost Dodgson's virulent mistrust of "modern" projective geometry, Bayley says. Everyone in the pig and pepper scene is bad at doing their job. The Duchess is a bad aristocrat and an appallingly bad mother; the Cook is a bad cook who lets the kitchen fill with smoke, over-seasons the soup and eventually throws out her fire irons, pots and plates.

Alice, angry now at the strange turn of events, leaves the Duchess's house and wanders into the Mad Hatter's tea party. This, Bayley surmises, explores the work of the Irish mathematician William Rowan Hamilton, who died in 1865, just after Alice was published. Hamilton's discovery of quaternions in 1843 was hailed as an important milestone in abstract algebra, since they allowed rotations to be calculated algebraically.

Just as complex numbers work with two terms, quaternions belong to a number system based on four terms. Hamilton spent years working with three terms - one for each dimension of space - but could only make them rotate in a plane. When he added the fourth, he got the three-dimensional rotation he was looking for, but he had trouble conceptualizing what this extra term meant. Like most Victorians, he assumed this term had to mean something, so in the preface to his Lectures on Quaternions of 1853 he added a footnote: "It seemed (and still seems) to me natural to connect this extra-spatial unit with the conception of time."

As Bayley points out, the parallels between Hamilton's mathematics and the Mad Hatter's tea party are uncanny. Alice is now at a table with three strange characters: the Hatter, the March Hare and the Dormouse. The character Time, who has fallen out with the Hatter, is absent, and out of pique he won't let the Hatter move the clocks past six.

Reading this scene with Hamilton's ideas in mind, the members of the Hatter's tea party represent three terms of a quaternion, in which the all-important fourth term, time, is missing. Without Time, we are told, the characters are stuck at the tea table, constantly moving round to find clean cups and saucers.

Their movement around the table is reminiscent of Hamilton's early attempts to calculate motion, which was limited to rotatations in a plane before he added time to the mix. Even when Alice joins the party, she can't stop the Hatter, the Hare and the Dormouse shuffling round the table, because she's not an extra-spatial unit like Time.

The Hatter's nonsensical riddle in this scene - "Why is a raven like a writing desk?" - may more specifically target the theory of pure time. In the realm of pure time, Hamilton claimed, cause and effect are no longer linked, and the madness of the Hatter's unanswerable question may reflect this.

Alice's ensuing attempt to solve the riddle pokes fun at another aspect of quaternions that Dodgson would have found absurd: their multiplication is non-commutative. Alice's answers are equally non-commutative. When the Hare tells her to "say what she means", she replies that she does, "at least I mean what I say - that's the same thing". "Not the same thing a bit!" says the Hatter. "Why, you might just as well say that 'I see what I eat' is the same thing as 'I eat what I see'!"

When the scene ends, the Hatter and the Hare are trying to put the Dormouse into the teapot. This could be their route to freedom. If they could only lose him, they could exist independently, as a complex number with two terms. Still mad, according to Dodgson, but free from an endless rotation around the table.

The sting in the tale

Even if you accept Bayley's suggestions - and obviously I am inclined to do so, at least overall, otherwise I would not have written about her work - you might think the mathematical inspirations for some of the scenes we read in Alice are nothing more than an interesting footnote. Think again, says Bayley. Without those mathematical undercurrents, it is highly unlikely that Dodgson's book(s) would have achieved lasting, international stardom. His original nursery tale, written for the ten-year-old Alice Liddell, she says, would have been unlikely to attract much attention.

Dodgson was most witty when he was poking fun at something, Bayley explains, and then only when the subject matter got him truly riled. He wrote two uproariously funny pamphlets, fashioned in the style of mathematical proofs, which ridiculed changes at the University of Oxford. In comparison, other stories he wrote besides the Alice books were dull and moralistic.

"I would venture that without Dodgson's fierce satire aimed at his colleagues," Bayley claims, "Alice's Adventures in Wonderland would never have become famous, and Lewis Carroll would not be remembered as the unrivalled master of nonsense fiction."

Put that in your hookah and smoke it.


Devlin's Angle is updated at the beginning of each month. Find more columns here.

Mathematician Keith Devlin (email: devlin@stanford.edu) is the Executive Director of the Human-Sciences and Technologies Advanced Research Institute (H-STAR) at Stanford University and The Math Guy on NPR's Weekend Edition. His most recent book for a general reader is The Unfinished Game: Pascal, Fermat, and the Seventeenth-Century Letter that Made the World Modern, published by Basic Books.