Engine Difference Babbage’s
On my old blog, I once did a post on Babbage’s Difference Engine and how to run it backwards. However, I didn’t really finish the thought there and just recently it came up again IRL. 1 So this time, I think I’ll do the whole post.
The DE computed polynomials and worked by simple addition. It consisted of a series of numerical columns each of which had multiple digits, each column representing different stages of the computation, as I’ll show below. Suppose you have a function like

I can compute this using only addition by starting with a table like this:

The
and
columns are pretty self-explanatory. The
and
columns are the differences between successive entries in the column to the left of each. For instance, the 3 at the top of the
column is the difference between the 2 and the 5 in the
column. The 2 at the top of the
column is the difference between the the 3 and the 5 in the
column. (There are exactly two difference columns because this is a 2nd degree polynomial.)
Once I have a table started, I compute the function using simple addition from the right to the left, starting with the constant in the rightmost column, like this:



So all Babbage’s Difference Engine had to do was be able to add columns and it could compute tables of values for any polynomial (of degree
for some number of columns in his machine).
Not a lot of call for computing mathematical tables today and that goes double for mechanical computers. However, this technique can be used in reverse for something that’s slightly more helpful. Say I have a function that I can compute, but I don’t have a polynomial expression for it. I’m going to choose a simple one that probably has other ways to figure out:

Start by just computing a few values:

Then the differences of those values

Then the differences of those differences

When the last column is constant, we are done and we know the degree of the polynomial we are looking for. 2 That polynomial can be expressed as

Which means the first differences column can be expressed as:
![Rendered by QuickLaTeX.com \begin{eqnarray*} f'(x) & = & f(x+1) - f(x) \\ & = & \left[a(x+1)^2 + b(x+1) + c\right] - \left[ax^2 + bx + c\right] \\ & = & ax^2 + 2ax + a + bx + b +c - ax^2 - bx - c \\ & = & 2ax + a + b \end{eqnarray*}](http://david.rysdam.org/blog/wp-content/ql-cache/quicklatex.com-f46cb0536ed151edd789f05fcd9c7b16_l3.png)
Likewise, the second differences column can be expressed as:
![Rendered by QuickLaTeX.com \begin{eqnarray*} f''(x) & = & f'(x+1) - f'(x) \\ & = & \left[2a(x+1) + a + b\right] - \left[2ax + a + b\right]\\ & = & 2a \end{eqnarray*}](http://david.rysdam.org/blog/wp-content/ql-cache/quicklatex.com-4eab553f251483311401c4cb853b3fc8_l3.png)
This is the function for the last column, so now we know that in the searched-for polynomial
. With that, let’s back up a step and solve
using the known values of
and
.

And now do the same thing to solve for
.

So the final polynomial is

And there we have it.
