1.4 Basic Vector Calculus

DATA 442/642 · Week 1 · PDF · Slides

Gradients, Jacobians, and Hessians in the notation this course uses.

These notes walk through the lecture slides. The original deck is unchanged; use (slides) on the course hub if you want that PDF.

Notation follows Deisenroth, Faisal, and Ong, Mathematics for Machine Learning.

1. Gradient

The gradient is the derivative for several variables. Vary one coordinate of θ, hold the others. Those partial derivatives, stacked, are the gradient.

For J(θ):ℝl→ℝ,

∂J∂θi,i=1,…,l.

This course writes the collection as a row

∇J=[∂J∂θ1∂J∂θ2⋯∂J∂θl]∈ℝ1×l.

Some books write a column. Be consistent inside one derivation. Descent updates look like θ←θ−α(∇J)⊤ if ∇J is a row.


2. Chain rule

Let J:ℝ2→ℝ depend on θ1(t) and θ2(t). The derivative of J with respect to t is

dJdt=[∂J∂θ1∂J∂θ2][∂θ1/∂t∂θ2/∂t]=∂J∂θ1dθ1dt+∂J∂θ2dθ2dt.

That is a gradient times a Jacobian. Back-propagation (Module 6) is this rule applied to a long composition. You do not need the neural-net story yet. You do need to be willing to write the product.


3. Hessian

If J(θ1,θ2) is twice differentiable, the Hessian is

∇2J=[∂2J/∂θ12∂2J/∂θ1∂θ2∂2J/∂θ2∂θ1∂2J/∂θ22].

The mixed partials match (Schwarz), so the Hessian is symmetric. It measures curvature of J around a point.

At a critical point ∇J=0:

  • ∇2J positive definite ⇒ local minimum;
  • negative definite ⇒ local maximum;
  • indefinite ⇒ saddle.

Newton’s method (Week 2) solves a linear system with this matrix every step. Eigenvalues of ∇2J are why a long thin valley makes steepest descent zigzag.


4. Practice

  1. If a book prints ∇J as a column, how does the descent update θ←θ−α∇J change compared with the row convention in these slides?

  2. In the chain rule, which factor is “how J depends on θ” and which is “how θ depends on t”?

  3. Why does a symmetric Hessian with one positive and one negative eigenvalue make a critical point a saddle, not a min?