M1-024M1: Mathematics & Statistics FundamentalsCalculus & Taylor ExpansionMedium
⚡Flashcard Drill➔Mastery:

Explain the Method of Lagrange Multipliers and How It Transforms Constrained Optimization into Unconstrained Optimization

📐 Mathematical Definition
L(x,λ)=f(x)+λg(x),∇f+λ∇g=0\mathcal L(x,\lambda)=f(x)+\lambda g(x),\qquad \nabla f+\lambda\nabla g=0
⚡ One-Sentence Core Answer
Lagrange multipliers incorporate constraints into the objective scaled by λ\lambda; at optimality, the objective gradient is collinear with constraint gradients, eliminating directional descent along the constraint manifold.

📌 Key Takeaways

  • •
    Geometric condition: At the constrained optimum x∗x^*, ∇f(x∗)=−∑iλi∇gi(x∗)\nabla f(x^*) = -\sum_i \lambda_i \nabla g_i(x^*), meaning no descent direction remains within the tangent space.
  • •
    Lagrangian function: L(x,λ)=f(x)+∑iλigi(x)\mathcal{L}(x, \lambda) = f(x) + \sum_i \lambda_i g_i(x); setting ∇x,λL=0\nabla_{x, \lambda} \mathcal{L} = 0 reproduces the optimality and constraint equations.
  • •
    Shadow price: The optimal multiplier λi∗=∂f∗∂ci\lambda_i^* = \frac{\partial f^*}{\partial c_i} quantifies the rate of improvement in objective value per unit relaxation of constraint gi(x)≤cig_i(x) \le c_i.

📐 Mathematical Derivations

Consider minimizing f(x)f(x) subject to equality constraint g(x)=0g(x) = 0. The tangent space of the constraint manifold at xx is Tx={v:∇g(x)Tv=0}T_x = \{v : \nabla g(x)^T v = 0\}. Any feasible perturbation along the manifold must satisfy v∈Txv \in T_x. If ∇f(x)Tv≠0\nabla f(x)^T v \ne 0, ff can be decreased while remaining on g(x)=0g(x)=0. Thus, optimality strictly requires ∇f(x)⊥Tx\nabla f(x) \perp T_x. Since ∇g(x)\nabla g(x) spans the normal space to the constraint surface, ∇f(x)\nabla f(x) must be collinear with ∇g(x)\nabla g(x): ∇f(x)+λ∇g(x)=0\nabla f(x) + \lambda \nabla g(x) = 0. Defining L(x,λ)=f(x)+λg(x)\mathcal{L}(x, \lambda) = f(x) + \lambda g(x), the stationary conditions ∇xL=∇f(x)+λ∇g(x)=0\nabla_x \mathcal{L} = \nabla f(x) + \lambda \nabla g(x) = 0 and ∇λL=g(x)=0\nabla_\lambda \mathcal{L} = g(x) = 0 transform the nn-variable constrained problem into an (n+m)(n+m)-variable unconstrained root-finding system.

🏭 Production Trade-offs

Engineering implications: (1) Shadow price $\lambda^*$: In ad auctions and cloud scheduling, λ∗\lambda^* represents the marginal value of budget or compute capacity. If relaxing a budget constraint by 1yields1 yields\Delta \text{Revenue} = \lambda^* > 1,budgetshouldbeincreased.(2)<strong>AugmentedLagrangianMethods(ALM)</strong>:Addquadraticpenalties, budget should be increased. (2) <strong>Augmented Lagrangian Methods (ALM)</strong>: Add quadratic penalties\frac{\rho}{2}\|g(x)\|^2$ to convexify non-convex constraints, accelerating numerical convergence in modern solvers.
⚠️ Common Interview Pitfalls
  • ✕
    Forgetting constraint qualification conditions (e.g. LICQ): if ∇g(x∗)=0\nabla g(x^*) = 0, the Lagrange multiplier formulation fails.
  • ✕
    Assuming the saddle point (x∗,λ∗)(x^*, \lambda^*) of L\mathcal{L} is a local minimum of L\mathcal{L} in both variables (it is a min in xx but max in λ\lambda).
🎯 Interviewer Follow-up Inquiries
  • ?
    How does the method of Lagrange multipliers extend to inequality constraints via the KKT conditions?
  • ?
    Why is the Lagrangian dual function g(λ)=inf⁡xL(x,λ)g(\lambda) = \inf_x \mathcal{L}(x, \lambda) always concave, even when f(x)f(x) is non-convex?
⚡
Test muscle memory on this topic via 3-Layer Flashcards
Active Recall: Mentally formulate Prompt ➔ Math Derivation ➔ Benchmark Implementation in 3 minutes.
🎯 Drill This Card Now➔
📚

Associated Knowledge Base Guides & Mindmaps

Explore the comprehensive technical article, exam cards, and global architecture tree.

← PreviousM1-023: Define the Jacobian Matrix and Vector-Jacobian Product (VJP), and Explain Why ML Frameworks Rely on VJP📋Back to BankNext →M1-025: Explain Second-Order Sufficient Conditions and Saddle Points, and Why Deep Learning Escapes Saddle Points
中文速览与面试要点

解释拉格朗日乘子法,说明它如何把约束优化转为无约束。

把约束乘上 λ 加入目标;最优解处目标梯度与约束梯度共线。

核心要点

  • 拉格朗日乘子法的几何直觉:在约束曲面 g(x)=0 上移动时,若目标 f 的梯度 ∇f 与约束的梯度 ∇g 不平行 ,则 ∇f 必有一个沿约束曲面的切向分量,说明还能沿该方向继续下降 f——故极值点处必须有 ∇f=−λ∇g,即两者共线。构造拉格朗日函数 L(x,λ)=f(x)+λg(x) 后,对其求无约束驻点(∂L/∂x=0 给出 ∇f+λ∇g=0,∂L/∂λ=0 给出 g(x)=0)即同时满足最优性与可行性。多个等式约束时用向量乘子:L=f+Σᵢλᵢgᵢ,最优性条件为 ∇f=−Σᵢλᵢ∇gᵢ,即 ∇f 落在约束梯度的张成空间中。
  • 工程含义:① λ 是影子价格 ——λ* 表示'若把约束放松一个单位,最优值能改善多少'(∂f*/∂c=λ*),这在资源分配、预算约束、SVM 的对偶中都有直接解释:SVM 中 λᵢ>0 的样本正是 支持向量 ,λᵢ=0 的样本不影响决策边界(KKT 互补松弛);② 对偶问题 ——拉格朗日函数关于 x 取最小、关于 λ 取最大,得到对偶问题,其最优值给出原问题的下界(弱对偶),凸问题下相等(强对偶,Slater 条件保证),对偶常把难解的原问题转为更易解的形式(SVM 的对偶形式使核技巧成为可能);③ 与正则化的联系 ——带约束的 min f s.t. ‖w‖≤c 等价于无约束的 min f+λ‖w‖(正则化),λ 与 c 一一对应,这就是为什么'正则化'与'约束'是同一件事的两种视角。
  • 等式约束用拉格朗日;不等式约束用 KKT
  • λ 的经济含义是'约束的影子价格'

常见陷阱

  • 认为 λ 必须为正(等式约束的 λ 可正可负,不等式约束才要求 λ≥0)
  • 混淆拉格朗日(等式约束)与 KKT(含不等式约束)