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

\begin{remark*}
    We have shown that monotone functions and
    continuous functions are Riemann integrable,
    but there do exist more complicated functions
    that are Riemann integrable.s
\end{remark*}

\begin{example*}
    $f : [0, 1] \to \RR$
    \[ f(x) = \begin{cases}
        \frac{1}{q} & x = \frac{p}{q} \in (0, 1]
        \text{in its lowest form} \\
        0 & \text{otherwise}
    \end{cases} \]
    Clearly $s(f, \mathcal{D}) = 0 \,\,\forall\,\,
    \mathcal{D}$. We'll show that given $\eps >
    0$, $\exists \mathcal{D}$ such that $S(f,
    \mathcal{D}) < \eps$. This would imply that
    $f$ is integrable with $\int_0^1 f = 0$.
    Consider the set
    \[ \left\{x \in [0, 1] : f(x) \ge \frac{1}{N}
    \right\} = \left\{ \frac{p}{q} : 1 \le q \le
    N, 1 \le p \le q \right\} \]
    Take $N \in \NN$ such that $\frac{1}{N} <
    \frac{\eps}{2}$. This is a finite set
    \[ 0 < t_1 < t_2 < \cdots < t_R = 1 \]
    Consider a dissection $\mathcal{D}$ of $[a,
    b]$ such that
    \begin{enumerate}[(1)]
        \item Each $t_k$, $1 \le k < R$ is some
            $(x_{j - 1}, x_j)$
        \item $\forall\,\, k$, the unique interval
            containing $t_k$ has length at most
            $\frac{\eps}{2R}$.
    \end{enumerate}
    Note $f \le 1$ everywhere so
    \[ S(f, \mathcal{D}) \le \frac{1}{N} +
    \frac{\eps}{2} < \eps \]
\end{example*}

\subsubsection*{Elementary Properties of the Integral}

Let $f, g$ bounded and integrable on $[a, b]$.
\begin{enumerate}[(1)]
    \item If $f \le g$ on $[a, b]$ then
        \[ \int_a^b f \le \int_a^b g \]
    \item $f + g$ is integrable on $[a, b]$ and
        \[ \int_a^b f + g = \int_a^b f + \int_a^b
        g \]
    \item For any constant $k$, $kf$ is integrable
        and
        \[ \int_a^b kf = k \int_a^b f \]
    \item $|f|$ is integrable and
        \[ |\int_a^b f| \le \int_a^b |f| \]
    \item The product $fg$ is integrable.
\end{enumerate}

\begin{proof}
    \begin{enumerate}[(1)]
        \item If $f \le g$, then
            \begin{align*}
                \int_a^b f
                &= I^*(f) \\
                &\le S(f, \mathcal{D}) \\
                &\le S(g, \mathcal{D}) \\
                \implies \int_a^b f
                &= I^*(f) \\
                &\le I^*(g) \\
                &= \int_a^b g
            \end{align*}
        \item \eqnoskip
            \[ \sup_{[x_{j - 1}, x_j]} (f + g) \le
            \sup_{[x_{j - 1}, x_j]} f +
            \sup_{[x_{j - 1}, x_j]} g \]
            \[ \implies S(f + g, \mathcal{D}) \le
            S(f, \mathcal{D}) + S(g, \mathcal{D}) \]
            Now take dissections $\mathcal{D}_1$
            and $\mathcal{D}_2$
            \begin{align*}
                I^*(f + g)
                &\le S(f + g, \mathcal{D}_1 \cup
                \mathcal{D}_2) \\
                &\le S(f, \mathcal{D}_1 \cup
                \mathcal{D}_2) + S(g,
                \mathcal{D}_1 \cup \mathcal{D}_2)
                \\
                &\le S(f, \mathcal{D}_1) + S(g,
                \mathcal{D}_2)
            \end{align*}
            Fix $\mathcal{D}_1$ and take inf over
            $\mathcal{D}_2$ to get
            \[ I^*(f + g) \le S(f, \mathcal{D}_1)
            + I^*(g) \]
            now take inf over all $\mathcal{D}_1$
            to get
            \[ I^*(f + g) \le I^*(f) + I^*(g) =
            \int_a^b f + \int_a^b g \]
            Similarly
            \[ \int_a^b f + \int_a^b g \le I_*(f +
            g) \]
            so $f + g$ is integrable with integral
            equal to the sum of integrals.
        \item Exercise!
        \item Consider
            \[ f_+(x) = \max(f(x), 0) \]
            \[ \sup_{[x_{j - 1}, x_j]} f_+ -
            \inf_{[x_{j - 1}, x_j]} f_+ \le
            \sup_{[x_{j - 1}, x_j]} f - \inf_{[x_{j -
            1}, x_j]} f \]
            We know that given $\eps > 0$ there
            exists $\mathcal{D}$ such that
            \[ S(f, \mathcal{D}) - s(f,
            \mathcal{D}) < \eps \]
            (criterion from last time)
            \[ S(f, \mathcal{D}) - s(f,
            \mathcal{D}) = \sum_{j = 1}^n
            (\sup_{[x_{j - 1}, x_j]} f -
            \inf_{[x_{j - 1}, x_j]} f) (x_j - x_{j
            - 1}) \]
            \[ \implies S(f_+, \mathcal{D}) -
            s(f_+, \mathcal{D}) \le S(f,
            \mathcal{D}) - s(f, \mathcal{D}) <
            \eps \]
            \[ \implies \text{$f_+$ is integrable} \]
            But $|f| = 2f_+ - f$, so by (2) and
            (3), $|f|$ is integrable. Since
            \[ -|f| \le f \le |f| \]
            property (1) gives
            \[ |\int_a^b f| \le \int_a^b |f| \]
        \item Take $f$ integrable and $\ge 0$.
            Then
            \[ \sup_{[x_{j - 1}, x_j]} f^2 =
            \left( \sup_{[x_{j - 1}, x_j]} f
            \right)^2 = M_j^2 \]
            \[ \inf_{[x_{j - 1}, x_j]} f^2 =
            \left( \inf_{[x_{j - 1}, x_j]} f
            \right)^2  = m_j^2\]
            Thus
            \begin{align*}
                S(f^2, \mathcal{D}) - s(f^2,
                \mathcal{D})
                &= \sum_{j = 1}^n (x_j -
                x_{j - 1})(M_J^2 - m_j^2) \\
                &= \sum_{j = 1}^n (x_j - x_{j -
                1})(M_j + m_j)(M_j - m_j) \le
                2K(S(f, \mathcal{D}) - s(f,
                \mathcal{D}))
            \end{align*}
            ($|f(X)| \le K \,\,\forall\,\, x \in
            [a, b]$) Using the criterion in
            Theorem 5.3 we deduce that $f^2$ is
            integrable. Now take any $f$, then
            $|f| \le 0$. Since $f^2 = |f|^2$ we
            deduce that $f^2$ is integrable for
            any $f$. Finally for $fg$ note that
            \[ 4fg = (f + g)^2 - (f - g)^2 \]
            hence $fg$ is integrable given what we
            proved before.
    \end{enumerate}
\end{proof}
