At the optimum, ∇f = λ∇g - the gradients are parallel. λ (lambda) is the Lagrange multiplier: the rate of change of the optimal value with respect to the constraint.
Try: Place (a,b) inside the circle (r larger than distance). What happens? The constraint becomes inactive.
Lagrange Multipliers - Interactive Visualization
Lagrange multipliers solve constrained optimization: minimize f(x,y) subject to g(x,y) = 0. The key insight is that at the optimum, the gradients ∇f and ∇g must be parallel: ∇f = λ∇g. This visualization animates the search for where the objective's gradient aligns with the constraint's gradient - the Lagrange condition. This underlies SVM dual formulation and neural network pruning.
See objective contours and constraint curve on the same plot
Watch gradient arrows ∇f and ∇g become parallel at the optimum
Adjust objective center (a,b) and constraint radius r
Animate the search to the constrained optimum
Connect to SVM dual, KKT conditions, and variational problems
Part of the EngineersOfAI Interactive 3D - free interactive visualizations covering every major concept in machine learning and AI engineering. Hover any element for a plain-English explanation. No code required.