If two continuous functions are equal almost everywhere on $[a,b]$, then they are equal everywhere on $[a,b]$

Suppose $f$ and $g$ are continuous functions on $[a,b]$. Show that if $f=g$ almost everywhere on $[a,b]$, then, in fact, $f=g$ on $[a,b]$. Is a similar assertion true if $[a,b]$ is replaced by a general measurable set $E$?

I have known that the set $A=\{x \mid f(x) \neq g(x)\}$ has measure zero and we want to show that A is empty. Now let's assume $A$ is not empty. I am stuck in getting the contradiction.

Thanks for your hints and answers.


Solution 1:

You can do it even more simply:

$f,g$ continuous on $[a,b]$ implies $(f-g)$ continuous. Thus:

$$(f-g)^{-1}(0, + \infty)\cup(0, -\infty) = A$$

is open, thus $A=\emptyset$ as that is the only open set of measure zero. QED. No epsilonics required.

Solution 2:

A nonempty open subset of $[a,b]$ always has positive measure. Does that help?

More Hints: The inverse image of an open set under a continuous function is _ _ _ _? A nonempty open set always contains an open interval.