# Nowhere continuous function for every equivalence class

Since our calculus lectures, we know that there are nowhere continuous functions (like the indicator function of the rationals). However, if we change this Dirichlet function on a set of measure zero, then we get a continuous function (the zero function). So my question ist

Does there exist a function $f: \mathbb{R}\rightarrow \mathbb{R}$ such that every function which equals $f$ almost everywhere (with respect to the Lebesgue measure) is nowhere continuous? Is it possible to choose $f$ borel-measurable?

Let $r_1,r_2, \dots$ be the rationals. Let $f(x) = x^{-1/2}, x\in (0,1),$ $f=0$ elsewhere. For $x\in \mathbb R,$ define

$$g(x) = \sum_{n=1}^{\infty}\frac{f(x-r_n)}{2^n}.$$

Then $g$ is a Borel measurable function from $\mathbb R$ to $[0,\infty].$ Note that $\lim_{x\to r_n^+} g(x)=\infty$ for all $n.$

Now $\int_{\mathbb R} g <\infty$ by the monotone convergence theorem. Thus $g<\infty$ a.e. Define $h=g$ wherever $g$ is finite, $h=0$ where $g=\infty.$ The function $h$ fits the bill.

To be sure, there are some things to check, but I'll leave it here for now

• I like your counterexample, I had a hard time deciding which answer I should accept. Thank you. Mar 3, 2018 at 18:43

See my answer to this question for the construction of an $F_\sigma$ set $M\subset\mathbb R$ such that $0\lt m(M\cap I)\lt m(I)$ for every finite interval $I,$ where $m$ is the Lebesgue measure.

Let $f$ be the indicator function of $M.$ Clearly $f$ is Borel-measurable. If $g(x)=f(x)$ almost everywhere, then $g^{-1}(0)$ and $g^{-1}(1)$ are everywhere dense, whence $g$ is nowhere continuous.

• Thank you for this elegant counterexample. Mar 3, 2018 at 18:41
• You're welcome.
– bof
Mar 3, 2018 at 19:29

Any discontinuous function s.t. $f(x + y) = f(x) + f(y)$.

• Additive discontinuous functions are not Lebesgue measurable, so this example cannot be used for the second part of the question. Mar 2, 2018 at 8:02
• @KaviRamaMurthy Is it difficult to prove that additive discontinuous functions are not Lebesgue measurable? Do you have a reference? Mar 3, 2018 at 18:44
• @SeverinSchraven, math.stackexchange.com/questions/45861/…. Mar 3, 2018 at 19:19
• @Severin, suppose f is additive and measurable. The $\mathbb R =\cup f^{-1} (-n,n)$ so there must be some n such that $E \equiv f^{-1} (-n,n)$ has positive measure. This implies E-E contains an interval around 0. [Ref. Halmos 's Measure Theory]. From this and additivity prove that f is bounded on some interval $(-a,a)$, say by M. Now $|f(x)|=\frac 1 n f(nx)| \leq \frac 1 n M$ if n is large enough. Conclude that f is continuous at 0 and use additivity to get continuity at all points. Mar 5, 2018 at 4:51
• @KaviRamaMurthy and Martin: Thank you for the references. Mar 5, 2018 at 8:16