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

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.

• 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
• 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
• I will refuse to upvote you question... but instead I gladly upvoted the infamous "W" answer below. – Matemáticos Chibchas Sep 24 '17 at 6:09

$|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.

• $\uparrow$ Change first + sign to a - sign for the infamous $\mathsf{W}$ solution...:) – Qmechanic Oct 22 '14 at 13:36

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

• @Shan Think about the $\mathsf{W}$ as the graph of a function. – Pedro Tamaroff May 4 '12 at 0:44
How about $f(x) = \max(\sin(n\pi x),0)$ or perhaps $g(x) = |\sin(n\pi x)|$?
• You're right, I think, because we're considering only one-sided derivatives at $1$ and $5$. – Saaqib Mahmood Aug 16 '13 at 9:45