lesson 27: lagrange multipliers i

36
Lesson 27 (Chapter 18.1–2) Constrained Optimization I: Lagrange Multipliers Math 20 November 26, 2007 Announcements I Problem Set 10 on the website. Due November 28. I next OH: Today 1–2, tomorrow 3–4 (SC 323) I Midterm II Review: Tuesday 12/4, 7:30–9:00pm in Hall E I Midterm II: Thursday, 12/6, 7–8:30pm in Hall A

Upload: matthew-leingang

Post on 22-Jun-2015

6.465 views

Category:

Technology


0 download

DESCRIPTION

The method of Lagrange mutipliers allows easy solution to a constrained optimization problem.

TRANSCRIPT

Page 1: Lesson 27: Lagrange Multipliers I

Lesson 27 (Chapter 18.1–2)Constrained Optimization I: Lagrange Multipliers

Math 20

November 26, 2007

Announcements

I Problem Set 10 on the website. Due November 28.

I next OH: Today 1–2, tomorrow 3–4 (SC 323)

I Midterm II Review: Tuesday 12/4, 7:30–9:00pm in Hall E

I Midterm II: Thursday, 12/6, 7–8:30pm in Hall A

Page 2: Lesson 27: Lagrange Multipliers I

Outline

Motivation

The Method of Lagrange Multipliers

Examples

Page 3: Lesson 27: Lagrange Multipliers I

The problem

We know how to find the critical points of a function of twovariables: look for where ∇f = 0. That is,

∂f

∂x=∂f

∂y= 0

Sometimes, however, we have a constraint which restricts us fromchoosing variables freely:

I Maximize volume subject to limited material costs

I Minimize surface area subject to fixed volume

I Maximize utility subject to limited income

Page 4: Lesson 27: Lagrange Multipliers I

The problem

We know how to find the critical points of a function of twovariables: look for where ∇f = 0. That is,

∂f

∂x=∂f

∂y= 0

Sometimes, however, we have a constraint which restricts us fromchoosing variables freely:

I Maximize volume subject to limited material costs

I Minimize surface area subject to fixed volume

I Maximize utility subject to limited income

Page 5: Lesson 27: Lagrange Multipliers I

Example

Maximize the function

f (x , y) =√

xy

subject to the constraint

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

Page 6: Lesson 27: Lagrange Multipliers I

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.

Page 7: Lesson 27: Lagrange Multipliers I

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.

Page 8: Lesson 27: Lagrange Multipliers I

Checking maximality: Closed Interval MethodCf. Section 9.3

Once the function is restricted to the line 20x + 10y = 200, wecan’t plug 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 checkf on these two endpoints and its critical point to find themaximum value. But f (0) = f (10) = 0 so f (5) =

√50 is the

maximum value.

Page 9: Lesson 27: Lagrange Multipliers I

Checking maximality: First Derivative TestCf. Section 9.2

We have

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

The denominator is always positive, so the fraction is positiveexactly when the numerator is positive. So f ′(x) < 0 if x < 5 andf ′(x) > 0 if x > 5. This means f changes from increasing todecreasing at 5. So 5 is the global maximum point.

Page 10: Lesson 27: Lagrange Multipliers I

Checking maximality: Second Derivative TestCf. Section 9.4

We have

f ′′(x) = − 100

(20x − 2x2)3/2

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

Page 11: Lesson 27: Lagrange Multipliers I

Example

Find 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 squareroot, of which there’s two choices.There’s a better way!

Page 12: Lesson 27: Lagrange Multipliers I

Example

Find 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 squareroot, of which there’s two choices.

There’s a better way!

Page 13: Lesson 27: Lagrange Multipliers I

Example

Find 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 squareroot, of which there’s two choices.There’s a better way!

Page 14: Lesson 27: Lagrange Multipliers I

Outline

Motivation

The Method of Lagrange Multipliers

Examples

Page 15: Lesson 27: Lagrange Multipliers I

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

Page 16: Lesson 27: Lagrange Multipliers I

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!

Page 17: Lesson 27: Lagrange Multipliers I

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

dx

)f

= − f ′xf ′y

and

(dy

dx

)g

= −g ′xg ′y

So they are equal when

f ′xf ′y

=g ′xg ′y⇐⇒ f ′x

g ′x=

f ′yg ′y

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

f ′xf ′y

=g ′xg ′y

= λ

So

f ′x = λg ′x

f ′y = λg ′y

This principle works with any number of variables.

Page 18: Lesson 27: Lagrange Multipliers I

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 setg = 0 are 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, λ.

Page 19: Lesson 27: Lagrange Multipliers I

Outline

Motivation

The Method of Lagrange Multipliers

Examples

Page 20: Lesson 27: Lagrange Multipliers I

Example

Maximize the function f (x , y) =√

xy subject to the constraint20x + 10y = 200.

Solution

Page 21: Lesson 27: Lagrange Multipliers I

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

∂f

∂x=

1

2

√y

x

∂g

∂x= 20

∂f

∂y=

1

2

√x

y

∂g

∂y= 10

So the equations we need to solve are

1

2

√y

x= 20λ

1

2

√x

y= 10λ

20x + 10y = 200.

Page 22: Lesson 27: Lagrange Multipliers I

Solution (Continued)

Dividing the first by the second gives us

y

x= 2,

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

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

Page 23: Lesson 27: Lagrange Multipliers I

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

1

2

√x

y= 10λ = 0

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

Page 24: Lesson 27: Lagrange Multipliers I

Example

Find 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.

Page 25: Lesson 27: Lagrange Multipliers I

Example

Find 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.

Page 26: Lesson 27: Lagrange Multipliers I

Solution (Continued)

Solving both of these for λ and equating them gives

x − 1

x=

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.

Page 27: Lesson 27: Lagrange Multipliers I

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

√5

5

is the maximum and

f(

2√

2/5, 6√

2/5)

s =94− 10

√5

5

is the minimum value of the constrained function.

Page 28: Lesson 27: Lagrange Multipliers I

Contour Plot

-4 -2 0 2 4

-4

-2

0

2

4

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

Page 29: Lesson 27: Lagrange Multipliers I

Compare and Contrast

Elimination

I solve, then differentiate

I messier (usually)equations

I fewer equations

I adaptable to more thanone constraint

I second derivative test iseasier

Lagrange Multipliers

I differentiate, then solve

I nicer (usually) equations

I more equations

I adaptable to more thanone constraint

I second derivative test(later) is harder

I multipliers havecontextual meaning

Page 30: Lesson 27: Lagrange Multipliers I

Another argument for Lagrange multipliers

To find the critical points of f subject to the constraint thatg = 0, create the lagrangian

L = f (x1, x2, . . . , xn)− λg(x1, x2, . . . , xn)

If L is restricted to the set g = 0, L = f and so the constrainedcritical points are unconstrained critical points of L . So for each i ,

∂L

∂xi= 0 =⇒ ∂f

∂xi= λ

∂g

∂xi.

But also,∂L

∂λ= 0 =⇒ g(x1, x2, . . . , xn) = 0.

Page 31: Lesson 27: Lagrange Multipliers I

Example

A 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 =1

3

√D

cz =

1

2

√D

c

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

Page 32: Lesson 27: Lagrange Multipliers I

Example

A 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 =1

3

√D

cz =

1

2

√D

c

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

Page 33: Lesson 27: Lagrange Multipliers I

Solution

Let the sides of the box be x , y , and z . Let the cost per unit areaof the sides and top be c ; so the cost per unit area of the bottomis 2c . If x and y are the dimensions of the bottom of the box, thenwe want to 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)

Page 34: Lesson 27: Lagrange Multipliers I

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

y

x=

2z + 3y

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

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

Page 35: Lesson 27: Lagrange Multipliers I

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

z

x=

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 =1

3

√D

cz =

1

2

√D

c

It also follows that

λ =x

4c=

1

12

√D

c3

Page 36: Lesson 27: Lagrange Multipliers I

Interpretation of λ

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

V ∗ =

(1

3

√D

c

)(1

3

√D

c

)(1

2

√D

c

)=

1

18

√D3

c3

NowdV ∗

dD=

3

2

1

18

√D

c3=

1

12

√D

c3= λ

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