Calculus
Calculus studies how quantities change. In machine learning, calculus appears whenever a loss changes with parameters, inputs, time, noise level, or coordinates.
For a scalar function , the derivative is:
For a multivariate function , the gradient is:
The chain rule is the core of backpropagation:
See Chain rule for composition, vector-Jacobian products, and backpropagation notation.
Jacobian View
For a vector-valued function , the derivative is the Jacobian:
For a composition :
Backpropagation usually avoids materializing the full Jacobian. It propagates vector-Jacobian products:
from the output loss back toward earlier variables.
Directional Derivative
The directional derivative of at in direction is:
This explains why the gradient gives the steepest local increase under an direction constraint:
The maximizing direction is when the gradient is nonzero.
Second-order information describes curvature. For a scalar loss , this is captured by the Hessian:
See Jacobian and Hessian for vector-valued derivatives, curvature, and Jacobian/Hessian products.
For a small perturbation , a second-order approximation is:
This is the local picture behind curvature, Newton-style updates, sharpness analysis, and some stability arguments.
Gradient Descent Connection
For parameters and loss , the simplest update is:
where is the learning rate. In stochastic training, the full gradient is replaced by an estimate from a mini-batch:
The math note defines the derivative object. Optimizer behavior belongs in Optimization and Optimizer.
Key Ideas
- Derivatives describe local sensitivity.
- Gradients point in the direction of steepest local increase for scalar functions.
- Optimization usually moves against the gradient of a loss.
- Chain rules compose derivatives across layers, time steps, or computational graphs.
- Continuous-time models, diffusion, flow matching, and dynamics use derivatives with respect to time or noise level.
Practical Checks
- Is the function scalar-valued or vector-valued?
- Are derivatives taken with respect to inputs, parameters, time, or coordinates?
- Is the gradient used for optimization, sensitivity analysis, or dynamics?
- Does the implementation compute exact gradients, approximate finite differences, or stopped gradients?
- Is the code using gradients, Jacobian-vector products, vector-Jacobian products, or Hessian-vector products?
- Does the notation distinguish population loss, mini-batch loss, and single-example loss?