Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Construct a function which is continuous in $[1,5]$ but not differentiable at $2, 3, 4$.

This question is just after the definition of differentiation and the theorem that if $f$ is finitely derivable at $c$, then $f$ is also continuous at $c$. Please help, my textbook does not have the answer.

share|cite|improve this question
Intuitively, a function is differentiable at a point if the graph of the function at that point is "smooth". – JavaMan Oct 20 '11 at 17:54
Just make some kind of saw-tooth with peeks in 2, 3, 4. – Jonas Teuwen Oct 20 '11 at 17:55
Intuitively, a function is continuous if you can "walk" on the graph and it is differentiable if you can see where you came from and where you are going. – AD. Oct 25 '11 at 18:05
@AD. Intuitively, a real-valued function of one real variable is differentiable if you can "walk" on its graph without stopping. – Amitesh Datta Oct 26 '11 at 8:59
But... a flight of stairs is discontinous and non-differentiable and yet you can walk up and down one step at a time. A better analogy would maybe that you could use a very tiny wheel to roll smoothly along it without any bumps. They see me rollin, they be differenti-ating. – mathreadler Dec 14 '15 at 22:15
up vote 137 down vote accepted

$|x|$ is continuous, and differentiable everywhere except at 0. Can you see why?

From this we can build up the functions you need: $|x-2| + |x-3| + |x-4|$ is continuous (why?) and differentiable everywhere except at 2, 3, and 4.

share|cite|improve this answer
$\uparrow$ Change first + sign to a - sign for the infamous $\mathsf{W}$ solution...:) – Qmechanic Oct 22 '14 at 13:36
nice.............+1 – Bhaskara-III Feb 26 at 10:28

$$\ \ \ \ \mathsf{W}\ \ \ \ $$

share|cite|improve this answer
OK, I confess: I always dreamt of reading/posting an answer with only one character... so I could not resist the occasion. – Did Oct 20 '11 at 19:48
+1 for succinctness. – aardvarkk Oct 20 '11 at 19:50
Best answer ever! – J. M. Oct 20 '11 at 22:36
This answer finally made me sign up to (so that I could upvote). – Heinzi Oct 21 '11 at 8:37
-1 "This answer is not useful" to any one who would actually ask this question. – Graphth Oct 24 '11 at 3:12

How about $f(x) = \max(\sin(n\pi x),0)$ or perhaps $g(x) = |\sin(n\pi x)|$?

share|cite|improve this answer
You're right, I think, because we're considering only one-sided derivatives at $1$ and $5$. – Saaqib Mahmuud Aug 16 '13 at 9:45

Remember that if a function isn't continuous at a point, then its antiderivative is not differentiable there. Knowing this, you could construct the desired function by taking the integral of a function that's discontinuous at $x=2,3,4$: $$ f(x) = \int_1^x F(y) \,\mathrm{d}y, $$ where $$ F(x) = \begin{cases} -1 & 1\le x\le 2 \\ +1 & 2<x\le 3 \\ -1 & 3<x\le 4 \\ +1 & 4<x\le 5 \\ \end{cases} $$

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.