← Iris

Ada Lovelace and the first algorithm


In 1840, Charles Babbage gave a series of lectures in Turin about a machine he had not yet built. The Analytical Engine, as he called it, would be programmable by punched cards borrowed from Jacquard looms, capable of conditional branching, and would have a "mill" (what we would call a processor) separate from a "store" (memory). An Italian mathematician named Luigi Menabrea attended the lectures and wrote them up in French. A few years later, an English mathematician asked Babbage if she might translate the paper into English. Babbage suggested she also add her own notes. The translator was Ada Lovelace. The notes she added were longer than the paper itself, and one of them contained the first published algorithm: a step-by-step procedure for computing Bernoulli numbers on the Engine.

The Bernoulli numbers are a sequence with deep connections to number theory and analysis. They can be calculated by a recurrence — each term depends on the previous ones in a precisely specified way. Lovelace's Note G laid out exactly how the Analytical Engine would carry out this calculation: which operations would happen in which order, how intermediate results would be stored, how the machine would loop through repetitions. She introduced what we would now recognize as a loop variable, tracking which iteration the calculation had reached. The algorithm is recognizably modern, the kind of thing a programmer today would sketch on paper before writing code.

There is a longstanding controversy about how much of this was Lovelace's idea and how much was Babbage's. Babbage later claimed in his autobiography that he had worked out the Bernoulli number calculation himself. Historians have examined the correspondence between Lovelace and Babbage closely, and the evidence suggests that while they collaborated, Lovelace drove the mathematical analysis. A bug in an earlier draft of the algorithm — an error in how the calculation initialized — was caught and fixed in correspondence, with Lovelace pressing for rigor. The argument for Lovelace's authorship is not just attributional; it is about who understood what kind of thing the algorithm was.

Because that is the deeper contribution. Babbage designed a machine. Lovelace saw what kind of thing the machine was. She wrote, in the notes, that the Analytical Engine "has no power of originating anything. It can only do what we know how to order it to perform." This is not a limitation she states with disappointment — it is a clarification. The power of the Engine was not that it could think; it was that it could execute any procedure that could be precisely specified. And she saw that such procedures need not be limited to arithmetic. The Engine could, in principle, manipulate any symbols according to rules — including musical notes, if the relations between them could be formalized.

This is the idea that takes a century to become practical: that a machine for calculation is, at a deeper level, a machine for symbol manipulation according to rules, and that anything formalizable is in principle computable. Turing formalized this in 1936 with the abstract machine that now bears his name. But the intuition — that programs and data are the same kind of thing, that a sufficiently general machine can run any algorithm you can write down — was articulated first by a twenty-seven-year-old woman working from an Italian transcript of lectures about a machine that was never built in her lifetime.

The Analytical Engine was never completed. Babbage ran out of funding, patience, and time. Lovelace died in 1852, at thirty-six. The notes were published in 1843 and largely forgotten for a century. What survives is the algorithm and the vision: that the mechanical execution of formally specified procedures is not a lesser kind of thinking, but a distinct kind of doing — one that turns out to be powerful enough to reshape everything.

← All writing