% vim: tw=50
% 16/02/2022 11AM

\begin{proof}
    Let
    \[ \phi(x) = \left|
    \begin{matrix}
        1 & 1 & 1 \\
        f(a) & f(x) & f(b) \\
        g(a) & g(x) & g(b)
    \end{matrix}
    \right| \]
    $\phi$ is continuous on $[a, b]$ and
    differentiable on $(a, b)$. Also
    \[ \phi(a) = \phi(b) = 0 \]
    By Rolle's Theorem $\exists\,\, t \in (a, b)$
    such that
    \[ \phi'(t) = 0 \]
    \[ \phi'(x) = f'(x)g(b) - g'(x)f(b) +
    f(a)g'(x) - g(a)f'(x) \]
    \[ = f'(x)[g(b) - g(a)] + g'(x)[f(a) - f(b)] \]
    and $\phi'(t) = 0$ gives the desired result.
\end{proof}

\noindent
``Lesson'': good choice of auxiliary function +
Rolle!

\begin{example*}[L'H\^opital's Rule]
    The example:
    %\begin{align*}
    %    \lim_{x \to 0} \frac{e^x - 1}{\sin x}
    %    &= \lim_{x \to 0} \frac{e^x - e^0}{\sin x
    %    - \sin 0} \\
    %    &= \lim_{x \to 0} \frac{e^t}{\cos t} \\
    %    &= 1
    %\end{align*}
    \[ \lim_{x \to 0} \frac{e^x -1 }{\sin x} =
    \lim_{x \to 0} \frac{e^x - e^0}{\sin x - \sin
    0} \]
    \[ = \lim_{x \to 0} \frac{e^t}{\cos t} = 1 \]
    where $t = t(x) \in (0, x)$ is chosen using
    Cauchy's Mean Value Theorem.
\end{example*}

\noindent
Goal: we want to extend the MVT to include higher
order derivatives.

\begin{theorem}[Taylor's Theorem With Lagrange's Remainder]
    Suppose $f$ and its derivatives up to order $h
    - 1$ are continuous in $[a, a + h]$ and
    $f^{(n)}$ exists for $x \in (a, a + h)$. Then
    \[ f(a + h) = f(a) + hf'(a) + \frac{h^2}{2!}
    f''(a) + \cdots + \frac{h^{n - 1}f^{(n -
    1)}(a)}{(n - 1)!} + \frac{h^n}{n!} f^{(n)}(a +
    \theta h) \]
    where $\theta \in (0, 1)$.
\end{theorem}

\begin{note*}
    \begin{enumerate}[(1)]
        \item For $n = 1$ we get back MVT, so this
            is a ``$n$-th order MVT''.
        \item $R_n = \frac{h^n}{n!}f^{(n)}(a +
            \theta h)$ is known as Lagrange's form
            of the remainder
    \end{enumerate}
\end{note*}

\begin{proof}
    Define $0 \le t \le h$
    \[ \phi(t) = f(a + t) - f(a) - tf'(a) - \cdots
    - \frac{t^{n - 1}}{(n - 1)!} f^{(n - 1)}(a) -
    \frac{t^n}{n!}B \]
    where we choose $B$ such that $\phi(h) = 0$.
    (Note $\phi(0) = 0$.) (Recall that in the
    proof of the MVT we used $f(x) - kx$ and
    picked $k$ so we could use Rolle). We see that
    \[ \phi(0) = \phi;(0) = \cdots = \phi^{(n -
    1)}(0) = 0 \]
    We use Rolle's Theorem then $n$-times. Since
    $\phi(0) = \phi(h) = 0$
    \[ \text{Rolle } \implies \phi'(h_1) = 0
    \qquad 0 < h_1 < h \]
    Since $\phi'(0) = 0 = \phi'(h_1)$
    \[ \text{Rolle } \implies \phi''(h_2) = 0
    \qquad 0 < h_2 < h_1 \]
    Finally $\phi^{(n - 1)}(0) = \phi^{(n -
    1)}(h_{n - 1}) = 0$
    \[ \text{Rolle } \implies \phi^{(n)}(h_n) = 0
    \qquad 0 < h_n < h_{n - 1} < \cdots < h \]
    so $h_n = \theta h$ for $\theta \in (0, 1)$.
    Now
    \[ \phi^{(n)}(t) = f^{(n)}(a + t) - B \]
    \[ \implies B = f^{(n)}(a + \theta h) \]
    Set $t = h$, $\theta(h) = 0$ and put this
    value of $B$ in the second line in the proof.
\end{proof}

\begin{theorem}[Taylor's Theorem with Cauchy's Form of Remainder]
    With the same hypothesis as in Theorem 3.8 and
    $a = 0$ (to simplify) we have
    \[ f(h) = f(0) + hf'(0) + \cdots + \frac{h^{n
    - 1}}{(n - 1)!} f^{(n - 1)}(0) + R_n \]
    where
    \[ R_n = \frac{(1 - \theta)^{n -
    1}f^{(n)}(\theta h) h^n}{(n - 1)!} \]
    for $\theta \in (0, 1)$.
\end{theorem}

\begin{proof}
    Define
    \[ F(t) = f(h) - f(t) - (h - t)f'(t) - \cdots
    - \frac{(h - t)^{n - 1}f^{(n - 1)}(t)}{(n -
    1)!} \]
    for $t \in [0, h]$.
    \[ F'(t) = -f'(t) + f'(t) - (h - t)f''(t) +
    (h - t) f''(t) - \frac{(h - t)^2}{2} f'''(t) +
    \cdots - \frac{(h - t)^{n - 1}}{(n -
    1)!}f^{(n)}(t) \]
    \[ \implies F'(t) = -\frac{(h - t)^{n - 1}}{(n
    - 1)!}f^{(n)}(t) \]
    Set
    \[ \phi(t) = F(t) - \left[ \frac{h - t}{h}
    \right]^p F(0) \]
    with $p \in \ZZ$, $1 \le p \le n$. Then
    $\phi(0) = \phi(h) = 0$. By Rolle's $\exists
    \,\,\theta \in (0, 1)$ such that
    \[ \phi'(\theta h) = 0 \]
    but
    \[ \phi'(\theta h) = F'(\theta h) + \frac{p(1
    - \theta)^{p - 1}}{h} F(0) = 0 \]
    \[ \implies 0 = -\frac{h^{n - 1}(1 -
    \theta)^{n - 1}}{(n - 1)!}f^{(n)}(\theta h) +
    \frac{p(1 - \theta)^{p - 1}}{h} \left[ f(h) -
    f(0) - hf'(0) - \cdots - \frac{h^{n - 1}}{(n -
    1)!} f^{(n - 1)}(0) \right] \]
    \[ \implies f(h) = f(0) + hf'(0) + \cdots +
    \frac{h^{n - 1}}{(n - 1)!}f^{(n - 1)}(0) +
    \frac{h^n(1 - \theta)^{n - 1}}{(n - 1)!p(1 -
    \theta)^{p - 1}} f^{(n)}(\theta h) \]
    If $p = n$ we get Lagrange's remainder. If $p
    = 1$ we get Cauchy's remainder.
\end{proof}
