Let $f:\mathbb R^2\longrightarrow \mathbb R$ a function s.t. all directional derivative exist at $0$. Why the gradient doesn't exist ?

Don't we have that $\nabla f(0)=(\frac{\partial f}{\partial x}(0),\frac{\partial f}{\partial y}(0))$ ? Indeed, $$\frac{\partial f}{\partial x}(0)=\nabla f(0)\cdot (1,0)\quad \text{and}\quad \frac{\partial f}{\partial y}(0)=\nabla f(0)\cdot (0,1)$$ so the gradient should exist, no ?

  • 1
    $\begingroup$ Is it possible you're conflating "$\nabla f(0)$ exists" with "$f$ is differentiable at $0$"? $\endgroup$ – Andrew D. Hwang Mar 12 '17 at 10:52
  • $\begingroup$ @AndrewD.Hwang: How do you distinguish between those? (Are you assuming a coordinate-dependent definition of $\nabla f$?) $\endgroup$ – hmakholm left over Monica Mar 12 '17 at 10:58
  • $\begingroup$ @HenningMakholm: Yes, I'm assuming OP means "$\nabla f(0)$ is the gradient vector in Cartesian coordinates at the origin". $\endgroup$ – Andrew D. Hwang Mar 12 '17 at 11:01
  • $\begingroup$ Giving the definition of the gradient would help. $\endgroup$ – mvw Mar 12 '17 at 11:08
  • $\begingroup$ @AndrewD.Hwang: Hmm, I consider a gradient to be "the thing whose inner product with every tangent vector is a directional derivative". I can see this is not exactly equivalent to $f$ being differentiable, but it's not clear the distinction is relevant for this question. $\endgroup$ – hmakholm left over Monica Mar 12 '17 at 11:08

As a counterexample, consider the function defined by $$ f(r\cos\theta, r\sin\theta) = r\sin(3 \theta) $$ (in particular, $f(0,0)=0$ independently of which $\theta$ you choose).

This has all directional derivatives at $(0,0)$ -- actually $f$ restricted to any straight line through $0$ is linear -- but it cannot be approximated by a linear function near $0$. Therefore it doesn't have a gradient.

Your confusion may be that you think that the gradient is merely "whatever we get by making a vector out of the partial derivatives". However, a more abstract definition (which appears to be what your course is using) is

The gradient is the vector $w$ such that the directional derivative $D_v(f)$ equals $v\cdot w$ for all $v$.

We can easily see that if such a $w$ exists then its elements must be the partial derivatives -- but it is not guaranteed that $(\frac{\partial f}{\partial x},\frac{\partial f}{\partial y})$ has this property, and if it doesn't then it isn't a gradient.

In the example above, the partial derivatives are $(0,-1)$ -- but that doesn't work as $w$, because the directional derivative in the direction $(\cos \frac\pi6,\sin\frac\pi 6)$ is $1$, which does not equal $(0,-1)\cdot(\cos\frac\pi6,\sin\frac\pi6)=-\frac12$.

| cite | improve this answer | |
  • $\begingroup$ I don't really understand your example. How can I get the gradient ? In my course they took as an example $u(x,y)=x^2\boldsymbol 1_{\mathbb Q}(x)(x)+y^2\boldsymbol 1_{\mathbb Q}(y)$ $\endgroup$ – user330587 Mar 12 '17 at 11:00
  • $\begingroup$ but in this example, the gradient existe since $\lim_{t\to 0}\frac{u(t,0)-u(0,0)}{t}=0$ and $\lim_{t\to 0}\frac{u(0,t)-u(0,0)}{t}=0$. Therefore $\nabla f(0)=(0,0)$ $\endgroup$ – user330587 Mar 12 '17 at 11:12
  • 1
    $\begingroup$ @user330587: I don't understand the notation in your first comment. Should $(x)(x)$ have been just $(x)$? In that case it is indeed not a counterexample -- $u$ is perfectly differentiable at $(0,0)$ since we can squeeze it between $0$ and $x^2+y^2$. $\endgroup$ – hmakholm left over Monica Mar 12 '17 at 11:26
  • $\begingroup$ @user330587: I have edited the answer with more explanation. Does that help? $\endgroup$ – hmakholm left over Monica Mar 12 '17 at 11:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.