Directional derivative and gradient

Given a scalar field like temperature, pressure, or electric potential in space, a single number rarely tells the whole story — how fast that quantity changes depends entirely on which way you move. Walk toward a mountain's summit and altitude rises steeply; walk along a contour line and it does not change at all. The directional derivative answers "how fast, in this specific direction," and the gradient is the one vector that carries the complete answer for every possible direction at once. Once you have ∇f\nabla f at a point, you can read off the directional derivative in any direction by a single dot product, find the direction of fastest increase, and find the normal to a level surface — three separate-looking questions collapsing into one calculation. This is the workhorse tool of MA10002 vector calculus, and it feeds directly into divergence, curl and the Laplacian in the topics that follow.

The core insight

The gradient ∇f\nabla f packs every directional rate of change of ff into one vector, so that Du^f=∇f⋅u^D_{\hat{\mathbf u}}f = \nabla f\cdot\hat{\mathbf u} gives the rate along any unit direction, with ∇f\nabla f itself pointing along steepest ascent and standing normal to the level surface through the point.

The core idea

For a scalar field f(x,y,z)f(x,y,z) with continuous partial derivatives, the gradient is the vector field built from the three partial derivatives,

∇f=∂f∂x ı^+∂f∂y ȷ^+∂f∂z k^,\nabla f = \frac{\partial f}{\partial x}\,\hat\imath + \frac{\partial f}{\partial y}\,\hat\jmath + \frac{\partial f}{\partial z}\,\hat k,

where: ı^,ȷ^,k^\hat\imath,\hat\jmath,\hat k are the standard unit vectors along x,y,zx,y,z, and each partial derivative is evaluated holding the other two variables fixed. The gradient is a vector at every point — it has a magnitude and a direction, unlike ff itself which is a plain scalar. Given a unit vector u^=(u1,u2,u3)\hat{\mathbf u}=(u_1,u_2,u_3) with ∣u^∣=1|\hat{\mathbf u}|=1, the directional derivative of ff at a point PP along u^\hat{\mathbf u} is the dot product of the gradient with that direction,

Du^f∣P=∇f∣P⋅u^,D_{\hat{\mathbf u}}f\big|_P = \nabla f\big|_P\cdot\hat{\mathbf u},

where: Du^fD_{\hat{\mathbf u}}f is a scalar — the instantaneous rate of change of ff per unit distance moved from PP in direction u^\hat{\mathbf u}. If you are only given a direction vector v⃗\vec v that is not already a unit vector, normalize it first: u^=v⃗/∣v⃗∣\hat{\mathbf u}=\vec v/|\vec v|, otherwise the "rate per unit distance" reading is wrong. Writing the dot product as Du^f=∣∇f∣cos⁡θD_{\hat{\mathbf u}}f = |\nabla f|\cos\theta, where θ\theta is the angle between ∇f\nabla f and u^\hat{\mathbf u}, two geometric facts fall out immediately. First, Du^fD_{\hat{\mathbf u}}f is largest when θ=0\theta=0, so ∇f\nabla f points along the direction of steepest ascent, and that maximum rate of increase equals ∣∇f∣|\nabla f|; the direction of steepest descent is −∇f-\nabla f. Second, ∇f\nabla f is normal to the level surface f=cf=c passing through the point, because moving along the surface keeps ff constant, forcing the directional derivative along any tangent direction to vanish — and the only way ∇f⋅u^=0\nabla f\cdot\hat{\mathbf u}=0 for every tangent u^\hat{\mathbf u} is for ∇f\nabla f to be perpendicular to the whole tangent plane.

Figure
A contour map of a scalar field with a gradient arrow at a point standing perpendicular to the contour line and pointing toward higher values, alongside a shorter arrow showing the projection onto an arbitrary direction
Gradient is normal to the level curve and points toward increasing f f = c1 f = c2 f = c3 (higher) P grad f (normal, steepest ascent) unit direction u-hat D_u f = projection

Directional derivative from first principles

The dot-product formula is not a definition pulled out of thin air — it follows from the ordinary limit definition of a derivative combined with the multivariable chain rule, and seeing that derivation once removes any temptation to plug in a non-unit vector or to reach for the wrong sign on steepest descent.

Derivation ADirectional derivative as gradient dot direction

The goal is to show, starting only from the limit definition "rate of change per unit distance moved," that the directional derivative of a differentiable scalar field f(x,y,z)f(x,y,z) at a point PP in a unit direction u^=(u1,u2,u3)\hat{\mathbf u}=(u_1,u_2,u_3) reduces to the single dot product ∇f∣P⋅u^\nabla f\big|_P\cdot\hat{\mathbf u}, so that computing it never requires re-deriving a limit — only evaluating three partial derivatives and one dot product.

Step 1. Parametrize the line through P=(x0,y0,z0)P=(x_0,y_0,z_0) in direction u^\hat{\mathbf u} by arc length tt: r⃗(t)=(x0+tu1, y0+tu2, z0+tu3)\vec r(t) = (x_0+tu_1,\ y_0+tu_2,\ z_0+tu_3). Because u^\hat{\mathbf u} is a unit vector, tt is exactly distance travelled from PP, which is what makes the coming rate a "rate per unit distance."

Step 2. Define the directional derivative as the ordinary single-variable derivative of ff along this line, evaluated at t=0t=0: Du^f∣P=ddt[f(x0+tu1, y0+tu2, z0+tu3)]t=0D_{\hat{\mathbf u}}f\big|_P = \dfrac{d}{dt}\Big[f(x_0+tu_1,\,y_0+tu_2,\,z_0+tu_3)\Big]_{t=0}. This is just "how fast does ff change as I walk along the line," matching the plain-English meaning.

Step 3. Apply the multivariable chain rule to differentiate f(r⃗(t))f(\vec r(t)) with respect to tt. Since dxdt=u1\frac{dx}{dt}=u_1, dydt=u2\frac{dy}{dt}=u_2, dzdt=u3\frac{dz}{dt}=u_3 are constants, the chain rule gives dfdt=∂f∂xu1+∂f∂yu2+∂f∂zu3\dfrac{df}{dt} = \dfrac{\partial f}{\partial x}u_1 + \dfrac{\partial f}{\partial y}u_2 + \dfrac{\partial f}{\partial z}u_3, with every partial derivative evaluated at the moving point r⃗(t)\vec r(t).

Step 4. Evaluate at t=0t=0, where r⃗(0)=P\vec r(0)=P. The right-hand side becomes ∂f∂x∣Pu1+∂f∂y∣Pu2+∂f∂z∣Pu3\dfrac{\partial f}{\partial x}\Big|_P u_1 + \dfrac{\partial f}{\partial y}\Big|_P u_2 + \dfrac{\partial f}{\partial z}\Big|_P u_3, which is exactly the dot product of the vector (∂f∂x,∂f∂y,∂f∂z)∣P\left(\dfrac{\partial f}{\partial x},\dfrac{\partial f}{\partial y},\dfrac{\partial f}{\partial z}\right)\Big|_P with (u1,u2,u3)(u_1,u_2,u_3). Naming that vector ∇f∣P\nabla f\big|_P gives Du^f∣P=∇f∣P⋅u^D_{\hat{\mathbf u}}f\big|_P = \nabla f\big|_P\cdot\hat{\mathbf u}, the formula used throughout this topic. Verified: the same steps with u^\hat{\mathbf u} replaced by ı^=(1,0,0)\hat\imath=(1,0,0) collapse to Dı^f=∂f/∂xD_{\hat\imath}f = \partial f/\partial x, confirming the ordinary partial derivative is the special case of a directional derivative along a coordinate axis.

Worked example

Problem. For f(x,y,z)=x2y+yz3f(x,y,z) = x^2y + yz^3, find the directional derivative at the point P(2,−1,1)P(2,-1,1) in the direction of the vector v⃗=(1,2,2)\vec v = (1,2,2), and state the direction and magnitude of the maximum rate of increase of ff at PP.

Step 1. Compute the gradient symbolically. ∂f∂x=2xy\dfrac{\partial f}{\partial x} = 2xy, ∂f∂y=x2+z3\dfrac{\partial f}{\partial y} = x^2+z^3, ∂f∂z=3yz2\dfrac{\partial f}{\partial z} = 3yz^2, so ∇f=(2xy, x2+z3, 3yz2)\nabla f = (2xy,\ x^2+z^3,\ 3yz^2).

Step 2. Evaluate at P(2,−1,1)P(2,-1,1): 2xy=2(2)(−1)=−42xy = 2(2)(-1)=-4, x2+z3=4+1=5x^2+z^3 = 4+1=5, 3yz2=3(−1)(1)=−33yz^2 = 3(-1)(1)=-3. So ∇f∣P=(−4, 5, −3)\nabla f\big|_P = (-4,\,5,\,-3).

Step 3. Normalize the direction. ∣v⃗∣=12+22+22=9=3|\vec v| = \sqrt{1^2+2^2+2^2}=\sqrt9=3, so u^=(13,23,23)\hat{\mathbf u} = \left(\tfrac13,\tfrac23,\tfrac23\right).

Step 4. Take the dot product. Du^f∣P=(−4)(13)+5(23)+(−3)(23)=−43+103−2=63−2=0D_{\hat{\mathbf u}}f\big|_P = (-4)\left(\tfrac13\right)+5\left(\tfrac23\right)+(-3)\left(\tfrac23\right) = -\tfrac43+\tfrac{10}3-2 = \tfrac63-2 = 0. The directional derivative is 00 — this particular direction happens to be tangent to the level surface of ff through PP.

Competitive stretch

The same gradient answers the second half of the problem without any new computation. Since ∇f∣P=(−4,5,−3)\nabla f\big|_P=(-4,5,-3) already points along steepest ascent, the maximum rate of increase at PP is simply its magnitude, ∣∇f∣P∣=(−4)2+52+(−3)2=16+25+9=50=52≈7.07|\nabla f\big|_P| = \sqrt{(-4)^2+5^2+(-3)^2} = \sqrt{16+25+9}=\sqrt{50}=5\sqrt2 \approx 7.07, attained in the unit direction 152(−4,5,−3)\dfrac{1}{5\sqrt2}(-4,5,-3). Notice this is a completely different direction from v⃗=(1,2,2)\vec v=(1,2,2) above — one direction gave zero change, the other gives the fastest possible increase, and both came from the same gradient vector.

Common traps

  • Plugging a non-unit vector directly into Du^f=∇f⋅u^D_{\hat{\mathbf u}}f = \nabla f\cdot\hat{\mathbf u} without normalizing first — the result then is not a rate per unit distance.
  • Mixing up the gradient (a vector) with the directional derivative (a scalar, its projection onto a chosen direction).
  • Forgetting the sign on steepest descent: ∇f\nabla f gives steepest ascent, and −∇f-\nabla f gives steepest descent.
  • Assuming the gradient lies tangent to the level surface — it is exactly the opposite: ∇f\nabla f is normal to the level surface at that point.

Ask the tutor: Want to try a fresh scalar field and check your own gradient, directional derivative, and steepest-ascent direction against a worked walkthrough?

Why does the direction vector have to be a unit vector before I dot it with the gradient?

The dot product ∇f⋅v⃗\nabla f\cdot\vec v scales with ∣v⃗∣|\vec v|, so using a non-unit v⃗\vec v inflates or shrinks the answer by that magnitude and it stops meaning "rate of change per unit distance moved." Normalizing to u^=v⃗/∣v⃗∣\hat{\mathbf u}=\vec v/|\vec v| strips out that scaling so the number you get is a genuine rate, comparable across problems and directly usable as a maximum-increase value when u^\hat{\mathbf u} is chosen along ∇f\nabla f itself.

If the directional derivative comes out to zero, does that mean the gradient is zero too?

No, and Worked example above is exactly this case: ∇f∣P=(−4,5,−3)\nabla f\big|_P=(-4,5,-3) is clearly nonzero, yet Du^f=0D_{\hat{\mathbf u}}f=0 for the specific direction u^=(1/3,2/3,2/3)\hat{\mathbf u}=(1/3,2/3,2/3). A zero directional derivative just means that particular direction is perpendicular to the gradient at that point, i.e. it lies tangent to the level surface through PP. Only when ∇f\nabla f itself is the zero vector is the directional derivative zero in every direction.

How is the gradient being normal to the level surface useful beyond this topic?

It is the standard way to get the normal vector for a tangent plane to a surface f(x,y,z)=cf(x,y,z)=c at a point — you compute ∇f\nabla f there and use it directly as the plane's normal, which is exactly the trick used later for divergence theorem and surface-integral setups. It also explains, without extra machinery, why contour lines on a topographic map are always crossed at right angles by the direction of steepest slope.

Before this

Where this leads