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?

  • $\begingroup$ 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/… $\endgroup$ Jul 19, 2013 at 4:40
  • $\begingroup$ 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. $\endgroup$ Jul 19, 2013 at 5:07
  • 2
    $\begingroup$ 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. $\endgroup$
    – astro
    Jul 7, 2020 at 20:54
  • $\begingroup$ I thought of this example before searching on MSE: $$f(x,y)=\sqrt{x^2+y^2}\exp\left(-\left(\frac{y-x^2}{x^3}\right)^2\right)$$ But I prefer John's answer. $\endgroup$
    – mr_e_man
    May 2, 2023 at 6:07

2 Answers 2


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$.

  • $\begingroup$ You are right, thanks. Could my conjecture be saved by adding continuity everywhere? $\endgroup$
    – Bananach
    Jul 19, 2013 at 14:04
  • $\begingroup$ This, I don't know... $\endgroup$
    – Etienne
    Jul 19, 2013 at 14:09
  • 3
    $\begingroup$ @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? $\endgroup$ Jul 20, 2013 at 19:40
  • 1
    $\begingroup$ @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. $\endgroup$ May 20, 2017 at 12:09
  • 2
    $\begingroup$ @Bananach It is probably no longer relevant to you, but may be to others (myself included) who found this thread: a proof of the statement for Lipschitz functions can be found in [Cui, Pang – Modern Nonconvex Nondifferentiable Optimization, Proposition 4.1.1]. $\endgroup$
    – bongobums
    Nov 17, 2022 at 12:07

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.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .