\section{Taylor's Formula}
\label{section:taylor}

\begin{theorem}[Taylor's Formula, Lagrange Remainder]
\label{theorem:taylor-lagrange}
    Let $-\infty < a < b < \infty$, $E$ be a separated locally convex space, $S \subset [a, b]$ be at most countable, $n \in \natp$, and $f \in C^{n}([a, b]; E)$ be $(n+1)$-fold differentiable on $[a, b] \setminus N$, then
    \[
    f(b) - f(a) - \sum_{k = 1}^n \frac{1}{k!}D^kf(a)(b - a)^k
    \]

    is contained in the closed convex hull of
    \[
    \bracs{D^{n+1}f(s)(t - a)^{n+1}  | s \in (a, b) \setminus N, t \in [a, b]}
    \]

\end{theorem}
\begin{proof}[Proof {{\cite[Theorem 4.7.1]{Bogachev}}}. ]
    If $n = 0$, then the theorem is the \hyperref[Mean Value Theorem]{theorem:mean-value-theorem-line}.

    Suppose inductively that the theorem holds for $n$. Let
    \[
    g: [a, b] \to E \quad t \mapsto f(t) - \sum_{k = 1}^{n+1} \frac{1}{k!}D^kf(a)(t - a)^k
    \]

    then for any $t \in (0, 1)$,
    \begin{align*}
    Dg(t) &= Df(t) - \sum_{k = 1}^{n+1} \frac{1}{(k-1)!}D^{k}f(a)(t - a)^{k-1} \\
    &= Df(t) - Df(a) - \sum_{k = 1}^{n} \frac{1}{k!}D^{k+1}f(a)(t - a)^{k}
    \end{align*}
    by the \hyperref[Mean Value Theorem]{theorem:mean-value-theorem-line},
    \[
    g(b) - g(a) = f(b) - f(a) - \sum_{k = 1}^{n+1} \frac{1}{k!}D^kf(a)(t - a)^k
    \]

    is contained in the closed convex hull of
    \[
    \bracs{\braks{Df(t) - Df(a) - \sum_{k = 1}^{n} \frac{1}{k!}D^{k+1}f(a)(t - a)^{k}}(b - a) \bigg | t \in [a, b]}
    \]


    By the inductive hypothesis applied to $Df$, for any $t \in [a, b]$,
    \[
    Df(t) - Df(a) - \sum_{k = 1}^n \frac{1}{k!}D^{k+1}f(a)(t - a)^k
    \]

    is contained in the closed convex hull of
    \[
    \bracs{D^{n+2}f(s)(t - a)^{n+1} | s \in (a, t) \setminus N}
    \]

    Therefore
    \[
    f(b) - f(a) - \sum_{k = 1}^{n+1} \frac{1}{k!}D^kf(a)(b - a)^k
    \]

    is contained in the convex hull of
    \[
    \bracs{D^{n+2}f(s)(t - a)^{n+2} | s \in (a, t) \setminus N, t \in [a, b]}
    \]

\end{proof}

\begin{theorem}[Taylor's Formula, Peano Remainder]
\label{theorem:taylor-peano}
    Let $E$ be a topological vector space, $\sigma \subset \mathfrak{B}(E)$ be an ideal containing bounded subsets in finite-dimensional subspaces, $F$ be a separated locally convex space, $U \subset E$ be open, and $f: U \to F$ be $n$-fold $\tilde \sigma$-differentiable at $x_0 \in U$, then there exists $r \in \mathcal{R}_\sigma^n(E; F)$ such that
    \[
    f(x_0 + h) = f(x_0) + \sum_{k = 1}^n \frac{1}{k!}D^k_\sigma f(x_0)(h^{(k)}) + r(h)
    \]

    for sufficiently small $h$. 
\end{theorem}
\begin{proof}[Proof {{\cite[Theorem 4.7.3]{Bogachev}}}. ]
    Let
    \[
    r(h) = f(x_0 + h) - f(x) - \sum_{k = 1}^n \frac{1}{k!}D^k_\sigma f(x_0)(h^{(k)})
    \]

    For any $1 \le k \le n$, $D^k_\sigma(x_0) \in B^k_\sigma(E; F)$ is symmetric by \autoref{theorem:derivative-symmetric}. Let $T_k(h) = \frac{1}{k!}D^k_\sigma f(x_0)(h^{(k)})$, then by \autoref{theorem:power-rule}, for any $\bracs{t_j}_1^\ell \in E$,
    \[
    D^\ell_\sigma T_k(h)(t_1, \cdots, t_\ell) = \begin{cases}
        0 &\ell > k \\
        D^k_\sigma(x_0)(t_1, \cdots, t_\ell) &\ell = k \\
         \frac{1}{(k-\ell)!}D^k_\sigma(x_0)(h^{(k - \ell)}, t_1, \cdots, t_\ell) & \ell < k
    \end{cases}
    \]

    so
    \[
    D^k_\sigma r(0) = D^k_\sigma g(x_0) - D^k_\sigma f(x_0) = 0
    \]


    If $n = 1$, then the theorem holds by definition of the derivative. Now suppose inductively that the theorem holds for $n$. By the \hyperref[Mean Value Theorem]{theorem:mean-value-theorem},
    \[
    r(h) = r(h) - r(0) \in \overline{\text{Conv}\bracs{D_\sigma r(s)(h)| s \in [0, h]}}
    \]

    For any $A \in \sigma$ and $t > 0$,
    \[
    \frac{r(tA)}{t^{n+1}} \subset \overline{\text{Conv}\bracs{t^{-n}D_\sigma r(s)(h)|s \in [0, h], h \in tA}}
    \]

    Let $U \in \cn_F(0)$ be convex and circled, then by the inductive assumption applied to $D_\sigma r$, there exists $t_0 \in (0, 1)$ such that for any $t \in (0, t_0)$.
    \[
    \frac{D_\sigma r(tA)}{t^n} \subset \bracs{T \in L(E; F)| T(A) \subset U}
    \]

    Since $U$ is circled,
    \[
    \bracs{T \in L(E; F)| T(A) \subset U} = \bracs{T \in L(E; F)| T(tA) \subset U \forall t \in (0, 1)}
    \]

    so
    \[
    \bracs{t^{-n}D_\sigma r(s)(h)|s \in [0, h], h \in tA} \subset U
    \]

    and
    \[
    \frac{r(tA)}{t^{n+1}} \subset \overline{\text{Conv}\bracs{t^{-n}D_\sigma r(s)(h)|s \in [0, h], h \in tA}} \subset \overline{U}
    \]

    Therefore $r \in \mathcal{R}_\sigma^{n+1}(E; F)$.
\end{proof}


\begin{theorem}[Taylor's Formula, Integral Remainder]
\label{theorem:taylor-integral}
    Let $E$ be a topological vector space, $\sigma \subset \mathfrak{B}(E)$ be a covering ideal, $F$ be a separated locally convex space, $U \subset E$ be open, and $f \in C^{n+1}_\sigma(E; F)$, then for any $x_0 \in U$ and $h \in E$ such that $[x_0, x_0 + h] \subset U$, then
    \[
    f(x_0 + h) = f(x_0) + \sum_{k = 1}^n \frac{1}{k!}D^k_\sigma f(x_0)(h^{(k)}) + r(h)
    \]

    where
    \[
    r(h) = \int_0^1 \frac{(1 - t)^{n}}{n!}D^{n+1}_\sigma f(x_0 + th)(h^{(n+1)}) dt
    \]

    In particular, for any continuous seminorm $[\cdot]_F: F \to [0, \infty)$, 
    \[
    [r(h)]_F \le \frac{1}{(n+1)!} \cdot \sup_{t \in [0, 1]}[D^{n+1}_\sigma f(x_0 + th)(h^{n+1})]
    \]
\end{theorem}
\begin{proof}[Proof, {{\cite[Section XIII.6]{Lang}}}. ]
    Firstly, if $n = 0$, then by the \hyperref[Fundamental Theorem of Calculus]{theorem:ftc-riemann}, 
    \[
    f(x_0 + h) - f(x_0) = \int_0^1 D_\sigma f(x_0 + th)(h) dt
    \]

    Assume inductively that the theorem holds for $n \in \natz$. Let
    \[
    u(t) =  D^{n+1}_\sigma f(x + ty)(h^{(n+1)}) \quad v(t) = -\frac{(1 - t)^{n+1}}{(n+1)!}
    \]

    then $Dv(t) = (1 - t)^n/n!$, and using the \hyperref[change of variables formula]{theorem:rs-change-of-variables} and \hyperref[integration by parts]{theorem:rs-ibp},
    \begin{align*}
        r(h) &= \frac{1}{n!}\int_0^1 (1 - t)^{n}D^{n+1}_\sigma f(x_0 + th)(h^{(n+1)}) dt \\
        &= \int_0^1 udv = u(1)v(1) - u(0)v(0) - \int_0^1 vdu \\
        &= D_\sigma^{n+1}(x_0)(h^{(n+1)}) \\
        &+ \int_0^1 \frac{(1 - t)^{n+1}}{(n+1)!}D^{n+2}_\sigma f(x_0 + th)(h^{(n+2)}) dt
    \end{align*}
\end{proof}
