How to prove that if the integral of a nonnegative function is zero, then the function is zero This is required to prove that the expression $d(f,g)=\int|f-g|dt$ is a metric. We need to show that if $\int |f-g|dt=0$ then $f=g$. It seems obvious but how to prove it? This relation is not given in Paul's Online Math Notes for example.
f,g continuous on [a,b]

Let's forget continuity for a minute.
Let $u$ be a measurable function that's also non-negative almost everywhere on $I=[a, b]$, such that $$\int_a^bu=0$$
Then for $\epsilon>0$,  let $$S_\epsilon=\{x\in[a,b] \textrm{  such that  } u(x)\geq\epsilon\}$$
Then by definition of $S_\epsilon$, $$\int_a^bu\geq\int_{S_\epsilon}u\geq\epsilon\mu(S_\epsilon)$$
where $\mu(S_\epsilon)$ is the Lebesgue measure of $S_\epsilon$.
That inequality $$\int_a^bu\geq\epsilon\mu(S_\epsilon)$$ is known as the Chebyshev inequality.
Because $u$ has a $0$ integral on $[a,b]$, it follows that $S_\epsilon$ is of measure $0$. So $u<\epsilon$ almost everywhere on $[a, b]$, and that, for all $\epsilon >0$. It's now easy to conclude that $u=0$ almost everywhere (for instance take the sequence $\epsilon_n=\frac 1 n$).
Now if you assume that $u$ is also continuous, that means that $u=0$ everywhere on $[a, b]$.
Finally, in the world of probabilities, this is how you prove that if a random variable has zero variance, the that variable is not that random: It is constant, almost surely.
