This is a companion to the parent note . There we built the formula
D u f ( a ) = ∇ f ( a ) ⋅ u , ∥ u ∥ = 1.
Here we drill it. The plan: first lay out a scenario matrix — a checklist of every kind of case this topic can throw at you — then work examples that together tick off every cell.
Intuition The one habit that saves every problem
Before any arithmetic, whisper the recipe from the parent note — "GUN" : G radient, U nit-ize the direction, N umber from the dot product. If you skip the U, you get a wrong number that looks right. Every mistake below is a missing letter.
Definition What "unit-ize" means and why we can always do it
To unit-ize a nonzero direction vector v means to shrink or stretch it to length 1 while keeping its heading: u = ∥ v ∥ v . In the parent note the directional derivative is a rate per unit distance travelled , so the arrow we walk along must have length exactly 1 . This requires v = 0 : the zero vector has no direction at all (and ∥ v ∥ = 0 would divide by zero), so "walk in direction 0 " is not a valid question. Every example below silently assumes a genuine, nonzero heading.
Each row is a "case class" — a situation with its own trap. The last column names the example that covers it.
#
Case class
What's tricky about it
Covered by
C1
Direction given as two points
must subtract, then normalise
Ex 1
C2
Direction given as an angle
already unit — don't re-normalise
Ex 2
C3
Negative directional derivative (walking downhill)
sign of the answer is meaningful
Ex 3
C4
Zero directional derivative (u ⊥ ∇ f )
you're on a level curve
Ex 4
C5
Three variables , mixed signs in u
normalising with a minus sign
Ex 5
C6
Maximum / minimum rate, and the special directions
± ∥∇ f ∥
Ex 6
C7
Degenerate: ∇ f = 0 at the point
every direction gives 0
Ex 7
C8
Word problem (temperature / hill), with units
translate words → vectors
Ex 8
C9
Exam twist: given D u f in two directions, find ∇ f
reverse the dot product
Ex 9
Prerequisites you may want open: Gradient vector , Partial derivatives , Dot product and cosine of angle , Level curves and level sets .
Worked example Ex 1 — subtract, then unit-ize
f ( x , y ) = x 2 + x y at a = ( 1 , 2 ) , walking from ( 1 , 2 ) toward ( 4 , 6 ) .
Forecast: the target is up-and-right, and the gradient (we'll see) points strongly rightward — so expect a solidly positive number, a few units in size.
Gradient. f x = 2 x + y , f y = x , so ∇ f = ( 2 x + y , x ) . At ( 1 , 2 ) : ∇ f = ( 4 , 1 ) .
Why this step? The formula is ∇ f ⋅ u ; we always need the gradient at the specific point first.
Direction vector. ( 4 , 6 ) − ( 1 , 2 ) = ( 3 , 4 ) .
Why this step? "Toward a point" means the arrow from here to there — subtract start from end.
Unit-ize. ∥ ( 3 , 4 ) ∥ = 9 + 16 = 5 (nonzero, so this is legal), so u = ( 3/5 , 4/5 ) .
Why this step? The directional derivative measures change per unit distance, so the heading must have length 1 ; otherwise the slope is scaled by 5 .
Dot. D u f = ( 4 , 1 ) ⋅ ( 3/5 , 4/5 ) = 5 12 + 4 = 5 16 = 3.2 .
Why this step? ∇ f ⋅ u multiplies matching components and adds — this collapses "how f changes per axis" into one slope for our heading.
Verify: ∥ u ∥ = ( 3/5 ) 2 + ( 4/5 ) 2 = 9/25 + 16/25 = 1 ✓. Positive, moderate — matches the forecast.
Worked example Ex 2 — the angle is already a unit vector
f ( x , y ) = sin ( x y ) at ( 1 , 0 ) , direction 3 0 ∘ above the + x -axis.
Forecast: at ( 1 , 0 ) the "x y " inside sine is 0 , so things are near their fastest change — but which way? Guess before reading on.
Turn the angle into u . u = ( cos 3 0 ∘ , sin 3 0 ∘ ) = ( 2 3 , 2 1 ) .
Why this step? A point on the unit circle at angle θ is ( cos θ , sin θ ) — automatically length 1 , so there is nothing to normalise . In Figure 1 this arrow is a radius of the unit circle: its tip sits on the circle, which is the visual meaning of "length 1 ".
Gradient. f x = y cos ( x y ) , f y = x cos ( x y ) , so ∇ f = ( y cos ( x y ) , x cos ( x y )) . At ( 1 , 0 ) : cos ( 0 ) = 1 , so ∇ f = ( 0 , 1 ) .
Why this step? We need the gradient at the given point before dotting; the chain-rule factor cos ( x y ) appears in both partials because it comes from differentiating the outer sin .
Dot. D u f = ( 0 , 1 ) ⋅ ( 2 3 , 2 1 ) = 2 1 .
Why this step? Dotting selects the overlap between heading and gradient. Here the x -rate is 0 , so only the vertical lean of the walk (2 1 ) contributes.
Verify: ∥ u ∥ 2 = 4 3 + 4 1 = 1 ✓. Answer 2 1 = 0.5 , positive and less than the max ∥∇ f ∥ = 1 — consistent.
Reading Figure 1. The plum circle is the unit circle. The orange arrow is u at 3 0 ∘ — notice its tip lands exactly on the circle, confirming length 1 with no re-normalising. The teal arrow is ∇ f = ( 0 , 1 ) , pointing straight up; the directional derivative 2 1 is precisely how much u leans toward that teal arrow.
Worked example Ex 3 — the sign carries the geometry
f ( x , y ) = x 2 + y 2 at ( 3 , 4 ) , in direction v = ( − 1 , 0 ) (due west ).
Forecast: this bowl rises away from the origin. Standing at ( 3 , 4 ) and heading west means heading back toward the centre — so downhill — expect a negative slope.
Gradient. f x = 2 x , f y = 2 y , so ∇ f = ( 2 x , 2 y ) = ( 6 , 8 ) at ( 3 , 4 ) .
Why this step? We need the local uphill direction and its steepness before we can measure any heading against it.
Unit-ize v . ∥ ( − 1 , 0 ) ∥ = 1 (nonzero, and already length 1 ), so u = ( − 1 , 0 ) .
Why this step? We must check the length rather than assume it — here it happens to be 1 , so no division is needed.
Dot. D u f = ( 6 , 8 ) ⋅ ( − 1 , 0 ) = − 6 .
Why this step? The dot product picks out how much the heading aligns with ∇ f ; the heading points opposite to the + x -part of the gradient, producing the minus sign.
Verify: A directional derivative along an axis equals ± the partial: heading in − x gives − f x = − 6 ✓. The minus sign literally means "f decreases as you step west" — you're descending into the bowl.
Worked example Ex 4 — perpendicular to the gradient
Same f = x 2 + y 2 at ( 3 , 4 ) , but head in v = ( − 4 , 3 ) .
Forecast: ∇ f = ( 6 , 8 ) points straight out from the origin. The direction ( − 4 , 3 ) — is it perpendicular? ( 6 ) ( − 4 ) + ( 8 ) ( 3 ) = − 24 + 24 = 0 . So expect exactly zero : you're sliding around the circle of constant height.
Gradient. ∇ f = ( 2 x , 2 y ) = ( 6 , 8 ) at ( 3 , 4 ) .
Why this step? Zero slope happens exactly when the heading is perpendicular to ∇ f , so we need ∇ f to test perpendicularity.
Unit-ize. ∥ ( − 4 , 3 ) ∥ = 16 + 9 = 5 (nonzero), so u = ( − 4/5 , 3/5 ) .
Why this step? Normalising doesn't change perpendicularity, but a unit heading is required for the rate to mean "per unit distance."
Dot. D u f = ( 6 , 8 ) ⋅ ( − 4/5 , 3/5 ) = 5 − 24 + 24 = 0 .
Why this step? A zero dot product is the algebraic signature of a right angle — heading and gradient are perpendicular.
Verify: The level curve of x 2 + y 2 through ( 3 , 4 ) is the circle of radius 5 . The tangent to that circle at ( 3 , 4 ) is perpendicular to the radius ( 3 , 4 ) — and ( − 4 , 3 ) is exactly that tangent. Zero slope = walking along constant height.
Reading Figure 2. The plum circles are level curves of f (constant height). At ( 3 , 4 ) the orange arrow ∇ f points radially outward — the uphill direction. The teal arrow is our heading u = ( − 4/5 , 3/5 ) : it lies along the plum circle (tangent), at a right angle to orange. Because it never leaves a single circle, the height doesn't change — that is the geometric reason the answer is 0 .
Worked example Ex 5 — a minus sign inside the unit vector
f ( x , y , z ) = x 2 y + z 3 at ( 1 , 1 , 1 ) , direction v = ( 2 , − 1 , 2 ) .
Forecast: the z -slope is big (3 z 2 = 3 ) and the x -slope is up too, but u has a − y component fighting the + y -slope. Net should be positive but reduced .
Gradient. f x = 2 x y , f y = x 2 , f z = 3 z 2 , so ∇ f = ( 2 x y , x 2 , 3 z 2 ) = ( 2 , 1 , 3 ) at ( 1 , 1 , 1 ) .
Why this step? Each partial answers "how fast does f change if I nudge just this one variable?"; stacking them gives the full gradient we dot against.
Unit-ize. ∥ ( 2 , − 1 , 2 ) ∥ = 4 + 1 + 4 = 3 (nonzero), so u = ( 3 2 , − 3 1 , 3 2 ) .
Why this step? The minus stays with its component; normalising divides all three by the same length 3 , preserving heading but fixing length to 1 .
Dot. D u f = ( 2 , 1 , 3 ) ⋅ ( 3 2 , − 3 1 , 3 2 ) = 3 4 − 3 1 + 2 = 1 + 2 = 3 .
Why this step? Same recipe as in 2-D — multiply matching components and add; the − 3 1 is the y -slope working against us.
Verify: ∥ u ∥ 2 = 9 4 + 9 1 + 9 4 = 9 9 = 1 ✓. The − 3 1 term shows the y -component pulling the total down; still solidly positive, as forecast.
θ in the dot-product form
From Dot product and cosine of angle , any two vectors satisfy a ⋅ b = ∥ a ∥ ∥ b ∥ cos θ , where θ is the angle between them (measured 0 to π ). Applying this to ∇ f and the heading u , and using ∥ u ∥ = 1 :
D u f = ∇ f ⋅ u = ∥∇ f ∥ ∥ u ∥ cos θ = ∥∇ f ∥ cos θ ,
so here θ is precisely the angle between the gradient arrow and the direction you walk. Facing along the gradient means θ = 0 ; facing opposite means θ = π ; facing perpendicular means θ = π /2 .
Worked example Ex 6 — the two extreme directions
For f = x 2 + x y at ( 1 , 2 ) (so ∇ f = ( 4 , 1 ) ), find the greatest and least possible directional derivatives, and the directions achieving them.
Forecast: the biggest slope is the length of the gradient; the most negative is minus that.
Max value. D u f = ∥∇ f ∥ cos θ , maximised at θ = 0 : value = ∥∇ f ∥ = 4 2 + 1 2 = 17 .
Why this step? With θ the angle between ∇ f and u , the only free part of ∥∇ f ∥ cos θ is cos θ , which peaks at 1 when θ = 0 (walk exactly along the gradient).
Direction of max. u = 17 1 ( 4 , 1 ) .
Why this step? cos θ = 1 means u points the same way as ∇ f ; unit-izing ∇ f gives that heading.
Min value. At θ = π , cos θ = − 1 : value = − 17 , direction − 17 1 ( 4 , 1 ) .
Why this step? The most negative slope is achieved by facing exactly opposite the gradient — steepest descent.
Verify: 17 ≈ 4.123 . Check Ex 1's answer 3.2 is below this cap (3.2 < 4.123 ) ✓ — no direction can beat the gradient's length.
Worked example Ex 7 — a flat spot, every direction gives
0
f ( x , y ) = x 2 + y 2 at the origin ( 0 , 0 ) , any (nonzero) direction u .
Forecast: the origin is the bottom of the bowl — perfectly flat to first order . Whatever way you face, the instantaneous slope should be 0 .
Gradient. f x = 2 x , f y = 2 y , so ∇ f = ( 2 x , 2 y ) = ( 0 , 0 ) at the origin.
Why this step? The gradient's length is the maximum possible slope; if that length is 0 , no direction can produce any first-order rise.
Dot. D u f = ( 0 , 0 ) ⋅ u = 0 for every unit u .
Why this step? The zero vector dotted with anything is 0 — the heading becomes irrelevant, which is exactly what "flat spot" means.
Verify: Directly from the parent note's limit definition, f ( h u ) = h 2 ( u 1 2 + u 2 2 ) = h 2 , so h f ( h u ) − f ( 0 ) = h h 2 = h → 0 as h → 0 ✓. The surface curves up in every direction, but the first-order rate is 0 — a genuine flat spot (a minimum).
D u f = 0 everywhere means f is constant"
Why it feels right: zero slope in every direction sounds like no change at all. Why it's wrong: it's only the first-order rate that's zero. f = x 2 + y 2 clearly grows away from the origin — the change is second-order (curvature). Fix: ∇ f = 0 marks a critical point, not a constant function.
Worked example Ex 8 — temperature on a metal plate
The temperature (in ∘ C ) at point ( x , y ) on a plate is T ( x , y ) = 100 − x 2 − 2 y 2 , with x , y in metres . An ant sits at ( 2 , 1 ) and marches in the direction of the vector ( 3 , 4 ) . How fast does it feel the temperature change, per metre walked?
Forecast: ( 3 , 4 ) points outward , where − x 2 − 2 y 2 makes T smaller — expect a negative rate (getting colder), a few ∘ C per metre.
Gradient. T x = − 2 x , T y = − 4 y , so ∇ T = ( − 2 x , − 4 y ) = ( − 4 , − 4 ) at ( 2 , 1 ) .
Why this step? The gradient collects the temperature's rate along each axis (in ∘ C per metre) — the raw material for any heading.
Unit-ize. ∥ ( 3 , 4 ) ∥ = 9 + 16 = 5 (nonzero), so u = ( 3/5 , 4/5 ) .
Why this step? The question asks per metre , so the heading must itself be one metre long — i.e. length 1 .
Dot. D u T = ( − 4 , − 4 ) ⋅ ( 3/5 , 4/5 ) = 5 − 12 − 16 = 5 − 28 = − 5.6 .
Why this step? Dotting combines both cooling rates, weighted by how much the ant's path leans along each axis.
Verify: Units: ∇ T is ∘ C / m , u is dimensionless, so the answer is ∘ C / m . Result − 5.6 ∘ C / m — negative (cooling), as forecast. The ant cools by 5. 6 ∘ for each metre it walks along ( 3 , 4 ) .
Worked example Ex 9 — reverse the dot product
A differentiable f ( x , y ) satisfies D u f = 1 in direction u 1 = ( 1 , 0 ) and D u f = 2 in direction u 2 = ( 0 , 1 ) , both at the same point a . Find ∇ f ( a ) , then the directional derivative along u 3 = ( 3/5 , 4/5 ) .
Forecast: directional derivatives along the axes are the partials, so ∇ f should just be ( 1 , 2 ) .
Read off the partials. D ( 1 , 0 ) f = ∇ f ⋅ ( 1 , 0 ) = f x = 1 and D ( 0 , 1 ) f = ∇ f ⋅ ( 0 , 1 ) = f y = 2 .
Why this step? Dotting the gradient with ( 1 , 0 ) selects its first component; with ( 0 , 1 ) , its second — so these two special headings hand us the partials directly.
Assemble. ∇ f ( a ) = ( 1 , 2 ) .
Why this step? The gradient is defined as the vector of partials, so we just stack the numbers from step 1.
Use it. D u 3 f = ( 1 , 2 ) ⋅ ( 3/5 , 4/5 ) = 5 3 + 8 = 5 11 = 2.2 .
Why this step? With ∇ f known and f differentiable, the dot-product formula works for any unit heading.
Verify: ∥ u 3 ∥ = 9/25 + 16/25 = 1 ✓. And 2.2 < ∥∇ f ∥ = 1 2 + 2 2 = 5 ≈ 2.236 ✓ — below the max, as it must be. This works because f is differentiable , so the linear (dot-product) formula holds in every direction.
Intuition The whole matrix, in one glance
We have now closed every case class from the scenario matrix: two-point directions (Ex 1 ), angle directions (Ex 2 ), negative (Ex 3 ) and zero (Ex 4 ) slopes, three variables with mixed signs (Ex 5 ), the extreme directions ± ∥∇ f ∥ (Ex 6 ), the degenerate flat spot ∇ f = 0 (Ex 7 ), a units-carrying word problem (Ex 8 ), and the reverse-engineering exam twist (Ex 9 ). Every one used the same three-letter recipe — G radient, U nit-ize, N umber — differing only in how the direction arrives and how the answer is read.
Recall Which cell is which?
C3 asks for the sign of D u f when walking toward the origin in a bowl. What sign, and why? ::: Negative — the height decreases as you approach the minimum.
In C4, why is the answer exactly 0 ? ::: The direction is perpendicular to ∇ f , i.e. tangent to the level curve, so height is momentarily constant.
In C7 the gradient is 0 . What is D u f for a general u ? ::: 0 for every direction — the zero vector dotted with anything is 0 .
In C9, how do you recover ∇ f from two axis-direction derivatives? ::: They are the partials: D ( 1 , 0 ) f = f x , D ( 0 , 1 ) f = f y , so ∇ f = ( f x , f y ) .
What does θ mean in D u f = ∥∇ f ∥ cos θ ? ::: The angle between the gradient ∇ f and the heading u .
Why can't we take a directional derivative "in direction 0 "? ::: The zero vector has no heading and ∥ 0 ∥ = 0 makes unit-izing divide by zero — the question is undefined.
Mnemonic Sign map for the answer
Positive = uphill (toward ∇ f ) · Zero = along a level curve (⊥ ∇ f ) · Negative = downhill (away from ∇ f ). The size is capped at ∥∇ f ∥ .