Watch on Instagram

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.

Posted · About a 1 minute watch, 3 minute read · Take the quiz

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

  1. The gradients: ∇(xy) = (y, x) (hold y still to get ∂/∂x, hold x still to get ∂/∂y). The rule's gradient is ∇(x + y) = (1, 1).
  2. Line them up: (y, x) = λ(1, 1) splits into y = λ and x = λ, so x = y.
  3. Use the rule: x + y = 10 with x = y gives x = y = 5.
  4. 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

  1. If x + y = 8, what's the biggest value of xy?
  2. If x + 2y = 8, what's the biggest value of xy?

(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 f and 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 xy in 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.

1What does the method of Lagrange multipliers solve?
2At the best spot on the constraint, what happens on the contour map?
3Which equation do you solve with the rule?
4For f = xy with x + y = 10, what is the biggest value of xy?

Sources

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

All Multivariable calculus lessons