Given function $f(\vec x) \in \mathbb R, \vec x \in \mathbb R^n $, We know that for all unit direction $\hat u$:

$$ \partial_{\hat u} f = \hat u \cdot \nabla f $$

Consider function $f$:

$$ f(\left<x,y,z\right>) = z - \min(\lvert x \rvert, \lvert y \rvert)\times\frac{\lvert y \rvert}{y} $$ At the origin, along direction $\hat u=\left<\frac{1}{\sqrt 3}, \frac{1}{\sqrt 3}, \frac{1}{\sqrt 3} \right>$: $$ \partial_{\hat u} f(\vec 0) = \lim_{t \to 0} \frac{f(t \hat u) - f(\vec 0)}{t} = \lim_{t \to 0} \frac{\left(\frac{1}{\sqrt 3} - \min\left(\frac{1}{\sqrt 3},\frac{1}{\sqrt 3}\right)\times 1\right) - 0}{t} = \lim_{t \to 0} \frac{0 - 0}{t} = 0\\ \hat u \cdot \nabla f(\vec 0) = \hat u \cdot \left<f_x,f_y,f_z \right> = \left<\frac{1}{\sqrt 3}, \frac{1}{\sqrt 3}, \frac{1}{\sqrt 3} \right> \cdot \left<0,0,1\right> = \frac{1}{\sqrt 3}\\ \partial_{\hat u} f(\vec 0) \ne \hat u \cdot \nabla f(\vec 0) $$

So there must be other requirements for:

$$ \partial_{\hat u} f = \hat u \cdot \nabla f $$

From the graph of the function $f$, we can see that even the directional derivative is defined for all direction at the origin, the tangent surface at the origin is not a plane.


Here are my questions:

  1. does $\nabla f(\vec 0)$ exist ?
  2. what's the requirement for $\partial_{\hat u} f = \hat u \cdot \nabla f$

Edit: Proof that $f$ is not differentiable at the origin

For $f$ to be differentiable, there is a linear transformation $T$ such that: $$ \lim_{\lVert \mathbf h\rVert \to 0} \frac{f(\mathbf a+\mathbf h)-f(\mathbf a)-T_a(\mathbf h)}{\lVert \mathbf h\rVert} = \mathbf 0. $$ Since $\mathbf h$ can approach to $\mathbf 0$ follow any trajectory, assume $\mathbf h$ is following direction $\hat u$, $\mathbf h = t \hat u$ and $\lVert \hat u \rVert = 1$, then we have: $$ \lim_{t \to 0} \frac{f(\mathbf a+t \hat u)-f(\mathbf a)-T_a(t \hat u)}{t} = 0\\ \lim_{t \to 0}\frac{f(\mathbf a+t \hat u)-f(\mathbf a)}{t} = \lim_{t \to 0}\frac{T_a(t \hat u)}{t}\\ $$ To the left we have: $$ \lim_{t \to 0}\frac{f(\mathbf a+t \hat u)-f(\mathbf a)}{t} = \partial_{\hat u} f(a) $$ To the right, since $T$ is linear, we have: $$ \lim_{t \to 0}\frac{T_a(t \hat u)}{t} = \lim_{t \to 0}\frac{t T_a(\hat u)}{t} = T_a(\hat u) $$ So $$ \partial_{\hat u} f(a) = T_a(\hat u) $$ $T$ is linear and I have already proofed that $\partial_{\hat u} f(0)$ is not linear (above in the question). So $f$ is not differentiable at the origin.

What have surprised me is that I thought linearity of $\partial_{\hat u} f$ is a property of differentiable function, but in reality, it is a requirement. Although, technically there is no difference between property and requirement, they are both $\Rightarrow$ in math world.


In order to ensure that $\partial_{\hat u} f = \hat u \cdot \nabla f$ at a given point $\mathbf a \in \mathbb R^n,$ you can simply require that the function $f$ is differentiable at $\mathbf a.$

There may be weaker conditions that ensure that $\partial_{\hat u} f = \hat u \cdot \nabla f$, but I do not know what they are. Differentiability seems to be the one usually used.

Of course you must also define what it means for a function over $\mathbb R^n$ to be differentiable at $\mathbf a.$ Here is a typical definition:

A function $f: A \to \mathbb{R}^n$, $A \subseteq \mathbb{R}^m$ is differentiable at a point $\mathbf a \in \mathbb R^n,$ if there is a linear transformation $T$ such that $$ \lim_{\lVert \mathbf h\rVert \to 0} \frac{f(\mathbf a+\mathbf h)-f(\mathbf a)-T(\mathbf h)}{\lVert \mathbf h\rVert} = \mathbf 0. $$

A good definition of the gradient $\nabla f$, in turn, would require that $f$ be differentiable at every point where $\nabla f$ is defined.

Your function does not have such a derivative at $\mathbf 0.$

There is more that can be said about this, but that is the fundamental issue.

  • $\begingroup$ Thanks, I have written a proof that $f$ is not differentiable at the origin in my question. And for linearity of partial derivative, I have an already answered question here math.stackexchange.com/questions/3079820 $\endgroup$ – Zang MingJie Jan 19 '19 at 21:35

You are taking a derivative where your function doesn't have one. $f(x) = |x|$ does not have a derivative at 0. However it is convex and has the subdifferential $[-1,1]$ at $0$.

Edit: Your partial derivative wrt $x$ is not smooth. Consider $|y|>0$, then the function $g(x) = \max(|x|,|y|)\frac{|y|}{y}$ does not have a derivative at $x=0$. So even if your function has partial derivatives at $(0,0,0)$, the partial derivative wrt $x$ is not continuous.

  • $\begingroup$ My $f$ is already carefully chosen that the derivative exist for all directions. you can try derivative it using limitation. $\endgroup$ – Zang MingJie Jan 18 '19 at 12:02
  • $\begingroup$ @Zang MingJie It is discontinuous along $x=0$ and also along $y=0$. Verify that the left and right derivatives there do not match. $\endgroup$ – lightxbulb Jan 18 '19 at 12:15
  • $\begingroup$ @ZangMingJie having a partial derivative in all directions does not necessarily make your function differentiable. $\endgroup$ – Randall Jan 18 '19 at 12:18
  • $\begingroup$ @lightxbulb $f \vert_{x=0} = z - \min(0, \lvert y \rvert)\times \frac{\lvert y \rvert}{y} = z$ can you explain why it is discontinuous. $\endgroup$ – Zang MingJie Jan 18 '19 at 12:33
  • $\begingroup$ @Randall this maybe the answer I need, I want to know exactly the requirements for a function be differentiable. Any why my $f$ is not differentiable. $\endgroup$ – Zang MingJie Jan 18 '19 at 12:35

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.