# Example for a continuous function that has directional derivative at every point but not differentiable at the origin

Can we find a function $f:\mathbb R^n\to\mathbb R$ that such that $f$ is continuous and $\partial_v f(p)$ exists for all $p\in\mathbb R^n$ and $v\in\mathbb R^n$. But $f$ is not differentiable at $0$?

Is such function $f$ exists?

Here give a example that has directional derivative everywhere, but it's not continuous at the origin.

Consider the polar coordinates $\ (r\,\ \Phi)\$ in $\ \mathbb R^2.\$ Function $f:\mathbb R^2\rightarrow\mathbb R,\$ which in polar coordinates is given by:

$$f(r\,\ \Phi)\,\ :=\,\ r\cdot\sin(3\cdot\Phi)$$

is continuous everywhere, is infinitely differentiable outside the origin $\ O,\$ and $\ f\$ has all directional derivative at $\ O,\$ but $\ f\$ is not differentiable at $\ O.$

• It clearly doesn’t have a derivative in direction $(x,y) = (1,1)$ at $O$. – arseniiv Dec 16 '17 at 4:10
• @arseniiv, I've fixed it. Thank you. I was indeed careless. – Wlod AA Dec 16 '17 at 4:43
• Yeah, with 3 it’s great now! – arseniiv Dec 16 '17 at 5:01
• @arseniiv, thank you. Thank you TWICE. :) – Wlod AA Dec 16 '17 at 5:52

On $\mathbb R^2$ define

$$f(x,y) = \begin{cases} \dfrac{xy^2}{x^2+y^2}& (x,y)\ne (0,0) \\ 0 & (x,y)= (0,0)\end{cases}$$

Then $f\in C^\infty(\mathbb R^2 \setminus \{(0,0)\}),$ and $f$ is continuous at $(0,0).$ For any unit vector $u= (a,b),$ we have

$$\tag 1 \frac{f(tu)}{t} = ab^2.$$

Thus $f$ has directional derivatives at $(0,0)$ in all directions.

Suppose $Df(0,0)$ exists. Because $f$ is $0$ on the axes, all partial derivatives of $f$ at $(0,0)$ vanish, so $Df(0,0)$ must be the $0$ linear transformation. Thus $f(x,y) = o((x^2+y^2)^{1/2}).$ But that violates $(1),$ so we have a contradiction. This proves $f$ is not differentiable at $(0,0).$