myLearning

Topic 3 of 7

Step 18 · Multivariable calculus topics

Find the largest or smallest value of a function when the variables must satisfy a constraint, using the fact that the gradients line up at the best point.

Constrained optimization

Often you want the best value of f(x, y) along a curve g(x, y) = c: the most area for a fixed perimeter, the least cost for a fixed output. The free critical points of f usually do not lie on the curve, so you need a different condition.

Example: By substitution

Maximize f(x, y) = xy subject to x + y = 10.

  1. The constraint gives y = 10 − x, so f = 10x − x².
  2. Its derivative, 10 − 2x, is 0 at x = 5.

Answer25, at (5, 5)

The Lagrange condition

Walk along the constraint curve. At a highest or lowest point of f, the curve just touches a level curve of f without crossing it. There the two curves share a tangent line, so their gradients are parallel.

∇f=λ∇gg(x,y)=c\nabla f = \lambda \nabla g \qquad g(x, y) = c
The line x + y = 10 crosses the level curves xy = 9 and xy = 16, but only touches xy = 25, at (5, 5). That touching point is the maximum.

Example: The same problem

Use Lagrange multipliers to maximize xy subject to x + y = 10.

  1. ∇f = ⟨y, x⟩ and ∇g = ⟨1, 1⟩, so y = λ and x = λ.
  2. So x = y, and x + y = 10 gives x = y = 5.

Answer25 at (5, 5), with λ = 5

Solving Lagrange problems

  • Write ∇f = λ∇g as one equation for each variable.
  • Add the constraint g = c.
  • Solve the system, often by getting rid of λ first.
  • Evaluate f at every solution and compare.

Example: On a circle

Find the largest and smallest values of f(x, y) = x + 2y on the circle x² + y² = 5.

  1. 1 = 2λx and 2 = 2λy, so y = 2x.
  2. x² + 4x² = 5 gives x = ±1, so the points are (1, 2) and (−1, −2).
  3. f(1, 2) = 5 and f(−1, −2) = −5.

AnswerLargest 5, smallest −5

Example: A box

A closed box must hold 8 m³. What dimensions use the least material?

  1. Minimize 2(xy + yz + zx) with xyz = 8.
  2. The Lagrange equations treat x, y and z alike, giving x = y = z.
  3. So each side is 2.

AnswerA cube with 2 m sides, using 24 m² of material

Try it yourself

Work each one on paper first, then open the answer to check.

  1. Maximize xy subject to x + y = 20.

    Show answer

    100, at (10, 10)

  2. Minimize x² + y² subject to x + y = 4.

    Show answer

    8, at (2, 2)

  3. Write the Lagrange equations for f = x²y with x + y = 3.

    Show answer

    2xy = λ, x² = λ and x + y = 3

  4. Find the largest value of x + y on the circle x² + y² = 2.

    Show answer

    2, at (1, 1)

  5. At the best point, how are ∇f and ∇g related?

    Show answer

    They are parallel: ∇f = λ∇g

  6. A rectangle has perimeter 40. What is its largest area?

    Show answer

    100

What next?