Worked examples
The question
Question: find the maximum of f(x, y) = xy with x + y = 10.
f(x, y) = xy, x + y = 10
1 Set up the equations
At the best point, the level curve of f just touches the curve.
So the two gradients point the same way.
The rule: ∇f = λ∇g.
λ is the Greek letter lambda.
It is just a number.
∇f = λ ∇g
The curve is g = 10, with g(x, y) = x + y.
g(x, y) = x + y
The x parts: f_x = λ g_x.
f_x is y, g_x is 1.
① y = λ
The y parts: f_y = λ g_y.
f_y is x, g_y is 1.
② x = λ
And ③: stay on the curve.
③ x + y = 10
Careful!
The curve's own equation is part of the system.
Without it, we cannot find x and y.
Careful: three equations: never forget ③
2 Solve the equations
From ①: λ is y.
λ = y
From ②: λ is x.
λ = x
Both are λ, so they are equal.
y = x
Tidy it up: y = x.
y = x
Put it into ③.
x + (x) = 10
Open the bracket and add the like terms.
2x = 10
Divide by 2: x = 5.
x = 5
Then y = x gives y = 5.
y = 5
3 Compare the values
At (5, 5), f is 25.
f(5, 5) = 25
There is one point, so it gives the maximum: 25.
= max 25 at (5, 5)
4 Check
Let's check on the xy grid.
The orange line is the curve ③: x + y = 10.
The blue curve is where f is 25.
It just touches the line at the point.
Another point on the line, (7, 3), gives 21.
That is smaller, as a maximum needs.
Right!
another point on the line: f(7, 3) = 21
Let's look back.
First: set up the equations.
Then: solve the equations.
Then: compare the values.
Last: check.
Answer = max 25 at (5, 5)
▶ Watch it solved
The question
Question: find the maximum of f(x, y) = xy with 3x + y = 18.
f(x, y) = xy, 3x + y = 18
1 Set up the equations
At the best point, the level curve of f just touches the curve.
So the two gradients point the same way.
The rule: ∇f = λ∇g.
λ is the Greek letter lambda.
It is just a number.
∇f = λ ∇g
The curve is g = 18, with g(x, y) = 3x + y.
g(x, y) = 3x + y
The x parts: f_x = λ g_x.
f_x is y, g_x is 3.
① y = λ × 3
The y parts: f_y = λ g_y.
f_y is x, g_y is 1.
② x = λ
And ③: stay on the curve.
③ 3x + y = 18
Careful!
The curve's own equation is part of the system.
Without it, we cannot find x and y.
Careful: three equations: never forget ③
2 Solve the equations
From ①: λ is y/3.
λ = y3
From ②: λ is x.
λ = x
Both are λ, so they are equal.
y3 = x
Tidy it up: y = 3x.
y = 3x
Put it into ③.
3x + (3x) = 18
Open the bracket and add the like terms.
6x = 18
Divide by 6: x = 3.
x = 3
Then y = 3x gives y = 9.
y = 9
3 Compare the values
At (3, 9), f is 27.
f(3, 9) = 27
There is one point, so it gives the maximum: 27.
= max 27 at (3, 9)
4 Check
Let's check on the xy grid.
The orange line is the curve ③: 3x + y = 18.
The blue curve is where f is 27.
It just touches the line at the point.
Another point on the line, (5, 3), gives 15.
That is smaller, as a maximum needs.
Right!
another point on the line: f(5, 3) = 15
Let's look back.
First: set up the equations.
Then: solve the equations.
Then: compare the values.
Last: check.
Answer = max 27 at (3, 9)
▶ Watch it solved
The question
Question: find the maximum and minimum of f(x, y) = 2x − y with x² + y² = 20.
f(x, y) = 2x − y, x2 + y2 = 20
1 Set up the equations
At the best point, the level curve of f just touches the curve.
So the two gradients point the same way.
The rule: ∇f = λ∇g.
λ is the Greek letter lambda.
It is just a number.
∇f = λ ∇g
The curve is g = 20, with g(x, y) = x² + y².
g(x, y) = x2 + y2
The x parts: f_x = λ g_x.
f_x is 2, g_x is 2x.
① 2 = λ × 2x
The y parts: f_y = λ g_y.
f_y is −1, g_y is 2y.
② −1 = λ × 2y
And ③: stay on the curve.
③ x2 + y2 = 20
Careful!
The curve's own equation is part of the system.
Without it, we cannot find x and y.
Careful: three equations: never forget ③
2 Solve the equations
From ①: 2 = λ × 2x, so λ is 2/2x.
λ = 22x
From ②: λ is −1/2y.
λ = −12y
Both are λ, so they are equal.
22x = −12y
Cross-multiply and tidy up: y = −1/2x.
y = −12x
Put it into ③.
x² + (−1/2x)² = 20
Add the x² terms and divide: x² = 16.
x² = 16
Two numbers: x = 4 or −4.
Then y follows: two points.
x = 4 or −4
3 Compare the values
At (4, −2), f is 10.
f(4, −2) = 10
At (−4, 2), f is −10.
f(−4, 2) = −10
The bigger value is the maximum, the smaller one the minimum.
= max 10 at (4, −2), min −10 at (−4, 2)
4 Check
Let's check on the xy grid.
The orange circle is the curve ③.
The blue lines are where f is 10 and −10.
Each just touches the circle.
Another point on the circle gives −4.47: between the two.
Right!
f(0, 4.47) = −4.47
Let's look back.
First: set up the equations.
Then: solve the equations.
Then: compare the values.
Last: check.
Answer = max 10 at (4, −2), min −10 at (−4, 2)
▶ Watch it solved