Charles Babbage is credited with having devised the first ever special-purpose mechanical computer as well as the first ever general-purpose mechanical computer. The first claim seems rather dubious in an age where there is general agreement that the Antikythera mechanism is some sort of analogue computer. However, Babbage did indeed conceive and design the Difference Engine, a special purpose mechanical computer, in the first half of the nineteenth century. But what is a Difference Engine and why “Difference”?

Both Babbage and John Herschel were deeply interested in mathematical tables – trigonometrical tables, logarithmic tables – when they were still students and Babbage started collecting as many different editions of such tables as he could find. His main object was to check them for mistakes. Such mathematical tables were essential for navigation and errors in the figures could lead to serious navigation error for the users. Today if I want to know the natural logarithm of a number, let’s take 23.483 for example, I just tip it into my pocket calculator, which cost me all of €18, and I instantly get an answer to nine decimal places, 3.156276755. In Babbage’s day one would have to look the answer up in a table each value of which had been arduously calculated by hand. The risk that those calculations contained errors was very high indeed.

Babbage reasoned that it should be possible to devise a machine that could carryout those arduous calculations free of error and if it included a printer, to print out the calculated answer avoiding printing errors as well. The result of this stream of thought was his Difference Engine but why Difference?

Babbage needed to keep his machine as simple as possible, which meant that the simplest solution would be a machine that could calculate all the necessary tables with variations on one algorithm, where an algorithm is just a step-by-step recipe to solve a mathematical problem. However, he needed to calculate logarithms, sines, cosines and tangents, did such an algorithm exist. Yes it did and it had been discovered by Isaac Newton and known as the method of finite differences.

The method of finite differences describes a property shared by all polynomials. If it has been a while since you did any mathematics, polynomials are mathematical expressions of the type x^{2}+5x-3 or 7x^{5}-3x^{3}+2x^{2}-3x+6 or x^{2}-2 etc, etc. If you tabulate the values of a given polynomial for x=0, x=1, x=2, x=3 and so on then subtract the first value from the second, the second from the third and so on you get a new column of numbers. Repeating the process with this column produces yet another column and so on. At some point in the process you end up with a column that is filled with a numerical constant. Confused? OK look at the table below!

x | x^{3}-3x^{2}+6 |
x_{n+1}-x_{n} |
diff(1)_{n+1 –}diff(1)_{n} |
diff(2)_{n+1 }– diff(2)n |

0 | 6 | -2 | 0 | 6 |

1 | 4 | -2 | 6 | 6 |

2 | 2 | 4 | 12 | 6 |

3 | 6 | 16 | 18 | |

4 | 22 | 34 | ||

5 | 56 | |||

6 |

As you can see this particular polynomial bottoms out, so to speak, with as constant of 6. If we now go back into the right hand column and enter a new 6 in the first free line then add this to its immediate left hand neighbour repeating this process across the table we arrive at the polynomial column with the next value for the polynomial. See below:

x | x^{3}-3x^{2}+6 |
x_{n+1}-x_{n} |
diff(1)_{n+1 –}diff(1)_{n} |
diff(2)_{n+1 }– diff(2)n |

0 | 6 | -2 | 0 | 6 |

1 | 4 | -2 | 6 | 6 |

2 | 2 | 4 | 12 | 6 |

3 | 6 | 16 | 18 | 6 |

4 | 22 | 34 | ||

5 | 56 | |||

6 |

x | x^{3}-3x^{2}+6 |
x_{n+1}-x_{n} |
diff(1)_{n+1 –}diff(1)_{n} |
diff(2)_{n+1 }– diff(2)n |

0 | 6 | -2 | 0 | 6 |

1 | 4 | -2 | 6 | 6 |

2 | 2 | 4 | 12 | 6 |

3 | 6 | 16 | 18 | 6 |

4 | 22 | 34 | 24 | |

5 | 56 | |||

6 |

x | x^{3}-3x^{2}+6 |
x_{n+1}-x_{n} |
diff(1)_{n+1 –}diff(1)_{n} |
diff(2)_{n+1 }– diff(2)n |

0 | 6 | -2 | 0 | 6 |

1 | 4 | -2 | 6 | 6 |

2 | 2 | 4 | 12 | 6 |

3 | 6 | 16 | 18 | 6 |

4 | 22 | 34 | 24 | |

5 | 56 | 58 | ||

6 |

x | x^{3}-3x^{2}+6 |
x_{n+1}-x_{n} |
diff(1)_{n+1 –}diff(1)_{n} |
diff(2)_{n+1 }– diff(2)n |

0 | 6 | -2 | 0 | 6 |

1 | 4 | -2 | 6 | 6 |

2 | 2 | 4 | 12 | 6 |

3 | 6 | 16 | 18 | 6 |

4 | 22 | 34 | 24 | |

5 | 56 | 58 | ||

6 | 114 |

This means that if we set up our table and calculate enough values to determine the difference constant then we can by a process of simple addition calculate all further values of the polynomial. This is exactly what Babbage designed his difference engine to do.

If you’ve been paying attention you might notice that the method of finite differences applies to polynomials and Babbage wished to calculate were logarithmic and trigonometrical functions. This is however not a serious problem, through the use of other bits of higher mathematics, which we don’t need to go into here, it is possible to represent both logarithmic and trigonometrical functions as polynomials. There are some problems involved with using the method of finite differences with these polynomials but these are surmountable and Babbage was a good enough mathematician to cope with these difficulties.

Babbage now had a concept and a plan to realise it, all he now needed was the finances to put his plan into action. This was not a problem. Great Britain was a world power with a large empire and the British Government was more than ready to cough up the readies for a scheme to provide reliable mathematical tables for navigation for the Royal Navy and Merchant Marine that serviced, controlled and defended that empire. In total over a period of about ten years the Government provided Babbage with about £17, 000, literally a fortune in the early nineteen hundreds. What did they get for their money, in the end nothing!

Why didn’t Babbage deliver the Difference Engine? There is a widespread myth that Babbage’s computer couldn’t be built with the technology available in the first half of the nineteenth century. This is simply not true, as I said a myth. Several modules of the Difference Engine were built and functioned perfectly. Babbage himself had one, which he would demonstrate at his scientific soirées, amongst other things to demonstrate his theory of miracles.

Other Difference Engines modules were exhibited and demonstrated at the Great Exhibition in Crystal Palace. So why didn’t Babbage finish building the Difference Engine and deliver it up to the British Government? Babbage was not an easy man, argumentative and prone to bitter disputes. He became embroiled in one such dispute with Joseph Clement, the engineer who was actually building the Difference Engine, about ownership of and rights to the tools developed to construct the engine and various already constructed elements. Joseph Clement won the dispute and decamped together with said tools and elements. By now Babbage was consumed with a passion for his new computing vision, the general purpose Analytical Engine. He now abandoned the Difference Engine and tried to convince the government to instead finance the, in his opinion, far superior Analytical Engine. Having sunk a fortune into the Difference Engine and receiving nothing in return, the government, not surprisingly, demurred. The much hyped Ada Lovelace Memoire on the Analytical Engine was just one of Babbage’s attempts to advertise his scheme and attract financing.

However, the story of the Difference Engine didn’t end there. Using knowledge that he had won through his work on the Analytical Engine, Babbage produced plans for an improved, simplified Difference Engine 2 at the beginning of the 1850s.

The Swedish engineer Per Georg Scheutz, who had already been designing and building mechanical calculators, began to manufacture difference engines based on Babbage’s plans for the Difference Engine 2 in 1855. He even sold one to the British Government.