Not true. ƒ may only be piecewise differentiable, not wholly differentiable.

Let us define a sequence of functions as follows:

where

is chosen so that

for continuity. Then if we make

by piecing together the functions

and their domains, this function satisfies all your given conditions but is not differentiable at any integer value of

, where the gradient changes abruptly.