1. Polynomial Interpolation

Let $\displaystyle h_i = x_i-x_{i-1}>0$. Suppose $\displaystyle f$ is three times differentiable and let $\displaystyle P_i$ be the linear interpolant through the points $\displaystyle (x_{i-1}, f(x_{i-1}))$ and $\displaystyle (x_i, f(x_i)).$
I want to show, for $\displaystyle h_i \rightarrow 0$
$\displaystyle \\$
$\displaystyle f'(x)-P'_i(x) = \frac{1}{2}(2x-x_{i-1}-x_i)f''(x)+\mathcal{O}(h_i^2)=$$\displaystyle \left(\begin{array}{cc}\mathcal{O}(h_i^2),&\mbox{ if } x= \frac{1}{2}(x_{i-1}+x_i)\\\mathcal{O}(h_i), & \mbox{ otherwise} \end{array}\right) 2. I almost have the solution. I just made a mistake somewhere with some minussign but i can't find a mistake; \displaystyle P_i(x) is of degree 1. So \displaystyle P_i'(x) is a constant and \displaystyle P_i'(x) = \frac{f(x_i)-f(x_{i-1})}{h_i} \displaystyle f(x_i)=f(x)+f'(x)(x-x_i)+\frac{1}{2}f"(x)(x-x_i)^2+\mathcal{O}(h_i^3) \displaystyle f(x_{i-1})=f(x)+f'(x)(x-x_{i-1})+\frac{1}{2}f"(x)(x-x_{i-1})^2+\mathcal{O}(h_i^3) So \displaystyle f(x_i)-f(x_{i-1}) =$$\displaystyle f'(x)(x_{i-1}-x_i)+\frac{1}{2}f"(x)(x^2-2xx_i+x_i^2-x^2+2xx_{i-1}-x_{i-1}^2)+\mathcal{O}(h_i^3)$
$\displaystyle =f'(x)(x_i-x_{i-1})+\frac{1}{2}f"(x)(-2x(x_i-x_{i-1})+(x_i-x_{i-1})(x_i+x_{i-1}))+\mathcal{O}(h_i^3)$
While $\displaystyle h_i=x_{i-1}-x_i$ the equation becomes
$\displaystyle =-f'(x)h_i+\frac{1}{2}f"(x)(-2xh_i+ (x_i+x_{i-1})h_i)+\mathcal{O}(h_i^3)$
And so $\displaystyle P_i'(x) = \frac{f(x_i)-f(x_{i-1})}{h_i}=-f'(x)+\frac{1}{2}f"(x)(-2x+ x_i+x_{i-1})+\mathcal{O}(h_i^2)$
Thus $\displaystyle f'(x)-P_i'(x)=f'(x)-(-f'(x)+\frac{1}{2}f"(x)(-2x+ x_i+x_{i-1})+\mathcal{O}(h_i^2)$

So somewhere there is a small mistake, can you find it anywhere?
thanks