Directional derivative calculator

How fast a surface rises as you walk in a chosen direction — the gradient dotted with a unit vector.

The direction is normalised automatically, so ⟨3, 4⟩ and ⟨0.6, 0.8⟩ give the same answer.

Try

The idea

A partial derivative measures change along an axis. A directional derivative measures it along any direction you choose. For a surface \(z = f(x, y)\), it answers: if I walk from this point in this compass bearing, how steeply does the ground rise?

The definition combines the two partials, weighted by where the direction points:

\[D_{\hat u} f = \nabla f \cdot \hat u = f_x u_1 + f_y u_2\]

where \(\hat u = \langle u_1, u_2 \rangle\) is a unit vector. The calculator normalises whatever direction you type, because skipping that step is the single most common error here.

The gradient, and what it tells you

The vector \(\nabla f = \langle f_x, f_y \rangle\) is the gradient, and three facts about it answer most exam questions:

  • It points in the direction of steepest increase.
  • Its length \(|\nabla f|\) is that steepest rate — no direction beats it.
  • It is perpendicular to the level curve through the point, so walking along a contour gives a directional derivative of zero.

All three follow from \(D_{\hat u} f = |\nabla f|\cos\theta\), where \(\theta\) is the angle between the direction and the gradient. Maximum at \(\theta = 0\), zero at \(90°\), most negative at \(180°\).

Worked example

Take \(f(x, y) = x^{2}y\) in the direction \(\langle 3, 4 \rangle\).

  1. Partials: \(f_x = 2xy\) and \(f_y = x^{2}\), so \(\nabla f = \langle 2xy, x^{2} \rangle\).
  2. Normalise the direction: \(|\langle 3, 4\rangle| = 5\), so \(\hat u = \langle 0.6, 0.8 \rangle\).
  3. Dot them: \(D_{\hat u} f = 0.6(2xy) + 0.8(x^{2}) = 1.2xy + 0.8x^{2}\).
  4. At the point \((1, 2)\): \(1.2(2) + 0.8(1) = 3.2\).

Compare that with the steepest possible rate at \((1, 2)\): \(\nabla f = \langle 4, 1 \rangle\), whose length is \(\sqrt{17} \approx 4.12\). Our direction gets 3.2 of a possible 4.12 — it points reasonably close to uphill, but not exactly.

When the direction is given as an angle

Problems often give a direction as an angle rather than a vector. Convert first: a direction at angle \(\theta\) from the positive \(x\)-axis is \(\hat u = \langle \cos\theta, \sin\theta \rangle\), which is already a unit vector.

  • \(30°\): \(\langle \cos 30°, \sin 30° \rangle = \langle 0.866, 0.5 \rangle\)
  • \(45°\): \(\langle 0.707, 0.707 \rangle\)
  • \(60°\): \(\langle 0.5, 0.866 \rangle\)
  • \(120°\): \(\langle -0.5, 0.866 \rangle\)

Type those components into the direction fields above.

Common mistakes

  • Not normalising. Using \(\langle 3, 4 \rangle\) instead of \(\langle 0.6, 0.8 \rangle\) inflates the answer by a factor of 5.
  • Confusing the gradient with the directional derivative. The gradient is a vector; the directional derivative is a single number.
  • Forgetting that the steepest rate is \(|\nabla f|\), not \(\nabla f\).
  • Expecting a directional derivative along a level curve to be non-zero. By definition the function is not changing there.

Questions

What is a directional derivative?

The rate at which \(f\) changes as you move from a point in a chosen direction: \(D_{\hat u} f = \nabla f \cdot \hat u\).

Why must the direction vector be a unit vector?

Because otherwise the answer scales with the length of the vector rather than measuring a rate per unit distance. This calculator normalises the direction for you.

How do I use an angle instead of a vector?

A direction at angle \(\theta\) from the positive \(x\)-axis is \(\langle \cos\theta, \sin\theta \rangle\). Enter those two components.

In which direction does f increase fastest?

Along the gradient \(\nabla f\). The rate in that direction is \(|\nabla f|\), and no other direction beats it.

Is this Calculus 3?

Yes — directional derivatives and the gradient are multivariable calculus, typically Calculus 3. They do not appear on AP Calculus.