Intuition What this page is for
The parent note gave you the machinery:
∇ f is a vector of partials, D u f = ∇ f ⋅ u , and it equals ∥∇ f ∥ cos θ . Here we stress-test that machinery against every kind of input it can meet — every sign, every quadrant, the degenerate cases (zero gradient, non-unit direction), the limiting behaviour, a word problem, and an exam twist. If a scenario exists, you will see it worked below.
Before we start, three symbols we will lean on — defined in plain words:
Definition The three objects, in words
∇ f ("nabla f", the gradient ) is an arrow living in the input plane . Component i is ∂ f / ∂ x i = how fast f climbs if you nudge only coordinate i .
u is a unit step direction : an arrow of length exactly 1 (so ∥ u ∥ = 1 , meaning u 1 2 + u 2 2 = 1 ). "Length" here is the ordinary ruler distance.
D u f is a single number : the slope you feel underfoot if you walk one unit in direction u . Positive = uphill, negative = downhill, zero = flat.
Every worked example below is tagged with the cell of this matrix it covers. Together they fill the whole grid — you will never meet an unshown case.
Cell
Scenario class
What is special / what can trip you
A
∇ f in Quadrant I (both partials + )
plain baseline, positive dot product
B
∇ f with a negative component (Q II / IV)
signs must survive the dot product
C
Both components negative (Q III)
steepest ascent points "down-left"
D
Direction u not yet unit
must normalize before dotting
E
Walking along a contour (θ = 90° )
answer is exactly 0
F
Walking opposite the gradient (θ = 180° )
most negative slope = − ∥∇ f ∥
G
Degenerate: ∇ f = 0
a flat / critical point, every direction gives 0
H
Limiting behaviour of the slope as u rotates
slope traces a cosine wave
I
Word problem (temperature field)
attach units, interpret sign
J
Exam twist : find the direction with a given slope
invert the cosine relation
Worked example A · both partials positive
f ( x , y ) = x 2 + x y + y 2 at a = ( 1 , 1 ) , step direction u = ( 0 , 1 ) (due "north").
Forecast: north-slope should be positive (surface rises going north). Guess a number before reading.
Step 1 — partials. ∂ f / ∂ x = 2 x + y , ∂ f / ∂ y = x + 2 y .
Why this step? The gradient is built from Partial derivatives ; freeze the other variable and differentiate.
Step 2 — evaluate. ∇ f ( 1 , 1 ) = ( 2 + 1 , 1 + 2 ) = ( 3 , 3 ) . Both components positive ⇒ arrow in Quadrant I , pointing up-right.
Step 3 — is u unit? ∥ ( 0 , 1 ) ∥ = 0 2 + 1 2 = 1 . ✓ No normalization needed.
Why check? D u f only means "slope per unit distance" when ∥ u ∥ = 1 .
Step 4 — dot product. D u f = ( 3 , 3 ) ⋅ ( 0 , 1 ) = 3 ⋅ 0 + 3 ⋅ 1 = 3 .
Why a dot product? From the chain-rule derivation in the parent, g ′ ( 0 ) = ∑ i ∂ i f u i , which is the dot product ∇ f ⋅ u .
Verify: north step changes only y ; ∂ f / ∂ y ( 1 , 1 ) = 3 — matches exactly. Positive, as forecast. ✓
Look at the figure: the blue arrow is ∇ f = ( 3 , 3 ) ; the yellow arrow is your northward step; the number 3 is the shadow (projection) of your step onto the gradient scaled by ∥∇ f ∥ — that is what the dot product measures.
Worked example B · gradient with one negative component
f ( x , y ) = x 2 − y 2 (a saddle) at a = ( 2 , 1 ) , step u = ( 1 , 0 ) .
Forecast: − y 2 pushes down in y ; but we step in x . Sign of the answer?
Step 1 — partials. ∂ f / ∂ x = 2 x , ∂ f / ∂ y = − 2 y .
Why the minus? d y d ( − y 2 ) = − 2 y — the constant x 2 vanishes.
Step 2 — evaluate. ∇ f ( 2 , 1 ) = ( 4 , − 2 ) . Positive x -part, negative y -part ⇒ arrow in Quadrant IV (down-right).
Step 3 — unit check. ∥ ( 1 , 0 ) ∥ = 1 . ✓
Step 4 — dot. D u f = ( 4 , − 2 ) ⋅ ( 1 , 0 ) = 4 . The negative y -component simply doesn't participate (its partner u 2 = 0 ).
Verify: ∂ f / ∂ x ( 2 , 1 ) = 4 . ✓ Sign of the other component is irrelevant here — a common panic that costs nothing.
Worked example J · exam twist — find a direction with a
prescribed slope
Same f , same point (∇ f = ( 4 , − 2 ) , so ∥∇ f ∥ = 20 ≈ 4.472 ). Find a unit direction u along which D u f = 3 .
Forecast: since 3 < ∥∇ f ∥ = 4.472 , such a direction must exist (you can always get any slope between − ∥∇ f ∥ and + ∥∇ f ∥ ). Guess whether one or two directions work.
Step 1 — geometric relation. D u f = ∥∇ f ∥ cos θ where θ is the angle from ∇ f to u .
Why cosine? The dot product's geometric form; it earns θ as "how aligned are the two arrows".
Step 2 — solve for θ . cos θ = 3/ 20 = 0.6708 , so θ = ± 47.87° .
Why ± ? Cosine is even: rotating u that angle either clockwise or counter-clockwise gives the same slope. Two directions work.
Verify: ∥∇ f ∥ cos ( 47.87° ) = 4.472 × 0.6708 = 3.00 . ✓ Both the + and − rotations satisfy it.
Worked example C · steepest ascent points "down-left"
f ( x , y ) = − x 2 − x y at a = ( 1 , 1 ) .
Forecast: with two minus signs the surface falls toward the upper-right — so the uphill arrow should point back toward lower-left.
Step 1 — partials. ∂ f / ∂ x = − 2 x − y , ∂ f / ∂ y = − x .
Step 2 — evaluate. ∇ f ( 1 , 1 ) = ( − 2 − 1 , − 1 ) = ( − 3 , − 1 ) . Both negative ⇒ Quadrant III (down-left).
Step 3 — steepest ascent direction. u ⋆ = ( − 3 ) 2 + ( − 1 ) 2 ( − 3 , − 1 ) = 10 ( − 3 , − 1 ) .
Why divide by 10 ? To make the arrow length 1 while keeping its direction.
Step 4 — max slope. ∥∇ f ∥ = 10 ≈ 3.162 .
Verify: D u ⋆ f = ∇ f ⋅ u ⋆ = 10 ( − 3 ) ( − 3 ) + ( − 1 ) ( − 1 ) = 10 10 = 10 . ✓ The steepest-ascent value always equals ∥∇ f ∥ , even when the arrow points into Quadrant III.
Worked example D · normalize before you dot
f ( x , y ) = x 2 + 3 x y + y 2 at a = ( 1 , 2 ) , raw direction v = ( 3 , 4 ) (length 5 , not 1 ).
Forecast: if you (wrongly) skip normalizing, your answer is inflated by the factor ∥ v ∥ = 5 . Predict both the wrong and right numbers.
Step 1 — gradient. ∂ x f = 2 x + 3 y , ∂ y f = 3 x + 2 y ; at ( 1 , 2 ) : ∇ f = ( 8 , 7 ) .
Step 2 — normalize. ∥ v ∥ = 3 2 + 4 2 = 5 , so u = ( 3/5 , 4/5 ) = ( 0.6 , 0.8 ) .
Why? A slope "per unit distance" needs the step to be one unit long.
Step 3 — correct dot. D u f = ( 8 , 7 ) ⋅ ( 0.6 , 0.8 ) = 4.8 + 5.6 = 10.4 .
Step 4 — the trap. Skipping normalization gives ( 8 , 7 ) ⋅ ( 3 , 4 ) = 24 + 28 = 52 , which is exactly 5 × 10.4 — the inflation factor is ∥ v ∥ .
Verify: 52/5 = 10.4 . ✓ The mistake is a clean scale error, so you can even recover from it by dividing by ∥ v ∥ .
Worked example E · walking along a contour (
θ = 90° )
f ( x , y ) = x 2 + y 2 at a = ( 3 , 4 ) . Step perpendicular to ∇ f .
Forecast: contours of x 2 + y 2 are circles; walking around the circle keeps height fixed. Guess the slope.
Step 1 — gradient. ∇ f = ( 2 x , 2 y ) = ( 6 , 8 ) . It points radially outward.
Step 2 — pick a perpendicular unit step. Rotate ( 6 , 8 ) by 90° : ( − 8 , 6 ) , normalize by 100 = 10 ⇒ u = ( − 0.8 , 0.6 ) .
Why rotate 90°? Perpendicular to ∇ f means "along the contour" — the level set direction.
Step 3 — dot. D u f = ( 6 , 8 ) ⋅ ( − 0.8 , 0.6 ) = − 4.8 + 4.8 = 0 .
Verify: height on the circle radius 5 is constant = 25 ; moving along it can't change f , so slope = 0 . ✓ This is why the gradient is orthogonal to contours.
Worked example F · straight downhill (
θ = 180° )
Same f , same a = ( 3 , 4 ) , but step opposite the gradient: u = − ∇ f /∥∇ f ∥ = ( − 0.6 , − 0.8 ) .
Forecast: this is the gradient-descent direction — most negative slope. Guess its value.
Step 1 — dot. D u f = ( 6 , 8 ) ⋅ ( − 0.6 , − 0.8 ) = − 3.6 − 6.4 = − 10 .
Step 2 — compare to ∥∇ f ∥ . ∥∇ f ∥ = 6 2 + 8 2 = 10 , so D u f = − ∥∇ f ∥ exactly.
Why the minus of the norm? cos ( 180° ) = − 1 , so ∥∇ f ∥ cos θ = − ∥∇ f ∥ .
Verify: − 10 is the smallest value any unit direction can produce; every other direction gives something larger. ✓
Worked example G · a flat / critical point
f ( x , y ) = x 2 + y 2 at a = ( 0 , 0 ) (the bowl's bottom).
Forecast: at the very bottom, is there any uphill direction? Guess before computing.
Step 1 — gradient. ∇ f = ( 2 x , 2 y ) = ( 0 , 0 ) at the origin. The arrow has length zero .
Step 2 — directional derivative in any u . D u f = ( 0 , 0 ) ⋅ u = 0 for every unit u .
Why every direction gives 0? A zero vector dotted with anything is 0 — there is no preferred uphill.
Step 3 — what "steepest ascent direction" means here. It is undefined : ∇ f /∥∇ f ∥ = 0/0 . This is exactly the signal ML uses — ∇ f = 0 means a stationary point (min, max, or saddle) where gradient descent stops moving .
Verify: to first order f is flat at a critical point in every direction, so all directional derivatives must vanish. ✓ (Curvature — who's a min vs saddle — is decided by the Hessian , not the gradient.)
Worked example H · slope traces a cosine as
u spins
f ( x , y ) = x 2 + 3 x y + y 2 at ( 1 , 2 ) so ∇ f = ( 8 , 7 ) , ∥∇ f ∥ = 113 ≈ 10.630 . Let u = ( cos ϕ , sin ϕ ) sweep all angles ϕ .
Forecast: sketch how D u f behaves as ϕ goes 0 → 360° . Bounded? Where max/min?
Step 1 — write it as one wave. D u f = ∥∇ f ∥ cos θ , where θ = ϕ − ϕ g and ϕ g = arctan ( 7/8 ) ≈ 41.19° is the gradient's own angle.
Why θ = ϕ − ϕ g ? θ is the gap between your heading ϕ and the gradient's heading ϕ g .
Step 2 — read off the limits.
Max = + 113 ≈ 10.630 at ϕ = ϕ g (θ = 0 ).
Min = − 113 at ϕ = ϕ g + 180° (θ = 180° ).
Two zeros at ϕ = ϕ g ± 90° (the contour directions).
Step 3 — check one intermediate value. At ϕ = 90° (due north), θ = 90° − 41.19° = 48.81° , cos θ = 0.6585 , slope = 10.630 × 0.6585 = 7.0 . And indeed ∇ f ⋅ ( 0 , 1 ) = 7 . ✓
Verify: the slope is a pure cosine of amplitude ∥∇ f ∥ — it can never exceed ∥∇ f ∥ nor drop below − ∥∇ f ∥ . That bound is the whole reason ∇ f deserves the name "steepest". ✓
Worked example I · a temperature field
A metal plate has temperature T ( x , y ) = 100 − x 2 − 2 y 2 degrees Celsius, with x , y in metres. An ant sits at ( 3 , 1 ) and walks toward ( 3 , 4 ) at 1 m/s . How fast (in ° C/s ) does it feel the temperature change?
Forecast: more y ⇒ the − 2 y 2 term drops fast ⇒ expect the ant to cool . Sign should be negative.
Step 1 — gradient (units: ° C/m ). ∇ T = ( − 2 x , − 4 y ) ; at ( 3 , 1 ) : ∇ T = ( − 6 , − 4 ) .
Step 2 — unit direction. Toward ( 3 , 4 ) : raw ( 0 , 3 ) , length 3 , so u = ( 0 , 1 ) .
Why unit? So D u T comes out per metre, ready to multiply by speed.
Step 3 — directional derivative. D u T = ( − 6 , − 4 ) ⋅ ( 0 , 1 ) = − 4 ° C/m .
Step 4 — attach the speed. Rate in time = D u T × speed = ( − 4 ° C/m ) ( 1 m/s ) = − 4 ° C/s .
Why multiply? D u T is change per metre travelled ; the chain rule turns metres into seconds via speed.
Verify: negative, matching the forecast — the ant cools at 4° C per second. Units check: m ° C ⋅ s m = s ° C . ✓
Recall Did every cell get covered?
Cell A (Q I) ::: Example A — ∇ f = ( 3 , 3 ) , slope 3 north.
Cell B (one negative component) ::: Example B — ∇ f = ( 4 , − 2 ) , slope 4 .
Cell C (both negative, Q III) ::: Example C — ∇ f = ( − 3 , − 1 ) , max slope 10 .
Cell D (non-unit direction) ::: Example D — normalize ( 3 , 4 ) first, slope 10.4 not 52 .
Cell E (along contour) ::: Example E — perpendicular step, slope 0 .
Cell F (opposite gradient) ::: Example F — slope − 10 = − ∥∇ f ∥ .
Cell G (zero gradient) ::: Example G — origin, every direction gives 0 .
Cell H (limiting cosine) ::: Example H — slope bounded in [ − 113 , + 113 ] .
Cell I (word problem, units) ::: Example I — ant cools at − 4 ° C/s .
Cell J (exam twist, invert cosine) ::: Example J — two directions at ± 47.87° give slope 3 .
Mnemonic One line to carry it all
"Dot with a unit step; the answer lives between − ∥∇ f ∥ and + ∥∇ f ∥ , hits the top when you face the arrow, zero when you cross it, and is undefined only when the arrow itself dies."