[Math] function that’s continuous and has all directional derivatives as a linear function of direction, but still fails to be differentiable

examples-counterexamplesmultivariable-calculusreal-analysis

There are many standard examples of functions $f:\mathbb{R}^2\to\mathbb{R}$ that possess all directional derivatives at a point and yet fail to differentiable or even continuous there.

The most common counterexamples are not even continuous, e.g.
$$f(x,y)=\begin{cases}\frac{x^2y}{x^2+y^4}&(x,y)\neq(0,0)\\0&(x,y)=(0,0)\end{cases}$$
This example illustrates the easiest type of nondifferentiability given the existence of all directional derivatives, but I'm interested in more sophisticated pathologies — how far we can go in improving the situation before we finally hit differentiability.

The natural next step would be to impose continuity and yet still fail to achieve differentiability. A good example here is
$$f(x,y)=\sqrt[3]{x^2y}$$
This function is continuous at the origin, unlike the last example, and all its directional derivatives exist there, but it still fails to be differentiable. The easiest way to show this is to note that the partials are zero, but there are directional derivatives $D_u$ that are nonzero, so the directional derivative $D_u$ cannot be given by a linear function of the direction $u$ for all $u$. The problem is that the directional derivative isn't a linear function of the direction.

The next step would be to ask for both continuity and all-directional-derivatives-exist-as-a-linear-function-of-direction and yet still fail to achieve differentiability. The example given in this answer is not continuous, so it shows only that the second condition alone doesn't imply differentiability. What if we impose continuity?

I'm almost certain there is such a counterexample, but I can't think of one, nor could I find one in a quick glance at Courant, Apostol, or Munkres. Showing nondifferentiability here would be harder, since the standard arguments, discontinuity and the failure of the directional derivative operator to be linear, aren't available. Presumably the trick will be to have something go wrong along a nonlinear path even though everything goes right linearly.

Best Answer

Here's a real-analytic example: Let $g(t) =1/(1+t^2).$ Define

$$f(x,y) = \begin{cases} xg((y-x^2)/(x^2+y^2)^2), (x,y) \ne (0,0) \\ 0, (x,y) =(0,0).\end{cases}$$

Then $f$ is real-analytic on $\mathbb {R}^2 \setminus \{(0,0)\},$ $f$ is continuous at $(0,0),$ and $D_uf(0,0) = 0$ for all unit vectors $u.$ Because $f(x,x^2) = xg(0) = x\ne o(x,x^2),$ $f$ is not differentiable at $(0,0).$