# Deriving a polynomial from nth differences

Let $$f(x) = ax^2 + bx + c.$$ Then the first differences of $$f(x)$$ can be written as $$g(x),$$ as follows

\begin{align} g(x) =\,& f(x + 1) - f(x) \\ =\,& [a(x + 1)^2 + b(x + 1) + c] \\ -\,& [ax^2 + bx + c] \\ =\,& a(2x + 1) + b \\ =\,& (2a)x + (a + b) \end{align}

The first differences of $$g(x)$$ will be the second differences of $$f(x).$$ We write these as $$h(x),$$ as follows

\begin{align} h(x) =\,& g(x + 1) - g(x) \\ =\,& (2a)(x + 1) + (a + b) \\ -\,& (2a)x + (a + b) \\ =\,& 2a \end{align}

Now, the pattern is clear

$$\begin{array}{} c & & a + b + c & & 4a + 2b + c & & 9a + 3b + c \\ & a + b & & 3a + b & & 5a + b & \\ & & 2a & & 2a & & \\ \end{array}$$

This pattern is useful, because it allows us to find a quadratic from its first 3 values. In fact, this method can be generalized to work for any polynomial. If you start with $$f$$ being an $$n$$th degree polynomial, you will need to compute its nth differences to find the pattern. To use the pattern, you'll need the first $$n + 1$$ values from the polynomial you're attempting to infer.