Blog

Head to Tail: Lewis Carroll and the Shortest Path

November 11, 20266 min readBen Miller

Picture a winter evening in the late 1870s. Two young ladies are visiting, it is too dark or too wet to go out, and they have, in the way of guests everywhere, run out of things to do. Their host is Charles Dodgson, a mathematics lecturer at Oxford, better known to the world as Lewis Carroll, the man who sent Alice down the rabbit hole. So he invents a game for them.

Take a word. HEAD. Now turn it into TAIL. You may change one letter at a time, and every step along the way must be a real word.

It takes a moment to see. Then the chain Carroll himself published appears:

HEAD, HEAL, TEAL, TELL, TALL, TAIL.

Carroll called his game Doublets, and by 1879 it was running as a regular puzzle in a London magazine, with readers mailing in their chains and competing for the shortest. Today we call it a word ladder, and it is the puzzle behind our Word Ladder. What Carroll could not have known is that he had built a perfect little laboratory for an idea that would run half the modern world: the shortest path.

Every word is a place

Here is the trick that turns a parlour game into mathematics. Imagine every four-letter English word written on its own dot, scattered across an enormous sheet of paper. Now draw a line between any pair of dots whose words differ in exactly one letter. HEAD connects to HEAL, HEAT, HEAP, HERD, BEAD, DEAD, READ and plenty more. TAIL connects to TALL, TOIL, MAIL, RAIL, BAIL... you get the idea.

Mathematicians call a picture like this a graph: dots (called nodes) joined by lines (called edges). Once you have drawn it, a word ladder stops being a word puzzle at all. It becomes a journey. You are standing on one dot, you want to reach another, and you may only walk along the lines.

The same picture describes a road map, a subway system or the cables of the internet. Solve the ladder and, quietly, you have solved them all.

How a computer climbs the ladder

Suppose you want not just a ladder but the shortest one. A computer does it with a method called breadth-first search, and it is almost embarrassingly simple.

Start at HEAD. List every word one step away. Then list every word one step from those, skipping anything you have already seen. Then the next ring out, and the next, like ripples spreading from a pebble dropped in a pond. The first ripple that touches TAIL tells you the shortest distance, and by remembering which word led to which, you can walk the chain back.

The beauty is in the guarantee. Because the ripples spread evenly, one step at a time, nothing can sneak around and arrive sooner. The first arrival is provably the fastest. That guarantee is what makes a minimum step count, like the one our Word Ladder shows for each puzzle, something you can trust.

There is a lovely refinement, too. Ripple from both ends at once and stop when the two waves meet. Because each ring grows so quickly, two small circles are far cheaper than one big one. Computer scientists call this bidirectional search, and if you have ever solved a word ladder by working backwards from the target as well as forwards from the start, you have already invented it yourself.

Counting the letters that must change

Here is a question worth pausing on. Could HEAD become TAIL in four steps instead of five?

There is an easy way to get a floor. HEAD and TAIL differ in all four positions, and each step changes only one letter, so you need at least four steps. Computer scientists call this count of mismatched positions the Hamming distance, after the American mathematician Richard Hamming, who used it to catch errors in data. It is a lower bound: no ladder can ever beat it.

But a lower bound is not a promise. To get down to four, you would have to change each letter exactly once, and at some point the two middle letters would need to sit in a half-changed state, giving you something like HEIL, TEIL, HAAD or TAAL. None of the candidates is an everyday English word. So the ladder takes a detour: Carroll's route changes the A to L, then later changes the E to A, then L to I. That one extra step is the price of passing through real words.

That is what makes a word ladder a puzzle: the straight line exists on paper, but the landscape is full of gaps. Try APE to MAN. The Hamming distance is three. The best everyday chain we know runs APE, APT, OPT, OAT, MAT, MAN: five steps, two of them spent getting around holes in the language.

Islands, hubs and what solvers learn

Draw the whole graph and some odd features appear. Certain words are islands, with no one-letter neighbours at all. Try changing any single letter of ALOOF and you will struggle to land on a real word. No ladder can ever pass through it. Other words are hubs, sitting at busy crossroads: a short word like CAT or BAT touches twenty or more others, because so many letters can slot into each position.

That shape explains the best advice we can give a Word Ladder player:

  • Head for the hubs. Common, plain words have more exits. Obscure words are often dead ends, however clever they feel.
  • Move the vowels. Changing a vowel tends to open more doors than changing a consonant, because most consonant patterns accept several vowels.
  • Work from both ends. Write a step or two backwards from the target. When your forward chain touches any word on that list, you are done, just like the two-sided search.
  • Treat a detour as information. When the direct route is blocked, you have learned where a gap is. The extra step is not a failure; it is the shape of the map.

The road not drawn

What strikes us most about Carroll's game is how little it asks for: two words and one rule. Yet the moment you play it, you start thinking like a navigator. You look for busy junctions, you notice the islands, you work backwards from where you want to be, and you accept that the straight line on paper is not always the road on the ground.

That habit travels. Plenty of everyday problems, from a career change to a tangled project, have a clear start, a clear goal and a landscape of steps that may or may not exist. The ladder reminds us to ask two questions: what is the least this could possibly take, and where are the gaps that will make it take longer? Answer both, and the path usually reveals itself, one letter at a time.

← Back to Blog