First of all, the basic idea: The purpose of the Difference Engine was to pre-calculate tables of polynomials for books in the days before portable calculators. So you'd want to known 3x^{3} + 14x^{2} + 5 for all values of x from 1 to, say, 1000. As it happens, there's a clever little shortcut such that if you have a few values you can calculate the next one very simply using only addition from the previous answer (thus "Difference Engine").

So let's say f(x) = x^{2} + 3x.

See that second difference column is a constant. If we'd picked a polynomial of the 3rd degree, we'd have to work this out to the 3rd column. Fourth degree, 4th column, etc.x f(x) diff1 diff2 1 4 - - 2 10 6 - 3 18 8 2 4 28 10 2 5 40 12 2

So to build a machine, all you need to do is set the value for x = 1 and set the Nth difference in the last column. It automatically adds that difference to the previous difference, which is cascaded upwards until f(x + 1) is arrived at. Then you go around again. All that is required is simple addition.

What isn't explained on that page (that I saw) was how to know ahead of time what that last difference is going to be. Sure, you can work out N rows to get that Nth column, but it would be nice if you could set the inputs from direct inspection of the polynomial. As a matter of fact, this is easy.

Say f(x) = ax^{2} + bx + c. Then the difference between two successive answers (i.e. the value in the first difference column) is going to be:

`
a(x+1) ^{2} + b(x+1) + c - ax^{2} - bx - c`

= ax^{2} + 2ax + a + bx + b + c - ax^{2} - bx - c

= 2ax + a + b

The difference between successive entries in THAT column are going to be:

`
2a(x+1) + a + b - 2ax - a - b
= 2ax + 2a + a + b - 2ax - a - b
= 2a
`

And if we look at our example, we did indeed get 2 * 1 as the constant in the last column.

Working this out for a 3rd degree polynomial gives 6a (where a is the coefficient of x^{3}). Based on these two examples and looking at Pascal's Triangle, I predicted the value for a 4th degree would be 20. But it was actually 24.

In fact, if you work it out it should be clear that the constant difference will be a * n!, where a is the coefficient of the highest power of x and n is that power. It should be simple to prove this using induction, since all other terms always drop out and you muliply the coefficient by the power at each step on the way down.

So if I wanted to know what the constant difference was in the 5th column of differences for the polynomial 8x^{5} - 3x^{3} + 117, I just multiple 8 times 5! and get 960. I cram that, plus the initial value for x = 1 onto the machine and get cranking.