(a) Vector. The gradient has one component per input variable. Here there are two inputs x,y, so ∇f is a 2-component arrow, not a number. The number is what you get after dotting with a direction.
(b) Steepest slope =∥∇f∥. Magnitude of a vector (a,b) is a2+b2:
∥∇f∥=32+(−4)2=9+16=25=5.
This is the largest value Duf can ever reach, because ∥∇f∥cosθ maxes out at cosθ=1.
(c) Steepest-ascent unit direction=∥∇f∥∇f=5(3,−4)=(0.6,−0.8).
Dividing a vector by its own length gives a length-1 arrow pointing the same way.
Recall Solution 1.2
(a) True. A contour (level set) is a curve where f keeps the same value. Same value ⇒ no change ⇒Duf=0. Since Duf=∇f⋅u, that dot product is zero, so u⊥∇f.
(b) False. The gradient is perpendicular to the contour, not along it. It points across the contours, straight uphill. See the trap below.
Partials — differentiate one variable, freeze the other (see Partial derivatives).
∂x∂f=2xy (treat y constant; y3 has no x, so it dies).
∂y∂f=x2+3y2 (treat x constant).
Evaluate at (1,2):∇f(1,2)=(2⋅1⋅2,12+3⋅22)=(4,13).
Recall Solution 2.2
Step 1 — raw direction (arrow from a to target): (4−1,6−2)=(3,4).
Step 2 — normalise. Length =32+42=5, so the unit step is u=(3/5,4/5)=(0.6,0.8).
Why normalise?Duf should measure slope per one step of distance; a longer arrow would fake a steeper slope. See Dot product and projections.
Step 3 — dot product with ∇f=(4,13) from 2.1:
Duf=(4,13)⋅(0.6,0.8)=2.4+10.4=12.8.
Recall Solution 2.3
Gradient (1-D, so it's an ordinary derivative):L′(w)=2(w−3)+21.
At w=5:L′(5)=2(2)+0.5=4.5. Positive ⇒ loss rises as w grows, so we step the other way.
Update:w←w−ηL′(w)=5−0.1(4.5)=5−0.45=4.55.
We moved toward smaller loss by stepping opposite the gradient, because −∇L is steepest descent.
Use Duf=∥∇f∥cosθ with ∥∇f∥=36+64=100=10.
(a) Max at cosθ=1 (θ=0, step aligned with gradient): u=(6,8)/10=(0.6,0.8), value =+10.
(b) Min at cosθ=−1 (θ=180∘, step opposite): u=(−0.6,−0.8), value =−10. This is the descent direction.
(c) Zero at cosθ=0 (θ=90∘, step perpendicular): u=(0.8,−0.6)or(−0.8,0.6), value =0 — both run along the contour.
Notice the two contour directions in (c): perpendicularity has two solutions (forward and backward along the contour), and both give zero.
Recall Solution 3.2
Dotting the gradient with an axis unit vector just reads off a component:
∇f⋅(1,0)=fx=5 and ∇f⋅(0,1)=fy=12.
So ∇f(a)=(5,12), and the steepest slope is
∥∇f∥=52+122=25+144=169=13.
The directional derivatives along the axes are literally the partial derivatives — that's why the gradient is the vector of partials.
Gradient:fx=2x+y, fy=x+4y, so ∇f(2,1)=(5,6), ∥∇f∥=25+36=61.
Half the max rate means Duf=21∥∇f∥. But Duf=∥∇f∥cosθ, so
∥∇f∥cosθ=21∥∇f∥⇒cosθ=21⇒θ=60∘.
The rate depends only on the angle, not on where you stand — a clean payoff of ∥∇f∥cosθ.
One valid direction: rotate the unit gradient g^=(5,6)/61 by 60∘. Using the 2-D rotation of g^=(cosα,sinα) by 60∘: any u with u⋅g^=cos60∘=0.5 works. (A second valid answer exists by rotating −60∘.)
Recall Solution 4.2
Parametrise a path x(t) that stays on the contour, and let h(t)=f(x(t)) be the height along it. By the Chain rule,
h′(t)=∑i∂xi∂fdtdxi=∇f⋅x′(t).
On a contour the tangent x′(t) is perpendicular to ∇f (that's what "along the contour" means), so the dot product is 0. Hence h′(t)=0 everywhere on the path ⇒h is constant ⇒f never changes. This is exactly the statement "∇f⊥ contour" turned into a derivative fact.
Gradient:∇f=(2x,2y).
At (3,4):∇f=(6,8), ∥∇f∥=10, steepest-ascent unit direction (0.6,0.8), max slope 10. Contours are circles; the gradient points radially outward — perpendicular to the circle, as expected.
At the origin (0,0):∇f=(0,0). Now Duf=0⋅u=0 for every direction u. There is no steepest direction — the surface is momentarily flat to first order. This is a critical point (here, the minimum). The direction of steepest ascent is undefined; that's not a failure of the theory, it's the signal that gradient descent has converged (zero step). See Jacobian and Hessian for how the second-order info (the Hessian) tells minimum vs maximum vs saddle when the gradient is zero.
Recall Solution 5.2
(a) Gradient:∇L=(2w1,8w2). At (−2,1): ∇L=(−4,8).
(b) Step opposite the gradient:
w←w−η∇L=(−2,1)−0.25(−4,8)=(−2+1,1−2)=(−1,−1).(c) Loss check:L(−2,1)=4+4=8; L(−1,−1)=1+4=5. Since 5<8, the loss dropped. ✓
(d) Why not straight at (0,0)? The straight-to-minimum direction from (−2,1) is (2,−1) (normalised (0.894,−0.447)). The negative gradient is −∇L=(4,−8) (normalised (0.447,−0.894)) — it leans much harder along w2 because L is 4× steeper in w2 (the 4w22 term). Steepest descent chases steepness, not the shortest route home. On stretched (ill-conditioned) bowls this causes the zig-zag that motivates momentum and preconditioning.
L1 tested recognising gradient-as-vector and the contour-perpendicularity fact.
L2 tested the compute pipeline: partials → evaluate → normalise → dot.
L3 tested reasoning through ∥∇f∥cosθ (max/min/zero, two perpendicular solutions).
L4 tested combining rate control via angle and proving the contour fact with the chain rule.
L5 tested the degenerate zero-gradient case, a full sign audit, and minimum-vs-saddle nuance.