Determining if this set defines a metric over and open interval?

$d(f,g) = \int_a^b |f(x)-g(x)|dx,\ f,g \in X = C(I)$ the set of all continuous functions from the closed bounded interval $I=[a,b]$ to $\mathbb{R}$

I have found that $d$ is a metric on the set X. However

1. Is this still a metric if $I=(0,1)$?
2. Is this still a metric if $I=\mathbb{R}$

It seems to me that $d$ is not a metric for 1 as $f$ or $g$ could be unbounded as it is an open interval and therefore the integral would not exist?

And $d$ is not a metric for 2 for the same reason?

-
Do you perhaps mean $$d(f,g)=\int_a^b|f(x)-g(x)|\,dx,\:f,g\in X=C(I)$$ instead? –  Cameron Buie Sep 24 '12 at 10:12
Yes, for both questions there is a problem of integrability (that is, $d(x,y)$ could be infinite). However, unboundedness of $f$ or $g$ is not a problem per se: there are unbounded but integrable functions (on both $(0,1)$ and $\mathbb{R}$). –  lazyhaze Sep 24 '12 at 10:20
It should probably also be noted that: 1. if you change $X$ to integrable continuous functions on $I$, than $d$ is a metric; the only problematic thing that might happen is that $d(f,g) = \infty$, which a metric shouldn't do 2. if you take $\lVert f \rVert = d(f,0)$ then you actually get a norm, so the metric comes from a norm an is very thus a nice type of metric. –  Feanor Sep 24 '12 at 10:48

Your intuition is spot on, though the integral still may exist in both cases, so you need to choose your functions with a bit of care--for example, if $f(x)=x^{-1/2}$, $g=0$, then $d(f,g)$ exists in the first case, even though $f$ is unbounded. To make it slightly less complicated, you may as well take one of your functions to be the constant zero function in both cases. That way, you only need to pick out one function. Case $2$ should be ridiculously simple, and Case $1$ shouldn't take many guesses....
Why does the integral exist for$f(x) = x^{-\frac{1}{2}}$ yet not for $f(x) = \frac{1}{x}$? –  dukenukem Sep 24 '12 at 23:02
An excellent question! The intuitive answer is because $1/x$ blows up far more quickly than $x^{-1/2}$ as $x\to 0^+$. It's also related to the fact that the harmonic series diverges, while the series $\sum\frac1{n^2}$ converges. If you'd like to confirm that the integral exists, consider them as improper integrals--that is, $$\int_0^1f(x)\,dx=\lim_{a\to 0^+}\int_a^1 f(x)\,dx.$$ It should be relatively easy to confirm, since both functions have an antiderivative. –  Cameron Buie Sep 25 '12 at 0:46
Incidentally, $1/x$ is just the function I'd use to show that it fails to be a metric in the first case. –  Cameron Buie Sep 25 '12 at 0:48
$d$ is not a metric in the second case for the reason that integral $\int\limits_{-\infty}^{+\infty}{|f(x)-g(x)|\, dx} {\,}$ may be divergent.