Optimisation in Many Variables
Finding the highest and lowest points of a function of several variables: where the gradient is zero, sorted by the Hessian.
Needs a step first: 11
At a smooth minimum or maximum every partial derivative is zero, so the candidates are the solutions of . The matrix of second derivatives, the Hessian, then tells them apart: positive curvature in every direction is a minimum, negative in every direction a maximum, and mixed signs a saddle, which goes up one way and down another. In many dimensions saddles are far more common than minima. Training a model is minimising a loss in millions of variables, which is why gradient descent and convexity come next.
Where it shows up: Gradient descent, Lagrange multipliers and every model's training loop are ways of solving when it can't be done by hand.
How to hold it: In your head
See critical points as where the gradient vanishes, and read the Hessian's eigenvalues as curvature: all positive a minimum, all negative a maximum, mixed a saddle.
What knowing it looks like
- Find all critical points of a two-variable function by solving .
- Classify each as a minimum, maximum or saddle from the Hessian's determinant and trace, or its eigenvalues.
- Sketch the contour lines near a saddle point.
Test yourself
Find and classify all critical points of , and give the value of at each.
Show the worked answer
Needs a step first: 11
Learn it with an AI
Copy this prompt into any AI assistant. It will take you through step by step at your level and finish with the test above.
Be my maths tutor. I'm learning "Optimisation in Many Variables" (Undergraduate I tier): Finding the highest and lowest points of a function of several variables: where the gradient is zero, sorted by the Hessian. I already know: Partial Derivatives and the Gradient, Rates of Change and Extremes. Teach it Socratically: first ask what I already know; then explain the core idea with one concrete example and why it's true; then give me three problems, one at a time, easy to hard. Wait for my answer, check every step, and point out mistakes without giving the answer away. Finish by testing me with this: Find and classify all critical points of $f(x, y) = x^3 - 3x + y^2$, and give the value of $f$ at each. Use LaTeX for formulas. When you say where it's used later (machine learning, quantum mechanics), be specific.
Needs first
- Partial Derivatives and the GradientDerivatives of a function of several variables, taken one variable at a time, and the gradient vector that collects them.Undergraduate I · Multivariable & Vector Calculus
- Rates of Change and ExtremesUsing derivatives to find where a function is largest or smallest, how fast linked quantities change, and the shape of a graph.Core · Functions & Calculus
Leads to
- Gradient DescentRepeatedly stepping against the gradient, , to walk downhill towards a minimum.Undergraduate I · Optimisation & Information
- ConvexityA function is convex if the chord between any two points on its graph lies above it; then every local minimum is global.Undergraduate II · Optimisation & Information
- Lagrange MultipliersOptimising under a constraint: at the best point, the gradient of the function is a multiple of the constraint's gradient.Undergraduate II · Optimisation & Information
On the way to
Recommended
- Mathematics for Machine LearningDeisenroth, Faisal and Ong (Cambridge University Press) · BookA free book that gathers exactly the linear algebra, vector calculus, probability and optimisation machine learning uses, then applies them to regression, PCA and classification.
- Convex OptimizationStephen Boyd and Lieven Vandenberghe · BookThe standard text on convex sets, duality and Lagrange multipliers, free as a PDF from Stanford along with lecture slides and exercises.
- Information Theory, Inference, and Learning AlgorithmsDavid MacKay · BookMacKay's book connecting entropy, coding, Bayesian inference and neural networks, free to read online and still the one recommended for information theory with intuition.