TITLE: Meaning of "almost everywhere" in measure theory.
QUESTION [8 upvotes]: I'm slightly confused about the term almost everywhere as it is used in Folland's real analysis.
Given a measure space $(X, \mathcal{M}, \mu)$  Suppose $f \equiv g$, $\mu$-almost everywhere where $f, g : X \to \mathbb{R}$.
Does this mean that $$\mu(\{x : f(x) \ne g(x) \}) = 0$$
Or that there exists a measurable set $E$ such that $\{x : f(x) \ne g(x) \} \subseteq E$ and $\mu(E) = 0$?
This issue came up when my professor was proving the following theorem from Folland:

To prove (a) $\implies$ $\mu$ is complete, he took a null set $N \in \mathcal{M}$ and said for any $E \subseteq N$, $1_E \equiv 0$ almost everywhere.  This part confused me, because how can we know if $E$ is measurable?

REPLY [2 votes]: Although the comments more or less answer the question, and the question is a few years old, some readers might benefit from a complete answer.
Here is another way to think about the concept. "Almost everywhere" means some proposition/property is true everywhere except a set of measure zero. So if $f=g$ a.e. this means the following. 
Let $f,g:X\rightarrow Y$ and let $E\subset X$ with $\mu(E)=0$. If $f=g$ on $X\setminus E$ and $f\neq g$ on $E$ then $f=g$ a.e. 
Note that here, we did not assume the Lebesgue measure, or that we are even dealing with domains which are subsets of $\mathbb{R}^n$. 
Here are some good examples of what can "go wrong" with functions equal almost everywhere. For simplicity, let's consider the Lebesgue measure on $\mathbb{R}$
$(1)$ Let $D(x)$ denote the Dirichlet function, where $D(x)=0$ if $x$ irrational and $D(x)=1$ if $x$ is rational. Now consider the zero function $f(x)=0$. Note that $f=D$ almost everywhere, since $\mu(\mathbb{Q})=0$ and $f\neq D$ only on $\mathbb{Q}$. 
So even if two functions are equal almost everywhere, one can be continuous everywhere and the second one can be nowhere continuous. 
$(2)$ Cantor's function is constant a.e. but monotone increasing. 
$(3)$ Define $g(x)=0$ if $x$ irrational and $g(x)=x$ if $x$ is rational. 
$g(x)$ is bounded a.e. but not globally bounded. 
In addition, you can show two functions in $L^2$ are equal almost everywhere if you can show their Fourier series and/or Fourier transforms are equal almost everywhere. 
There are countless of other such examples.