% vim: tw=50
% 11/03/2022 11AM

\begin{corollary}[integration by parts]
    Suppose $f'$ and $g'$ exist and are continuous
    on $[a, b]$. Then
    \[ \int_a^b f'g = f(b)g(b) - f(a)g(a) -
    \int_a^b fg' \]
\end{corollary}

\begin{proof}
    By the product rule
    \[ (fg)' = f'g + fg' \]
    By 5.9
    \[ f(b)g(b) - f(a)g(a) = \int_a^b f'g +
    \int_a^b fg' \]
\end{proof}

\begin{corollary}[integration by substitution]
    Let $g : [\alpha, \beta] \to [a, b]$ with
    $g(\alpha) = a$, $g(\beta) = b$ and $g'$
    exists and is continuous on $[\alpha, \beta]$.
    Let $f : [a, b] \to \RR$ be continuous. Then
    \[ \int_a^b f(x) \dd x = \int_\alpha^\beta
    f(g(t)) g'(t) \dd t \]
\end{corollary}

\begin{proof}
    Set $F(x) = \int_a^x f(t) \dd t$ as before.
    Let $h(t) = F(g(t))$ (defined since $g$ takes
    values in $[a, b]$). Then
    \begin{align*}
        \int_\alpha^\beta f(g(t)) g'(t) \dd t
        &=
        \int_\alpha^\beta F'(g(t)) g'(t) \dd t
        &&\text{(FTC)} \\
        &= \int_\alpha^\beta h'(t) \dd t
        &&\text{(Chain rule)} \\
        &= h(\beta) - h(\alpha) \\
        &= F(b) - F(a) \\
        &= \int_a^b f(x) \dd x
    \end{align*}
\end{proof}

\begin{theorem}[Taylor's Theorem with remainder an
    integral]
    Let $f^{(n)}(x)$ be continuous for $x \in [0,
    h]$. Then
    \[ f(h) = f(0) + \cdots + \frac{h^{n - 1}
    f^{(n - 1)}(0)}{(n - 1)!} + R_n \]
    where
    \[ R_n = \frac{h^n}{(n - 1)!} \int_0^1 (1 -
    t)^{n - 1} f^{(n)} (th) \dd t \]
\end{theorem}

\begin{proof}
    Substitution $u = th$.
    \[ R_n = \frac{1}{(n - 1)!} \int_0^h (h -
    u)^{n - 1} f^{(n)} (u) \dd u \]
    Integrating by parts now, we get:
    \[ R_n = -\frac{h^{n - 1} f^{(n - 1)}(0)}{(n -
    1)!} + \ub{\frac{1}{(n - 2)!} \int_0^h (h - u)^{n
    - 2} f^{(n - 1)}(u) \dd u}_{R_{n - 1}} \]
    If we integrate by parts $n - 1$ times we
    arrive at:
    \[ R_n = -\frac{h^{n - 1} f^{(n - 1)}(0)}{(n -
    1)!} - \cdots - hf'(0) + \ub{\int_0^h f'(u)
    \dd u}_{f(h) - f(0)} \]
\end{proof}

\myskip
Now we can get the Cauchy \& Lagrange form of the
remainder. However note that the proof above uses
continuity of $f^{(n)}$ not just mere existence as
in section 3. But first we need to prove:

\begin{theorem}
    $f, g : [a, b] \to \RR$ continuous with $g(x)
    \neq 0 \,\,\forall\,\, x \in (a, b)$. Then
    $\exists\,\, c \in (a, b)$ such that
    \[ \int_a^b f(x) g(x) \dd x = f(c) \int_a^b
    g(x) \dd x \]
\end{theorem}

\begin{note*}
    If we take $g(x) = 1$ we get
    \[ \int_a^b f(x) \dd x = f(c)(b - a) \]
    \begin{center}
        \includegraphics[width=0.6\linewidth]
        {images/74620426c4dd11ec.png}
    \end{center}
\end{note*}

\begin{proof}
    We're going to use Cauchy's MVT (Theorem 3.7).
    \[ F(x) = \int_a^x fg, \qquad G(x) = \int_a^x
    g \]
    Theorem 3.7 implies $\exists\,\, c \in (a, b)$
    such that
    \[ (F(b) - F(a))G'(c) = F'(c)(G(b) - G(a)) \]
    \[ \left( \int_a^b fg \right) g(c) = f(c)g(c)
    \int_a^b g \]
    Since $g(c) \neq 0$ we simplify and we're
    done.
\end{proof}

\myskip
Now we want to apply this to
\[ R_n = \frac{h^n}{(n - 1)!} \int_0^1 (1 - t)^{n
- 1} f^{(n)} (th) \dd t \]
First we use Theorem 5.13 with $g \equiv 1$, to
get
\[ R_n \frac{h^n}{(n - 1)!}(1 - \theta)^{n - 1}
f^{(n)}(\theta h) \]
($\theta \in (0, 1)$), which is Cauchy's form of
remainder!

\myskip
To get Lagrange, we use Theorem 5.13 with $g(t) =
(1 - t)^{n - 1}$ which is $> 0$ for $t \in (0,
1)$. Therefore $\exists\,\, \theta \in (0, 1)$
such that
\[ R_n = \frac{h^n}{(n - 1)!} f^{(n)}(\theta h)
\left[ \int_0^1 (1 - t)^{n - 1} \dd t \right] \]
and
\[ \int_0^1 (1 - t)^{n - 1} \dd t = \left.
-\frac{(1 - t)^n}{n} \right|_0^1 = \frac{1}{n} \]
\[ \implies R_n = \frac{h^n}{n!} f^{(n)}(\theta
h), \qquad \theta \in (0, 1) \]
which is Lagrange's form of the remainder!
