Charles Babbage’s Difference Engine

Here I discuss the computing work carried out by Charles Babbage and his colleague, Ada Lovelace. Ultimately they did the first really useful work on bringing a general purpose computer to realisation. Yet, in the end, they failed. This is probably due to two factors, the first, and most damaging as far as I can see it, was that Babbage could never settle on a final design and kept on developing and changing his ideas. This is evidenced most prominently in the shift from the Difference Engine to the Analytical Engine when Babbage realised that it would be possible to generalise many of the ideas he had developed for the Difference Engine. [Figs.36 & 37]

Appendix 1_Incunabula_extended_html_7068620e
Fig 36: Babbage’s Difference Engine from the frontispiece to his Passages from a Life, (1864). exlib Stephen Jones

The single algorithm of the Difference Engine1 could only enable one type of calculation, but the more general algorithms he developed as he continually worked on improvements to it allowed for a much more general range of calculations which led him to the Analytical Engine. As Lovelace noted; anything that could be represented in numerical symbols could be manipulated by the Analytical Engine. The second factor is that Babbage was moving so fast that the technical capabilities of his engineers could never keep up.

It has been suggested that the most useful thing Babbage did was to bring the manufacturing engineering of the day into a new level of precision. As Bowden put it in his history of computing Faster than Thought:

Babbage “[p]oor man, … tried to solve by himself and with his own resources a series of problems which in the end taxed the united efforts of two generations of engineers.”2

Difference Engine model
Fig 37: The first “small portion” of Difference Engine No.1 known as the 1832 model (as in the frontispiece above). Still in the Science Museum, South Kensington. [Photograph: Stephen Jones]

Mr. Babbage’s Difference Engine No. I

Sir David Brewster in his Letters On Natural Magic London, 1868, said of the Difference Engine

“Great as the power of mechanism is known to be, yet we venture to say that many of the most intelligent of our readers will scarcely admit it to be possible that astronomical and navigation tables can be accurately computed by machinery; that the machine can itself correct the errors which it may commit; and that the results of its calculations, when absolutely free from error, can be printed off, without the aid of human hands, or the operation of human intelligence. All this however, Mr. Babbage’s machine can do…3

while Charles Babbage, Esq., in his Passages of the Life of a Philosopher, London, 1864, recalled

“I considered that a machine to execute the mere isolated operations of arithmetic, would be comparatively of little value, unless it were very easily set to do its work, and unless it executed not only accurately, but with great rapidity, whatever it was required to do.”“On the other hand, the method of differences supplied a general principle by which all Tables might be computed through limited intervals, by one uniform process. Again, the method of differences required the use of mechanism for Addition only. In order, however, to insure accuracy in the printed tables, it was necessary that the machine which computed Tables should also set them up in type, or else supply a mould in which stereotype plates of those Tables could be cast.”4

The calculating machine should engage in two processes: that of addition and that of carrying the tens value to the next digit. Adding each of the values sequentially would be too slow a process for large numbers. A quicker approach would be (an early kind of parallel process)

“to add all the digits of the two numbers each to each at the same instant, but reserving a certain mechanical memorandum, wherever a carriage became due. These carriages were then to be executed successively.”

and finally, in order to minimise the errors caused by the clerical process of recording the numbers of any table and making up type to print those tables the printing part of the engine should be directly driven from the results of the calculating engine.

On error checking and the reason for using the Method of Differences

In the approach to computation which involved calculating the value of each term directly an unpredictable array of errors may be generated through various means, perhaps incorrect calculation, the choosing of a wrong number, or some error in setting up the type for printing the tables. Finding these errors is a matter of checking every result again by making the same calculation, which is further prone to error. In the method of differences, [a fixed algorithm is used at each stage and thus] if the last tabular number agrees with a directly calculated version then the table may be safely believed to be correct. Error detection is thus reduced to a single calculation, rather than the reproduction of the hundreds of calculations necessary for any practical table.

On the Method of Differences:

The first point to recognise is that the function of this algorithm is to produce Tables of numbers generated in series, starting with some arbitrarily low number, say 0, and from thence incrementing the table number. At each row (count) of the table the result of the performance of whatever function the table exemplifies should be available. Thus in a table of logarithms, the first row of the table will provide the logarithm of the first value to be expressed: either ‘0’ which has no logarithm or ‘1’ which has a logarithm of ‘0’. The rows of the table then incrementing as far as is considered necessary by its producer.

The Method of Differences then proceeds as follows, (using as an example the table of squares):

n f(n)
f(n) = n
Δ1 Δ2

f(n+1) =
n+ n) + f(n)







































Referring to the table above:

For each row n of the table, the number f(n) appropriate to that row, according to the series being developed, is inserted into the tabular value column f(n), in this example f(n) = n2.

Then the difference between that number and its succeeding is inserted into the column of 1st Differences Δ1, proceeding row by row.

This column having been completed the next column, the column of 2nd Differences Δ2, is similarly generated from the column of 1st Differences, and so on for each succeeding column until a column with constant difference is generated (in the example here this is Δ2, the column of 2nd Differences).

The next step is to add to the tabular value of any particular row n the values in Δ1 and Δ2 and any further columns of Differences in that row, thus yielding the next tabular value f(n+1).

Where column

  • n = row number
  • f(n) = n2 = value in table at that row number
  • Δ1 = 1st Difference between numbers at row n and row n+1, placed in row n+1
  • Δ2 = 2nd Difference between number in Δ1 at row n and row n+1, placed in row n+1 final column shows the additions
  • The task of the programmer is to generate the sets of differences which form the rules for each function f that one might wish to execute as a Table.

On the mechanical process of Addition


“The process of Addition includes two distinct parts – 1st. The first consists of the addition of any one digit to another digit; 2nd. The second consists in carrying the tens to the next digit above.”5

So, two numbers may be added together by taking the first digit of the first number and adding it to the first digit of the second number. If this sum is greater than 9, then a ten value must carry forth to the addition of the second pair of digits. If the sum of the second pair plus the carry also exceeds ten then a further carry is issued to the third (the hundreds) pair of digits. And so forth until all digits in each number are accounted for.

Portion of the Difference Engine_1
Fig 38: A fragment of the Difference Engine No.1 now in the History of Science Museum, Broad Street, Oxford, donated, along with several manuscripts relating to Charles Babbage in 1939 by the estate of Dr L. H. Dudley Buxton. [Photograph: Stephen Jones]

“The mechanical means I employed to make these carriages bears some slight analogy to the operation of the faculty of memory. A toothed wheel had the ten digits marked upon its edge; between the nine and the zero a projecting tooth was placed. Whenever any wheel, in receiving addition, passed from nine to zero, the projecting tooth pushed over a certain lever. Thus … every carriage which had become due was indicated by the altered position of its lever. An arm now went round, which was so contrived that the act of replacing that lever caused the carriage which its position indicated to be made to the next figure above. But this figure might be a nine, in which case, in passing to zero, it would put over its lever, and so on. By placing the arms spirally around an axis, these successive carriages were accomplished.”6

Portion of the Difference Engine_2
Fig 39: Fragment of the Difference Engine No.1 in the Museum of Applied Arts and Sciences, Sydney. Assembled from the original parts of the Difference Engine No.1 manufactured by Babbage and his engineer, Joseph Clement, between 1822 and 1830. Some parts were inherited by Charles’ son Henry Prevost Babbage, who assembled about six fragments around 1879. Pieces were deposited at University College, London, the Whipple Museum in Cambridge, U.K. and Harvard University, Cambridge, USA. This piece in the MAAS, Sydney, was purchased from the descendants of Charles Whitmore Babbage of New Zealand, who would have received it from Henry P. Now in the MAAS collection: Object no. 96/203/1

Babbage’s engine used a wide word of decimal values, ie. decimal numbers of a largish number of digits. Each digit is represented on a wheel so that by rotation the wheel may be stepped from zero to nine. Stacks of these wheels are placed on an “axis”, one above the other. Each axis then represents a column in the table of differences. The values of the 2nd Difference are placed on the first axis, the values of the 1st Difference are placed on the next axis and the current tabular value is on the third axis.

In Babbage’s “small portion” of the engine (in the frontispiece, Fig.36, and photos, Fig.38-39, above) there are three axis stacks. In the operation of the engine, the 2nd Difference axis is added into the 1st Difference axis, which may or may not then generate a carry. The value now on the 1st Difference axis plus the carry, if any, is then added into the tabular value (or result) axis. Thus each digit is acted upon in the same addition cycle.

Difference Engine functional
Fig 40: Detail of the addition wheels from the frontispiece above [Fig 35].


Using the table of squares above, the value 2 is placed on the D2 axis, the value 1 is placed on the D1 axis and the value 1 is placed on the results, f(n), axis. As the D2 axis is rotated the digit wheels then rotate the adjacent digit wheels of axis D1. Since the D1 axis already has a number on it, the D2 axis rotating in the appropriate direction will rotate the D1 digit wheel for the number of counts (steps) necessary to bring the value on the D2 digit wheel to zero, thus adding 2 to the number on the D1 wheel. With the value 2 on D2 and the value 1 on D1, there will be no carry, as the D1 digit wheel has not rotated from 9 to zero. The value now on the D1 digit wheel will be rotated similarly, adding its value to the number on the results axis. There being no carry due the first result is 4 which is then sent to the printing (output) mechanism.

To produce the second result, the values of the D2 and D1 wheels are set to the difference values in row n = 2, so D2 is set to 2 again, and D1 becomes 3, Performing the same rotation (addition) sequence again yields a 5 on the D1 axis and a 9 on the result axis. No carries became due.

On the third sequence, D2 = 2 and D1 = 5. After the first rotation (addition) D1 becomes 7. When this is added to the value of 9 in the results axis, the results axis passes through zero, thus raising a carry, and counts on to 6. Now that there is a carry due, the carry processing arm swings around and adds a 1 onto the next higher order digit of the results axis, in this case the tens digit. This process continues for as long as is required for production of the target table.

There is a great deal of literature on Babbage. Some of it is noted here.

Babbage’s own writings are:

  • Babbage, Charles (1837) The Ninth Bridgewater Treatise. A fragment. London: Murray.
    Contains Babbage’s first account of his Analytical Engine.
  • Babbage, Charles (1843) “Addition to the Memoir of M. Menabrea on the Analytical Engine.” In The London, Edinburgh, and Dublin Philosophical Magazine, 23, (151), London, Richard and John E. Taylor, September 1843. “In which Babbage details his 20 years’ labour, the expenditure of his own fortune, and his absolute correctness in the handling of such Government funds as had been forthcoming.” [Quarritch booksellers catalogue]
  • Babbage, Charles (1864) Passages from the Life of a Philosopher, London: Longman, Green, Longman, Roberts and Green. This is an anecdotal autobiography in which Babbage reveals himself quite extensively. It has a frontispiece “woodcut of a small portion of Mr Babbage’s Difference Engine No.1., the property of the government, at present deposited in the Museum at South Kensington.” and still there, which is shown here as Fig.36, having been scanned from my copy of the volume.
  • Babbage’s collected works may be found in Campbell-Kelly, Martin (ed.) The Works of Charles Babbage. 11 vols. New York: New York University Press.

Other contemporary works

  • Babbage, Henry Prevost (1889) Babbage’s Calculating Engines. London, Spon. Henry Prevost, Babbage’s son, built a model of the Analytical Engine, and provided details on all Babbage’s engines.
  • Brewster, Sir David, Letters on Natural Magic. William Tegg, London, 1868.
  • Lardner, Dionysius (1834) “Babbage’s Calculating Engine”. in Edinburgh Review, No. CXX., July, 1834. Item describing the first small portion of the Difference Engine. Reprinted in Morrison and Morrison, 1961, op cit
  • Lovelace, Ada (nee Byron) Notes by the Translator to: ‘Sketch of the Analytical Engine invented by Charles Babbage, Esq.’ by L.F.Menabrea, in Bibliotheque Universelle de Geneve, No.82. Oct.1842.” in Taylor’s Scientific Memoirs, Vol.III, pp.666-731. Lovelace’s translation provides a thorough annotation based on her knowledge of the Analytical Engine gained through discussions with Babbage. Her notes are the best description of the Analytical Engine and the algorithms to be used on it. They show her to be a very competent mathematician and entirely justify the claim that she is the world’s first programmer. Lovelace’s translation of the Menebrea article and her notes also appear as Appendix I in Bowden, R.V., Faster than Thought, 1953, and in Morrison and Morrison, 1961.

More recent works include:

  • Bromley, Alan G. (1982) “Charles Babbage’s Analytical Engine, 1838” Annals of the History of Computing, vol.4, no.3, July, 1982, pp.196-217.
  • Bromley, Alan G. (1987) “The Evolution of Babbage’s Calculating Engines” in Annals of the History of Computing, vol.9, no.2, pp.113-136.
  • Bromley, A.G. (1990a) “Difference and Analytical Engines”, chapter 2 in Aspray, 1990, pp.59-98.
  • Dubbey, J.M. (1978) The mathematical work of Charles Babbage. Cambridge: Cambridge University Press.
  • Hyman, Anthony. (1982) Charles Babbage – Pioneer of the Computer. Oxford: Oxford University Press.
  • Morrison, P. and Morrison, E. (eds), Charles Babbage and his Calculating Engines: Selected writings by Charles Babbage and others. Dover, New York, N.Y., 1961.
  • Moseley, Maboth (1964) Irascible Genius. A Life of Charles Babbage, Inventor. London: Hutchinson.
  • Bromley, 1982; Bromley, 1987. Bromley, Alan G., “Difference and Analytical Engines” in Aspray, W. (ed) Computing Before Computers, Iowa State University Press, Ames, Iowa, 1990, pp.59-98.
  • Swade, Doron (1991), Charles Babbage and his Calculating Engines. London: Science Museum.


1 Often known as “Bones” on account of their commonly being made with ivory. Described in Bryden, D.J. (1992) Napier’s Bones: A History and Instruction Manual, London: Harriet Wynter Ltd.
2 These devices may be explored further in Williams, Michael R. (1990) “Early Calculation”, chapter 1 of Aspray, 1990 pp.14-20; and Tweedale, Geoffrey (1990) Calculating Machines and Computers, Princes Risborough, Bucks, UK: Shire Publications, pp.4-6.
3 Each of which are described in Tweedale, 1990 (op cit note 101), pp.7-9; and in considerably more detail in Williams, 1990 (op cit note 101), pp.35-49.
4 For a another description of the algorithm of differences see Bromley, Alan G., “Difference and Analytical Engines” in Aspray, W. (ed) Computing Before Computers, Iowa State University Press, Ames, Iowa, 1990.
5 Bowden, 1953, op cit, p.18.
6 Brewster, op cit, p341.
7 Passages… p42-3 referring to his reccollections of 1819.8 Babbage, 1864, op cit, p.58.
1 Babbage, 1864, op cit, p.62.

Return to Contents

%d bloggers like this:
search previous next tag category expand menu location phone mail time cart zoom edit close