Hermite problem formula 
Consider the Hermite problem $$p^{(r)}(x_i)=y_i^{(r)},\ i=1,2 ;\ 
 r=0,1,2$$ with $p(x)$ a polynomial of degree $\leq 5$.
a - Give a Lagrange type of formula for $p(x)$.
b - Give a Newton divided difference formula and also derive an error formula.

Attempt at a solution:
What I know up to this point is for the basis functions $l(x_2)=l'(x_2)=l''(x_2)=0$, I will then have to use $l(x)=(x-x_2)^3g(x)$, where $g(x)$ is of degree $\leq 2$, then I will have to find $g(x)$. 
 A: Your notation is confusing to me, so I used something that makes more sense to me, please forgive that. 
The Lagrange Polynomial is given by:
$\tag 1 \displaystyle P(x) = f(x_0)L_{n,0}(x) + \cdots + f(x_n)L_{n,n}(x) = \sum_{k=0}^{n} f(x_k)L_{n,k}(x), \text{where}$
$\tag 2 \displaystyle L_{n,k}(x) = \frac{(x-x_0)(x-x_1)\cdots (x-x_{k-1})(x-x_{k+1}) \cdots (x-x_n)}{(x_k - x_0)(x_k - x_1) \cdots (x_k-x_{k-1})(x_k-x_{k+1}) \cdots (x_k-x_n)} = \prod_{i=0, i \ne k}^n \frac{(x-x_1)}{(x_k-x_i)}$
for each $k = 0, 1, \cdots, n.$
So, for the three values of $r$, we have:


*

*$\tag 3 \displaystyle L_{2,0}(x) = \frac{(x-x_1)(x-x_2)}{(x_0-x_1)(x_0-x_2)}$ and we can calculate $L_{2,0}'(x)$

*$\tag 4 \displaystyle L_{2,1}(x) = \frac{(x-x_0)(x-x_2)}{(x_1-x_0)(x_1-x_2)}$ and we can calculate $L_{2,1}'(x)$

*$\tag 5 \displaystyle L_{2,2}(x) = \frac{(x-x_0)(x-x_1)}{(x_2-x_0)(x_2-x_1)}$ and we can calculate $L_{2,2}'(x)$
The Hermite polynomials are given by:
$\tag 6 H_{2n+1}(x) = \sum_{j=0}^{n} f(x_j)H_{n,j}(x) + \sum_{j=0}^{n} f'(x_j) \hat H_{n,j}(x)$, where
$\tag 7 H_{n,j}(x) = [1 - 2(x-x_j)L'_{n,j}(x_j)]L^2_{n,j}(x)$, and
$\tag 8 \hat H_{n,j}(x) = (x - x_j)L^2_{n,j}(x).$
Using all of this information, we can write a Lagrange type formula as (the function-values, $f(x_k)$) below represent the six data points you have, that is, three values each for $f(x_k)$ and $f'(x_k)$:
$\tag 9 \displaystyle H_5(x) = f(x_0)H_{2,0}(x) + f(x_1)H_{2,1}(x) + f(x_2)H_{2,2}(x) + f'(x_0) \hat H_{2,0}(x) + f'(x_1) \hat H_{2,1}(x) + f'(x_2) \hat H_{2,2}(x).$
From the above, you can see that this is a complete description of the Hermite polynomials, however, we needed to determine and evaluate the Lagrange polynomials and their derivatives, which is tedious, even for these small values of $n$.
An alternative method for generating the Hermite approximations is to use the Newton interpolatory divided-difference formula for the Lagrange polynomials at $x_0, x_1, \ldots, x_n:$
$\tag {10} \displaystyle P_n(x) = f[x_0] + \sum_{k=1}^{n} f[x_o, x_1, \ldots, x_k](x-x_0) \cdots (x-x_{k-1})$
We can write out a divided-difference table to find all of the coefficients as (you can fill out the three missing columns):
$$\begin{array}{c|c|c}
\text{z} & \text{f(z)} & \text{1st divided differences} & \text{2nd divided differences}\\ 
\hline
\\z_0 = x_0 & f[z_0] = f(x_0) &   &  
\\  &  & f[z_0, z_1] = f'(x_0) & 
\\z_1 = x_0 & f[z_1] = f(x_0) &  & f[z_0, z_1, z_2] = \frac{f[z_1, z_2]-f[z_0,z_1]}{z_2-z_0}
\\ &  & f[z_1, z_2] = \frac{f[z_2]-f[z_1]}{z_2-z_1} & 
\\z_2 = x_1 & f[z_2] = f(x_1) &  & f[z_1, z_2, z_3] = \frac{f[z_2, z_3]-f[z_1,z_2]}{z_3-z_1}
\\ &  & f[z_2, z_3] = f'(x_1) & 
\\z_3 = x_1 & f[z_3] = f(x_1) &  & f[z_2, z_3, z_4] = \frac{f[z_3, z_4]-f[z_2,z_3]}{z_4-z_2}
\\ &  & f[z_3, z_4] = \frac{f[z_4]-f[z_3]}{z_4-z_3} & 
\\z_4 = x_2 & f[z_4] = f(x_2) &  & f[z_3, z_4, z_5] = \frac{f[z_4, z_5]-f[z_3,z_4]}{z_5-z_3}
\\ &  & f[z_4, z_5] = f'(x_2) & 
\\z_5 = x_2 & f[z_5] = f(x_2) &  & 
\end{array}$$
We can now form $H_5(x) = P(x)$ using the values in this table with the Newton divided-differences formula.
I'll leave it to you to derive the error term, all you need to do is look at the Lagrange and Newton error term with a slight change.
Hope that all makes sense and too bad we didn't have real data to play with and actually solve.
A: I'm wondering, for this Hermite problem it seems that you are given 2 nodes and the polynomial must interpolate through the second derivates.
I could be wrong but wouldn't we need to have a formula that is different than the usual hermite problem with just going through the first derivative? 
