1.2.4 · D5Calculus & Optimization Basics
Question bank — Gradients and directional derivatives
Before you start, recall the three characters:
- A partial derivative — a slope along one axis (see Partial derivatives).
- The gradient — a vector stacking all partials, pointing steepest-uphill.
- The directional derivative — a scalar slope in a chosen unit direction , built through the Chain rule and read as a dot product.
True or false — justify
The gradient is a vector, not a number.
True. It has one component per input variable; the scalar slope you feel in a direction is the directional derivative , not the gradient itself.
points along the contour (level set) lines.
False. It is perpendicular to contours: along a contour is constant so , forcing , i.e. orthogonality. See Level sets and contours.
If and points along , then .
False. The formula requires a unit ; with length 2 you get , an inflated number that mixes "how far" with "how steep".
Moving perpendicular to leaves the value of unchanged (to first order).
True. There so — you are walking along a contour, the height stays flat locally.
The direction of steepest descent is .
True. Descent is most negative when , i.e. exactly opposite the gradient — this is why Gradient descent steps that way.
A directional derivative can be negative.
True. If has a component pointing downhill, and — the ground falls in that direction.
For every unit direction , .
True. Since and , the maximum over all directions is exactly , hit when aligns with .
Two different unit directions can give the same directional derivative.
True. Any two directions making the same angle with (e.g. mirror images across the gradient axis) share the same , hence the same slope.
The partial derivative is a special case of a directional derivative.
True. It is with , the unit vector along the -axis.
Spot the error
", so it's biggest when is big."
The error is treating as free. We fix ; the only free quantity is , so the size of is controlled by alignment, not length.
"The gradient equals the slope of the hill, so it's just one number."
Confuses the vector with the scalar slope. The slope in a chosen direction is the number ; the gradient itself is the vector encoding all such slopes.
"To get the directional derivative toward from , dot with ."
You must use the direction of travel, , and then normalize to before dotting. Using the raw endpoint gives a meaningless number.
", and ."
has many inputs, so there is no single . The Chain rule gives — a sum over all coordinates, not one derivative.
" tells you where the maximum of is."
It only tells you the local uphill direction, not the location of any maximum. At an actual maximum ; away from it the gradient just points the way that increases fastest right here.
"Gradient descent uses , so bigger gradient always means we take a bigger step and that's good."
The step is ; a huge gradient with a large can overshoot the minimum and diverge. Magnitude signals steepness, not a guarantee of progress — step size must be controlled.
"Since the gradient is perpendicular to contours, the directional derivative along the gradient is zero."
Reversed. It is zero along the contour (perpendicular to ) and maximal along the gradient ().
Why questions
Why must be a unit vector in ?
So the answer is a slope per unit distance travelled; a longer would scale the rate by its length, conflating distance with steepness.
Why do we use a dot product rather than some other combination of and ?
Because the Chain rule on produces exactly , which is the dot product — it falls out of the maths, we don't impose it.
Why does gradient descent move in instead of ?
is steepest ascent (increases loss); training wants to reduce loss, so it walks the steepest-descent direction .
Why is the maximum directional derivative exactly ?
From , the largest value occurs at (align with ), leaving just .
Why is the gradient perpendicular to level sets?
Along a level set doesn't change, so its directional derivative is , i.e. — the only way a nonzero dots to zero is by being orthogonal to .
Why do we treat all other variables as constant when taking a partial derivative?
A partial measures change along one coordinate axis; freezing the others isolates that axis so the north-slope can't contaminate the east-slope.
Why does the sign of tell you if you're going up or down?
Its sign is the sign of : positive means leans uphill, negative means downhill, zero means level.
Edge cases
At a point where , what is for every direction?
Zero in all directions — the surface is momentarily flat (a critical point: min, max, or saddle), so no direction has first-order slope.
If , does that guarantee a minimum?
No. It only marks a critical point; it could be a maximum or a saddle. Distinguishing them needs curvature — the Hessian.
For at the origin , what direction is "steepest ascent"?
There is none — at the exact bottom of the bowl, so every direction has slope and the notion of "steepest" is undefined.
Along a perfectly flat plateau (constant ), what does the gradient look like everywhere?
throughout, since no direction changes ; there are no contours to be perpendicular to because every point sits at the same level.
If is linear, e.g. , how does vary from point to point?
It doesn't — everywhere; a plane has the same steepest-uphill direction at every point, and the contours are parallel straight lines.
What happens to if you reverse the direction to ?
It flips sign: . Walking backwards up a slope is descending at the same rate.
Can the gradient exist while some directional derivatives behave badly (e.g. at a sharp corner)?
Yes — at kinks like the tip of , partials may fail to exist or disagree by direction, so the neat formula only holds where is differentiable (smooth).
Recall One-line self-test
Give the fastest-descent direction and its rate for at a point where . Direction ; rate of change (steepest possible decrease).
Connections
- Partial derivatives — the per-axis slopes these traps keep confusing with the gradient.
- Chain rule — the reason is a dot product.
- Dot product and projections — the geometry of .
- Level sets and contours — perpendicularity trap lives here.
- Gradient descent — why , and the step-size edge case.
- Jacobian and Hessian — needed when to classify the point.