Can a continuous function on [0,1] be constructed which is differentiable exactly at two points in [0,1]?

Take a function that is continuous everywhere and differentiable nowhere, call it $g$.

Take $2$ points, $a$ and $b$. Then $f(x) = (x-a)(x-b)g(x)$ is continuous everywhere, differentiable only at $a$ and $b$.


You can use continuity of $g$ and the definition of the derivative to verify very quickly that $f$ is differentiable at $a$ and $b$. To see that $f$ is differentiable nowhere else, you could note that if $f$ were differentiable at $c\not\in \{a,b\}$, then so would be $g(x) =\dfrac{f(x)}{(x-a)(x-b)}$ by the quotient rule.