# Continuous function with linear directional derivatives=>Total differentiability?

As in the title: If $f\colon\mathbb{R}^n\to\mathbb{R}$ is continuous in $x$ and has directional derivatives $\partial_vf(x)=L(v)\,\forall v\in\mathbb{R}^n$, where $L$ is linear, does this imply that $f$ is totally differentiable?

• notice the criteria "linear" is important. I think there exist sick examples where the directional derivatives exist in all directions, however, they don't glue together nicely. Linearity forces continuity hence the result. For example: math.stackexchange.com/questions/372070/… Jul 19 '13 at 4:40
• yes, you're correct, my (now deleted) post assumed the partials exist near the point, in fact, that calculation shows that bounded partials existing near a point imply continuity at the point (which is interesting). However, the question you ask is different, I'm sure someone will address it soon. Jul 19 '13 at 5:07
• If all partial derivatives of a continuous function exist and at most one is not continuous, the map is differentiable. And this result is optimal. Jul 7 '20 at 20:54

## 2 Answers

The answer is "no".

Let $f:\mathbb R^2\to\mathbb R$ be defined by $f(x,x^2)=x$ for all $x\in \mathbb R$ and $f(x,y)=0$ if $y\neq x^2$. This function $f$ is continuous at $0$ with $f(0)=0$. For any fixed direction $v$, we have $f(tv)=0$ if $t$ is small enough; so $\partial_v f(0)$ exists with $\partial_vf(0)=0$. But $f$ is not differentiable at $0$ because the only possible (total) differential is $L=0$ and we don't have $f(x,y)=o(\Vert (x,y)\Vert)$ as $(x,y)\to 0$.

• You are right, thanks. Could my conjecture be saved by adding continuity everywhere? Jul 19 '13 at 14:04
• This, I don't know... Jul 19 '13 at 14:09
• @Bananach I don't think that adding continuity fixes it, I conjecture you could smooth out the discontinuity hence obtaining an example which is continuous everywhere yet still possesses the non-differentiability at (0,0) with all directional derivatives existing. I'm thinking of using a bump function with a width which decreases to zero as you approach the origin, yet has finite width as you travel along $y=x^2$ for finite distance away from $(0,0)$. I haven't worked out the details... but, does this make sense? Jul 20 '13 at 19:40
• @JamesS.Cook Your idea works. $U = \{(x,y) : \frac{1}{2}x^2 < y < 2x^2\}$ is open. $F = \{(x,x^2) : -1 \le x \le 1\}$ is closed. Define a function on $U^c \cap F$ to be $x$ on $(x,x^2)$ and $0$ elsewhere. This is continuous. By the Tietze extension theorem, we may extend this to a continuous function on $\mathbb{R}^2$. By the same argument, it cannot be differentiable, but all directional derivatives will exist. May 20 '17 at 12:09
• @Bananach If you require that the function is locally lipschitz at the point where the directional derivatives are defined, then your conjecture works. May 20 '17 at 12:10

The answer is "no."

Let $f: R^2 \to R$ be defined by $f(x,y)= \frac{x^3y}{x^4+y^2}$ for $(x,y) \neq (0,0)$ and $f(0,0) = 0$. This function is continuous; its directional derivative is defined at each point in every direction; and at each point its directional derivative is a linear function of the direction. But, you can check that $f$ is not differentiable at $(0,0)$ by approaching $(0,0)$ along $y=x^2$.

See Foundations of Modern Analysis by Dieudonne, Vol. 1 Chapter VIII Section 4.