Skip to main content

Thomas’ Calculus · Chapter 14 · Section 14.8

By Muhammad Abdullah Athar · SymPy Verified

Lagrange Multipliers

❦

Read this page the way you would a book: first the notes, then the key ideas, then every worked example in order — each step explains not only what to do, but why it works.

Part One

Section Notes

❧

Section 14.8: Lagrange Multipliers

The method of Lagrange multipliers optimizes functions subject to equality constraints.


1. Single Constraint ∇f=λ∇g\nabla f = \lambda \nabla g

Solve the system of equations: {fx=λgxfy=λgyfz=λgzg(x,y,z)=k\begin{cases} f_x = \lambda g_x \\ f_y = \lambda g_y \\ f_z = \lambda g_z \\ g(x, y, z) = k \end{cases}

The scalar λ\lambda represents the marginal rate of change of the optimal value with respect to the constraint level kk: λ=df∗dk\lambda = \frac{df^*}{dk}.


2. Two Constraints ∇f=λ∇g+μ∇h\nabla f = \lambda \nabla g + \mu \nabla h

When restricted to the intersection curve of two surfaces g=k1g = k_1 and h=k2h = k_2: ∇f=λ∇g+μ∇h\nabla f = \lambda \nabla g + \mu \nabla h

Part Two

Key Ideas to Remember

2 essential statements for this section, each with a plain-words explanation.

Theorem #1Sec 14.8

Method of Lagrange Multipliers (One Constraint)

∇f=λ∇g,g(x,y,z)=k\nabla f = \lambda \nabla g, \quad g(x, y, z) = k

To find the maximum and minimum values of f(x, y, z) subject to constraint g(x, y, z) = k (assuming grad g != 0 on the constraint surface), find all values of x, y, z and scalar multiplier lambda satisfying grad f = lambda grad g alongside g = k.

Conditions: grad g != 0 on the level surface g = k; f and g have continuous partials

In plain words: At an extremum, the level surface of f must be tangent to the constraint surface g = k, meaning their normal gradient vectors must be parallel.

Remember — Transforms constrained optimization into an unconstrained system of equations.

Theorem #2Sec 14.8

Lagrange Multipliers with Two Constraints

∇f=λ∇g+μ∇h,g=k1,  h=k2\nabla f = \lambda \nabla g + \mu \nabla h, \quad g = k_1, \; h = k_2

To optimize f subject to two simultaneous constraints g = k_1 and h = k_2, the gradient of f must lie in the plane spanned by the constraint gradients grad g and grad h.

Conditions: grad g and grad h are linearly independent

In plain words: The curve of intersection of the two constraint surfaces is orthogonal to grad f at the extremum point.

Remember — Optimizes functions along space curves formed by intersecting surfaces.

Part Three

Worked Examples

5 exercises, solved in full. Every answer has been checked symbolically with SymPy before printing.

Example 01(Section 14.8, Exercise 1)

Warm-up

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

Step-by-Step Derivation (3 steps)

1

Set Up Lagrange Multiplier Gradients

∇f=⟨y,x⟩,∇g=⟨1,1⟩  ⟹  ⟨y,x⟩=λ⟨1,1⟩\nabla f = \langle y, x \rangle, \quad \nabla g = \langle 1, 1 \rangle \implies \langle y, x \rangle = \lambda \langle 1, 1 \rangle

Compute gradients of objective f and constraint g(x, y) = x + y - 10.

Why this works: Formulating Lagrange system.
2

Solve for Variables and Multiplier

y=λ,  x=λ  ⟹  x=y;x+x=10  ⟹  2x=10  ⟹  x=5,  y=5y = \lambda, \; x = \lambda \implies x = y; \quad x + x = 10 \implies 2x = 10 \implies x = 5, \; y = 5

Equate x and y and substitute into constraint.

Why this works: Finding critical point on constraint.
3

Evaluate Maximum Value

f(5,5)=(5)(5)=25f(5, 5) = (5)(5) = 25

Multiply optimal values.

Why this works: Computing optimal objective value.

Answer: Maximum is 25 at (5,5)\text{Maximum is } 25 \text{ at } (5, 5)

✓ Verified by SymPy CAS

Example 02(Section 14.8, Exercise 2)

Core practice

Problem. Find the point on the plane 2x - y + z = 6 closest to the origin, and compute that minimum distance.

Step-by-Step Derivation (4 steps)

1

Formulate Squared Distance Objective Function

f(x,y,z)=x2+y2+z2;g(x,y,z)=2x−y+z=6f(x, y, z) = x^2 + y^2 + z^2; \quad g(x, y, z) = 2x - y + z = 6

Minimizing squared distance avoids square root radicals.

Why this works: Setting up equivalent smooth objective.
2

Apply Lagrange Gradient Condition

⟨2x,2y,2z⟩=λ⟨2,−1,1⟩  ⟹  x=λ,  y=−λ2,  z=λ2\langle 2x, 2y, 2z \rangle = \lambda \langle 2, -1, 1 \rangle \implies x = \lambda, \; y = -\frac{\lambda}{2}, \; z = \frac{\lambda}{2}

Express coordinates in terms of multiplier lambda.

Why this works: Parametrizing variables via lambda.
3

Substitute into Plane Constraint

2(λ)−(−λ2)+(λ2)=6  ⟹  3λ=6  ⟹  λ=22(\lambda) - \left(-\frac{\lambda}{2}\right) + \left(\frac{\lambda}{2}\right) = 6 \implies 3\lambda = 6 \implies \lambda = 2

Solve for multiplier lambda = 2.

Why this works: Finding specific multiplier value.
4

Compute Coordinates and Distance

x=2,  y=−1,  z=1  ⟹  d=22+(−1)2+12=4+1+1=6x = 2, \; y = -1, \; z = 1 \implies d = \sqrt{2^2 + (-1)^2 + 1^2} = \sqrt{4 + 1 + 1} = \sqrt{6}

Calculate Euclidean distance from origin.

Why this works: Evaluating shortest distance.

Answer: Closest point: (2,−1,1),Distance: 6\text{Closest point: } (2, -1, 1), \quad \text{Distance: } \sqrt{6}

✓ Verified by SymPy CAS

Example 03(Section 14.8, Exercise 3)

Core practice

Problem. Find the maximum and minimum values of f(x, y) = x^2 + 2y subject to x^2 + y^2 = 1.

Step-by-Step Derivation (3 steps)

1

Set Up Lagrange System

∇f=⟨2x,2⟩,∇g=⟨2x,2y⟩  ⟹  2x=2λx,2=2λy\nabla f = \langle 2x, 2 \rangle, \quad \nabla g = \langle 2x, 2y \rangle \implies 2x = 2\lambda x, \quad 2 = 2\lambda y

Equate gradient components with scalar multiplier lambda.

Why this works: Formulating Lagrange equations.
2

Analyze Case x = 0 and Case lambda = 1

2x(1−λ)=0  ⟹  x=0 or λ=1.If x=0:y2=1  ⟹  y=±12x(1 - \lambda) = 0 \implies x = 0 \text{ or } \lambda = 1. \quad \text{If } x = 0: y^2 = 1 \implies y = \pm 1

Examine roots of the first equation.

Why this works: Branching solution cases.
3

Evaluate Objective at Candidate Points

f(0,1)=0+2(1)=2;f(0,−1)=0+2(−1)=−2f(0, 1) = 0 + 2(1) = 2; \quad f(0, -1) = 0 + 2(-1) = -2

Compare candidate values.

Why this works: Identifying global extrema.

Answer: Maximum: 2 at (0,1);Minimum: −2 at (0,−1)\text{Maximum: } 2 \text{ at } (0, 1); \quad \text{Minimum: } -2 \text{ at } (0, -1)

✓ Verified by SymPy CAS

Example 04(Section 14.8, Exercise 4)

Challenge

Problem. Find the difference between the maximum and minimum values of f(x, y, z) = z subject to x + y + z = 1 and x^2 + y^2 = 1.

Step-by-Step Derivation (3 steps)

1

Express z in Terms of Constraint Variables

z=1−(x+y)z = 1 - (x + y)

From the planar constraint x + y + z = 1, z is maximized when x + y is minimized.

Why this works: Reducing to single constraint optimization.
2

Optimize x + y on the Unit Circle

∇(x+y)=λ∇(x2+y2)  ⟹  ⟨1,1⟩=λ⟨2x,2y⟩  ⟹  x=y=±12\nabla(x + y) = \lambda \nabla(x^2 + y^2) \implies \langle 1, 1 \rangle = \lambda \langle 2x, 2y \rangle \implies x = y = \pm \frac{1}{\sqrt{2}}

The extrema of x + y on the unit circle are +- sqrt(2).

Why this works: Finding extreme values of x + y.
3

Compute Maximum and Minimum Values of z

zmax⁡=1−(−2)=1+2,zmin⁡=1−2  ⟹  zmax⁡−zmin⁡=22z_{\max} = 1 - (-\sqrt{2}) = 1 + \sqrt{2}, \quad z_{\min} = 1 - \sqrt{2} \implies z_{\max} - z_{\min} = 2\sqrt{2}

Subtract minimum from maximum.

Why this works: Evaluating difference between extrema.

Answer: zmax⁡−zmin⁡=22z_{\max} - z_{\min} = 2\sqrt{2}

✓ Verified by SymPy CAS

Example 05(Section 14.8, Exercise 5)

Core practice

Problem. Maximize production P(L, K) = 50 L^(0.5) K^(0.5) subject to budget constraint 100 L + 200 K = 40000.

Step-by-Step Derivation (3 steps)

1

Set Up Lagrange Ratio of Marginal Productivities

∂P/∂L100=∂P/∂K200  ⟹  25L−0.5K0.5100=25L0.5K−0.5200  ⟹  K100L=1200  ⟹  L=2K\frac{\partial P / \partial L}{100} = \frac{\partial P / \partial K}{200} \implies \frac{25 L^{-0.5} K^{0.5}}{100} = \frac{25 L^{0.5} K^{-0.5}}{200} \implies \frac{K}{100 L} = \frac{1}{200} \implies L = 2K

Equating marginal product per dollar yields capital-labor expansion path L = 2K.

Why this works: Finding optimal factor ratio.
2

Substitute into Budget Constraint

100(2K)+200K=40000  ⟹  400K=40000  ⟹  K=100,  L=200100(2K) + 200K = 40000 \implies 400K = 40000 \implies K = 100, \; L = 200

Solve linear budget equation.

Why this works: Finding optimal input quantities.
3

Compute Maximum Production

P(200,100)=50200×100=5020000=50(1002)=50002P(200, 100) = 50 \sqrt{200 \times 100} = 50 \sqrt{20000} = 50(100\sqrt{2}) = 5000\sqrt{2}

Substitute optimal L and K into production function.

Why this works: Evaluating maximum output.

Answer: Pmax⁡=50002 units at L=200,  K=100P_{\max} = 5000\sqrt{2} \text{ units at } L = 200, \; K = 100

✓ Verified by SymPy CAS