Skip to main content

TL;DR

Lagrange Multipliers: Optimize f(x,y) subject to g(x,y)=0 by solving grad(f) = lambda * grad(g). This concept is essential for quantitative trading interviews and is frequently tested at top firms.

By Valenke Exam Prep Team·Last updated 2026-06-01
Analysis

Lagrange Multipliers

Optimize f(x,y) subject to g(x,y)=0 by solving grad(f) = lambda * grad(g).

Lagrange multipliers find the extrema of a function f(x)f(\mathbf{x}) subject to a constraint g(x)=0g(\mathbf{x}) = 0: f=λg\nabla f = \lambda \nabla g Solve this system along with g(x)=0g(\mathbf{x}) = 0 to find the optimal point(s) and the multiplier λ\lambda. Intuition: At a constrained optimum, the gradient of ff must be parallel to the gradient of gg. Why? If they weren't parallel, you could move along the constraint surface in a direction that increases ff — meaning you haven't found the optimum yet. The condition f=λg\nabla f = \lambda \nabla g says exactly "the only way to increase ff is to violate the constraint." f = max g = 0 optimum nabla f nabla g At optimum: gradients are parallel Concrete example: Maximize f(x,y)=xyf(x,y) = xy subject to x+y=10x + y = 10. Set g(x,y)=x+y10=0g(x,y) = x + y - 10 = 0. Then f=(y,x)\nabla f = (y, x) and g=(1,1)\nabla g = (1, 1). System: y=λ, x=λ, x+y=10y = \lambda,\ x = \lambda,\ x + y = 10. Solution: x=y=5x = y = 5, λ=5\lambda = 5, maximum f=25f = 25. The multiplier λ\lambda has meaning: It measures the sensitivity of the optimum to the constraint. If the constraint were x+y=10+ϵx + y = 10 + \epsilon, the optimal value would increase by approximately λϵ=5ϵ\lambda \cdot \epsilon = 5\epsilon. This is the "shadow price" in economics. When to use: Constrained optimization in portfolio theory (maximize return subject to risk budget), entropy maximization, and any "optimize subject to" problem. In interviews: "maximize/minimize X given that Y is fixed." Alternative approach: For simple two-variable problems, you can substitute the constraint directly (set y=10xy = 10 - x and optimize f(x)=x(10x)f(x) = x(10-x)). Lagrange multipliers scale to higher dimensions and multiple constraints where substitution becomes unwieldy.

Ready to practice for the Valenke Finance Exam?

Adaptive practice powered by Item Response Theory targets your weak areas. Start with 3 free sessions.

Start free practice →