Tutorials › Calculus III › When Directional Derivatives Do Not Determine a Gradient

Directional Derivatives and Gradients · Tutorial 395 of 999

When Directional Derivatives Do Not Determine a Gradient

See why having a directional derivative in every direction does not guarantee that a function has a gradient at the point.

Intermediate 9 min read

What You'll Learn

  • Compute all directional derivatives at a point for a specific function of two variables.
  • Determine whether directional derivative values can come from a single gradient vector.
  • Use coordinate directions to identify the only possible gradient candidate.
  • Prove that differentiability forces directional derivatives to depend linearly on direction.
  • Test differentiability directly using the linear approximation remainder.
  • Distinguish existence of every directional derivative from differentiability.

When Directional Information Is Not Enough

A directional derivative measures how a function changes when we approach a point along one chosen straight line. It is tempting to think that if this rate exists in every direction, then all those rates must fit together as the components of a gradient. That conclusion is false.

The key distinction is that directional derivatives test one direction at a time. Differentiability requires a single linear approximation that works for all small changes at once. We will examine a continuous function whose directional derivative exists in every direction at the origin, but whose directional rates cannot come from any gradient vector.

Definition: For a function \(f:\mathbb{R}^2\to\mathbb{R}\), its directional derivative at \(\mathbf{p}\) in the direction \(\mathbf{v}\) is \(D_{\mathbf{v}}f(\mathbf{p})=\lim_{t\to 0}\frac{f(\mathbf{p}+t\mathbf{v})-f(\mathbf{p})}{t}\), if this two-sided limit exists. Here \(\mathbf{v}\) need not be a unit vector. When \(\mathbf{v}=\mathbf{0}\), the quotient is zero for every nonzero \(t\), so the directional derivative is zero.

For a differentiable function, the gradient predicts the directional derivative: \(D_{\mathbf{v}}f(\mathbf{p})=\nabla f(\mathbf{p})\cdot\mathbf{v}\). The dot product is linear in \(\mathbf{v}\). The example below shows that directional derivatives may all exist without obeying this linearity requirement.

A Continuous Counterexample

Define \(f:\mathbb{R}^2\to\mathbb{R}\) by

$$ f(x,y)= \begin{cases} \dfrac{x^3}{x^2+y^2}, & (x,y)\ne(0,0),\\[6pt] 0, & (x,y)=(0,0). \end{cases} $$

The formula away from the origin is a quotient, so it is not defined there. The separate value at the origin makes \(f\) a function on all of \(\mathbb{R}^2\). We will calculate its directional derivatives at the origin, compare them with a possible gradient, and then check differentiability directly.

Worked Example: Compute the Directional Derivative in an Arbitrary Direction

Fix \(\mathbf{v}=(a,b)\). If \((a,b)\ne(0,0)\) and \(t\ne0\), then \((ta,tb)\ne(0,0)\). Substitution gives

$$ f(ta,tb) =\frac{(ta)^3}{(ta)^2+(tb)^2} =\frac{t^3a^3}{t^2a^2+t^2b^2} =\frac{t a^3}{a^2+b^2}. $$

Since \(f(0,0)=0\), the difference quotient is

$$ \frac{f(ta,tb)-f(0,0)}{t} =\frac{t a^3}{a^2+b^2}\cdot\frac{1}{t} =\frac{a^3}{a^2+b^2}. $$

This expression does not depend on \(t\), so its limit exists. If \((a,b)=(0,0)\), the difference quotient is instead \(0\) for every \(t\ne0\). Thus the derivative exists in every direction, with

$$ D_{(a,b)}f(0,0)= \begin{cases} \dfrac{a^3}{a^2+b^2}, & (a,b)\ne(0,0),\\[6pt] 0, & (a,b)=(0,0). \end{cases} $$

For a check, take \(\mathbf{v}=(2,1)\). The formula gives \(D_{(2,1)}f(0,0)=\frac{2^3}{2^2+1^2}=\frac{8}{5}\). Directly, \(f(2t,t)=\frac{8t^3}{5t^2}=\frac{8t}{5}\), so \(\frac{f(2t,t)-f(0,0)}{t}=\frac{8}{5}\), as required.

This computation establishes existence for every fixed direction. It does not yet show whether these rates are consistent with a gradient. For that, we must check how the derivative values relate to one another as the direction changes.

What Differentiability Would Require

Theorem: If \(f:\mathbb{R}^2\to\mathbb{R}\) is differentiable at \(\mathbf{p}\), then for every fixed direction \(\mathbf{v}\), the directional derivative exists and equals \(\nabla f(\mathbf{p})\cdot\mathbf{v}\). Consequently, the function \(\mathbf{v}\mapsto D_{\mathbf{v}}f(\mathbf{p})\) must be linear.

Here differentiability means that there is a vector \(\mathbf{g}\) such that

$$ f(\mathbf{p}+\mathbf{h}) =f(\mathbf{p})+\mathbf{g}\cdot\mathbf{h}+r(\mathbf{h}), \qquad \lim_{\mathbf{h}\to\mathbf{0}} \frac{r(\mathbf{h})}{\|\mathbf{h}\|}=0. $$

The vector \(\mathbf{g}\) is the gradient \(\nabla f(\mathbf{p})\). The condition on the remainder says that the error in the linear approximation becomes negligible compared with the length of the displacement.

To justify the theorem, fix a nonzero \(\mathbf{v}\) and put \(\mathbf{h}=t\mathbf{v}\). The differentiability expansion becomes

$$ \frac{f(\mathbf{p}+t\mathbf{v})-f(\mathbf{p})}{t} = \mathbf{g}\cdot\mathbf{v} +\frac{r(t\mathbf{v})}{t}. $$

As \(t\to0\), the last term tends to zero: indeed, its absolute value is \(\frac{|r(t\mathbf{v})|}{\|t\mathbf{v}\|}\|\mathbf{v}\|\), which tends to zero by the defining remainder condition. Therefore the difference quotient tends to \(\mathbf{g}\cdot\mathbf{v}\), proving the directional derivative formula. For the zero direction, both the directional derivative and the dot product are zero. Since dot products are linear in \(\mathbf{v}\), the directional derivatives of a differentiable function must have that same linear dependence.

Worked Example: Test Whether the Rates Can Come from a Gradient

The coordinate directions determine the only possible gradient. For \(\mathbf{e}_1=(1,0)\), the formula gives

$$ D_{(1,0)}f(0,0)=\frac{1^3}{1^2+0^2}=1. $$

For \(\mathbf{e}_2=(0,1)\), it gives

$$ D_{(0,1)}f(0,0)=\frac{0^3}{0^2+1^2}=0. $$

If a gradient existed, its components would be these coordinate directional derivatives, so the only candidate would be \(\nabla f(0,0)=(1,0)\). This candidate predicts a rate of \((1,0)\cdot(1,1)=1\) in direction \((1,1)\). But the actual directional derivative is

$$ D_{(1,1)}f(0,0)=\frac{1^3}{1^2+1^2}=\frac12. $$

The prediction and the computed derivative disagree: \(1\ne\frac12\). Thus no gradient vector can produce all the directional derivatives. Equivalently, the directional rates fail additivity: \(D_{(1,0)}f+D_{(0,1)}f=1\), whereas \(D_{(1,1)}f=\frac12\). This contradicts the necessary linearity of directional derivatives at a differentiability point.

Checking Differentiability from the Definition

The failed gradient test already proves that \(f\) is not differentiable at the origin, by the theorem. A direct remainder calculation makes the failure concrete. First, the coordinate directions force any gradient at the origin to be \((1,0)\). We can test the linear approximation associated with that only possible candidate.

Worked Example: The Linear Approximation Remainder Does Not Vanish

Approach the origin along points \(\mathbf{h}=(s,s)\), where \(s\ne0\). Then

$$ f(s,s)=\frac{s^3}{s^2+s^2}=\frac{s}{2}. $$

The candidate linear approximation is \(f(0,0)+(1,0)\cdot(s,s)=s\). Its remainder is therefore

$$ r(s,s)=f(s,s)-f(0,0)-(1,0)\cdot(s,s) =\frac{s}{2}-s =-\frac{s}{2}. $$

The displacement length is \(\|(s,s)\|=\sqrt{2}|s|\), so the relative error is

$$ \frac{|r(s,s)|}{\|(s,s)\|} =\frac{|s|/2}{\sqrt{2}|s|} =\frac{1}{2\sqrt{2}}. $$

This ratio is a fixed positive number, not a quantity tending to zero as \(s\to0\). The required differentiability condition fails. The check confirms that the candidate gradient does not give a valid linear approximation.

Continuity Does Not Repair the Problem

This example is continuous at the origin, so the failure is not merely caused by a jump in function values. For every \((x,y)\ne(0,0)\),

$$ |f(x,y)| =\frac{|x|^3}{x^2+y^2} =|x|\frac{x^2}{x^2+y^2} \le |x| \le \sqrt{x^2+y^2}. $$

As \((x,y)\to(0,0)\), the final bound tends to zero. Since \(f(0,0)=0\), this proves continuity there. The example therefore has all three properties: it is continuous at the point, its directional derivative exists in every direction, and it is not differentiable there.

The different conditions measure different things. Continuity controls the function values near a point. Directional derivatives control limits along individual lines through that point. Differentiability requires one linear map to approximate changes in every direction simultaneously. Neither continuity nor existence of all directional derivatives supplies that common linear approximation.

Takeaway: A gradient is more than a list of rates measured along selected directions. At a differentiability point, every directional derivative must equal the dot product of one fixed gradient with the direction vector. If the directional-rate function is not linear, no such gradient exists.

A Useful Contrast

For comparison, consider \(g(x,y)=x^2+y^2\) at the origin. Along \((ta,tb)\),

$$ \frac{g(ta,tb)-g(0,0)}{t} =\frac{t^2(a^2+b^2)}{t} =t(a^2+b^2)\longrightarrow 0. $$

Thus \(D_{(a,b)}g(0,0)=0\) for every direction, which is the linear function of direction given by the zero gradient. In addition, \(g(x,y)=o(\sqrt{x^2+y^2})\) at the origin, since \(g(x,y)/\sqrt{x^2+y^2}=\sqrt{x^2+y^2}\to0\); hence \(g\) is differentiable there. This comparison reinforces the distinction: linear directional data are necessary for differentiability, while the differentiability definition also requires the actual function values to admit the corresponding first-order approximation.

How to Evaluate Directional Data

When all directional derivatives at a point are available, a practical test for whether they could arise from a gradient is to compare them with the linearity that a gradient would impose. In two variables, the coordinate directions fix the only possible gradient. Other directions then test that candidate. A mismatch rules out differentiability immediately; agreement in selected directions, however, does not by itself prove differentiability.

1
Find coordinate rates.
These are the partial derivatives, when they exist, and they give the only possible gradient components.
2
Predict another rate.
Use the candidate gradient's dot product with a direction vector.
3
Compare with the directional limit.
If the values differ, the directional derivatives cannot come from a gradient, so differentiability fails.
4
Use the definition when needed.
To establish differentiability, verify that the remainder divided by the displacement length tends to zero, rather than checking only a few lines.

Check Your Understanding

Use the definition of a directional derivative and the relationship between differentiability and linear approximation to answer these questions.

  1. For the function \(f\) in this tutorial, calculate \(D_{(1,-1)}f(0,0)\).
  2. What gradient is forced by the directional derivatives in the two coordinate directions?
  3. Why does the value of \(D_{(1,1)}f(0,0)\) rule out that gradient?
  4. State the theorem that relates differentiability to directional derivatives, and explain why it requires linear dependence on the direction.
  5. How does the remainder along \((s,s)\) demonstrate failure of differentiability?
  6. Does existence of directional derivatives in every direction guarantee continuity? Does continuity together with their existence guarantee differentiability? Explain what this example establishes.