The Lagrange Multiplier Method

The Concept of a Constrained Extremum

Constrained extremum

Finding the extrema of the function z=f(x,y)z = f(x, y) (called the objective function) subject to the constraint φ(x,y)=0\varphi(x, y) = 0 is called a constrained extremum (or a constrained optimisation).

More generally, finding the extrema of a function of nn variables f(x1,…,xn)f(x_1, \ldots, x_n) subject to mm constraints

φi(x1,…,xn)=0(i=1,…,m)\varphi_i(x_1, \ldots, x_n) = 0 \quad (i = 1, \ldots, m)

is the general constrained extremum problem.

The Lagrange Multiplier Method (a Single Constraint)

Theorem1

To find the possible extremum points of the objective function z=f(x,y)z = f(x, y) subject to the constraint φ(x,y)=0\varphi(x, y) = 0, construct the Lagrangian function:

L(x,y,λ)=f(x,y)+λφ(x,y)L(x, y, \lambda) = f(x, y) + \lambda \varphi(x, y)

where λ\lambda is called the Lagrange multiplier. Set all the first-order partial derivatives of LL equal to zero:

{Lx=fx+λφx=0Ly=fy+λφy=0Lλ=φ(x,y)=0\begin{cases} L_x = f_x + \lambda \varphi_x = 0 \\ L_y = f_y + \lambda \varphi_y = 0 \\ L_\lambda = \varphi(x, y) = 0 \end{cases}

The (x,y)(x, y) obtained by solving this system are the possible constrained extremum points.

A Geometric Explanation

The Lagrange Multiplier Method (Multiple Constraints)

Theorem2

To find the possible extremum points of the objective function u=f(x,y,z)u = f(x, y, z) subject to the two constraints φ(x,y,z)=0\varphi(x, y, z) = 0 and ψ(x,y,z)=0\psi(x, y, z) = 0, construct the Lagrangian function:

L(x,y,z,λ,μ)=f(x,y,z)+λφ(x,y,z)+μψ(x,y,z)L(x, y, z, \lambda, \mu) = f(x, y, z) + \lambda \varphi(x, y, z) + \mu \psi(x, y, z)

Set all the first-order partial derivatives equal to zero:

{Lx=fx+λφx+μψx=0Ly=fy+λφy+μψy=0Lz=fz+λφz+μψz=0Lλ=φ=0Lμ=ψ=0\begin{cases} L_x = f_x + \lambda \varphi_x + \mu \psi_x = 0 \\ L_y = f_y + \lambda \varphi_y + \mu \psi_y = 0 \\ L_z = f_z + \lambda \varphi_z + \mu \psi_z = 0 \\ L_\lambda = \varphi = 0 \\ L_\mu = \psi = 0 \end{cases}

Solving the system gives the possible constrained extremum points.

In general, mm constraints call for mm Lagrange multipliers λ1,…,λm\lambda_1, \ldots, \lambda_m.

Deciding Whether an Extremum Point Is Indeed One

Worked Examples

Example 1: A Constrained Extremum with a Single Constraint

Find the extrema of the function f(x,y)=xyf(x, y) = xy subject to the constraint x+y=1x + y = 1.

a constrained extremumthe Lagrange multiplier methoda single constraint

Approach:

Write the constraint as φ=0\varphi=0, construct the Lagrangian function, set its partial derivatives with respect to the two variables to zero, and solve the system together with the constraint.

Steps:

  1. The constraint φ(x,y)=x+y−1=0\varphi(x,y) = x+y-1 = 0
  2. The Lagrangian function: L=xy+λ(x+y−1)L = xy + \lambda(x+y-1)
  3. Lx=y+λ=0L_x = y+\lambda=0, Ly=x+λ=0L_y = x+\lambda=0 and Lλ=x+y−1=0L_\lambda = x+y-1=0
  4. From the first two equations: x=y=−λx = y = -\lambda; substituting into the third: 2x=12x=1 and x=y=12x=y=\frac{1}{2}
  5. The stationary point (12,12)(\frac{1}{2}, \frac{1}{2}), and f(12,12)=14f(\frac{1}{2},\frac{1}{2}) = \frac{1}{4}
  6. Deciding: substituting y=1−xy=1-x gives f=x(1−x)=x−x2f=x(1-x)=x-x^2, a downward-opening parabola, which attains its maximum value 14\frac{1}{4} at x=12x=\frac{1}{2}.

Answer: the constrained local maximum is 14\frac{1}{4} (at (12,12)(\frac{1}{2},\frac{1}{2})), and there is no constrained minimum (as x→±∞x\to\pm\infty, f→−∞f\to-\infty).

Example 2: A Constrained Extremum with Two Constraints

Find the extrema of the function f(x,y,z)=xyzf(x, y, z) = xyz subject to the constraints x2+y2=1x^2 + y^2 = 1 and x+z=1x + z = 1.

a constrained extremumthe Lagrange multiplier methodtwo constraints

Approach:

With two constraints you introduce two multipliers; the partial derivatives of the Lagrangian with respect to the three variables, together with the two constraint equations, give five equations to solve.

Steps:

  1. The constraints φ=x2+y2−1=0\varphi = x^2+y^2-1=0 and ψ=x+z−1=0\psi = x+z-1=0
  2. L=xyz+λ(x2+y2−1)+μ(x+z−1)L = xyz + \lambda(x^2+y^2-1) + \mu(x+z-1)
  3. Lx=yz+2λx+μ=0L_x = yz + 2\lambda x + \mu = 0 Ly=xz+2λy=0L_y = xz + 2\lambda y = 0 Lz=xy+μ=0L_z = xy + \mu = 0 Lλ=x2+y2−1=0L_\lambda = x^2+y^2-1 = 0 Lμ=x+z−1=0L_\mu = x+z-1 = 0
  4. From Lz=0L_z=0: μ=−xy\mu = -xy
  5. From Ly=0L_y=0: xz=−2λyxz = -2\lambda y; if y≠0y\neq0 then λ=−xz2y\lambda = -\frac{xz}{2y}
  6. Substituting into Lx=0L_x=0: yz−x2zy−xy=0yz - \frac{x^2z}{y} - xy = 0, that is, z(y2−x2)=xy2z(y^2-x^2) = xy^2
  7. Substituting z=1−xz=1-x and y2=1−x2y^2=1-x^2 and simplifying gives the concrete solutions
  8. The stationary points: (12,±32,12)(\frac{1}{2}, \pm\frac{\sqrt{3}}{2}, \frac{1}{2}), with f=±38f = \pm\frac{\sqrt{3}}{8}; and (−1,0,2)(-1, 0, 2) and (1,0,0)(1,0,0), with f=0f=0
  9. Comparing: the maximum is 38\frac{\sqrt{3}}{8} and the minimum is −38-\frac{\sqrt{3}}{8}

Answer: the constrained local maximum is 38\frac{\sqrt{3}}{8} (at (12,32,12)(\frac{1}{2},\frac{\sqrt{3}}{2},\frac{1}{2})), and the constrained local minimum is −38-\frac{\sqrt{3}}{8} (at (12,−32,12)(\frac{1}{2},-\frac{\sqrt{3}}{2},\frac{1}{2})).

Example 3: The Extreme Distances

Find the longest and the shortest distance from the origin to the curve {x2+y2=1x+y+z=1\begin{cases} x^2 + y^2 = 1 \\ x + y + z = 1 \end{cases}.

a constrained extremumdistancetwo constraintsthe maximum value

Approach:

Minimising the distance is equivalent to minimising the square of the distance, which avoids the square root and makes the derivatives cleaner.

Steps:

  1. The objective function: the square of the distance f(x,y,z)=x2+y2+z2f(x,y,z) = x^2+y^2+z^2 (minimising the distance is equivalent to minimising its square)
  2. The constraints: φ=x2+y2−1=0\varphi = x^2+y^2-1=0 and ψ=x+y+z−1=0\psi = x+y+z-1=0
  3. L=x2+y2+z2+λ(x2+y2−1)+μ(x+y+z−1)L = x^2+y^2+z^2 + \lambda(x^2+y^2-1) + \mu(x+y+z-1)
  4. Lx=2x+2λx+μ=0L_x = 2x+2\lambda x+\mu=0, Ly=2y+2λy+μ=0L_y = 2y+2\lambda y+\mu=0 and Lz=2z+μ=0L_z = 2z+\mu=0
  5. From the first two: 2(x−y)(1+λ)=02(x-y)(1+\lambda)=0, so x=yx=y or λ=−1\lambda=-1
  6. If x=yx=y: from x2+y2=1x^2+y^2=1 we get x=y=±12x=y=\pm\frac{1}{\sqrt{2}} and z=1∓2z=1\mp\sqrt{2}
    • (12,12,1−2)(\frac{1}{\sqrt{2}},\frac{1}{\sqrt{2}},1-\sqrt{2}): f=1+(1−2)2=4−22f = 1 + (1-\sqrt{2})^2 = 4-2\sqrt{2}
    • (−12,−12,1+2)(-\frac{1}{\sqrt{2}},-\frac{1}{\sqrt{2}},1+\sqrt{2}): f=1+(1+2)2=4+22f = 1 + (1+\sqrt{2})^2 = 4+2\sqrt{2}
  7. If λ=−1\lambda=-1: from Lx=0L_x=0 we get μ=0\mu=0, from Lz=0L_z=0 we get z=0z=0, and from x+y=1x+y=1 and x2+y2=1x^2+y^2=1 we get xy=0xy=0, that is, (1,0,0)(1,0,0) or (0,1,0)(0,1,0), with f=1f=1
  8. Comparing: the shortest distance =1=1, and the longest distance =4+22=\sqrt{4+2\sqrt{2}}

Answer: the shortest distance is 11, and the longest distance is 4+22\sqrt{4+2\sqrt{2}}.


Exercises

Exercise 1

Find the minimum of f(x,y)=x2+y2f(x, y) = x^2 + y^2 subject to the constraint xa+yb=1\frac{x}{a} + \frac{y}{b} = 1.

a constrained extremumthe Lagrange multiplier methodthe minimum value

Approach:

The objective function is exactly the square of the distance from the origin to the line, so the minimum is the square of that distance.

Steps:

  1. L=x2+y2+λ(xa+yb−1)L = x^2+y^2 + \lambda(\frac{x}{a}+\frac{y}{b}-1)
  2. Lx=2x+λa=0L_x = 2x+\frac{\lambda}{a}=0 and Ly=2y+λb=0L_y = 2y+\frac{\lambda}{b}=0
  3. x=−λ2ax = -\frac{\lambda}{2a} and y=−λ2by = -\frac{\lambda}{2b}; substituting into the constraint: −λ2a2−λ2b2=1-\frac{\lambda}{2a^2}-\frac{\lambda}{2b^2}=1, so λ=−2a2b2a2+b2\lambda = -\frac{2a^2b^2}{a^2+b^2}
  4. x=ab2a2+b2x = \frac{ab^2}{a^2+b^2} and y=a2ba2+b2y = \frac{a^2b}{a^2+b^2}
  5. The minimum f=a2b4+a4b2(a2+b2)2=a2b2a2+b2f = \frac{a^2b^4+a^4b^2}{(a^2+b^2)^2} = \frac{a^2b^2}{a^2+b^2}

Answer: the minimum is a2b2a2+b2\frac{a^2b^2}{a^2+b^2} (this is the square of the distance from the origin to the line xa+yb=1\frac{x}{a}+\frac{y}{b}=1).

Exercise 2

Find the largest volume of a rectangular box whose surface area is a2a^2.

a constrained extremuma rectangular boxthe maximum valuean application

Approach:

When the surface area is fixed, the volume is largest; by symmetry one expects the optimum to be a cube, and the Lagrange multiplier method confirms it.

Steps:

  1. Let the length, width and height be x,y,zx,y,z; the objective is V=xyzV=xyz and the constraint is 2(xy+yz+xz)=a22(xy+yz+xz)=a^2
  2. L=xyz+λ(2xy+2yz+2xz−a2)L = xyz + \lambda(2xy+2yz+2xz-a^2)
  3. Lx=yz+2λ(y+z)=0L_x = yz+2\lambda(y+z)=0, Ly=xz+2λ(x+z)=0L_y = xz+2\lambda(x+z)=0 and Lz=xy+2λ(x+y)=0L_z = xy+2\lambda(x+y)=0
  4. From the first two: yz(x+z)=xz(y+z)yz(x+z) = xz(y+z), which simplifies to x=yx=y; similarly y=zy=z
  5. Hence x=y=zx=y=z, and substituting into the constraint: 6x2=a26x^2=a^2 and x=a6x=\frac{a}{\sqrt{6}}
  6. The maximum volume V=(a6)3=a366V = (\frac{a}{\sqrt{6}})^3 = \frac{a^3}{6\sqrt{6}}

Answer: the maximum volume is a366\frac{a^3}{6\sqrt{6}} (when the box is a cube).


Summary

Symbols Used in This Article

SymbolTypePronunciation/ExplanationMeaning in This Article
LLLagrangianLagrangianThe Lagrangian function
λ,μ\lambda, \muLagrange multiplierlambda, muThe Lagrange multipliers
φ,ψ\varphi, \psiConstraint functionconstraint functionsThe constraint functions
ffObjective functionobjective functionThe function whose extremum is sought
∇φ\nabla \varphiGradientgradientThe gradient of the constraint function

Found an issue with this content?

Tell us what could be improved.