MAT1052 · Week 12 · Maximum and Minimum Problems, Lagrange Multipliers

Absolute extrema on a closed region and Lagrange multipliers

You learn to find the absolute largest and smallest values of a function on a closed and bounded region (interior critical points + boundary), and to solve extremum problems under a constraint with Lagrange multipliers.

absolute maximumabsolute minimumclosed and bounded regionExtreme Value TheoremboundaryconstraintLagrange multipliermethod of Lagrange multipliers

Last week’s second derivative test finds only local extrema. But in practice most questions ask “what is the highest and lowest value in this region?” or “what is the best value under this constraint?”. This week we answer these two questions. In the first (absolute extrema on a closed region) we scan the inside and the boundary of the region separately and compare the candidates. In the second (Lagrange multipliers) we find the candidates without solving the constraint, using the condition that the gradients are parallel. The exam has one big question from each; points are lost mostly by skipping a piece of the boundary or a solution case.

Golden rules:

  1. On a closed and bounded region, a continuous function always has an absolute max and min (Extreme Value Theorem).
  2. Candidates: interior critical points + critical points on the boundary + vertices.
  3. For absolute extrema the DD test is not needed. Just compare the values.
  4. Lagrange: ∇f=λ∇g\nabla f = \lambda\nabla g and g=kg = k. Before dividing, examine separately the factors that could be zero.

Absolute extrema: the closed region method

The region must be closed (it includes its boundary) and bounded (it does not go to infinity). A disk, a rectangle and a triangle are typical examples.

Method.

1) INTERIOR: solve f_x = 0, f_y = 0. Keep only the points that lie inside the region.
2) BOUNDARY: treat each edge separately.
     line segment → substitute y (or x), a single-variable function
       → set the derivative to 0 (roots inside the interval) + the two endpoints of the edge
     circle x²+y²=r² → substitute x² = r² - y², or x = r cos t, y = r sin t
3) TABLE: write all the candidates and the f values. Choose the largest and the smallest.

Example 1. f(x,y)=x2+y2−2x−4yf(x,y) = x^2+y^2-2x-4y, the triangle with vertices (0,0)(0,0), (4,0)(4,0), (0,4)(0,4).

Interior. fx=2x−2=0f_x = 2x-2 = 0, fy=2y−4=0f_y = 2y-4 = 0: (1,2)(1,2). 1+2≤41+2\le4, inside. f(1,2)=1+4−2−8=−5f(1,2) = 1+4-2-8 = -5.

Edge 1, y=0y = 0, 0≤x≤40\le x\le4. f=x2−2xf = x^2-2x, f′=2x−2=0f' = 2x-2 = 0: x=1x = 1, f=−1f = -1. Ends: f(0,0)=0f(0,0) = 0, f(4,0)=8f(4,0) = 8.

Edge 2, x=0x = 0, 0≤y≤40\le y\le4. f=y2−4yf = y^2-4y, y=2y = 2: f=−4f = -4. Ends: 00 and f(0,4)=0f(0,4) = 0.

Edge 3, x+y=4x+y = 4. y=4−xy = 4-x: f=x2+(4−x)2−2x−4(4−x)=2x2−6xf = x^2+(4-x)^2-2x-4(4-x) = 2x^2-6x. f′=4x−6=0f' = 4x-6 = 0: x=1.5x = 1.5, the point (1.5,2.5)(1.5,2.5), f=−4.5f = -4.5. The ends are already vertices.

Candidateff
(1,2)(1,2) interior−5-5
(1,0)(1,0)−1-1
(0,2)(0,2)−4-4
(1.5,2.5)(1.5,2.5)−4.5-4.5
(0,0)(0,0)00
(4,0)(4,0)88
(0,4)(0,4)00

Absolute max 88, at (4,0)(4,0). Absolute min −5-5, at (1,2)(1,2).

PITFALL · forgetting the vertices. When you reduce each edge to a single-variable function, the endpoints of that edge are candidates too. Since the endpoints are vertices, the easiest way is to compute the values at the vertices at the very start and write them in the table. In this example the maximum came out at a vertex, and no derivative zero gave it.

Lagrange multipliers

Problem. Find the largest and smallest values of f(x,y)f(x,y) on the constraint g(x,y)=kg(x,y) = k (a curve). In three variables the constraint is a surface: g(x,y,z)=kg(x,y,z) = k.

Theorem. At an extremum point of ff on the constraint (and if ∇g≠0\nabla g\neq\mathbf 0) there is a number λ\lambda such that

∇f=λ∇g,g=k.\nabla f = \lambda\nabla g,\qquad g = k.

In two variables these are three equations (fx=λgxf_x = \lambda g_x, fy=λgyf_y = \lambda g_y, g=kg = k) in three unknowns (x,y,λx,y,\lambda). In three variables, four equations in four unknowns.

Intuition. Imagine walking along the constraint curve and crossing the level curves of ff. As long as you cross a level curve, ff is increasing or decreasing. At an extremum the constraint curve is tangent to the level curve of ff. If two curves are tangent, their normals are parallel. The normals are the gradients: ∇f∥∇g\nabla f\parallel\nabla g. λ\lambda is the coefficient of parallelism.

Example 2. f=xyf = xy, constraint x2+y2=8x^2+y^2 = 8.

∇f = <y, x>,  ∇g = <2x, 2y>
y = 2λx        (1)
x = 2λy        (2)
x² + y² = 8    (3)
Multiply (1) by x and (2) by y: xy = 2λx² and xy = 2λy²  →  λx² = λy²
If λ = 0, then from (1),(2) x = y = 0, which does not satisfy (3) → λ ≠ 0, so x² = y²
(3): 2x² = 8, x = ±2, y = ±2  → four points
f(2,2) = f(-2,-2) = 4,   f(2,-2) = f(-2,2) = -4

Max 44, min −4-4. The constraint is a circle (closed and bounded), both values certainly exist.

Tactics for solving the system

TacticWhen
Dividing the equations to eliminate λ\lambdaIf what you divide by cannot be zero
Multiplying each equation by xx, yy, zz and equatingIn product functions like f=xyzf = xyz
Factoring and “either x=0x = 0 or …”If a variable stands as a factor in every equation
SymmetryIf ff and gg do not change under x↔yx\leftrightarrow y, try the candidate x=yx = y (do not assume it is the only one)

TIP · zero cases. In an equation like 2xy=2λx2xy = 2\lambda x, before cancelling xx write the case x=0x = 0 separately. In Q9 the x=0x = 0 branch produces two candidates with the value f=0f = 0. Even if they are neither the min nor the max, they must be in the list of candidates; skipping them leaves the solution incomplete.

Example 3 (three variables). The largest value of f=x+y+zf = x+y+z on the sphere x2+y2+z2=3x^2+y^2+z^2 = 3. ⟨1,1,1⟩=λ⟨2x,2y,2z⟩\langle1,1,1\rangle = \lambda\langle2x,2y,2z\rangle, so x=y=z=12λx = y = z = \frac{1}{2\lambda}. Constraint: 3x2=33x^2 = 3, x=±1x = \pm1. Max f(1,1,1)=3f(1,1,1) = 3, min f(−1,−1,−1)=−3f(-1,-1,-1) = -3.

Lagrange or substitution?

If you can easily pull a variable out of the constraint (a line, a plane), last week’s substitution method works too. Lagrange’s advantage: when the constraint is complicated (a circle, an ellipse, xyz=1xyz = 1) it gives a symmetric system without taking roots and without splitting cases. In closed-region questions, if the boundary is a circle or an ellipse you can examine the boundary with Lagrange and the interior with ∇f=0\nabla f = \mathbf 0.

Common mistakes

WrongCorrect
Taking a critical point outside the region as a candidateTake only those inside the region
Skipping one edge of the boundaryEach edge is separate; write it in the table
Forgetting the verticesVertices are always candidates
Doing the DD test for absolute extremaUnnecessary; compare the values
In Lagrange, dividing by xx and losing x=0x = 0First examine the zero case separately
Giving λ\lambda as the answerThe answer is the point and the ff value
Taking the only point found as both the max and the minCompare all candidates; on an unbounded constraint one of them may not exist
Forgetting to add the constraint equation to the systemg=kg = k is one of the equations too

Test yourself

Exam-style questions. Solve them on paper first, then reveal the answer.

Question 1medium

Find the absolute maximum and minimum of f(x,y)=x2+y2−2xf(x,y) = x^2+y^2-2x on the closed disk x2+y2≤4x^2+y^2\le4.

Show answer
Max 88 at (−2,0)(-2,0); min −1-1 at (1,0)(1,0)

Interior: fx=2x−2=0f_x = 2x-2 = 0, fy=2y=0f_y = 2y = 0: (1,0)(1,0), inside the disk, f=−1f = -1.
Boundary: on x2+y2=4x^2+y^2 = 4, f=4−2xf = 4-2x, −2≤x≤2-2\le x\le2. The largest is 88 at x=−2x=-2, the smallest is 00 at x=2x=2.
Candidates: −1-1, 88, 00. Absolute max 88 at (−2,0)(-2,0), absolute min −1-1 at (1,0)(1,0).

Question 2easy

Find the absolute extrema of f(x,y)=2x+3yf(x,y) = 2x+3y on the triangle with vertices (0,0)(0,0), (2,0)(2,0), (0,3)(0,3).

Show answer
Max 99 at (0,3)(0,3); min 00 at (0,0)(0,0)

∇f=⟨2,3⟩\nabla f = \langle2,3\rangle is never zero, so there is no interior critical point. A linear function has no critical points along the boundary edges either; the extrema are at the vertices.f(0,0)=0f(0,0) = 0, f(2,0)=4f(2,0) = 4, f(0,3)=9f(0,3) = 9.

Question 3hard

Find the absolute extrema of f(x,y)=x2−xy+y2+1f(x,y) = x^2-xy+y^2+1 on the rectangle 0≤x≤30\le x\le3, 0≤y≤20\le y\le2.

Show answer
Max 1010 at (3,0)(3,0); min 11 at (0,0)(0,0)

Interior: 2x−y=02x-y = 0, −x+2y=0⇒(0,0)-x+2y = 0\Rightarrow(0,0), a vertex (on the boundary).y=0y=0: x2+1∈[1,10]x^2+1\in[1,10]. x=0x=0: y2+1∈[1,5]y^2+1\in[1,5].x=3x=3: y2−3y+10y^2-3y+10, at y=1.5y = 1.5 it is 7.757.75; the ends are 1010, 88. y=2y=2: x2−2x+5x^2-2x+5, at x=1x=1 it is 44; the ends are 55, 88.
Among all candidates the largest is 1010 at (3,0)(3,0), the smallest is 11 at (0,0)(0,0).

Question 4easy

Use Lagrange multipliers to maximize f(x,y)=xyf(x,y) = xy subject to x+y=10x+y = 10.

Show answer
Max 2525 at (5,5)(5,5)

∇f=λ∇g\nabla f = \lambda\nabla g: y=λy = \lambda, x=λx = \lambda, so x=yx = y. From the constraint x=y=5x = y = 5.f(5,5)=25f(5,5) = 25. (The constraint is an unbounded line; there is no minimum, xyxy can be as negative as you like.)

Question 5medium

Find the maximum and minimum of f(x,y)=x+2yf(x,y) = x+2y on the circle x2+y2=5x^2+y^2 = 5.

Show answer
Max 55 at (1,2)(1,2); min −5-5 at (−1,−2)(-1,-2)

⟨1,2⟩=λ⟨2x,2y⟩\langle1,2\rangle = \lambda\langle2x,2y\rangle: x=12λx = \frac{1}{2\lambda}, y=1λy = \frac{1}{\lambda}, so y=2xy = 2x.
Constraint: x2+4x2=5x^2+4x^2 = 5, x=±1x = \pm1. The points are (1,2)(1,2) and (−1,−2)(-1,-2).f(1,2)=5f(1,2) = 5, f(−1,−2)=−5f(-1,-2) = -5. The circle is closed and bounded, both values are absolute.

Question 6medium

Find the minimum of f(x,y)=x2+y2f(x,y) = x^2+y^2 subject to xy=4xy = 4.

Show answer
88, at (2,2)(2,2) and (−2,−2)(-2,-2)

⟨2x,2y⟩=λ⟨y,x⟩\langle2x,2y\rangle = \lambda\langle y,x\rangle: 2x=λy2x = \lambda y, 2y=λx2y = \lambda x. Multiply: 4xy=λ2xy4xy = \lambda^2xy; since xy=4≠0xy = 4\neq0, λ2=4\lambda^2 = 4.λ=2\lambda = 2: x=yx = y, x2=4x^2 = 4, (2,2)(2,2) and (−2,−2)(-2,-2). λ=−2\lambda = -2: x=−yx = -y, −x2=4-x^2 = 4, no solution.f=8f = 8. (There is no maximum: the hyperbola goes to infinity.)

Question 7hard

Find the maximum volume of a rectangular box in the first octant with three faces on the coordinate planes and one vertex on the plane x+2y+3z=6x+2y+3z = 6.

Show answer
4/34/3, at (2,1,23)(2,1,\tfrac23)

V=xyzV = xyz, g=x+2y+3z=6g = x+2y+3z = 6. ∇V=λ∇g\nabla V = \lambda\nabla g: yz=λyz = \lambda, xz=2λxz = 2\lambda, xy=3λxy = 3\lambda.
Multiply each equation by xx, yy, zz respectively: xyz=λx=2λy=3λzxyz = \lambda x = 2\lambda y = 3\lambda z, that is, x=2y=3zx = 2y = 3z.
Constraint: x+x+x=6x+x+x = 6, x=2x = 2, y=1y = 1, z=23z = \frac23. V=43V = \frac43.

Question 8medium

Find the point on the plane 2x−y+2z=92x-y+2z = 9 closest to the origin.

Show answer
(2,−1,2)(2,-1,2), distance 33

f=x2+y2+z2f = x^2+y^2+z^2 (the square of the distance). ⟨2x,2y,2z⟩=λ⟨2,−1,2⟩\langle2x,2y,2z\rangle = \lambda\langle2,-1,2\rangle: x=λx = \lambda, y=−λ2y = -\frac\lambda2, z=λz = \lambda.
Constraint: 2λ+λ2+2λ=9λ2=92\lambda+\frac\lambda2+2\lambda = \frac{9\lambda}{2} = 9, λ=2\lambda = 2. The point is (2,−1,2)(2,-1,2), the distance is 4+1+4=3\sqrt{4+1+4} = 3.
(The closest point is the point reached by dropping from the origin along the normal direction to the plane.)

Question 9hard

Find the maximum and minimum of f(x,y)=x2yf(x,y) = x^2y on the ellipse x2+2y2=6x^2+2y^2 = 6.

Show answer
Max 44 at (±2,1)(\pm2,1); min −4-4 at (±2,−1)(\pm2,-1)

⟨2xy, x2⟩=λ⟨2x, 4y⟩\langle2xy,\,x^2\rangle = \lambda\langle2x,\,4y\rangle. First: 2xy=2λx2xy = 2\lambda x, so x=0x = 0 or y=λy = \lambda.x=0x = 0: y=±3y = \pm\sqrt3, f=0f = 0.y=λy = \lambda: the second equation gives x2=4y2x^2 = 4y^2. Constraint: 4y2+2y2=64y^2+2y^2 = 6, y=±1y = \pm1, x=±2x = \pm2.f(±2,1)=4f(\pm2,1) = 4, f(±2,−1)=−4f(\pm2,-1) = -4. Candidates 0,4,−40,4,-4: max 44, min −4-4.

Question 10easy

Find the absolute extrema of f(x,y)=x2+2y2f(x,y) = x^2+2y^2 on the disk x2+y2≤1x^2+y^2\le1.

Show answer
Max 22 at (0,±1)(0,\pm1); min 00 at (0,0)(0,0)

Interior: (0,0)(0,0), f=0f = 0. Boundary: x2=1−y2x^2 = 1-y^2, f=1+y2f = 1+y^2, −1≤y≤1-1\le y\le1.
The largest is 22 at y=±1y = \pm1, the smallest is 11 at y=0y=0. Candidates 00, 11, 22.

Question 11easy

Find the minimum of x2+y2+z2x^2+y^2+z^2 subject to x+y+z=3x+y+z = 3.

Show answer
33, at (1,1,1)(1,1,1)

⟨2x,2y,2z⟩=λ⟨1,1,1⟩\langle2x,2y,2z\rangle = \lambda\langle1,1,1\rangle: x=y=z=λ2x = y = z = \frac\lambda2. Constraint: 3x=33x = 3, x=1x = 1.
The value is 1+1+1=31+1+1 = 3.

Question 12hard

Find the absolute extrema of f(x,y)=xy−2xf(x,y) = xy-2x on the closed triangle x≥0x\ge0, y≥0y\ge0, x+y≤4x+y\le4.

Show answer
Max 11 at (1,3)(1,3); min −8-8 at (4,0)(4,0)

Interior: fx=y−2=0f_x = y-2 = 0, fy=x=0f_y = x = 0: (0,2)(0,2), on the boundary (not an interior point).x=0x = 0: f=0f = 0. y=0y = 0: f=−2xf = -2x, [−8,0][-8,0].x+y=4x+y = 4: f=x(4−x)−2x=2x−x2f = x(4-x)-2x = 2x-x^2, 0≤x≤40\le x\le4; critical x=1x = 1: f=1f = 1 at (1,3)(1,3); end x=4x = 4: −8-8.
The largest is 11, the smallest is −8-8.

Verification: Absolute extrema were checked with a dense grid scan over the whole region (interior and boundary), Lagrange results with a parametric scan of the constraint curve (circle, ellipse, hyperbola, line, sphere), and the condition ∇f ∥ ∇g with numerical gradients in node (verify/MAT1052/12.mjs).

Review card

ABSOLUTE EXTREMA (closed, bounded region), 3 STEPS: 1) Interior critical points (∇f = 0), keep those INSIDE the region 2) Each piece of the boundary: parametrize / substitute → single-variable max-min (interior critical point of the piece + endpoints = vertices) 3) Compute f at all candidates: largest = max, smallest = min The second derivative test is NOT needed (just compare values) LAGRANGE: extremum of f under the constraint g(x,y,z) = k ∇f = λ∇g and g = k → solve the system of equations Compute f at all the points found, compare Solving the system: eliminate λ (by ratio, by multiplying); examine the zero cases SEPARATELY Distance → minimize its square If the constraint curve is unbounded (line, hyperbola) there may be no max or min