Lecture 23: The Lagrangian and method of Lagrange multipliers
Overview
Burton Ma develops the Lagrange multiplier method for equality-constrained optimization: form the Lagrangian, set its gradients with respect to the decision variables and multipliers to zero, then solve the resulting equations. Examples range from projecting onto a line and minimizing Mahalanobis distance with MATLAB to quadratic objectives with linear constraints, multiple equality constraints, and the KKT system.
Key takeaways
- For an equality constraint h(w) = 0, differentiating L(w, μ) = f(w) + μh(w) with respect to μ enforces h(w) = 0, while the w-gradient supplies the stationarity condition.
- A Lagrange multiplier solution is a stationary candidate, not automatically a global minimum; when several real solutions exist, compare their objective values, as in the shifted-parabola example.
- A symmetric quadratic objective and linear equality constraints produce a linear KKT system that can be solved with standard linear algebra.
- With multiple equality constraints, the objective gradient must lie in the span of all constraint gradients, represented by a separate multiplier for each constraint.
- MATLAB symbolic differentiation and vpasolve provide a practical approach for nonlinear Lagrange systems, including the Mahalanobis-distance example with a parabolic constraint.
Chapters
- For an equality constraint h(w) = 0 and objective f(w), define L(w, μ) = f(w) + μh(w).
- Set the gradients of L with respect to w and μ to zero; the μ derivative reproduces the constraint.
- One constraint adds one multiplier and one equation, producing a generally nonlinear system with one more unknown than the dimension of w.
- The objective is squared distance from a point w₀ to a variable point w on a line, with the line represented by an implicit linear equation.
- Expanding (w − w₀)ᵀ(w − w₀) gives the gradient 2(w − w₀); differentiating the constraint term adds its normal vector scaled by μ.
- Solving the resulting 3-by-3 linear system gives w = (0, 2) and μ = −3, recovering the line-distance minimizer.
- The objective is a quadratic form wᵀKw, where K is the inverse covariance matrix used in the Mahalanobis distance.
- The constraint describes a parabola, so its nonlinear equation makes the stationarity system nonlinear even though the objective is quadratic.
- The gradient of the quadratic term is 2Kw when K is symmetric, while differentiating L with respect to μ returns the parabola equation.
- Burton Ma constructs the rotated covariance matrix and defines w1, w2, and μ as symbolic variables in MATLAB.
- MATLAB's symbolic diff function computes the three partial derivatives of the Lagrangian, and vpasolve numerically solves them when an analytic solution is impractical.
- The initial parabola example produces three algebraic solutions, two complex and one real; the real solution matches the earlier Mahalanobis-distance result to four decimal places.
- Shifting the parabola changes the constraint while leaving the Mahalanobis objective unchanged, creating three real stationary points.
- Each candidate satisfies the Lagrange stationarity equations, but stationarity alone does not identify the minimum.
- Evaluating the objective at the candidates gives approximately 0.06, 1.3, and 2.3; the point near (−0.66, −0.3) is the minimizer.
- A quadratic objective has the form wᵀKw + qᵀw + c, with symmetric K; a linear constraint has the form mᵀw + d = 0.
- Differentiating the Lagrangian gives linear stationarity equations because both the objective gradient and constraint gradient are linear or constant in w.
- Combining stationarity with the constraint yields a block linear system, called the KKT equations; its block coefficient matrix is the KKT matrix.
- The line-to-point distance example is a special case: identifying K, q, m, and d lets the same KKT system reproduce its solution.
- With two independent line constraints in two dimensions, the feasible set can be their single intersection point, which is both the constrained minimum and maximum.
- At that intersection, the objective gradient need not be parallel to either individual constraint gradient.
- Instead, the objective gradient lies in the span of the constraint gradients; introduce one multiplier for each constraint and sum their multiplier-weighted terms in the Lagrangian.
- For an m-dimensional decision vector and n equality constraints, stationarity produces a system with m + n equations and corresponding unknowns.
- The example seeks a point that minimizes the sum of its squared perpendicular distances to the three lines forming a triangle.
- Burton Ma represents the closest point on each line separately, uses three line equations as equality constraints, and assigns multipliers μa, μb, and μc.
- MATLAB symbolically differentiates the Lagrangian and solves a 15-variable system; the resulting point is shown in the triangle diagram.
- For multiple linear constraints, stack their coefficient vectors into a matrix M and their constants into a vector d.
- The quadratic-objective KKT system generalizes by replacing the single constraint vector with M, allowing several linear equalities to be solved together.
- The core workflow remains consistent: form the Lagrangian, compute gradients, set them to zero, and solve; nonlinear systems may require numerical tools, while exam problems are expected to stay small.
Transcript excerpt
0:03 All right. In the last lecture, we were looking at the method of lrangee multipliers for solving um optimization problems uh that are constrained using an equality constraint. Uh so remember this thing h is one of our con is our constraint function. So h of w equals 0 is the form of our constraint function. f is our is our objective function. Um and at the end of the last class we uh ended up uh looking at this equation here. So this is called the lrronian or the lrangee function. Uh it's just the objective function plus mu time h of w. Uh and the claim is that if you uh to find uh the minimizer of f that satisfies the constraint h you can
0:52 find the stationary points of l. So take the gradient with respect to w and mu in this case. Um so you need to take the gradient with respect to both of these uh variables. Um and then uh solve set the gradient equal to zero and then solve the system of equations that arises. Um and so the problem that occurs is that uh you end up with a system of equations here. So you end up with n equations for the w. So w1, w2, w3 and so on. you'll end up with n uh equations for those uh and you'll end up with one more for the mu. Uh so you end up with a system of n plus one equations that you now have to solve and the system is in general not linear uh and so it becomes very difficult to solve. Uh so the basic idea is take your
1:41 function L take its gradient with respect to uh w set that to zero. Take your function L, take its gradient with
This is the start of the transcript. Save this video free for the whole transcript, searchable and time-coded.
In this course
Related notes
Summary, takeaways, and chapters were generated by AI from the video's transcript and may contain errors. The video belongs to its creator, Burton Ma.