TITLE: A demonstration of Lagrange's Form for the Remainder of a Taylor Series
QUESTION [5 upvotes]: The following argument for Lagrange's Form for the Remainder of a Taylor polynomial is a typical one in analysis books.  Even in the case of finding the remainder when the Taylor polynomial is a linear polynomial, deciding on the functions $g(x)$ and $h(x)$ is not apparent.  (See the following argument.)  Can someone provide the motivation for these functions?  Also, does anyone know who concocted this argument?
Lagrange's Form for the Remainder
$f$ is a twice differentiable function defined on an interval $I$, and $a$ is an element in $I$ distinct from any endpoints of $I$. For every real number $x \in I$ distinct from $a$, there is a real number $c$ between $a$ and $x$ such that
\begin{equation*}
R_{1}(x) = \frac{f^{(2)}(c)}{2!} \, (x - a)^{2} .
\end{equation*}
So, if $T_{1}$ denotes the linear Taylor polynomial of $f$ at $a$,
\begin{equation*}
f(x) = T_{1}(x) + \frac{f^{(2)}(c)}{2!} \, (x - a)^{2} .
\end{equation*}
Demonstration
\begin{equation*}
g(u) = f(x) - \Bigl[f(u) + f^{\prime}(u)(x - u)\Bigr]
\end{equation*}
is a differentiable, and
\begin{equation*}
g^{\prime}(u) = - f^{\prime\prime}(u)(x - u) .
\end{equation*}
The function
\begin{equation*}
h(u) = g(u) - g(a) \left(\frac{1}{x - a}\right)^{2} (x - u)^{2}
\end{equation*}
is a also differentiable, and
\begin{equation*}
h^{\prime}(u) = - f^{\prime\prime}(u)(x - u) + 2g(a) \left(\frac{1}{x - a}\right)^{2} (x - u) .
\end{equation*}
Moreover, $h(x) = g(x) = 0$, and $h(a) = 0$. According to Rolle's Theorem, there is a real number $a < c < x$ such that $h^{\prime}(c) = 0$.
\begin{equation*}
0 = h^{\prime}(c)
= - f^{\prime\prime}(c)(x - c) + 2g(a) \left(\frac{1}{x - a}\right)^{2} (x - c) ,
\end{equation*}
or equivalently, since $x \neq c$ and since
\begin{equation*}
g(a) = f(x) - \Bigl[f(a) + f^{\prime}(a)(x - a)\Bigr] ,
\end{equation*}
\begin{equation*}
f(x) - \Bigl[f(a) + f^{\prime}(a)(x - a)\Bigr] = \frac{f^{\prime\prime}(c)}{2!} \, (x - a)^{2} .
\end{equation*}

REPLY [3 votes]: $\newcommand{\angles}[1]{\left\langle\,{#1}\,\right\rangle}
 \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\half}{{1 \over 2}}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\iff}{\Longleftrightarrow}
 \newcommand{\imp}{\Longrightarrow}
 \newcommand{\Li}[1]{\,\mathrm{Li}_{#1}}
 \newcommand{\mc}[1]{\mathcal{#1}}
 \newcommand{\mrm}[1]{\mathrm{#1}}
 \newcommand{\ol}[1]{\overline{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\ul}[1]{\underline{#1}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$

The $\underline{motivation}$ comes from repeatedly integration by parts of the following identity:
  $$
\mrm{f}\pars{x} =
\mrm{f}\pars{0} + \int_{0}^{x}\mrm{f}'\pars{x - t}\,\dd t
$$

\begin{align}
\mrm{f}\pars{x} & =
\mrm{f}\pars{0} + \int_{0}^{x}\mrm{f}'\pars{t}\,\dd t =
\mrm{f}\pars{0} + \int_{0}^{x}\mrm{f}'\pars{x - t}\,\dd t
\\[5mm] & =
\mrm{f}\pars{0} + \mrm{f}'\pars{0}x + \int_{0}^{x}t\,\mrm{f}''\pars{x - t}
\,\dd t
\\[5mm] & =
\mrm{f}\pars{0} + \mrm{f}'\pars{0}x + \half\,\mrm{f}''\pars{0}x^{2} + \half\int_{0}^{x}t^{2}\,\mrm{f}'''\pars{x - t}\,\dd t
\\[5mm] & =
\mrm{f}\pars{0} + \mrm{f}'\pars{0}x + \half\,\mrm{f}''\pars{0}x^{2} +
{1 \over 3 \times 2}\,\mrm{f}'''\pars{0}x^{3} +
{1 \over 3 \times 2}
\int_{0}^{x}t^{3}\,\mrm{f}^{\pars{\texttt{IV}}}\pars{x - t}\,\dd t
\\[5mm] & = \cdots =
\sum_{k = 0}^{n}{\mrm{f}^{\pars{n}}\pars{0} \over n!}\,x^{n} +
{1 \over n!}\int_{0}^{x}t^{n}\,\mrm{f}^{\pars{n + 1}}\pars{x - t}\,\dd t
\end{align}