Function which is continuous everywhere in its domain, but differentiable only at one point

I am new in this forum. My question: Suppose a real valued function $f: \mathbb{R} \rightarrow \mathbb{R}$ is continuous everywhere. Is it possible to construct $f$ that is differentiable at only one point? If possible, please give an example.

Note: I am aware that there is a function which is differentiable at a single point but discontinuous elsewhere. I also know about Weierstrass function that continuous everywhere but nowhere differentiable. But is there a function which is continuous but only differentiable in one point?

In fact, I found this discussion but unfortunately it still does not give a definitive answer. Moreover they consider only in an interval, whereas my problem is for the entire domain. Thank you very much


Solution 1:

It is certainly possible. Fix a nowhere-differentiable function $f$ such that $0\leq f(x)\leq 1$ for all $x$. Now consider $x^2f(x)$. This is differentiable at $0$ but nowhere else. You can verify it is differentiable at $0$ using the limit definition of derivative. $$\lim_{h\to 0} \frac{h^2f(h)-0^2f(0)}{h}=\lim_{h\to 0}hf(h)$$ and $0\leq f(h)\leq 1$ implies $0\leq hf(h)\leq h$. So the limit goes to $0$ by the squeeze theorem.

To see it is not differentiable elsewhere is a slightly harder exercise. Suppose $x^2f(x)$ is differentiable at $x\neq 0$. Then $$\lim_{h\to 0} \frac{(x+h)^2f(x+h)-x^2f(x)}{h}=L.$$ Adding and subtracting a mixed term $x^2f(x+h)$ in the middle, this becomes $$ \lim_{h\to 0} \frac{(x+h)^2f(x+h)-x^2f(x+h)}{h}+\frac{x^2f(x+h)-x^2f(x)}{h}=L $$ The left-hand term limits to $2x f(x).$ The right-hand term limits to $x^2f'(x)$. This implies that $f'(x)$ exists, since it is equal to $x^{-2}(2xf(x)-L)$. (This fails for $x=0$.)