Numerical Analysis/Divided differences

The Expanded Form of the Definition
The usual definition of divided differences is equivalent to the Expanded form

With help of a polynomial functions $$q$$ with $$q(\xi) = (\xi-x_0) \cdots (\xi-x_n)$$ this can be written as

f[x_0,\dots,x_n] = \sum_{j=0}^{n} \frac{f(x_j)}{q'(x_j)}\,. $$

Since we will need the Expanded form ($$) for our other work below, we first prove that it is equivalent to the usual definition.

Proof of the expanded form
For $$n=1$$, ($$) holds because

f[x_0,x_1]= \frac{f[x_1]-f[x_0]}{x_1-x_0}= \frac{f(x_0)}{(x_0-x_1)} + \frac{f(x_1)}{(x_1-x_0)}\,. $$ We now assume ($$) holds for $$n$$ and show that this implies it also holds for $$n+1$$. Thus by induction it holds for all $$n$$.

If the formula $$f[x_0,x_1,\ldots,x_n]=\sum_{j=0}^n\frac{f(x_j)}{q'(x_j)}$$, where $$q(\xi)=\prod_{k=0}^n(\xi-x_k)$$, then denoting $$q_1(\xi)=\prod_{k=1}^{n+1}(\xi-x_k),$$ $$q_2(\xi)=\prod_{k=0}^n(\xi-x_k)$$ and $$Q(\xi)=\prod_{k=0}^{n+1}(\xi-x_k)$$, we have

\begin{align} f[x_0,x_1,\ldots,x_{n+1}]&=\frac{f[x_1,\ldots,x_{n+1}]-f[x_0,\ldots,x_n]}{x_{n+1}-x_0}\\&=\frac 1{x_{n+1}-x_0}\left(\sum_{j=0}^n\frac{f(x_{j+1})}{q_1'(x_{j+1})}-\sum_{j=0}^n\frac{f(x_j)}{q_2'(x_j)}\right)\\&=\frac 1{x_{n+1}-x_0}\left(\sum_{k=1}^{n+1}\frac{f(x_k)}{q_1'(x_k)}-\sum_{k=0}^n\frac{f(x_k)}{q_2'(x_k)}\right)\\&=\frac 1{x_{n+1}-x_0}\left(\frac{f(x_{n+1})}{q_1'(x_{n+1})}+\sum_{k=1}^nf(x_k)\left(\frac 1{q_1'(x_k)}-\frac 1{q_2'(x_k)}\right)-\frac{f(x_0)}{q_2'(x_0)}\right) \,. \end{align} $$ We have,
 * $$(x_{n+1}-x_0)q_1'(x_{n+1})=(x_{n+1}-x_0)\prod_{k=1}^n(x_{n+1}-x_k)=\prod_{k=0}^{n}(x_{n+1}-x_k)=Q'(x_{n+1}),$$
 * $$(x_{n+1}-x_0)q_2'(x_0)=(x_{n+1}-x_0)\prod_{k=1}^n(x_0-x_k)=-\prod_{k=1}^{n+1}(x_0-x_k)=-Q'(x_0)$$

and

\begin{align} \frac 1{q_1'(x_k)}-\frac 1{q_2'(x_k)}&=\prod_{j=1,j\neq k}^{n+1}\frac 1{x_k-x_j}-\prod_{j=0,j\neq k}^n\frac 1{x_k-x_j} \\&=\prod_{j=0,j\neq k}^{n+1}\frac 1{x_k-x_j}(x_k-x_0-(x_k-x_{n+1})) \\&=(x_{n+1}-x_0)\prod_{j=0,j\neq k}^{n+1}\frac 1{x_k-x_j}\,, \end{align} $$ which gives
 * $$f[x_0,x_1,\ldots,x_{n+1}]=\sum_{j=0}^{n+1}\frac{f(x_j)}{Q'(x_{j+1})}=\sum_{j=0}^{n+1} \frac{f(x_j)}{\prod_{k\in\{0,\dots,n\}\setminus\{j\}} (x_j-x_k)}\,.$$

Hence, since the assertion holds for $$n=1$$ and $$n+1$$, then by induction, the assertion holds for all positive integer $$n$$.

Symmetry property of divided differences
The divided differences have a number of special properties that can simplify work with them. One of the property is called the Symmetry Property which states that the Divided differences remain unaffected by permutations (rearrangement) of their variables.

Now we prove this symmetry property by showing that

f[x_0,x_1\dots,x_n]=f[x_1,x_0\dots,x_n]\quad \text{etc.} $$ When $$n=1$$, we have

f[x_1,x_0]= \frac{f[x_1]-f[x_0]}{x_1-x_0}= \frac{f(x_0)}{(x_0-x_1)} + \frac{f(x_1)}{(x_1-x_0)}= \frac{f[x_0]-f[x_1]}{x_0-x_1}=f[x_0,x_1]\,. $$ Hence $$f[x_1,x_0]=f[x_0,x_1]$$, which is the symmetry of the first divided difference.

When $$n=2$$, we have

\begin{align} f[x_2,x_1,x_0] &= \frac{f[x_2,x_1]-f[x_1,x_0]}{x_2-x_0}=\frac{{\frac{f[x_2]-f[x_1]}{x_2-x_1}}-{\frac{f[x_1]-f[x_0]}{x_1-x_0}}}{x_2-x_0}\\&=\frac{f(x_2)}{(x_2-x_0)\cdot(x_2-x_1)} + \frac{f(x_1)}{(x_1-x_0)\cdot(x_1-x_2)} + \frac{f(x_0)}{(x_0-x_1)\cdot(x_0-x_2)}\\&=f[x_0,x_1,x_2]=f[x_1,x_0,x_2] \quad\text{etc.} \end{align} $$ Hence $$f[x_2,x_1,x_0]=f[x_0,x_1,x_2]=f[x_1,x_0,x_2]$$ etc., which is the symmetry of the second divided difference.

Similarly, when $$n=3$$ we have

\begin{align} f[x_3,x_2,x_1,x_0]&=\frac{f[x_3,x_2,x_1]-f[x_2,x_1,x_0]}{x_3-x_0}\\&=\frac{f(x_0)}{(x_0-x_1)\cdot(x_0-x_2)\cdot(x_0-x_3)} + \frac{f(x_1)}{(x_1-x_0)\cdot(x_1-x_2)\cdot(x_1-x_3)} + \frac{f(x_2)}{(x_2-x_0)\cdot(x_2-x_1)\cdot(x_2-x_3)} +\\&\quad\quad \frac{f(x_3)}{(x_3-x_0)\cdot(x_3-x_1)\cdot(x_3-x_2)}\\&=f[x_0,x_1,x_2,x_3]=f[x_1,x_0,x_2,x_3]\quad\text{etc.} \end{align} $$ Hence $$f[x_3,x_2,x_1,x_0]=f[x_0,x_1,x_2,x_3]=f[x_1,x_0,x_3,x_2]$$ etc., which is the symmetry of the third divided difference.

In general, we can use the Expanded Form ($$) to obtain

f[x_0,x_1\dots,x_n] =\sum_{j=0}^{n} \frac{f(x_j)}{\prod_{k\in\{0,\dots,n\}\setminus\{j\}} (x_j-x_k)}= f[x_1,x_0\dots,x_n]\quad\text{etc.} $$ Hence $$f[x_0,x_1\dots,x_n]=f[x_1,x_0\dots,x_n]$$ etc., which is the symmetry of the $$n^{th}$$ divided difference.

Computing the divided differences in tabular form
A difference table is again a convenient device for displaying differences, the standard diagonal form being used and thus the generation of the divided differences is outlined in Table below.



\begin{matrix} x  & f(x)   &\text{First Divided Difference}   &\text{Second Divided Difference}     &\text{Third Divided Difference}   &\text{Fourth Divided Difference} \\ x_0 & f[x_0] &                                           &             & \\ &   &f[x_0,x_1]= \frac{f[x_1]-f[x_0]}{x_1-x_0} & \\ x_1 & f[x_1]&                                               &f[x_0,x_1,x_2]= \frac{f[x_1,x_2]-f[x_0,x_1]}{x_2-x_0}& \\ &   &f[x_1,x_2]= \frac{f[x_2]-f[x_1]}{x_2-x_1} &                 &f[x_0,x_1,x_2,x_3]= \frac{f[x_1,x_2,x_3]-f[x_0,x_1,x_2]}{x_3-x_0}\\ x_2 & f[x_2]&                                               &f[x_1,x_2,x_3]= \frac{f[x_2,x_3]-f[x_1,x_2]}{x_3-x_1}&   &f[x_0,x_1,x_2,x_3,x_4]=\frac{f[x_1,x_2,x_3,x_4]-f[x_0,x_1,x_2,x_3]}{x_4-x_0} \\ &   &f[x_2,x_3]= \frac{f[x_3]-f[x_2]}{x_3-x_2} &                 &f[x_1,x_2,x_3,x_4]= \frac{f[x_2,x_3,x_4]-f[x_1,x_2,x_3]}{x_4-x_1}\\ x_3 & f[x_3]&                                             &f[x_2,x_3,x_4]= \frac{f[x_3,x_4]-f[x_2,x_3]}{x_4-x_2}& \\ &   &f[x_3,x_4]= \frac{f[x_4]-f[x_3]}{x_4-x_3}&                 \\ x_4 & f[x_4]&                                             \\

\end{matrix} $$

A Numerical Example 1
For a function $$f$$, the divided differences are given by



\begin{matrix} x_1=2& f[x_1]=2&  \\ & \\ x_0=1& f[x_0]=-6&  \\ & \\ x_2=4&  f[x_2]=12& \\ \end{matrix} $$ find $$f[x_0,x_1,x_2]$$.

Solution:



\begin{matrix} x&       f(x)  &\text{First Divided Difference}  &\text{Second Divided Difference} \\ x_1=2& f[x_1]=2&                  &  \\ & &f[x_1,x_0]=\frac{(-6)-2}{1-2}=8&    &  \\ x_0=1& f[x_0]=-6&                   &f[x_1,x_0,x_2]=\frac{6-8}{4-2}=-1 \\ & &f[x_0,x_2]=\frac{12-(-6)}{4-1}=6& & \\ x_2=4& f[x_2]=12&                &  \\ \end{matrix} $$

Hence, $$f[x_1,x_0,x_2]=-1$$ and by symmetry property we know that $$f[x_1,x_0,x_2]=f[x_0,x_1,x_2]$$, Hence $$f[x_0,x_1,x_2]=-1$$.

A Numerical Example 2
For a function $$f$$, the divided differences are given by



\begin{matrix} x_0=0.0& f[x_0]&                  &                           \\ & &f[x_0,x_1]&    &                              \\ x_1=0.4& f[x_1] &                 &  &f[x_0,x_1,x_2]=\frac{50}{7}&     \\ & &f[x_1,x_2]=10& &                                \\ x_2=0.7& f[x_2]=6&                 &                            \\ \end{matrix} $$ Determine the missing entries in the table.

Solution: We have the formula
 * $$f[x_0,x_1,x_2]=\frac{f[x_1,x_2]-f[x_0,x_1]}{x_2-x_0}$$

and substituting gives
 * $$\frac{50}{7}=\frac{(10-f[x_0,x_1])}{0.7}\,.$$

Thus,
 * $$f[x_0,x_1]=-0.7\cdot(\frac{50}{7}) + {10}=5$$

Using the formula
 * $$f[x_1,x_2]=\frac{f[x_2]-f[x_1]}{x_2-x_1}$$

and substituting gives
 * $$10=\frac{(6-f[x_1])}{0.3}\,.$$

Thus,
 * $$f[x_1]=6-3=3\,.$$

Further,
 * $$f[x_0,x_1]= \frac{f[x_1]-f[x_0]}{x_1-x_0}\,.$$

So,
 * $$5=\frac{(3-f[x_0])}{0.4}\,.$$

Thus,
 * $$f[x_0]=3-2=1$$.

Algorithm: Newton's Divided-Differences
Given the points $$(x_i,f(x_i)), i=0,1,...,n.$$ Step 1: Initialize $$F_i,_0=f(x_i), i=0,1,...,n.$$ Step 2: For $$i=1:n.$$ For $$j=1:i.$$ $$F_i,_j=\frac{F_i,_{j-1}-F_{i-1},_j}{x_i-x_{i-j}} $$ End End Result: The diagonal, $$F_i,_j$$ now contains $$f[x_0,...,x_i].$$

Generalization of the Mean Value Theorem
For any n + 1 pairwise distinct points x0, ..., xn in the domain of an n-times differentiable function f there exists an interior point
 * $$ \xi \in (\min\{x_0,\dots,x_n\},\max\{x_0,\dots,x_n\}) \,$$

where the nth derivative of f equals $$n$$ ! times the $$n^{th}$$ divided difference at these points:
 * $$ f[x_0,\dots,x_n] = \frac{f^{(n)}(\xi)}{n!}\,.$$

This is called the Generalized Mean Value Theorem. For $$n=1$$ we have
 * $$f[x_0,x_1]= \frac{f[x_1]-f[x_0]}{x_1-x_0}=f'(\xi)$$

for some $$ \xi$$ between $$x_0$$ and $$x_1$$, which is exactly Mean Value Theorem. We have extended MVT to higher order derivatives as
 * $$ f[x_0,\dots,x_n] = \frac{f^{(n)}(\xi)}{n!}\,.$$

What is the theorem telling us?
 * This theorem is telling us that the Newton's $$n^{th}$$ divided difference is in some sense approximation to the $$n^{th}$$ derivatives of $$f$$.

A Numerical Example
Let $$f(x)=\cos(x)$$, $$x_0=0.2,x_1=0.3,x_2=0.4$$. Then, Show that for some $$ \xi$$ between the minimum and maximum of $$x_0,x_1$$ and $$x_2$$. Solution:
 * 1) $$f[x_0,x_1]\approx f'(\xi)$$
 * 2) $$f[x_0,x_1,x_2]\approx\frac{1}{2}f''(\xi)$$
 * $$f[x_0,x_1]= \frac{f[x_1]-f[x_0]}{x_1-x_0}=\frac{\cos(0.3)-\cos(0.2)}{0.3-0.2}=-0.2473009 $$

If we chose $$ \xi=0.25, $$ Where $$ 0.25 \in (0.2,0.3)$$ and we get $$f'(\xi)=-\sin(0.25)=-0.24744040$$ and we can see that $$f[x_0,x_1]$$ is a very good approximation of this derivative. Similarly,
 * $$f[x_1,x_2]= \frac{f[x_2]-f[x_1]}{x_2-x_1}=\frac{\cos(0.4)-\cos(0.3)}{0.4-0.3}=-0.3427550$$

and
 * $$f[x_0,x_1,x_2]= \frac{f[x_1,x_2]-f[x_0,x_1]}{x_2-x_0}=\frac{-0.3427550-(-0.2473009)}{0.4-0.2}=-0.4772705\,.$$

Thus, by the Generalized Mean Value Theorem with $$n=2$$ we have
 * $$f[x_0,x_1,x_2]=\frac{1}{2}f''(\xi)$$

for some $$ \xi$$ between the minimum and maximum of $$x_0,x_1$$ and $$x_2$$. Taking $$f(\xi)=-\cos(\xi)$$ with $$\xi=x_1$$, we have $$\frac{1}{2}f(0.3)=-\frac{1}{2}\cos(0.3)=-0.4776682$$ which is nearly equal to the result of $$f[x_0,x_1,x_2]=-0.4772705$$ Thus with this example we conclude that the Newton's $$n^{th}$$ divided difference is in some sense an approximation to the $$n^{th}$$ derivatives of $$f$$.

Quiz
{find $$f[2,4,9,10]$$ where $$f(x)=x^4+x^2+1$$ + 25 - -25
 * type=""}

- 50 - -50

{If $$f[x_1,x_0]=f[x_0,x_1]$$ then, this is called symmetry of the - zero divided difference + first divided difference - second divided difference - third divided difference
 * type=""}

{Let $$f(x)=\cos(x)$$, $$x_0=0.2,x_1=0.3$$ Then, $$f[x_0,x_1]= $$ + -0.2473009 - 0.2473009 - -0.2474404 -  0.2474404
 * type=""}

{If $$f[x_0,x_1]= \frac{f[x_1]-f[x_0]}{x_1-x_0}=f'(\xi)$$ for some $$ \xi$$ between $$x_0$$ and $$x_1$$ then, this is exactly - Generalized Mean Value Theorem + Mean Value Theorem - Derivative of $$f$$ - Rolle's Theorem
 * type=""}

{If $$f[x_0,x_1,x_2]= \frac{f[x_1,x_2]-f[x_0,x_1]}{x_2-x_0}$$ then, this is called - First Divided Difference + Second Divided Difference - Third Divided Difference - Fourth Divided Difference
 * type=""}

Reference

 * Guide to Numerical Analysis by Peter R. Turner
 * Numerical Analysis by Richard L. Burden and J. Douglas Faires (EIGHT EDITION)
 * Elementary Numerical Analysis by Kendall Atkinson (Second Edition)
 * Applied Numerical Analysis by Gerald / Wheatley (Sixth Edition)
 * Theory and Problems of Numerical Analysis by Francis Scheid