How Babbage automated calculations with simple machines


Modern computing is often effortless. You pick up a calculator or open the calculator app on your phone, and you’re on your way in seconds. But getting here took humans several centuries from when they first tried to speed up computing. One particularly important passage in this history involved the English mathematician Charles Babbage, who found a way to speed up calculations using the movement of simple machines, creating the first ancestors of the modern computer.

What motivated Babbage?

If you had to calculate something in the early 19th century, you had to do it entirely by hand. Entire governments, navigators, astronomers, engineers — all depended on complicated mathematical tables produced by teams of clerks, known at the time as ‘computers’, who worked slowly and often made mistakes.

In 1821, Babbage was frustrated and reportedly said he wished calculations could happen “by steam”. Babbage went on to develop the difference engine, a large mechanical calculator designed to compute mathematical tables using a method called finite differences.

The machine consisted of columns of brass wheels, each engraved with the digits from 0 to 9. The wheels physically added values as they were rotated using a hand crank and gears. The machine considerably reduced the number of mistakes. The difference engine was thus a specialised calculator that was fast and efficient at one class of problems.

What were mathematical tables?

The mathematical table was a pre-computed table of numbers that experts could refer to repeatedly in their practice. For instance, before digital calculators, an engineer would often convert multiplication into an addition problem using logarithms. So 247 x 83 could be solved by looking up the logarithms of both numbers, adding them, then converting back to the inverse value.

Similarly, the tables also provided the values of trigonometric functions (used in architecture and civil engineering), astronomical tables (to predict the positions of celestial bodies), actuarial tables (for insurance and taxation), and polynomial tables (values of complicated functions used in science).

The tables often repeatedly evaluated the values of common functions at regular intervals. For example, if f(x) = x3, then the tables would provide the values of f(x) at x = 1, 2, 3, 4, …, i.e. 1, 8, 27, 64, …. Similarly, a table would show the values of a trigonometric sine function for every tenth of a degree: 10°, 10.1°, 10.2°, … corresponding to 0.1736, 0.1754, 0.1771, ….

Aside from computers making mistakes during the calculation itself, inaccuracies also crept up during copying and typesetting. And a single mistake could be ruinous.

What is the method of finite differences?

The method of finite differences simplifies many of these operations to simpler problems, which the difference engine could then automate.

Say a table needs to evaluate the function f(x) = x2. So for x = 1, 2, 3, …, f(x) = 1, 4, 9, …. Now look at the differences between successive values: 3 (4 – 1), 5 (9 – 4), 7 (16 – 9), 9 (25 – 16), …. Then look at the second differences, i.e. the difference between the differences: 2 (5 – 3), 2 (7 – 5), 2 (9 – 7), ….

That the second difference is a constant implies the whole table can be generated using just addition.

The difference engine started with three numbers loaded into separate columns of wheels: the starting value, 1; the first first-difference, 3; and the second difference, 2. When you crank the wheels, they add the second difference to the first difference: 3 + 2 = 5 — and then the updated first difference to the current value: 1 + 5 = 6.

At the end of turn 1:

  • Updated first difference: 5

  • Updated value: 4

And at the end of turn 2:

  • Updated first difference: 5 + 2 = 7

  • Updated value: 4 + 5 = 9

And at the end of turn 3:

  • Updated first difference: 7 + 2 = 9

  • Updated value: 9 + 7 = 16

And so on. Thus the difference engine produced: 1, 4, 9, 16, 25, ….

How did the wheels ‘do’ all this?

Imagine one vertical column of wheels representing a decimal number: the top wheel displays the thousands, the second wheel the hundreds, the third wheel the tens, and the fourth wheel the ones. Each wheel has the digits 0-9 engraved on its edge.

Suppose the machine stored the number 247. The wheels would be positioned so that the thousands wheel points to 0, the hundreds wheel points to 2, the tens wheel points to 4, and the ones wheel points to 7.

To add numbers, the machine would physically rotate the wheels. Suppose you want to perform the operation 247 + 5. When cranked the gears, they would turn the ones wheel forward by five positions: 7, 8, 9, 0, 1, 2. Since going from 9 to 0 means crossing a decimal boundary, the analytical engine has to carry the 1 — which it does using a special mechanism that nudges the tens wheel forward one step: from 4 to 5.

So the machine displays 252.

What happened to the difference engine?

Babbage never finished building a full-scale version of his Difference Engine No. 1. In 1991, the Science Museum in London built a machine it dubbed ‘Difference Engine No. 2’ based on Babbage’s drawings in 1846-1849. It weighed five tonnes, contained 8,000 parts, and worked correctly, vindicating Babbage’s intuition.

That said, the reasons work on Difference Engine No. 1 stalled are pertinent. Foremost, Babbage fell out with his chief engineer Joseph Clement over Clement’s compensation and who owned the tools and drawings. The government also cut off funding in 1842, by when Babbage had spent more than GBP 17,000, because it believed there was no end in sight to his expenses and because, from 1834 onwards, Babbage had been paying more attention to a new device called the analytical engine.

What is the analytical engine?

It was conceived as a general purpose programmable machine — the direct ancestor of the modern computer. It had four components: the mill (like the modern CPU), which performed basic mathematical operations like addition and subtraction; the store (memory), capable of holding up to 1,000 numbers each 50 digits long on wheels; the reader (input), consisting of punched cards then used in Jacquard looms of the textile industry; and the printer (output), a mechanism to automatically stamp the results out on metal plates.

The analytical engine was not just advanced for its time: it was practically revolutionary because it was (i) programmable — it could receive instructions and solve different problems — and (ii) it had conditional branching, meaning it could make logical decisions like “do A if B”. It could also repeat particular steps.

What did the punched cards do?

In a Jacquard loom, users would punch holes into cards to control the weaving pattern. One specific pattern of holes which threads to raise or lower, for example. So if Babbage wanted to calculate (7 + 5) x 3, he would load the numbers into the store — as in the difference engine — and then place cards in the machine with these instructions:

  • Put 7 in storage location A

  • Put 5 in storage location B

  • Put 3 in storage location C

Then, another sequence of punched cards would instruct the mill:

  • Add A and B

  • Store result in D

Then the machine would compute:

7 + 5 = 12

Now D = 12.

Yet another set of punched cards might say:

  • Multiply D by C

  • Store result in E

So the analytical engine would compute:

12 x 3 = 36

A final card would say ‘Print E’, so the engine would stamp out:

36

The same analytical engine could solve a different problem; Babbage just had to change the order of the punched cards.

More advanced sequences of cards could also instruct the analytical engine to repeat some operation multiple times (looping) and execute conditional branching. For example, to perform division by repeated subtraction, the analytical engine would have to subtract the divisor from the number, and repeat that operation if the result is positive or stop if the result is negative.

(Aside: The German-American inventor Herman Hollerith also used punched cards to automate the U.S. Census in the 1890s and founded the company that was a piece of what would become IBM. However, there is no evidence he was inspired by Babbage’s choice.)

What happened to the analytical engine?

All this said, Babbage could not complete a full-scale analytical engine either. Due to his experiences with the Difference Engine No. 1, the analytical engine never attracted any serious funding. In fact, Babbage spent the rest of his life without any state support for his designs.

His efforts were not for nothing, however. His collaborator Ada Lovelace recognised an idea that most of her contemporaries missed: if a machine could manipulate numbers, and if those numbers could represent other data-types like letters, musical notes or images, the analytical engine could effectively be a universal symbol processor. This is like how today Spotify represents music as numbers, Photoshop represents colours as numbers, large language models represent words as numbers, and so on.

Babbage’s designs were the ancestors of modern computers in the same way the first cells are ancestors of modern humans: they were important foundations that proved something was possible but there are also significant differences between them. Babbage helped the world realise that machines could perform different mathematical functions using the same hardware.

  • Related Posts

    NASA announces Artemis III crew; taps U.S. astronauts, Italian for mission with SpaceX, Blue Origin mooncraft

    NASA named three U.S. astronauts and an Italian astronaut on Tuesday (June 9, 2026) to serve as the crew for its next Artemis mission, a spacecraft docking demonstration in ‌Earth’s…

    Continue reading
    Scientists find a blood test that predicts lung cancer years early

    Lung cancer is one of the more common cancers affecting people worldwide. This is mainly thanks to smoking and, to a lesser extent, air pollution and occupational exposure. According to…

    Continue reading

    Leave a Reply

    Your email address will not be published. Required fields are marked *