Calculus & Optimization
Gradients, Lagrangians, convexity — how robots decide.
Why it matters in robotics
Almost every decision a robot makes — a trajectory, a grasp, a control input, a sensor-fusion estimate — is the solution to an optimization problem: an objective to minimize subject to constraints. There are principled ways to handle those constraints directly, to tell whether a problem can be solved reliably or gets trapped in a bad partial answer, and to follow the slope of a function step by step toward the best solution. Turning a planning or control idea into a solvable formulation, and knowing which methods will actually converge, is the daily work of robotics.
What to study
- ✓Gradients, Jacobians, and Hessians; gradient descent and its convergence behavior (step size, conditioning, local vs. global minima)
- ✓Constrained optimization: Lagrange multipliers, the Lagrangian, and KKT conditions for equality/inequality constraints
- ✓Convexity: convex sets and functions, why convex problems have a global optimum, and recognizing LP/QP/SOCP/SDP standard forms
- ✓Applying it in robotics: formulating trajectory optimization and convex MPC, and solving problems with tools like CVXPY
Where to study
Cheatsheet
Symbols used below
Gradient descent
Steps downhill along the steepest local descent direction. On an ill-conditioned (elongated) cost surface it zig-zags, since it ignores curvature — convergence needs small enough to not overshoot.
Newton's method
Rescales the step by the inverse Hessian, so it accounts for curvature and heads more directly at the minimum — far fewer iterations near a well-behaved optimum, but each step costs more (Hessian build + solve).
Lagrangian & KKT conditions
For s.t. , :
At an optimum: (stationarity), , (feasibility), (dual feasibility), and (complementary slackness — a constraint is either active or its multiplier is zero).
Convexity
A function is convex if the line segment between any two points on its graph lies on or above the graph — equivalently everywhere.
For a convex problem (convex objective, convex feasible set) any local minimum is the global minimum — this is why casting a problem as LP/QP/SOCP/SDP is so valuable: solvers can certify the global optimum.
Saddle points stall first-order methods
Near a saddle the gradient nearly vanishes even though it isn't a minimum — gradient descent crawls through these flat regions. Second-order methods see the mixed curvature (positive in some directions, negative in others) and escape faster.
| Gradient descent | Newton's method | |
|---|---|---|
| Uses | Gradient only | Gradient + Hessian |
| Cost per step | Cheap: one gradient eval | Expensive: build + solve/invert Hessian |
| Convergence near optimum | Linear, sensitive to conditioning | Quadratic — very fast |
| Behavior on ill-conditioned surfaces | Zig-zags | Rescales by curvature, heads straight in |