\(\def\ans#1{\bbox[border:1px solid green,6pt]{#1}}\)

Lagrange Multipliers

Procedure

Lagrange multipliers are a method used to optimize an objective function when the variables are constrained. Before, we used a constraint to reduce a function of three variables to one of two variables. Now, the function is given in terms of two variables, and x and y are limited.

Goal:

Maximize or minimize an objective function \(f(x,y)\).

Constraints:

\[g(x,y)=0\]

Procedure:

Let the objective function \(f\) and the constraint function \(g\) be differentiable on a region of \(\mathbb{R}^2\) with \(\nabla g (x,y) \neq \vec{0}\) on the curve \(g (x,y) = 0\).

  1. Find \(x\), \(y\), and \(\lambda\) such that \[\nabla f (x,y) = \lambda \nabla g (x,y)\ \textrm{ and }\ g(x,y) = 0.\] These are the candidates for the maxima and minima.
  2. Select the points \((x,y)\) that give the max/min values for \(f(x,y)\).

Examples

Find the absolute maximum and minimum for \(f(x,y)=2x^2+y^2+2\) subject to \(g(x,y)=x^2+4y^2-4=0\).

Solution

\[\begin{align} \nabla f (x,y) &= 4x \hat{\imath} + 2y \hat{\jmath}\\ \\ \nabla g (x,y) &= 2x \hat{\imath} + 8y \hat{\jmath} \end{align}\]

Set up the equality:

\[\begin{align} \nabla f (x,y) &= \lambda \nabla g (x,y)\\ \\ 4x &= \lambda 2x \longrightarrow 2x(2-\lambda)=0 \longrightarrow x=0 \textrm{ or } \lambda = 2\\ \textrm{ and } 2y &= \lambda 8y \longrightarrow 2y(1-4\lambda) = 0 \longrightarrow y=0 \textrm{ or } \lambda = \dfrac{1}{4} \end{align}\]

The third condition is that \(g(x,y)=0\):

  • If \(x=0\): \[0^2+4y^2-4 = 0 \longrightarrow y=1,-1\]
  • If \(y=0\): \[x^2+4(0)^2-4 = 0 \longrightarrow x = 2,-2\]

Thus, we have four candidates for the maximum and minimum: \((0,1)\), \((0,-1)\), \((2,0)\), and \((-2,0)\). We just need to test the function \(f\) at these four points and see which gives the largest value and which gives the smallest.

\[\begin{array}{c | c} (x,y) & f(x,y)\\ \hline (0,1) & 3\\ (0,-1) & 3\\ (2,0) & 10\\ (-2,0) & 10 \end{array}\]

Therefore, the maximum of this function is 10, attained at \((2,0)\) and \((-2,0)\), and the minimum is 3, attained at \((0,1)\) and \((0,-1)\).

Try it yourself:

(click on a problem to show/hide its answer)

  1. Find the absolute maximum and minimum of \(f(x,y)=xy\) subject to the constraint \(x^2+y^2-8y=9\).
  2. Maximum of 9 at \((3,3)\) and \((-3,-3)\); minimum of \(-3\) at \((-\sqrt{3},\sqrt{3})\) and \((\sqrt{3},-\sqrt{3})\)

  3. Find the absolute maximum and minimum of \(f(x,y)=y^2-4x^2\) subject to the constraint \(x^2+2y^2=4\).
  4. Maximum of 2 at \((0,\sqrt{2})\) and \((0,-\sqrt{2})\); minimum of \(-16\) at \((2,0)\) and \((-2,0)\)

Find the point on the surface \(4x+y-1=0\) closest to the point \((1,2,-3)\).

Solution

It will be easiest to minimize the squared distance from this point (subject to the constraint that the point lies on the surface):

\[\begin{align} f(x,y,z) &= (x-1)^2+(y-2)^2+(z+3)^2\\ \\ g(x,y,z) &= 4x+y-1 \end{align}\] Find the gradients: \[\begin{align} \nabla f (x,y,z) &= \langle 2x-2, 2y-4, 2z+6 \rangle\\ \\ \nabla g (x,y,z) &= \langle 4,1,0 \rangle \end{align}\]

Set up the equality, and equate the components:

\[\begin{align} \nabla f (x,y,z) &= \lambda \nabla g (x,y,z)\\ \\ 2x-2 &= 4\lambda \longrightarrow x=1+2\lambda\\ \textrm{ and } 2y-4 &= \lambda \longrightarrow y = 2+\dfrac{\lambda}{2}\\ \textrm{ and } 2z+6 &= 0 \longrightarrow z=-3 \end{align}\]

The last condition is that \(g(x,y)=0\):

\[\begin{align} 4x+y-1 &= 0\\ 4(1+2\lambda)+\left(2+\dfrac{\lambda}{2}\right)-1 &= 0\\ \dfrac{17\lambda}{2} &= -5\\ \lambda &= -\dfrac{10}{17} \end{align}\]

Therefore, the point on the given surface that is closest to \((1,2,-3)\) is

\[\left(-\dfrac{3}{17},\dfrac{29}{17},-3\right)\]