Calculus and Optimization

2 min read

Calculus studies local change; optimization uses local change to choose better parameters. The useful mental model is: derivatives describe sensitivity, Taylor expansions approximate functions locally, and optimizers use those local signals to move through a loss surface.

Core sequence:

  1. Taylor Expansion - approximates a function near a point using derivatives.
  2. Gradient - gives the direction of steepest local increase for scalar-valued functions.
  3. Chain Rule (Multivariable) - composes derivatives through nested functions.
  4. Jacobian Matrix - organizes first derivatives for vector-valued functions.
  5. Hessian Matrix - organizes second derivatives and captures local curvature.
  6. Convexity - identifies problems where local minima are global minima.
  7. Computation Graphs - represents composed functions so derivatives can be propagated mechanically.
  8. Stochastic Gradient Descent - updates parameters using noisy gradient estimates from minibatches.
  9. Momentum - smooths update directions by accumulating velocity.
  10. Adam Optimizer - adapts per-parameter learning rates using first and second moment estimates.
  11. Learning Rate Schedules - controls step size over training.

How the pieces fit:

  • Taylor expansion is the local approximation that makes gradient methods sensible.
  • Gradients, Jacobians, and Hessians expose first-order and second-order structure.
  • The chain rule and computation graphs are the basis of backpropagation.
  • Convexity gives guarantees; nonconvex neural networks rely on heuristics and scale instead.
  • SGD, momentum, Adam, and schedules are practical rules for turning derivatives into parameter updates.

Core equations to keep active:

  • First-order Taylor approximation: f(x+Δx)f(x)+f(x)Δxf(x+\Delta x) \approx f(x) + \nabla f(x)^\top \Delta x
  • Second-order Taylor approximation: f(x+Δx)f(x)+f(x)Δx+12ΔxHΔxf(x+\Delta x) \approx f(x) + \nabla f(x)^\top \Delta x + \frac{1}{2}\Delta x^\top H \Delta x
  • Gradient descent: θt+1=θtηθL(θt)\theta_{t+1} = \theta_t - \eta \nabla_\theta L(\theta_t)
  • Multivariable chain rule: Lx=Lyyx\frac{\partial L}{\partial x} = \frac{\partial L}{\partial y}\frac{\partial y}{\partial x}
  • Jacobian: Jij=fixjJ_{ij} = \frac{\partial f_i}{\partial x_j}
  • Hessian: Hij=2fxixjH_{ij} = \frac{\partial^2 f}{\partial x_i \partial x_j}
  • Convexity: f(λx+(1λ)y)λf(x)+(1λ)f(y)f(\lambda x + (1-\lambda)y) \leq \lambda f(x) + (1-\lambda)f(y)
  • Momentum: vt=βvt1+θL(θt)v_t = \beta v_{t-1} + \nabla_\theta L(\theta_t), θt+1=θtηvt\theta_{t+1} = \theta_t - \eta v_t
  • Adam update direction: θt+1=θtηm^tv^t+ϵ\theta_{t+1} = \theta_t - \eta \frac{\hat{m}_t}{\sqrt{\hat{v}_t}+\epsilon}

See also: Backpropagation, Linear Algebra

Linked from