# Proving that $d(f,g)=\|f-g\| = \sup \limits_{0\leq x \leq 1} |f(x)-g(x)|$ is a metric on $X=C[0,1]$

Let $X=C[0,1]$ be the set of all continuous functions on $[0,1]$. For any two functions $f,g\in X$, set $$d(f,g)=\|f-g\| = \sup \limits_{0\leq x \leq 1} |f(x)-g(x)|.$$

Prove $(X,d)$ is a metric space.

My attempt:

This question comes down to showing that $d$ is a metric, which means that:

• $d(f,g)\geq 0$
• $d(f,g)=0\iff f=g$
• $d(f,g)=d(g,f)$

1) Nonnegativity is guaranteed by taking the supremum of the absolute value of a sum, since the absolute value of a sum is non-negative, the supremum of non-negative numbers is non-negative. $\square$

2) For the supremum of $|f(x)-g(x)|$ to be equal to $0$, the greatest number for $|f(x)-g(x)|$ from $0\leq x\leq 1$ must be $0$, hence $|f(x)-g(x)|=0$ for all values on this range, and thus $f(x)=g(x)$ is the constant zero map. $\square$

3) $|f(x)-g(x)|=|g(x)-f(x)|$ implies that $\sup \limits_{0\leq x \leq 1} |f(x)-g(x)|=\sup \limits_{0\leq x \leq 1} |g(x)-f(x)|$ $\square$

We need to prove that $d(f,g)\leq d(f,h) + d(g,h)$

I.e. $\sup \limits_{0\leq x \leq 1} |f(x)-g(x)|\leq \sup \limits_{0\leq x \leq 1} |f(x)-h(x)|+\sup \limits_{0\leq x \leq 1} |g(x)-h(x)|$

Now I am not sure how I can 'behave' with the sup 'function'. Can I do the following?

$$\sup|f(x)-g(x)| = \sup|f(x)-g(x)+h(x)-h(x)|=\sup|f(x)-h(x)+(h(x)-g(x))|$$ Then use normal triangular inequality:

$$\sup|f(x)-h(x)+(h(x)-g(x))|\leq \sup(|f(x)-h(x)|+|h(x)-g(x)|)=\sup(|f(x)-h(x)|+|g(x)-h(x)|)$$

This is obviously less than $\sup \limits_{0\leq x \leq 1} |f(x)-h(x)|+\sup \limits_{0\leq x \leq 1} |g(x)-h(x)|$, but I don't know how to prove it. How do I finish that one off.

• Hint : $|f(x)-h(x)|+|g(x)-h(x)|\leq \sup|f(x)-h(x)|+\sup|g(x)-h(x)|$. – Nicolas Jun 12 '15 at 12:23

For all $x \in [0,1]$ we have $$|f(x)-g(x)|\leq |f(x)-h(x)|+|h(x)-g(x)|\leq \| f-h\|+\|h-g\|$$ and the last bound doesn't depend on $x$ so $\sup _{x\in [0,1]}|f(x)-g(x)|\leq \| f-h\|+\|h-g\|$.