§ Gradients · Interactive Graduate Primer
Tensor by Tensor · expanded

Steepest ascent

Learn how changing several inputs changes one output. Begin with partial derivatives, then explore gradient descent, backpropagation, and optimizers. The later sections include proofs and deeper mathematical detail.
A first reading path

Start with sections 2–4, then section 7. Return to the directional-derivative proof after you understand a gradient-descent update. An optimizer is a rule for updating the model’s adjustable numbers.

For L(a, b) = a² + 2b², the gradient at (1, 2) is [2, 8]. The first entry measures change along a while b stays fixed. The second measures change along b while a stays fixed. With step size 0.1, subtract [0.2, 0.8] to reach (0.8, 1.2). The loss falls from 9 to 3.52.

Check: why subtract the gradient?

The gradient points toward the steepest local increase under the usual Euclidean length measure. Subtracting it moves toward a local decrease when the step is small enough. A large step can still overshoot and increase the loss.

6. Steepest Ascent — A Proof

Introduction

For gradient 4, 3, no unit direction can produce a directional rate above 5. The Cauchy-Schwarz inequality proves this exact bound and shows exactly when the bound is reached.

Learning goal

Prove why the gradient gives the steepest-ascent direction and connect that result to level-set geometry.

Before you start

Directional derivatives, dot products, unit vectors, vector length, and inequalities.

Lesson plan

  1. Express every directional rate as the gradient's dot product with a unit vector.
  2. Apply Cauchy-Schwarz and identify the equality condition that reaches the bound.
  3. Use the result to explain why gradients meet level sets at right angles.

Before the proof, predict the result: among unit-length directions, the gradient direction should give the largest local increase. The proof turns this claim into a dot-product bound. Equality identifies when the bound is reached.

Theorem

Among all unit vectors $u$, $D_u f(x) = \langle \nabla f(x), u\rangle$ is maximised at $u^\star = \nabla f(x)/\|\nabla f(x)\|$, with value $\|\nabla f(x)\|$. Symmetrically, steepest descent is $-u^\star$.

Proof

By Cauchy–Schwarz, $\langle \nabla f,u\rangle \le \|\nabla f\|\|u\| = \|\nabla f\|$ since $\|u\|=1$. Equality holds iff $u\parallel\nabla f$ and is a positive multiple, which forces $u = \nabla f/\|\nabla f\|$. $\square$

Corollary: orthogonality to level sets

If $\gamma(t)$ lies in $\{x: f(x)=c\}$, then $f(\gamma(t))=c$ for all $t$. Differentiating: $0 = \langle \nabla f(\gamma(t)), \gamma'(t)\rangle$. So $\nabla f$ is orthogonal to every tangent vector of the level set.