# Example of two functions that are equal almost everywhere?

We shall say that two functions $f$ and $g$ defined on a set $E$ are equal almost everywhere, and write $f(x)=g(x)$ a.e $x\in E$, if the set $\{x\in E: f(x)\neq g(x)\}$ has measure zero.

I just can't wrap my brain around the fact that such functions exist! Certainly, we can take the cantor set which has measure zero but how to pick $f$ and $g$? Is there an example that I am not aware of ?

-
Any function is equal to itself almost everywhere. – David Mitra Dec 26 '12 at 3:04

Let $f$ map all real numbers to $0$ and $g$ map all irrationals to $0$ and all rationals to $1$. Then $f$ and $g$ are distinct but equal a.e.

-

$\newcommand{\R}{\Bbb R}$ There are other sets of measure $0$. For example $Z=\{1\}$ have measure $0$. Consider $f:\R\to \R$ the function defined by $$f(x)=x,$$ and $g:\R\to\R$ given by $$g(x)=\begin{cases} x &\text{if x\neq 1}\\ \pi &\text{if x=1}\end{cases}$$ Then $f=g$ a.e. since $f\neq g$ on $Z$.

-
That's neat!Thanks! – Lyapunov Dec 26 '12 at 3:04
@POTUS glad to help. – leo Dec 26 '12 at 3:08

Consider a measure zero set i.e. $E_1$ such that $\mu(E_1) = 0$. Let $$h(x) = \begin{cases} 0 & x \in E_1^c\\ \text{any value} & x \in E_1 \end{cases}$$ Now consider any function $f(x)$. Then $g(x) = f(x) + h(x)$ satisfies your criteria.

-

If we let $f(x) = \lceil x \rceil$ and $g(x) = \lfloor x \rfloor + 1$ (ceiling and floor functions respectively) then $f$ and $g$ only differ on the set of integers $\mathbb{Z}$, which has measure zero.

-

Consider $\mathbb{R}$ equipped with the Borel $\sigma$-field $\mathcal{B}(\mathbb{R})$ and the Lebesgue measure $\lambda$, i.e. $\lambda$ is the measure on $\mathcal{B}(\mathbb{R})$ which satisfies $\lambda((a,b))=b-a$ for $a,b\in\mathbb{R}$, $a<b$.

Let $f:\mathbb{R}\to\mathbb{R}$ be any Borel measurable function and suppose we "change" $f$ in at most countably many points. If we call this new function $g$, then $f=g$ almost everywhere (with respect to $\lambda$). In particular, $f$ and $g$ have the same integral over any Borel set.

Let us formalize this: Let $(x_n)_{n\geq 1},(y_n)_{n\geq 1}\subseteq \mathbb{R}$ be two sequences of real numbers and define $$g(x)= \begin{cases} y_n\quad &\text{if } x=x_n,\\ f(x)&\text{if }x\neq x_n\text{ for all }n, \end{cases}$$ i.e. we have "changed" $f$ along the sequence $(x_n)_{n\geq 1}$. Then $$\{x\in\mathbb{R}:f(x)\neq g(x)\}\subseteq \{x_n: n\geq 1\},$$ which has measure zero.

-