\section{The Mean Value Theorem}
\label{section:mean-value-theorem}

\begin{definition}[Right-Differentiable]
\label{definition:right-differentiable-mvt}
    Let $-\infty < a < b < \infty$, $E$ be a separated topological vector space, $f: [a, b] \to E$, and $x \in [a, b)$, then $f$ is \textbf{right-differentiable at $x$} if
    \[
    D^+f(x) = \lim_{t \downto 0} \frac{f(x + t) - f(x)}{t}
    \]

    exists.
\end{definition}

\begin{lemma}[{{\cite[Lemma 4.6.2]{Bogachev}}}]
\label{lemma:right-differentiable-inequality}
    Let $-\infty < a < b < \infty$, $f, g \in C([a,b]; \real)$, and $N \subset [a, b]$ be at most countable such that:
    \begin{enumerate}
        \item[(a)] $f, g$ are right-differentiable on $[a, b] \setminus N$.
        \item[(b)] For every $x \in [a, b] \setminus N$, $D^+f(x) \le D^+g(x)$.
    \end{enumerate}
    then for any $x \in [a, b]$, $f(x) - f(a) \le g(x) - g(a)$.
\end{lemma}
\begin{proof}
    First assume that for every $x \in [a, b] \setminus N$, $D^+f(x) < D^+g(x)$.

    Let $\seq{x_n}$ be an enumeration of $N$. For each $x \in [a, b]$, let $N(x) = \bracs{n \in \natp|x_n \in [a, x)}$. Let $\eps > 0$ and define
    \[
    S = \bracs{x \in [a, b] \bigg | f(y) - f(a) \le g(y) - g(a) + \eps\sum_{n \in N(x)}2^{-n} \quad \forall y \in [a, x]}
    \]

    then by continuity of $f$ and $g$, $S$ is closed.

    Let $x \in S$ and suppose that $s < b$. If $x \in [a, b] \setminus N$, then since
    \[
    \lim_{t \downto 0}\frac{f(x + t) - f(x)}{t} < \lim_{t \downto 0}\frac{g(x + t) - f(x)}{t}
    \]

    there exists $\delta > 0$ such that $f(x + t) - f(x) < g(x + t) < g(x)$ for all $t \in [0, \delta)$. In which case, $[x, x + \delta) \subset S$.

    If $x = x_n \in N$, then by continuity of $f$ and $g$, there exists $\delta > 0$ such that $f(x + t) - f(x) \le g(x + t) - g(x) + 2^{-n}$ for all $t \in (0, \delta)$. Hence $[x, x + \delta) \subset S$ as well.

    Therefore $S = [a, b]$. As this holds for all $\eps > 0$, $f(b) - f(a) \le g(b) - g(a)$.

    Finally, suppose that $D^+f(x) \le D^+g(x)$ for all $x \in [a, b] \setminus N$. Let $\eps > 0$ and $h(x) = g(x) + \eps(x - a)$. By the preceding case, $f(b) - f(a) \le g(b) - g(a) + \eps(b - a)$. As this holds for all $\eps > 0$, $f(x) - f(a) \le g(x) - g(a)$.
\end{proof}

\begin{theorem}[{{\cite[Theorem 4.6.1]{Bogachev}}}]
\label{theorem:right-differentiable-convex-form}
    Let $-\infty < a < b < \infty$, $E$ be a separated locally convex space, $f \in C([a, b]; E)$, $g \in C([a, b]; \real)$, $N \subset [a, b]$ be at most countable, and $B \subset E$ be a closed convex set such that:
    \begin{enumerate}
        \item $f, g$ are right-differentiable on $[a, b] \setminus N$.
        \item For each $x \in [a, b] \setminus N$, $D^+f(x) \in D^+g(x)B$.
        \item $g$ is non-decreasing.
    \end{enumerate}
    then
    \[
    f(b) - f(a) \in [g(b) - g(a)]B
    \]

\end{theorem}
\begin{proof}
    Let $\phi \in E^*$ and $x \in [a, b] \setminus N$, then since $g$ is non-decreasing,
    \begin{align*}
        \lim_{t \downto 0} \frac{\phi(f(x + t) - f(x))}{t} &\le \lim_{t \downto 0}\sup_{z \in B} \frac{\phi(g(x + t) - g(x)z)}{t} \\
        D^+(\phi \circ f)(x) &\le \sup_{z \in B}\phi(z) \cdot \lim_{t \downto 0}\frac{\phi(g(x + t) - g(x))}{t} \\
        D^+(\phi \circ f)(x) &\le  D^+g(x) \cdot \sup_{z \in B}\phi(z)
    \end{align*}
    By \autoref{lemma:right-differentiable-inequality},
    \[
    \phi(f(b) - f(a)) \le (g(b) - g(a)) \cdot \sup_{z \in B}\phi(z)
    \]


    Suppose that $f(b) - f(a) \not\in [g(b) - g(a)]B$. Given that $B$ is closed and convex, by the \hyperref[Hahn-Banach theorem]{theorem:hahn-banach-geometric-2}, there exists $\phi \in E^*$ such that
    \[
    \phi(f(b) - f(a)) > \sup_{x \in B}\phi[(g(b) - g(a))b] = \phi(g(b) - g(a)) \cdot \sup_{x \in B}\phi(x)
    \]

    which is impossible. Therefore $f(b) - f(a) \in [g(b) - g(a)]B$.
\end{proof}


\begin{theorem}[Mean Value Theorem]
\label{theorem:mean-value-theorem-line}
    Let $-\infty < a < b < \infty$, $E$ be a separated locally convex space, $S \subset [a, b]$ be at most countable, and $f \in C([a, b]; E)$ be differentiable on $(a, b) \setminus N$, then
    \[
    f(b) - f(a) \in \overline{\text{Conv}\bracs{Df(x)(b - a)| x \in (a, b) \setminus N}}
    \]

\end{theorem}
\begin{proof}
    By \autoref{proposition:derivative-sets-real}, $f$ is right-differentiable on $(a, b) \setminus N$ with
    \[
    D^+f(x) = Df(x) \in \bracs{Df(y)|y \in (a, b) \setminus N}
    \]

    for all $x \in (a, b)$. Let $g(x) = x$, then by \autoref{theorem:right-differentiable-convex-form},
    \[
    f(b) - f(a) \in \overline{(b - a)\text{Conv}\bracs{Df(x)|x \in (a, b) \setminus N}}
    \]

\end{proof}

\begin{theorem}[Mean Value Theorem]
\label{theorem:mean-value-theorem}
    Let $E$ be a topological vector space, $F$ be a separated locally convex space, $V \subset E$ be open and star shaped at $x \in V$, $f: V \to F$ be Gateau-differentiable on $V$, then for any $y \in V$,
    \[
    f(y) - f(x) \in \overline{\text{Conv}\bracs{Df(z)(y - x)|z \in (x, y)}}
    \]

    where $[x, y] = \bracs{(1 - t)x + ty|y \in [0, 1]}$.
\end{theorem}
\begin{proof}
    Let $g: [0, 1] \to F$ be defined by $g(t) = f((1 - t)x + ty)$. Since $f$ is Gateaux-differentiable, $g$ is differentiable by the chain rule \autoref{proposition:chain-rule-sets-conditions} with $Dg(t) = Df((1 - t)x + ty)(y - x)$, and continuous by \autoref{proposition:derivative-sets-real}.

    By the \hyperref[Mean Value Theorem]{theorem:mean-value-theorem-line}, $f(y) - f(x) = g(1) - g(0)$ is contained in
    \[
    \overline{\text{Conv}\bracs{Dg(t)|t \in [0, 1]}} = \overline{\text{Conv}\bracs{Df(z)(y - x)|z \in (x, y)}}
    \]

\end{proof}

\begin{proposition}
\label{proposition:zero-derivative-constant}
    Let $E$ be a topological vector space, $F$ be a separated locally convex space, $V \subset E$ be open and connected, $f: V \to F$ be Gateaux-differentiable on $V$ such that $Df(x) = 0$ for all $x \in V$, then $f$ is constant.
\end{proposition}
\begin{proof}
    Let $x \in V$, then for any $U \in \cn(0)$ circled with $U + x \subset V$ and $y \in U + x$,
    \[
    f(y) - f(x) \in \overline{\text{Conv}\bracs{Df(z)(y - x)|z \in (x, y)}} = \bracs{0}
    \]

    by the \hyperref[Mean Value Theorem]{theorem:mean-value-theorem-line}.

    Fix $x \in V$ and let $W$ be the connected component of $\bracs{y \in V|f(x) = f(y)}$ containing $x$. For any $y \in W$, by \autoref{proposition:tvs-good-neighbourhood-base}, there exists $U \in \cn(0)$ circled such that $U + y \subset V$. Therefore $W \supset W \cup (U + y)$, and $W$ is open by \autoref{lemma:openneighbourhood}.

    For any $y \in \ol W \cap V$, there exists $U \in \cn(0)$ circled such that $U + y \subset V$. As $y \in \ol W \cap V$, $U \cap W \ne \emptyset$. Thus $f(y) = f(x)$, $y \in W$, and $W$ is relatively closed.

    Since $V$ is connected and $W \subset V$ is both open and closed, $W = V$.
\end{proof}
