Error in trapezoidal rule via integral mean value theorem During a class, I saw the following analysis of the error term in the trapezoidal rule

For $f \in C^2([a,b])$, $\int_a^b f(x) \,dx - \frac{b-a}{2}[f(a)+f(b)] = -\frac{(b-a)^3}{12}f''(\eta)$ for some $\eta \in (a,b)$
Proof
The error is $\int_a^b f(x) - p_1(x)\,dx$ where $p_1$ is the Langrange interpolant of $f$ at $a,b$. We have $f(x) - p_1(x) = (x-a)(x-b) \frac{f''(\zeta(x))}{2}$ for some $\zeta(x) \in (a,b)$ so by the integral mean value theorem $$\int_a^b f(x) \,dx - \frac{b-a}{2}[f(a)+f(b)] = \int_a^b (x-a)(x-b)\frac{f''(\zeta(x))}{2} \, dx = $$
$$f''(\eta) \int_a^b \frac{(x-a)(x-b)}{2} \,dx \text{ for some } \eta \in (a,b)$$ and then computing the integral gives the result.

The derivation I know for the error term for the Lagrange interpolant (in general) involves repeated applications of Rolle's theorem. In particular, the proof of existence of suitable $\zeta(x)$ is non-constructive so we don't know that $\zeta(x)$ is continuous, which I think is a problem for applying the integral mean value theorem since $f''\circ \zeta$ may not be continuous even though $f''$ is.
I've since seen this proof in a few different places and all of them pass over this issue without comment. Why is it that we can apply the integral mean value theorem here?
Edit: I've changed the proposition to be for $f$ twice continuously differentiable on $[a,b]$ rather than on $(a,b)$. Given this is a requirement in the IMVT I imagine this was either a typographical error either in my memory or in the original proof.
 A: The proposition is simpler than implied because
$$\frac{(x-a)(x-b)}2\le0$$
For all $x\in[a,b]$. Thus
$$\frac{(x-a)(x-b)}2\max\left(f^{\prime\prime}(x)\right)\le\frac{(x-a)(x-b)}2f^{\prime\prime}(\zeta(x))\le\frac{(x-a)(x-b)}2\min\left(f^{\prime\prime}(x)\right)$$
And so
$$\begin{align}\max\left(f^{\prime\prime}(x)\right)\int_a^b\frac{(x-a)(x-b)}2dx&\le\int_a^b\frac{(x-a)(x-b)}2f^{\prime\prime}(\zeta(x))dx\\
&\le\min\left(f^{\prime\prime}(x)\right)\int_a^b\frac{(x-a)(x-b)}2dx\end{align}$$
Now
$$\int_a^b\frac{(x-a)(x-b)}2f^{\prime\prime}(\zeta(x))dx=f^{\prime\prime}(\eta)\int_a^b\frac{(x-a)(x-b)}2dx$$
Follows from the continuity of $f^{\prime\prime}(x)$ and the intermediate value theorem.
A: Consider the function $h : (a,b) \rightarrow \mathbb{R}$ given by
$$ h(x) = 2 \frac{f(x) - p_1(x)}{(x-a)(x-b)}. $$
It is clear, that $h \in C^2((a,b))$ and by the definition of $\xi$ we have
$$\forall x \in (a,b) \: : \: f''(\xi(x)) = h(x).$$
We now make the following claims


*

*$h$ can be extended continuously to the entire entire interval $[a,b]$.

*The extended function $\bar{h}$ satifies $$\forall x \in [a,b] \: \exists\, \nu \in (a,b) \: : \: \bar{h}(x) = f''(\nu).$$

*The extended function $\bar{h}$ satisfies $$\forall x \in [a,b] \: : \: f(x) - p_1(x) = \frac{1}{2}\bar{h}(x)(x-a)(x-b).$$


Before proving these claims show that the extended function $\bar{h}$ solves our problem. By the mean value theorem for integration we have
$$ \int_a^b f(x) - \int_a^b p_1(x) dx = \frac{1}{2} \int_a^b \bar{h}(x) (x-a)(x-b) dx = \frac{1}{2} \bar{h}(\eta) \int_a^b (x-a)(x-b) dx, $$
for some $\eta \in [a,b]$.
We now prove the claims made above.


*

*We will now investigate the behavior of $h$ as $x$ tends to $a$ from the left. To that end, let $T(x) = f(x) - p_1(x)$ and $N(x) = (x-a)(x-b)$, so that $$h(x) = 2 \frac{T(x)}{N(x)}.$$ Then $$T(x) \rightarrow 0, \quad
x \rightarrow a_+, \quad \text{and} \quad N(x) \rightarrow 0, \quad x \rightarrow a_+,$$ which is why we investigate the derivatives $T'$ and $N'$. We have $$T'(x) = f'(x) - p'_1(x) \rightarrow f'(a) - p'_1(a), \quad x \rightarrow a_+ $$ and $$ N'(x) = 2x - (a+b) \rightarrow a - b,\quad x \rightarrow a_+$$ It follows by l'Hospital's theorem that $$h(x) \rightarrow 2 \frac{f'(a) - p'_1(a)}{a-b}, \quad x \rightarrow a_+$$ In the same fashion we discover, that $$h(x) \rightarrow 2 \frac{f'(b) - p'_1(b)}{b-a}, \quad x \rightarrow b_-$$ This proves that $h$ can be extended continuously to the entire interval $[a,b]$.

*By the definition of $\xi = \xi(x)$ we have $$\forall x \in [a,b] \: : f(x) - p_1(x) = \frac{1}{2} f''(\xi(x)) (x-a)(x-b).$$ This implies that $$\forall x \in (a,b) \: : \: \exists\, \nu \in [a,b] \: : \: h(x) = f''(\nu).$$
Specifically, we can use $\nu = \xi(x)$. It remains to investigate the endpoints. This requires the use of divided differences with repeated points. We have
$$ \frac{1}{2} \bar{h}(a) = \frac{f'(a) - p'_1(a)}{a-b} = \frac{f'(a) - \frac{f(a)-f(b)}{a-b}}{a-b} = \frac{f[a,a]-f[b,a]}{a-b} = f[b,a,a].$$
By the mean value theorem for divided differences we have
$$\exists \mu \in (a,b) \: : \: f[b,a,a] = \frac{1}{2} f''(\mu).$$ It follows that $$\exists \mu \in (a,b) \: : \: h(a) = f''(\mu).$$ The same reasoning applies to the right hand end point $b$. This completes the proof of the second claim.

*As in the previous paragraph, we have $$\forall x \in (a,b) \: : f(x) - p_1(x) = \frac{1}{2} f''(\xi(x)) (x-a)(x-b) = \frac{1}{2} h(x)(x-a)(x-b).$$ By the continuity of $f$, $p_1$, and $\bar{h}$ this identity holds at the endpoints as well. This completes the proof of the third claim.


I would like to end with a small comment. 
Frequently, we use the chain rule to show that the composition $F \circ G$ of two functions $F$ and $G$ is differentiable. Here we do not care about the differentiability of either $f''$ or $\xi$, because we have an alternative representation of $f'' \circ \xi$ from which we deduce that that $f'' \circ \xi$ is differentiable for all $x \in (a,b)$. For the purpose of proving the theorem, it is irrelevant that we have exhausted the differentiability of $f$ and that we know nothing about the differentiability of $\xi$.
EDIT: After discussions with user5713492 I would like to emphasize that the above requires $f$ to be differentiable at $a$ and $b$. This is quietly used in the proof of Claim 1 above.
A: From the construction of the Newton interpolation polynomial we know that for the quadratic interpolation in $a,x,b$ one can write
$$
p_2(t)=f(a)+f[a,b](t-a)+f[a,b,x](t-a)(t-b)
$$
Now the first two terms form also the linear interpolation polynomial $p_1(t)$, so evaluating at $t=x$ gives
$$
f(x)=p_2(x)=p_1(x)+f[a,b,x](x-a)(x-b).
$$
For the divided differences we know $f[a,b,x]=\frac12f''(\xi_x)$.
Now if we defer the transformation of divided differences to derivative to after the integral mean value theorem, we get for the continuous function $f[a,b,x]$
\begin{align}
\int_a^b(f(x)-p_1(x))dx&=\int_a^bf[a,b,x](x-a)(x-b)\,dx  \\
&=f[a,b,c]\int_a^b(x-a)(x-b)\,dx  \\
&=\frac{f''(\xi)}{2}·\left(-\frac{(b-a)^3}{6}\right).
\end{align}
