continuous almost everywhere versus equal to a continuous function almost everywhere
The concept of almost everywhere can be somewhat tricky to people who are not familiar with it. Let $m$ denote Lebesgue measure^{}. Consider the following two statements about a function $f:\mathbb{R}\to \mathbb{R}$:

•
$f$ is continuous^{} (http://planetmath.org/Continuous) almost everywhere with respect to $m$

•
$f$ is equal to a continuous function almost everywhere with respect to $m$
Although these two statements seem alike, they have quite different meanings. In fact, neither one of these statements implies the other.
Consider the function $$
This function is not continuous at $0$, but it is continuous at all other $x\in \mathbb{R}$. Note that $m(\{0\})=0$. Thus, ${\chi}_{[0,\mathrm{\infty})}$ is continuous almost everywhere.
Suppose ${\chi}_{[0,\mathrm{\infty})}$ is equal to a continuous function almost everywhere. Let $A\subset \mathbb{R}$ be Lebesgue measurable (http://planetmath.org/LebesgueMeasure) with $m(A)=0$ and $g:\mathbb{R}\to \mathbb{R}$ such that ${\chi}_{[0,\mathrm{\infty})}(x)=g(x)$ for all $x\in \mathbb{R}\setminus A$. Since ${\chi}_{[0,\mathrm{\infty})}(x)=0$ for all $$ and $m(A\cap (\mathrm{\infty},0))=0$, there exists $$ such that $g(a)=0$. Similarly, there exists $b\ge 0$ such that $g(b)=1$. Since $g$ is continuous, by the intermediate value theorem, there exists $c\in (a,b)$ with $g(c)=\frac{1}{2}$. Let $U=(0,1)$. Since $g$ is continuous, ${g}^{1}(U)$ is open. Recall that $c\in {g}^{1}(U)$. Thus, ${g}^{1}(U)\ne \mathrm{\varnothing}$. Since ${g}^{1}(U)$ is a nonempty open set, $m({g}^{1}(U))>0$. On the other hand, ${g}^{1}(U)\subseteq A$, yielding that $$, a contradiction^{}.
Now consider the function ${\chi}_{\mathbb{Q}}(x)=\{\begin{array}{cc}1\hfill & \text{if}x\in \mathbb{Q}\hfill \\ 0\hfill & \text{if}x\notin \mathbb{Q}.\hfill \end{array}$
Note that $m(\mathbb{Q})=0$. Thus, ${\chi}_{\mathbb{Q}}=0$ almost everywhere. Since $0$ is continuous, ${\chi}_{\mathbb{Q}}$ is equal to a continuous function almost everywhere. On the other hand, ${\chi}_{\mathbb{Q}}$ is not continuous almost everywhere. Actually, ${\chi}_{\mathbb{Q}}$ is not continuous at any $x\in \mathbb{R}$. Recall that $\mathbb{Q}$ and $\mathbb{R}\setminus \mathbb{Q}$ are both dense in (http://planetmath.org/Dense) $\mathbb{R}$. Therefore, for every $x\in \mathbb{R}$ and for every $\delta >0$, there exist ${x}_{1}\in (x\delta ,x+\delta )\cap \mathbb{Q}$ and ${x}_{2}\in (x\delta ,x+\delta )\cap (\mathbb{R}\setminus \mathbb{Q})$. Since ${\chi}_{\mathbb{Q}}({x}_{1})=1$ and ${\chi}_{\mathbb{Q}}({x}_{2})=0$, it follows that ${\chi}_{\mathbb{Q}}$ is not continuous at $x$. (Choose any $\epsilon \in (0,1)$.)
Title  continuous almost everywhere versus equal to a continuous function almost everywhere 

Canonical name  ContinuousAlmostEverywhereVersusEqualToAContinuousFunctionAlmostEverywhere 
Date of creation  20130322 15:58:47 
Last modified on  20130322 15:58:47 
Owner  Wkbj79 (1863) 
Last modified by  Wkbj79 (1863) 
Numerical id  10 
Author  Wkbj79 (1863) 
Entry type  Example 
Classification  msc 28A12 
Classification  msc 60A10 