Show $d_2(f,g) = \sqrt{\int\limits_0^1 |f(x) - g(x)|^2 dx}$ is a metric on $C[0,1]$ I am surprised that this question hasn't been asked on here
I need to show that 

$$d_2(f,g) = \sqrt{\int\limits_0^1 |f(x) - g(x)|^2 dx}$$

is a metric on $C[0,1]$

Proof:


*

*As usual, positive semidefiniteness and symmetry are trivial
We want to show that 
$$d_2(f,g) \leq d_2(f,h) + d_2(h,g)$$ for some $f,g,h \in C^1$
(Unfortunately, I am not sure how to approach this in the most efficient manner)
$ d_2(f,g)  = \sqrt{\int\limits_0^1 |f(x) - g(x)|^2 dx}$
$ = \sqrt{\int\limits_0^1 |(f(x) - g(x))^2| dx}$
$ = \sqrt{\int\limits_0^1 |f^2 - 2gf + g^2| dx} $
$ = \sqrt{\int\limits_0^1 |(f^2 -2hf-h^2 + 2hf+h^2)- 2gf  + (g^2  -2hg-h^2 + 2hg+h^2)| dx}$ 
$ = \sqrt{\int\limits_0^1 |(f-h)^2 + 2hf-h^2- 2gf  + (g-h)^2 + 2hg-h^2)| dx}$ 
$ \leq \sqrt{\int\limits_0^1 |(f-h)^2| dx+ \int\limits_0^1 |(g-h)^2| dx +\int\limits_0^1 |2hf-2h^2- 2gf + 2hg| dx}$
$\leq d_2(f,h) + d_2(h,g) +  \sqrt{\int\limits_0^1 |2hf-2h^2- 2gf + 2hg| dx}$
Seems like this method cannot work....Can someone offer suggestions on how to fix this
 A: It is an overkill, but I think it is an interesting one. $C^0(0,1)\subset L^2(0,1)$, hence we may assume that the functions we are dealing with have a Fourier-Legendre expansion in terms of shifted Legendre polynomials: they give an orthogonal complete base of $L^2(0,1)$ with respect to the usual inner product and by assuming
$$ f(x)=\sum_{n\geq 0}c_n P_n(2x-1)\tag{1} $$
we have, by Parseval's identity:
$$ \| f \|_2 = \sqrt{\sum_{n\geq 0}\frac{c_n^2}{2n+1}}\tag{2} $$
so it is enough to work in $\ell^2$. We may notice that:
$$ \sum_{n\geq 0}\frac{(a_n+b_n)^2}{2n+1}=\sum_{n\geq 0}\frac{a_n^2}{2n+1}+\sum_{n\geq 0}\frac{b_n^2}{2n+1}+2\sum_{n\geq 0}\frac{a_n b_n}{2n+1}\tag{3}$$
but due to the Cauchy-Schwarz inequality:
$$ \left|\sum_{n\geq 0}\frac{a_n b_n}{2n+1}\right|\leq \sqrt{\left(\sum_{n\geq 0}\frac{a_n^2}{2n+1}\right)\cdot\left(\sum_{n\geq 0}\frac{b_n^2}{2n+1}\right)}\tag{4} $$
so, by $(3)$,
$$ \| a+b \|_{\ell^2} \leq \| a\|_{\ell^2}+\| b \|_{\ell^2}\tag{5} $$
and that proves:
$$ \| f+g \|_{L^2} \leq \| f\|_{L^2}+\| g \|_{L^2}\tag{6} $$
as wanted.
A: Verify that:
$$\|f\|_2 = \left( \int_0^1 |f(x)|^2 dx \right)^{1/2}$$
is a norm on $C([0,1])$ (hint for the triangle inequality: use the C-S inequality)
Now $d_2(x,y) = \|x - y\|_2$, hence it is a metric 
A: First, let's show that $||f||_2 = \sqrt{\int_{[0,1]} f(x)^2 dx}$ is a norm.  I will only prove that it satisfies the triangle inequality for norms:
$$
||f + g||_2 \leq ||f||_2 + ||g||_2.
$$
This follows from noting that the scalar product 
$$
(f, g) = \int_{[0,1]} f(x) g(x) dx
$$
satisfies the Cauchy-Schwarz inequality: https://en.wikipedia.org/wiki/Triangle_inequality#Normed_vector_space
Now,
$$
d_2(f, g) = ||f - g||_2 = ||(f - h) + (h - g)||_2 \leq ||f - h||_2 + ||h - g||_2 = d_2(f, h) + d_2(h, g).
$$
