Lesson 17: The Method of Lagrange Multipliers

Post on 25-May-2015

30.956 views 7 download

Tags:

description

The Method of Lagrange multipliers allows us to find constrained extrema. It's more equations, more variables, but less algebra.

Transcript of Lesson 17: The Method of Lagrange Multipliers

. . . . . .

Section 11.8Lagrange Multipliers

Math 21a

March 14, 2008

Announcements

◮ Midterm is graded◮ Office hours Tuesday, Wednesday 2–4pm SC 323◮ Problem Sessions: Mon, 8:30; Thur, 7:30; SC 103b

..Image: Flickr user Tashland

. . . . . .

Announcements

◮ Midterm is graded◮ Office hours Tuesday, Wednesday 2–4pm SC 323◮ Problem Sessions: Mon, 8:30; Thur, 7:30; SC 103b

. . . . . .

Happy Pi Day!

3:14 PM Digit recitation contest! Recite all the digits you know of π (inorder, please). Please let us know in advance if you’ll recite π ina base other than 10 (the usual choice), 2, or 16. Only positiveinteger bases allowed – no fair to memorize π in baseπ/(π − 2)...

4 PM — Pi(e) eating contest! Cornbread are square; pie are round.You have 3 minutes and 14 seconds to stuff yourself with asmuch pie as you can. The leftovers will be weighed to calculatehow much pie you have eaten.

Contests take place in the fourth floor lounge of the MathDepartment. .

.Image: Flickr user Paul Adam Smith

. . . . . .

Outline

Introduction

The Method of Lagrange Multipliers

Examples

For those who really must know all

. . . . . .

The problem

Last time we learned how to find the critical points of a function oftwo variables: look for where ∇f = 0. That is,

∂f∂x

=∂f∂y

= 0

Then the Hessian tells us what kind of critical point it is.

Sometimes,however, we have a constraint which restricts us from choosingvariables freely:

◮ Maximize volume subject to limited material costs◮ Minimize surface area subject to fixed volume◮ Maximize utility subject to limited income

. . . . . .

The problem

Last time we learned how to find the critical points of a function oftwo variables: look for where ∇f = 0. That is,

∂f∂x

=∂f∂y

= 0

Then the Hessian tells us what kind of critical point it is. Sometimes,however, we have a constraint which restricts us from choosingvariables freely:

◮ Maximize volume subject to limited material costs◮ Minimize surface area subject to fixed volume◮ Maximize utility subject to limited income

. . . . . .

ExampleMaximize the function

f(x, y) =√

xy

subject to the constraint

g(x, y) = 20x + 10y = 200.

. . . . . .

Maximize the function f(x, y) =√

xy subject to the constraint20x + 10y = 200.

SolutionSolve the constraint for y and make f a single-variable function:2x + y = 20, so y = 20 − 2x. Thus

f(x) =√

x(20 − 2x) =√

20x − 2x2

f′(x) =1

2√

20x − 2x2(20 − 4x) =

10 − 2x√20x − 2x2

.

Then f′(x) = 0 when 10 − 2x = 0, or x = 5. Since y = 20 − 2x, y = 10.f(5, 10) =

√50.

. . . . . .

Maximize the function f(x, y) =√

xy subject to the constraint20x + 10y = 200.

SolutionSolve the constraint for y and make f a single-variable function:2x + y = 20, so y = 20 − 2x. Thus

f(x) =√

x(20 − 2x) =√

20x − 2x2

f′(x) =1

2√

20x − 2x2(20 − 4x) =

10 − 2x√20x − 2x2

.

Then f′(x) = 0 when 10 − 2x = 0, or x = 5. Since y = 20 − 2x, y = 10.f(5, 10) =

√50.

. . . . . .

Checking maximality: Closed Interval MethodCf. Section 4.2

Once the function is restricted to the line 20x + 10y = 200, we can’tplug in negative numbers for f(x). Since

f(x) =√

x(20 − 2x)

we have a restricted domain of 0 ≤ x ≤ 10. We only need to check fon these two endpoints and its critical point to find the maximumvalue. But f(0) = f(10) = 0 so f(5) =

√50 is the maximum value.

. . . . . .

Checking maximality: First Derivative TestCf. Section 4.3

We have

f′(x) =10 − 2x√20x − 2x2

The denominator is always positive, so the fraction is positive exactlywhen the numerator is positive. So f′(x) < 0 if x < 5 and f′(x) > 0 ifx > 5. This means f changes from increasing to decreasing at 5. So 5is the global maximum point.

. . . . . .

Checking maximality: Second Derivative TestCf. Section 4.3

We have

f′′(x) = − 100(20x − 2x2)3/2

So f′′(5) < 0, which means f has a local maximum at 5. Since thereare no other critical points, this is the global maximum.

. . . . . .

ExampleFind the maximum and minimum values of

f (x, y) = x2 + y2 − 2x − 2y + 14.

subject to the constraint

g (x, y) = x2 + y2 − 16 ≡ 0.

This one’s harder. Solving for y in terms of x involves the square root,of which there’s two choices.There’s a better way!

. . . . . .

ExampleFind the maximum and minimum values of

f (x, y) = x2 + y2 − 2x − 2y + 14.

subject to the constraint

g (x, y) = x2 + y2 − 16 ≡ 0.

This one’s harder. Solving for y in terms of x involves the square root,of which there’s two choices.

There’s a better way!

. . . . . .

ExampleFind the maximum and minimum values of

f (x, y) = x2 + y2 − 2x − 2y + 14.

subject to the constraint

g (x, y) = x2 + y2 − 16 ≡ 0.

This one’s harder. Solving for y in terms of x involves the square root,of which there’s two choices.There’s a better way!

. . . . . .

Outline

Introduction

The Method of Lagrange Multipliers

Examples

For those who really must know all

. . . . . .

Consider a path that moves across a hilly terrain. Where are thecritical points of elevation along your path?

. .

. . . . . .

Simplified map

..-1.-2.-3.-4.-5.-6.-7.-8.-9.-10

.level curves of f .level curve g = 0

.At the constrainedcritical point, thetangents to thelevel curves of fand g are in thesame direction!

. . . . . .

Simplified map

..-1.-2.-3.-4.-5.-6.-7.-8.-9.-10

.level curves of f .level curve g = 0

.At the constrainedcritical point, thetangents to thelevel curves of fand g are in thesame direction!

. . . . . .

Simplified map

..-1.-2.-3.-4.-5.-6.-7.-8.-9.-10

.level curves of f .level curve g = 0

.At the constrainedcritical point, thetangents to thelevel curves of fand g are in thesame direction!

. . . . . .

The slopes of the tangent lines to these level curves are(dydx

)f= − fx

fyand

(dydx

)g= −gx

gy

So they are equal when

fxfy

=gx

gy⇐⇒ fx

gx=

fygy

If λ is the common ratio on the right, we have

fxfy

=gx

gy= λ

So

fx = λgx

fy = λgy

This principle works with any number of variables.

. . . . . .

Theorem (The Method of Lagrange Multipliers)Let f(x1, x2, . . . , xn) and g(x1, x2, . . . , xn) be functions of severalvariables. The critical points of the function f restricted to the set g = 0are solutions to the equations:

∂f∂xi

(x1, x2, . . . , xn) = λ∂g∂xi

(x1, x2, . . . , xn) for each i = 1, . . . , n

g(x1, x2, . . . , xn) = 0.

Note that this is n + 1 equations in the n + 1 variables x1, . . . , xn, λ.

. . . . . .

Outline

Introduction

The Method of Lagrange Multipliers

Examples

For those who really must know all

. . . . . .

ExampleMaximize the function f(x, y) =

√xy subject to the constraint

20x + 10y = 200.

Solution

. . . . . .

Let’s set g(x, y) = 20x + 10y − 200. We have

∂f∂x

=12

√yx

∂g∂x

= 20

∂f∂y

=12

√xy

∂g∂y

= 10

So the equations we need to solve are

12

√yx

= 20λ12

√xy

= 10λ

20x + 10y = 200.

. . . . . .

Solution (Continued)Dividing the first by the second gives us

yx

= 2,

which means y = 2x. We plug this into the equation of constraint to get

20x + 10(2x) = 200 =⇒ x = 5 =⇒ y = 10.

. . . . . .

Caution

When dividing equations, one must take care that the equation wedivide by is not equal to zero. So we should verify that there is nosolution where

12

√xy

= 10λ = 0

If this were true, then λ = 0. Since y = 800λ2x, we get y = 0. Sincex = 200λ2y, we get x = 0. But then the equation of constraint is notsatisfied. So we’re safe.Make sure you account for these because you can lose solutions!

. . . . . .

ExampleFind the maximum and minimum values of

f (x, y) = x2 + y2 − 2x − 6y + 14.

subject to the constraint

g (x, y) = x2 + y2 − 16 ≡ 0.

SolutionWe have the two equations

2x − 2 = λ(2x)

2y − 6 = λ(2y).

as well as the thirdx2 + y2 = 16.

. . . . . .

ExampleFind the maximum and minimum values of

f (x, y) = x2 + y2 − 2x − 6y + 14.

subject to the constraint

g (x, y) = x2 + y2 − 16 ≡ 0.

SolutionWe have the two equations

2x − 2 = λ(2x)

2y − 6 = λ(2y).

as well as the thirdx2 + y2 = 16.

. . . . . .

Solution (Continued)Solving both of these for λ and equating them gives

x − 1x

=y − 3

y.

Cross multiplying,

xy − y = xy − 3x =⇒ y = 3x.

Plugging this in the equation of constraint gives

x2 + (3x)2 = 16,

which gives x = ±√

8/5, and y = ±3√

8/5.

. . . . . .

Solution (Continued)Looking at the function

f (x, y) = x2 + y2 − 2x − 2y + 14

We see that

f(−2

√2/5,−6

√2/5

)=

94 + 10√

55

is the maximum and

f(

2√

2/5, 6√

2/5

)=

94 − 10√

55

is the minimum value of the constrained function.

. . . . . .

Contour Plot

-4 -2 0 2 4

-4

-2

0

2

4

The green curve is theconstraint, and the twogreen points are theconstrained max and min.

. . . . . .

Compare and Contrast

Elimination◮ solve, then differentiate◮ messier (usually)

equations◮ fewer equations◮ more complex with more

constraints◮ second derivative test is

easier

Lagrange Multipliers◮ differentiate, then solve◮ nicer (usually) equations◮ more equations◮ adaptable to more than

one constraint◮ second derivative test

(won’t do) is harder◮ multipliers have

contextual meaning

. . . . . .

ExampleA rectangular box is to be constructed of materials such that thebase of the box costs twice as much per unit area as does the sidesand top. If there are D dollars allocated to spend on the box, howshould these be allocated so that the box contains the maximumpossible value?

Answer

x = y =13

√Dc

z =12

√Dc

where c is the cost per unit area of the sides and top.

. . . . . .

ExampleA rectangular box is to be constructed of materials such that thebase of the box costs twice as much per unit area as does the sidesand top. If there are D dollars allocated to spend on the box, howshould these be allocated so that the box contains the maximumpossible value?

Answer

x = y =13

√Dc

z =12

√Dc

where c is the cost per unit area of the sides and top.

. . . . . .

Solution

Let the sides of the box be x, y, and z. Let the cost per unit area ofthe sides and top be c; so the cost per unit area of the bottom is 2c.If x and y are the dimensions of the bottom of the box, then we wantto maximize V = xyz subject to the constraint that2cyz + 2cxz + 3cxy − D = 0. Thus

yz = λc(2z + 3y)

xz = λc(3x + 2z)

xy = λc(2x + 2y)

. . . . . .

Before dividing, check that none of x, y, z, or λ can be zero. Each ofthose possibilities eventually leads to a contradiction to theconstraint equation.Dividing the first two gives

yx

=2z + 3y3x + 2z

=⇒ y(3x + 2z) = x(2z + 3y) =⇒ 2yz = 2xz

Since z ̸= 0, we have x = y.

. . . . . .

The last equation now becomes x2 = 4λcx. Dividing the secondequation by this gives

zx

=3x + 2z

4x=⇒ z = 3

2x.

Putting these into the equation of constraint we have

D = 3cxy + 2cyz + 2xz = 3cx2 + 3cx2 + 3cx2 = 9cx2.

So

x = y =13

√Dc

z =12

√Dc

It also follows that

λ =x4c

=112

√Dc3

. . . . . .

Interpretation of λ

Let V∗ be the maximum volume found by solving the Lagrangemultiplier equations. Then

V∗ =

(13

√Dc

) (13

√Dc

)(12

√Dc

)=

118

√D3

c3

NowdV∗

dD=

32

118

√Dc3 =

112

√Dc3 = λ

This is true in general; the multiplier is the derivative of the extremevalue with respect to the constraint.

. . . . . .

Outline

Introduction

The Method of Lagrange Multipliers

Examples

For those who really must know all

. . . . . .

The second derivative test for constrained optimization

Constrained extrema of f subject to g = 0 are unconstrained criticalpoints of the Lagrangian function

L(x, y, λ) = f(x, y) − λg(x, y)

The hessian at a critical point is

HL =

0 gx gygx fxx fxygy fxy fyy

For (x, y, λ) to be minimal, we need det(HL) < 0, and for (x, y, λ) tobe maximal, we need det(HL) > 0.