# On continuity and existence of all directional derivatives at a point of a scalar field whose gradient at that point is $\vec 0$

Let $f:\mathbb R^2 \to \mathbb R$ be a function such that for some $a \in \mathbb R^2$ , $\nabla f(a)$ exists and equals $\vec 0$.

1. Is $f$ necessarily continuous at $a$ ?
2. Do all directional derivatives $f'(a;y)$ exist at $a$?
3. Suppose $f$ is continuous at $a$ and $\nabla f(a)=0$. Do the directional derivatives at $a$ exist in this case?
• If partial derivatives exist and are continuous, then directional derivatives in all directions exist. Commented Oct 27, 2015 at 12:12
• @GEdgar : Actually it requires to exist in a naighbourhood , not only at one point ..
– user228168
Commented Oct 27, 2015 at 12:14
• How do you define $\nabla f(a)$? Is it the unique vector $v$ that satisfies $f(a+x)=f(a)+x\cdot v+o(|x|)$ or a vector whose components are partial derivatives? Commented Oct 27, 2015 at 12:14
• @JoonasIlmavirta No. You are writing the definition of differentiability. It does not follow from mere existence of partial derivatives. $\nabla f(a)$ is just the vector of partial derivatives. Commented Oct 27, 2015 at 12:16
• @uniquesolution, I would find it natural to say that $\nabla f(a)$ is the differential of $f$ at $a$, its existence thus implying differentiability. (This kind of gradient is invariant under linear changes of coordinates, the vector of partial derivatives is not.) I wanted to ask to be sure. In a low regularity setting I find it important to make sure that we have the same definitions, that's all. Commented Oct 27, 2015 at 12:26

As for 2 and 3., the answer is "no" again. Consider $f(x,y)=x^{1/3}y^{1/3}$. $f(x,y)$ is continuous at the origin, and the gradient is zero at $(0,0)$ because $f$ is zero along the axes, but it doesn't have directional derivatives in other directions: Indeed: $$\frac{f(hy_1,hy_1)-f(0,0)}{h}=\frac{h^{2/3}y_1^{1/3}y_2^{1/3}}{h}\approx h^{-1/3}$$ and so the limit does isn't finite as $h\to 0$.

• What about the second question ? Does $f'(a,y)$ exists for all $y \in \mathbb R^2$ ? Your note does not provide a counterexample to this second one
– user228168
Commented Oct 27, 2015 at 12:16
• What does $f^{'}(a,y)$ mean? If it means the directional derivative at $a$ in the direction $y$, then yes, the attached note takes care of that too. Commented Oct 27, 2015 at 12:17
• $f'(a;y):= \lim_{h \to 0}\dfrac{f(a+hy)-f(a)}{h}$ , where $h$ is taken from $\mathbb R$
– user228168
Commented Oct 27, 2015 at 12:19
• Well, yes, that is called the directional derivative of $f$ at $a$ in the direction $y$. Usually $y$ is taken as a unit vector. And yes, with $a=0$, the attached note proves exactly that: $f'(0,y)$ exists and is equal to zero for all $y$, but $f$ is not continuous at $a=(0,0)$. Commented Oct 27, 2015 at 12:20
• Well, that's a different question. Your original title does not ask it. So now you are asking whether a continuous function whose gradient exist and equals zero at some point has directional derivatives there? Commented Oct 27, 2015 at 12:26

It's not necessarily even continuous at the point since the derivatives only tell you about continuity in the directions of the coordinate axes. As a counterexample consider $$f(x,y)= x^2+y^2, x \neq y$$ $$=1, x=y \neq 0$$ $$=0, x=y=0$$

At (0,0), $\nabla f = <0,0>,$ but the function is not continuous at the origin.

$\newcommand{\Reals}{\mathbf{R}}$Let $f:\Reals^{2} \to \Reals$ be a function, and assume $\nabla f(0) = 0$.

1. Is $f$ necessarily continuous at $0$?

• No: Define $$f(x, y) = \begin{cases} 1 & \text{if y = x^{2} and x \neq 0,} \\ 0 & \text{otherwise.} \end{cases}$$ In this example, all directional derivatives of $f$ exist and are $0$ at the origin, but $f$ is discontinuous at the origin. (The file linked by uniquesolution gives a rational function having the same properties.)

1. Do all the directional derivatives of $f$ exist at $0$?

• No: Define $$f(x, y) = \begin{cases} 0 & \text{if xy = 0,} \\ 1 & \text{otherwise.} \end{cases}$$ (As Paul notes, partial derivatives at the origin only measure behavior along the coordinate axes.)
2. What if $f$ is continuous?

• No: Define $f(x, y) = \min\bigl(|x|, |y|\bigr)$, which vanishes along both coordinate axes (so both partials exist at the origin) and is continuous (as the minimum of two continuous functions), but fails to have directional derivatives at the origin along every non-coordinate direction.