Math Bytes · Multivariable calculus · Episode 6 · Applications of multivariable derivatives
Lagrange multipliers
To find the biggest or smallest value of f(x, y) while following a rule g(x, y) = c, look where a contour of f just touches the constraint curve. There the gradients line up, ∇f = λ∇g, and λ is the Lagrange multiplier. For f = xy with x + y = 10, this gives x = y = 5 and a biggest product of 25.
The best answer that follows a rule
Say you want to make f(x, y) = xy as big as possible, but x + y must equal 10. That rule is a constraint: you are not free to pick any point, only points on the line x + y = 10.
Draw the contour map of xy (lesson 2's level curves). The rule is a straight line across it. Walk along the line and you cross higher and higher contours, until you reach one that the line only just touches (it is tangent there) and never crosses. That is the best spot on the line.
Why the gradients line up
The gradient (lesson 4) is always perpendicular to the contour through that point. At the touching spot, the contour of f and the constraint line run in the same direction, so their perpendiculars line up too:
∇f = λ∇g
One gradient is a multiple of the other, and that multiple λ is the Lagrange multiplier. Solve this together with the rule g(x, y) = c. (The method needs ∇g ≠ 0 at the point.)
Worked example: biggest xy with x + y = 10
- The gradients:
∇(xy) = (y, x)(holdystill to get∂/∂x, holdxstill to get∂/∂y). The rule's gradient is∇(x + y) = (1, 1). - Line them up:
(y, x) = λ(1, 1)splits intoy = λandx = λ, sox = y. - Use the rule:
x + y = 10withx = ygivesx = y = 5. - The best value:
5 · 5 = 25. (Hereλ = 5.)
Is it really a maximum? The method finds candidates. On the line, xy = x(10 − x), a downward parabola, so (5, 5) is its top, and there is no smallest value on the whole line.
Try it yourself
- If
x + y = 8, what's the biggest value ofxy? - If
x + 2y = 8, what's the biggest value ofxy?
(Answers: 1. (y, x) = λ(1, 1) gives x = y = 4, so the biggest xy is 16. 2. (y, x) = λ(1, 2) gives y = λ and x = 2λ, so x = 2y; then 4y = 8, y = 2, x = 4, and the biggest xy is 8.)
Good to know
- "Just touches" means tangent: the contour of
fand the constraint curve share a direction at that point. - The same equations find constrained minimums too; you check which candidate is which.
λis read "lambda". It also measures how fast the best value changes if you loosen the rule a little.- The contour map in the video is a sketch of
xyin the first quadrant.
Answer to the comment question
If x + y = 12, what's the biggest value of xy? 36. The gradients give (y, x) = λ(1, 1), so x = y. Then x + y = 12 makes x = y = 6, and 6 · 6 = 36. On the line, xy = x(12 − x) is a downward parabola, so this is its maximum.
Test your knowledge
Quick quiz: Lagrange multipliers
4 multiple-choice questions. Pick one answer for each, then check how you did.
Sources
- OpenStax, "Calculus Volume 3, 4.8 Lagrange Multipliers": solve ∇f = λ∇g with the constraint; level curve tangent to the constraint at the optimum
- Wolfram MathWorld, "Lagrange Multiplier": the multiplier λ and the parallel-gradient condition
- MIT OpenCourseWare, "18.02 Multivariable Calculus (Fall 2007)": lecture notes
Video transcript
How do you find the best answer when you have to follow a rule?
Make x times y as big as possible, but x plus y must equal ten. That's a constraint.
On a contour map, the rule is a line. The best spot is where a contour just touches that line.
There, the two gradients line up: one is a multiple of the other, by a number called lambda. That number is a Lagrange multiplier.
The gradient of x y is y, x. The rule's gradient is one, one.
So y and x both equal lambda. They're equal, each is five, and the biggest product is twenty-five.
Your turn. If x plus y equals twelve, what's the biggest x times y? Comment your answer below!
That's your byte.
More from Multivariable calculus
- Multivariable calculus EP2Contour maps
- Multivariable calculus EP3Partial derivatives
- Multivariable calculus EP4The gradient
- Multivariable calculus EP8The big three theorems