# Are Continuous Functions Always Differentiable?

Are continuous functions always differentiable? Are there any examples in dimension $$n > 1$$?

• Think of $f(x)=\left\vert x\right\vert$. Oct 26 '10 at 15:15

No. Weierstraß gave in 1872 the first published example of a continuous function that's nowhere differentiable.

• But using that example for this question is tantamount to using thermonuclear weapons to kill mosquitoes! Oct 26 '10 at 22:13

No, consider the example of $f(x) = |x|$. This function is continuous but not differentiable at $x = 0$.

There are even more bizare functions that are not differentiable everywhere, yet still continuous. This class of functions lead to the development of the study of fractals.

For a nice simple example of an everywhere continuous, nowhere differentiable function it's hard to beat this example of John McCarthy.

• This is a nice example, and a nice exposition. It (the linked paper) also makes the point that (in some sense) most continuous functions are in fact non-differentiable. Oct 27 '10 at 4:58

This is my personal favorite example of intuition being catastrophically incorrect in real analysis.

In calculus, it is commonly taught that differentiable functions are always continuous, but also, all of the "common" continuous functions given, such as $f(x)=x^2$, $f(x)=e^x$, $f(x)=xsin(x)$ etc. are also differentiable. This leads to the false assumption that continuity also implies differentiability, at least in "most" cases.

The exception to this in early calculus courses is $f(x)=|x|$, which is continuous AND differentiable at every point except at $x=0$.

So it would appear that if functions are not differentiable, it can only happen at a finite number of points.

In real analysis, this concept of being differentiable everywhere except a finite number of points is formalized with the notion of "measure". A finite number of isolated, non-differentiable points adds up to a measure of $0$. The more precise way to comment on the differentiability of $f(x)=|x|$ is to say that it is continuous everywhere and differentiable almost everywhere. This means that the function $f(x)=|x|$ is differentiable in every subset of $\mathbb{R}$ except those subsets with measure 0, in particular, the singleton set ${x}=0$. Saying it is differentiable almost everywhere is advantageous to saying that $f(x)=|x|$ is not differentiable because it doesn't take into account how many points it is not differentiable at. A different function could be not differentiable at 3 points.

So it may seem reasonable that all continuous functions are differentiable a.e. (almost everywhere). This turns out to be completely false. In general, the set of continuous functions which are nowhere differentiable is dense in $C([0,1])$ (and for a general interval). Even stronger, the set of functions which are differentiable at even a single point is "meagre" in $C([0,1])$. This is is typically shown through proofs involving the Baire Category Theorem.

So this simply means that there are "way" more functions which can't be differentiated at any point than there are of functions which can be differentiated even at a single point (even if it is differentiable nowhere else!). This contradicts intuition but this is situation is a great example as to why proof is so vital to real analysis and mathematics in general. If a theorem holds in one direction, it should never be assumed the converse is true. There will likely be a counter example. In this particular situation, the counter-examples happen to be the general case.

• I don't understand the downvote and the delete vote. Sure, this is an old question, and I even disagree that the intuition is contradicted, but this post does answer the question, and it also mentions things that others didn't, which certainly might be of interest to future readers. Sep 16 '16 at 16:08
• How would you go about showing that the set of functions that are differentiable at a single point is meagre in C([0,1])? Or is there some proof that you can link that demonstrates such a claim? Nov 22 '20 at 0:45

An interesting fact is that most (i.e. a co-meager set of) continuous functions are nowhere differentiable. The proof is a consequence of the Baire Category theorem and can be found (as an exercise) in Kechris' Classical Descriptive Set Theory or Royden's Real Analysis.

• This holds also for other notions of most. Also, a more accessible reference might be "Measure and Category" by Oxtoby. May 16 '12 at 0:09
• @MichaelGreinecker Very interesting. Thanks. May 16 '12 at 3:28

What these answers miss a little bit I think is the why of what's going on here. A mistake people make I think is assuming that continuous and 'smooth' (in a loose sense here not the technical meaning) are the same thing -- whereas in reality continuous functions just have the simple property that they have no 'jumps' in them or they don't change 'too much' while differentiable functions require the stronger property that functions change in a 'smooth' way i.e. no sharp corners etc. The absolute value function is instructive there, as is any fractal etc. These notions can of course be made much more precise, but the geometric intuition is in this case quite important so as not to get thoroughly stuck in believing that analysis is some form of magic.

The Wiener process is a continuous everwhere, but differentiable nowhere function (quite an impressive beast by the way...)

• More precisely, the sample paths are continuous and with probability $1$ nowhere-differentiable. May 15 '12 at 23:52

Continuity requires

$$\lim_{h\to0}f(x+h)-f(x)=0.$$ Differentiability is stronger:

$$\lim_{h\to0}\frac{f(x+h)-f(x)}h$$ must exist.

Hence you can find counter-examples of the form

$$f(x)=x g(x)$$ where $$\lim_{x\to0}g(x)$$ does not exist.

E.g. $$g(x)=\text{sgn}(x)$$ or $$g(x)=\sin\dfrac1x$$ or $$g(x)=|x|^{-1/2}$$.

Consider $$f(x)=x^{\frac{1}{3}}, x\in\mathbb{R}^{1} .$$ The derivative $$f'(x)=\frac{1}{3}x^{-\frac{2}{3}}, x\in\mathbb{R}^{1}\backslash\{ 0 \}$$ does not exist at $$x=0$$ whereas $$f(x)$$ is continuous on $$\mathbb{R}^{1}$$.