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

\begin{example*}
    $f(x) = x^n$, $n \in \ZZ$, $n > 0$. $n = 1$,
    clearly $f(x) = x$ and $f'(x) = 1$.
    \begin{claim*}
        $f'(x) = nx^{n - 1}$
    \end{claim*}
    \begin{proof}
        Induction ($n = 1$ is clear). $f(x) = x
        x^n = x^{n + 1}$. So
        \[ f'(x) = x^n + x(nx^{n - 1}) = (n +
        1)x^n \]
    \end{proof}
    $n = 0$ can be done separately, and negative
    $n$ can be done using Proposition 3.1 (iv):
    \[ f'(x) = -\frac{(x^n)'}{x^{2n}} =
    -\frac{nx^{n - 1}}{x^{2n}} = -nx^{n - 1} \]
\end{example*}

\noindent
Here is another useful result:

\begin{theorem}[Chain rule]
    $f : U \to \CC$ is such that $f(x) \in V
    \,\,\forall\,\,x \in U$. If $f$ is
    differentiable at $a \in U$ and $g : V \to
    \CC$ is differentiable at $f(a)$, then $g
    \circ f$ is differentiable at $a$ with
    \[ (g \circ f)'(a) = f'(a)g'(f(a)) \]
    \begin{center}
        \includegraphics[width=0.6\linewidth]
        {images/3eac2362975a11ec.png}
    \end{center}
\end{theorem}

\begin{proof}
    We know:
    \[ f(x) = f(a) + (x - a)f'(a) + \eps_f(x)(x -
    a) \]
    (where $\lim_{x \to a} \eps_f(x) = 0$). Also
    \[ g(y) = g(b) + (y - b)g'(b) + \eps_g(y)(y -
    b) \]
    (where $\lim_{y \to b} \eps_g(y) = 0$). \\
    Let $b = f(a)$. Set $\eps_f(a) = 0$ and
    $\eps_g(b) = 0$ to make them continuous at $x
    = a$ and $y = b$. Now $y = f(x)$ gives
    \[ g(f(x)) = g(b) + (f(x) - b)g'(b) +
    \eps_g(f(x))(f(x) - b) \]
    \[ = g(f(a)) + [(x - a)f'(a) + \eps_f(x)(x -
    a)][g'(B) + \eps_g(f(x))] \]
    \[ = g(f(a)) + (x - a)f'(a)g'(b) + (x - a)
    [\eps_f(x)g'(b) + \eps_g(f(x))(f'(a) +
    \eps_f(x))] \]
    \[ \sigma(x) = \ub{\eps_f(x)g'(b)}_{\to 0} +
    \ub{\eps_g(f(x))}_{\to 0}\ub{(f'(a) +
    \eps_f(x))}_{\to f'(a)} \to 0 \]
\end{proof}

\subsubsection*{Examples}

\begin{enumerate}[(1)]
    \item $f(x) = \sin(x^2)$, $(\sin x)' = \cos x$
        \[ f'(x) = 2x \cos(x^2) \]
    \item \[ f(x) = \begin{cases}
            x \sin \left( \frac{1}{x} \right) & x
            \neq 0 \\
            0 & x = 0
        \end{cases} \]
        From previous lectures $f$ is continuous.
        It is differentiable at every $x \neq 0$
        by the previous theorems. At $x = 0$,
        \[ \frac{f(t) - f(0)}{t} = \sin \left(
        \frac{1}{t} \right) \]
        so the limit does not exist, so $f$ is not
        differentiable at $x = 0$.
\end{enumerate}

\subsubsection*{The Mean Value Theorem}

\begin{theorem}[Rolle's Theorem]
    Let $f : [a, b] \to \RR$ continuous on $[a,
    b]$ and differentiable on $(a, b)$. If $f(a) =
    f(b)$ then $\exists c \in (a, b)$ such that
    $f'(c) = 0$.
\end{theorem}

\begin{proof}
    Let $M = \max_{x \in [a, b]} f(x)$ and $m =
    \min_{x \in [a, b]} f(x)$. Recall by Theorem
    2.5 that these values are achieved. Let $k =
    f(a) = f(b)$. If $M = m = k$, then $f$ is
    constant and $f'(c) = 0 \,\,\forall\,\, c \in
    (a, b)$. If $f$ is not constant then $M > k$
    or $m < k$. Suppose $M > k$. By Theorem 2.5
    $\exists\,\,c \in (a, b)$ such that $f(c) =
    M$. If $f'(c) > 0$, then there are values to
    the right of $c$ for which $f(x) > f(c)$. Why?
    \[ f(h + c) - f(c) = h(f'(c) + \eps_f(h)) \]
    since $\eps_f(h) \to 0$ as $h \to 0$, $f'(c) +
    \eps_f(h) > 0$ for $h$ small. This contradicts
    that $M$ is the maximum. Similarly if $f'(c) <
    0$ there exists $x$ to the left of $c$ for
    which $f(x) > f(c)$. Hence $f'(c) = 0$.
\end{proof}
