1.2.12 · D3Calculus & Optimization Basics

Worked examples — Gradient descent intuition and update rule

3,078 words14 min readBack to topic

This page is a drill. The parent note told you the rule:

Here (theta) is the thing we are tuning (a number, or a list of numbers), is the loss (the "height on the hill"), (read "nabla L", the gradient) is the arrow pointing uphill, and (read "eta", the learning rate) is how big a step we take. One more symbol we lean on below:

If any of those words are shaky, read the parent first. Below we build a matrix of every case this one formula can throw at you, then we work an example for each cell so you never meet a scenario cold.


The scenario matrix

Every gradient-descent problem lives in one of these boxes. The columns are what makes it tricky; each row is a concrete example that lands in that box.

# Case class What is different here Example
A Start on the right of the minimum (), gradient positive Step must go left (minus a positive) Ex 1
B Start on the left (), gradient negative Step must go right (minus a negative) Ex 2
C Zero gradient — you start AT a minimum, or at a flat spot Nothing moves; is it done or stuck? Ex 3
D Learning rate too big — overshoot / diverge Loss grows; sign flips each step Ex 4
E 2-D parameters — gradient is a vector Update every coordinate at once Ex 5
F Real-world word problem — units and meaning Translate story → , , step Ex 6
G Non-convex — many valleys Which valley you land in depends on start Ex 7
H Exam twist — pick the largest safe Use the stability bound Ex 8
Figure — Gradient descent intuition and update rule

Figure s01 — one downhill step on : the step (white) points exactly opposite the gradient (amber).


Case A — start right of the minimum (positive gradient)


Case B — start left of the minimum (negative gradient)


Case C — the gradient is zero (start at the minimum / a flat spot)


Case D — learning rate too large (overshoot & divergence)

Figure — Gradient descent intuition and update rule

Figure s02 — overshoots the valley: each iterate () lands higher and further out, so the loss explodes.


Case E — two parameters at once (the gradient is a vector)


Case F — real-world word problem (units matter)


Case G — non-convex: which valley you land in depends on the start

Figure — Gradient descent intuition and update rule

Figure s03 — the double-well : the amber path from falls into the right well ; the white path from falls into the left well . The cyan dot at is the local max separating the two basins.


Case H — exam twist: largest safe learning rate

Before the example, we owe you one definition — the symbol (read "lambda-max") in the stability bound .


Recall Quick self-test

Which case has the step multiplier exactly ? ::: Ex 1/Ex 2 with , : . Why does freeze on both and ? ::: Both have ; zero gradient ⇒ zero step, regardless of whether it's a true minimum. What is in plain words? ::: The curvature of the loss along its steepest direction — the biggest eigenvalue of the curvature matrix; it sets the learning-rate limit . In Ex 8, what happens exactly at ? ::: The steep-axis multiplier is , so that component oscillates at constant size forever — it does not converge; hence the bound is strict. In Ex 7, what decides which well you reach? ::: The sign of the starting point — its basin of attraction — since the landscape is non-convex.