<s>[INST] Application for mean value theorem $f(x)$ is three-times differentiable on $[a,b]$, how to show that there is $\varepsilon\in(a,b)$ such that
$$f(b)=f(a)+\cfrac{1}{2}(b-a)[f'(a)+f'(b)]-\cfrac{1}{12}(b-a)^3f'''(\varepsilon)$$
 [/INST] Let $$F(x) := f(b)-f(x)- \frac{1}{2} (b-x) \cdot (f'(b)+f'(x)) - K \cdot (b-x)^3$$ where $$K := \frac{f(b)-f(a)-\frac{1}{2} (b-a) \cdot (f'(b)+f'(a))}{(b-a)^3} \tag{1}$$
Then $F$ is differentiable on $[a,b]$ and $F(a)=F(b)=0$. ($K$ is chosen such that $F(a)=0$.) By Rolle's theorem there exists $\varrho \in (a,b)$ such that $F'(\varrho)=0$, i.e.
$$ \begin{align} 0 = F'(\varrho) &= \underbrace{-f'(\varrho)+ \frac{1}{2} (f'(b)+f'(\varrho))}_{\frac{1}{2} (f'(b)-f'(\varrho))}- \frac{1}{2}(b-\varrho) \cdot f''(\varrho) + 3K \cdot (b-\varrho)^2  \\ \Leftrightarrow - \frac{1}{2} f'(b) &= - \frac{1}{2}f'(\varrho) - \frac{1}{2}f''(\varrho) \cdot (b-\varrho) + 3K \cdot (b-\varrho)^2 \tag{2} \\ \Leftrightarrow g(b) &= g(\varrho) + g'(\varrho) \cdot (b-\varrho) +3K \cdot (b-\varrho)^2 \end{align}  $$
where $g:=-\frac{1}{2} f'$. This already looks like a Taylor expansion of $g$. In fact, by applying Taylor's theorem to $g$ we obtain
$$\begin{align} g(b) &= g(\varrho) + g'(\varrho) \cdot (b-\varrho) + \frac{g^{(2)}(\varepsilon)}{2!} \cdot (b-\varrho)^2 \\ \Leftrightarrow - \frac{1}{2} f'(b) &= - \frac{1}{2} f'(\varrho) - \frac{1}{2} f''(\varrho) \cdot (b-\varrho) - \frac{1}{2} \cdot \frac{f^{(3)}(\varepsilon)}{2!} \cdot (b-\varrho)^2 \tag{3} \end{align}$$
for some $\varepsilon \in (\varrho,b) \subseteq (a,b)$. Now we subtract $(3)$ from $(2)$:
$$\begin{align} 0 &= 3K \cdot (b-\varrho)^2 + \frac{f^{(3)}(\varepsilon)}{4} \cdot (b-\varrho)^2 \\ \Rightarrow K &= - \frac{1}{12} \cdot f^{(3)}(\varepsilon) \end{align}$$
Hence
$$ \begin{align} - \frac{1}{12} \cdot f^{(3)}(\varepsilon) &= K \stackrel{(1)}{=} \frac{f(b)-f(a)-\frac{1}{2} (b-a) \cdot (f'(b)+f'(a))}{(b-a)^3} \\ \Leftrightarrow f(b) &= f(a) + \frac{1}{2} (b-a) \cdot (f'(b)+f'(a)) - \frac{1}{12} \cdot (b-a)^3 \cdot f^{(3)}(\varepsilon) \end{align}$$
</s>