Let \(C\bigl([a,b],\R\bigr)\) be the set of continuous real-valued functions on the interval \([a,b]\text{.}\) Define the metric on \(C\bigl([a,b],\R\bigr)\) as
\begin{equation*}
d(f,g) \coloneqq \sup_{x \in [a,b]} \abs{f(x)-g(x)} .
\end{equation*}
Let us check the properties. First, \(d(f,g)\) is finite as \(\abs{f(x)-g(x)}\) is a continuous function on a closed bounded interval \([a,b]\text{,}\) and so is bounded. It is clear that \(d(f,g) \geq 0\text{,}\) it is the supremum of nonnegative numbers. If \(f = g\text{,}\) then \(\abs{f(x)-g(x)} = 0\) for all \(x\text{,}\) and hence \(d(f,g) = 0\text{.}\) Conversely, if \(d(f,g) = 0\text{,}\) then for every \(x\text{,}\) we have \(\abs{f(x)-g(x)} \leq d(f,g) = 0\text{,}\) and hence \(f(x) = g(x)\) for all \(x\text{,}\) and so \(f=g\text{.}\) That \(d(f,g) = d(g,f)\) is equally trivial. To show the triangle inequality we use the standard triangle inequality;
\begin{equation*}
\begin{split}
d(f,g) & =
\sup_{x \in [a,b]} \abs{f(x)-g(x)} =
\sup_{x \in [a,b]} \abs{f(x)-h(x)+h(x)-g(x)}
\\
& \leq
\sup_{x \in [a,b]} \bigl( \abs{f(x)-h(x)}+\abs{h(x)-g(x)} \bigr)
\\
& \leq
\sup_{x \in [a,b]} \abs{f(x)-h(x)}+
\sup_{x \in [a,b]} \abs{h(x)-g(x)} = d(f,h) + d(h,g) .
\end{split}
\end{equation*}
When treating
\(C\bigl([a,b],\R\bigr)\) as a metric space without mentioning a metric, we mean this particular metric. Notice that
\(d(f,g) = \norm{f-g}_{[a,b]}\text{,}\) the uniform norm of
Definition 6.1.9.
This example may seem esoteric at first, but it turns out that working with spaces such as
\(C\bigl([a,b],\R\bigr)\) is really the meat of a large part of modern analysis. Treating sets of functions as metric spaces allows us to abstract away a lot of the grubby detail and prove powerful results such as
Picard’s theorem with less work.