% vim: tw=50
% 08/10/2022 11AM

\subsection{Convergence of Functions}

Let $X \subset \RR$, let $f_n : X \to \RR$ ($n \ge 1$)
and let $f : X \to \RR$. What does it mean for
$(f_n)$ to converge to $f$? \myskip
(Mostly can think of $X = \RR$ or some interval).
\myskip
Obvious idea:

\begin{definition*}[Convergence of functions]
    Say $(f_n)$ \emph{converges pointwise} to $f$
    and write $f_n \to f$ pointwise if $\forall~x
    \in X$, $f_n(x) \to f(x)$ as $n \to \infty$.
\end{definition*}

\noindent
Advantages:
\begin{itemize}
    \item Simple
    \item Easy to check
    \item Defined in terms of convergence in
        $\RR$.
\end{itemize}
Disadvantages:
\begin{itemize}
    \item Doesn't preserve `nice' properties.
    \item `Doesn't feel right'.
\end{itemize}

\subsubsection*{Examples}

In all three examples, have $X = [0, 1]$, $f_n \to
f$ pointwise.

\begin{example*}[Limit of continuous functions not
    continuous]
    Consider:
    \[ f(x) = \begin{cases}
        0 & x = 0 \\
        1 & x > 0
    \end{cases} \]
    and
    \[ f_n(x) = \begin{cases}
        nx & x \le \frac{1}{n} \\
        1 & x > \frac{1}{n}
    \end{cases} \]
    \begin{center}
    \begin{tsqx}
        ! size(2.5cm);
        (-0.5,0)--(1.5,0) EndArrow
        (0,-0.5)--(0,1.5) EndArrow
        label 1 @ (-0.3,1)
        label 1 @ (1,-0.3)
        label $\frac{1}{n}$ @ (0.25,-0.3)
        (0,0)--(0.25,1)--(1,1)
        label $f_n$ @ (1.2,1.2)
        (0.25,0)--(0.25,1) dotted
        (1,0)--(1,1) dotted
    \end{tsqx}
    \end{center}
    Clearly $f_n$ continuous for all $n$ but $f$
    not continuous. \myskip
    Proving that $f_n \to f$:
    \begin{itemize}
        \item If $x = 0$, then $\forall~n, f_n(0)
            = 0 = f(0)$.
        \item If $x > 0$, for sufficiently large
            $n$, $f_n(x) = 1 = f(x)$, so $f_n(x)
            \to f(x)$.
    \end{itemize}
\end{example*}

\begin{example*}[Limit of integrable not
    integrable]
    \begin{note*}
        As in IA, ``integrable'' means ``Riemann
        integrable''.
    \end{note*}
    Consider
    \[ f(x) = \begin{cases}
        1 & x \in \QQ \\
        0 & x \not\in \QQ
    \end{cases} \]
    Enumerate the rationals in $[0, 1]$ as $q_1,
    q_2, \dots$. For $n \ge 1$, set
    \[ f_n(x) = \begin{cases}
        1 & x = q_1, \dots, q_n \\
        0 & \text{otherwise}
    \end{cases} \]
\end{example*}

\begin{example*}[Functions and limit are
    integrable, but integral doesn't converge]
    Let $f(x) = 0$ for all $x$, so $\int_0^1 f =
    0$. Define $f_n$ such that $\int_0^1 f_n = 1$
    for all $n$:
    \[ f_n(x) = \begin{cases}
        n & 0 < x < \frac{1}{n} \\
        0 & \text{otherwise}
    \end{cases} \]
    Now $f_n \to f$ but clearly $\int_0^1 f_n
    \not\to \int_0^1 f$.
\end{example*}

\noindent
Now we try to make a ``better'' definition so that
more of these properties might be able to hold.

\begin{definition*}
    Let $X \subset \RR$, $f_n : X \to \RR$ ($n \ge
    1$), $f : X \to \RR$. We say $(f_n)$
    \emph{converges uniformly} to $f$ and write
    $f_n \to f$ uniformly if
    \[ \forall\eps > 0 ~\exists N ~\forall x ~\in
    X ~\forall n \ge N \quad |f_n(x) - f(x)| <
    \eps \]
\end{definition*}

\noindent
The definition for pointwise convergence can be
restated as:
\[ \forall \eps > 0 ~ \forall x \in X ~ \exists N
~ \forall n \ge N \quad |f_n(x) - f(x)| < \eps \]
In particular $f_n \to f$ uniformly $\implies$
$f_n \to f$ pointwise.
\begin{center}
    \includegraphics[width=0.6\linewidth]
    {images/416ab3d046f411ed.png}
\end{center}
Equivalently, $f_n \to f$ uniformly if for
sufficiently large $n$ $f_n - f$ is bounded and
\[ \sup_{x \in X} |f_n(x) - f(x)| \to 0 \]

\begin{theorem}
    Let $X \subset \RR$, let $f_n : X \to \RR$ be
    continuous $(n \ge 1)$ and let $f_n \to f : X
    \to \RR$ uniformly. Then $f$ is continuous.
\end{theorem}

\noindent
``A uniform limit of continuous functions is
continuous.''

\begin{proof}
    Let $x \in X$. Let $\eps > 0$. As $f_n \to f$
    uniformly, can find $N$ such that $\forall n
    \ge N$, $\forall y \in X$, $|f_n(y) - f(y)| <
    \eps$. In particular, $\forall y \in X$,
    $|f_N(y) - f(y)| < \eps$. As $f_N$ is
    continuous, can find $\delta > 0$ such that
    $\forall y \in X$,
    \[ |y - x| < \delta \implies |f_N(y) - f_N(x)|
    < \eps \]
    Now let $y \in X$ with $|y - x| < \delta$.
    Then
    \begin{align*}
        |f(y) - f(x)|
        &\le |f(y) - f_N(y)| + |f_N(y) - f_N(x)| +
        |f_N(x) - f(x)| \\
        &< \eps + \eps + \eps \\
        &= 3\eps
    \end{align*}
    But $3\eps$ can be made arbitrarily small by
    taking $\eps$ arbitrarily small. Hence $f$ is
    continuous.
\end{proof}

\begin{remark*}
    This is often called a ``$3\eps$ proof'' (or
    an ``$\frac{\eps}{3}$ proof'' if written in a
    different style).
\end{remark*}

\begin{flashcard}[uniform-limit-of-integrable-is-integrable]
\begin{theorem}
    Let $f_n : [a, b] \to \RR$ ($n \ge 1$) be
    integrable and let $f_n \to f : [a, b] \to
    \RR$ uniformly. Then $f$ is integrable and
    \[ \int_a^b f_n \to \int_a^b f \]
    as $n \to \infty$.
\end{theorem}
\prompt{

\begin{proof}
\cloze{
    Show $f$ is bounded since $f = (f - f_n) +
    f_n$, and $f_n$ bounded since integrable, and
    $f - f_n$ bounded for $n$ sufficiently large.
    \\
    Now show $f$ integrable by Riemann's
    criterion:
    \[ S(f_N, \mathcal{D}) - s(f_N, \mathcal{D}) <
    \eps \]
    (slightly long calculation for this step).
    \\
    Now show
    \[ \left| \int_a^b f_n - \int_a^b f \right|
    \le (b - a) \sup_{x \in [a, b]} |f_n(x) -
    f(x)| \to 0 \]
}
\end{proof}
}
\end{flashcard}

\begin{proof}
    As $f_n \to f$ uniformly, can pick a
    sufficiently large $n$ such that $f_n - f$ is
    bounded. Also, $f_n$ is bounded (as
    integrable). So by triangle inequality,
    \[ f = (f - f_n) + f_n \]
    is bounded. \myskip
    Let $\eps > 0$. As $f_n \to f$ uniformly there
    is some $N$ such that $\forall n \ge N$,
    $\forall x \in [a, b]$ we have $|f_n(x) -
    f(x)| < \eps$. In particular, $\forall x \in
    [a, b]$, $|f_N(x) - f(x)| < \eps$. By
    Riemann's criterion, there is some dissection
    $\mathcal{D}$ of $[a, b]$ for which
    \[ S(f_N, \mathcal{D}) - s(f_N, \mathcal{D}) <
    \eps .\]
    Let $\mathcal{D} = \{x_0, x_1, \dots, x_k\}$,
    where $a = x_0 < x_1 < \cdots < x_k = b$. Now
    \begin{align*}
        S(f, \mathcal{D})
        &= \sum_{i = 1}^k (x_i - x_{i - 1})
        \sup_{x \in [x_{i - 1}, x_i]} f(x) \\
        &\le \sum_{i = 1}^k (x_i - x_{i - 1})
        \sup_{x \in [x_{i - 1}, x_i]} (f_N(x) +
        \eps) \\
        &= \sum_{i = 1}^k (x_i - x_{i - 1})
        ((\sup_{x \in [x_{i - 1}, x_i]} f_N(x)) +
        \eps) \\
        &= \sum_{i = 1}^k (x_i - x_{i - 1})
        \sup_{x \in [x_{i - 1}, x_i]} f_N(x) +
        \sum_{i = 1}^k (x_i - x_{i - 1}) \eps \\
        &= S(f_N, \mathcal{D}) + (b - a)\eps
    \end{align*}
    That is,
    \[ S(f, \mathcal{D}) \le S(f_N, \mathcal{D}) +
    (b - a)\eps \]
    Similarly
    \[ s(f, \mathcal{D}) \ge s(f_N, \mathcal{D}) -
    (b - a)\eps \]
    Hence
    \begin{align*}
        S(f, \mathcal{D}) - s(f, \mathcal{D})
        &\le S(f_N, \mathcal{D}) - s(f_N,
        \mathcal{D}) + 2(b - a) \eps \\
        &< (2(b - a) + 1)\eps
    \end{align*}
    But $(2(b - a) + 1)\eps$ can be made
    arbitrarily small by taking $\eps$ small.
    Hence by Riemann's criterion, $f$ is
    integrable over $[a, b]$. \myskip
    Now, for any $n$ sufficiently large such that
    $f_n - f$ is bounded,
    \begin{align*}
        \left| \int_a^b f_n - \int_a^b f \right|
        &= \left| \int_a^b (f_n - f) \right| \\
        &\le \int_a^b \left| f_n - f \right| \\
        &\le (b - a) \sup_{x \in [a, b]} |f_n(x) -
        f(x)| \\
        &\to 0
    \end{align*}
    as $n \to \infty$ since $f_n \to f$ uniformly.
\end{proof}
