Check this measure theory argument Here's a problem from Cohn's Measure Theory. 


  [Cohn, 2.1.3] Let $f$ and $g$ be continuous real-valued functions on $\mathbb{R}$. Show that if $f =g$ for $\lambda$-almost every $x$, then $f = g$ everywhere. 


Here $\lambda$ denotes Lebesgue measure. 

Here's what I do. 

Let $h: \mathbb{R} \to \mathbb{R}$ be a continuous function. Suppose that $h \neq 0$. Then for some $x \in \mathbb{R}$, there is $n \in \mathbb{N}$ such that $|h(x)| &gt; 2/n$. Then by continuity for some $\delta &gt; 0$, we may ensure that whenever $|y - x| &lt; \delta/2$, we have 
$$
|h(y)| \geq |h(x)| - |h(y) - h(x)| &gt; 2/n - 1/n = 1/n. 
$$ 
Hence, $\lambda(\{h \neq 0\}) \geq \lambda(\{|h| &gt; 1/n\}) \geq \delta &gt; 0$. Taking the contrapositive, we just showed if $h$ is a continuous real-valued function on $\mathbb{R}$, then 
$\lambda\{h \neq 0\} = 0$ implies $h = 0$ (everywhere). The result follows now by setting $h = f - g$, which is continuous.

Question. Is this basically the simplest way to do it? Other ways?
I would say that $\{x:h(x)\ne0\}$ is an open set in $\Bbb R$. (Since it is
the inverse image of the open set $\Bbb R\setminus\{0\}$ under the continuous
function $h$). Each nonempty open set contains a nonempty open interval,
which has positive Lebesgue measure. So if $h$ is continuous, and not identically
zero, then it cannot be almost everywhere zero (w.r.t. Lebesgue measure).
(For completeness, following Lord Shark the Unknown's advice.)

Let $h: \mathbb{R} \to \mathbb{R}$ be a continuous function. Suppose that $h \neq 0$. Thus, the set $\{h \neq 0\}$ is nonempty and open, and hence has positive Lebesgue measure. Taking the contrapositive, if $h$ is a continuous real-valued function on $\mathbb{R}$, then $\lambda\{h \neq 0\} = 0$ implies $h = 0$ (everywhere). Now take $h = f - g$. The result follows.