Does differentiability almost everywhere imply continuity on an interval?

I suppose there are differentiable almost everywhere functions whose sets of discontinuities are dense. How to prove or disprove it?

Additionally, is Thomae's function $T(x)$ raised to some power greater than 2 an example? (With 2 it isn't differentiable anywhere by Hurwitz's theorem.) Or maybe $\begin{cases} e^{-\frac 1 {T(x)}} & \textrm{if$x\in\mathbb Q$} \\ 0 & \textrm{otherwise} \end{cases}$?

• Is $1/x$ not a counterexample? It is differentiable almost everywhere, yet not continuous. What do I not get here? – The Count Feb 22 '17 at 1:16
• @TheCount: such function has a single point of discontinuity, while the OP is looking for a function with a dense subset of discontinuities. – Jack D'Aurizio Feb 22 '17 at 1:18
• @JackD'Aurizio Thanks. The title lead me to think OP just wanted a counterexample to the assertion "differentiable a.e. implies continuous" and that the first sentence was a misunderstanding. Appreciate the clarification. – The Count Feb 22 '17 at 1:20

By Khinchin's theorem, for almost every real $x$ there are at most finitely many rationals $p/q$ (where $p,q$ are integers with $q > 0$) with $|x - p/q| < 1/q^3$. Consider the function $f(x)$ such that $f(p/q) = 1/q^4$ for rational $p/q$ in lowest terms, $f(x) = 0$ otherwise. Note that if $x$ is irrational and $|x - p/q| \ge 1/q^3$, $$\left|\frac{f(x) - f(p/q)}{x - p/q}\right| \le \frac{1/q^4}{1/q^3} = \frac{1}{q}$$ and as a result $f'(x)$ exists and is $0$ for any $x$ in Khinchin's set. But $f$ is discontinuous at every rational.
• If I understand correctly, you're using Khinchin's theorem for $\psi(q)=\frac 1 {q^2}$. And then you take such $f$ that $f(\frac 1 q)=o(\psi(q))$. But a version of $\psi$ with any exponent greater than 1 would fulfill the theorem's hypothesis. And for $f$ the exponent needn't be bumped by 1, just by an arbitralily small amount. So, was I right in my above hypothesis that Thomae's function raised to any power greater than 2 can serve as an example? – ByteEater Feb 22 '17 at 8:50
You may consider the function $f(x) = \text{sign}(x) e^{-|x|}$ and an enumeration $q_1,q_2,\ldots$ of the elements of $\mathbb{Q}$. If you manage to prove that $$F(x)\stackrel{\text{def}}{=}\sum_{n\geq 1}\frac{f(n(x-q_n))}{2^n}$$ is almost everywhere differentiable, you have your counter-example.