20  Lagrange multipliers II

NoteRemark

The Lagrangian combines the objective function \(f\) and the constraint function \(g\):

\[\mathcal{L}(x_1,\dots,x_n,\lambda) = f(x_1,\dots,x_n) - \lambda ( g(x_1,\dots,x_n) - c ).\]

This auxiliary function is useful because its gradient encodes the \(n+1\) Lagrange equations:

\[\nabla \mathcal{L} = \langle f_{x_1} - \lambda g_{x_1}, \cdots, f_{x_n} - \lambda g_{x_n}, g - c \rangle.\]

The critical points (the stationary points) of the Lagrangian are the solutions to our optimization problem.

TipMethod of Lagrange multipliers (Stewart, Clegg, and Watson 2020, 14.8.1)

We want to optimize \(f(x_1,\dots,x_n)\) subject to a constraint \(g(x_1,\dots,x_n) = c\).

  1. Compute the gradient of the Lagrangian \(\mathcal{L}(x_1,\dots,x_n,\lambda) = f - \lambda (g-c)\),
  2. Set \(\nabla \mathcal{L} = 0\) (a system of equations) and solve to find stationary points, and
  3. Plug the stationary points into \(f(x_1,\dots,x_n)\) to determine extreme values.

We take \(f(x,y) = (x - 2)^2 + y^2\) (since the square of a function inherits critical points), \(g(x,y) = x^2 - 5 y^2\), and \(c = 1\), which gives the stationary points \((-1, 0, 3), (1, 0, -1), (\tfrac{5}{3}, -\tfrac{4}{3\sqrt{5}}, -\frac{1}{5}), (\tfrac{5}{3}, \tfrac{4}{3\sqrt{5}}, -\frac{1}{5})\). The last two give minima (\(f=\frac{7}{15}\)), and all are visualized below in red:

What is the significance of the points that did not give the absolute minimum?

Caution

This code solves the above system, and can be used to check your solutions in Homework.

f = (x - 2)^2 + y^2;
g = x^2 - 5 y^2;
c = 1;
L = f - λ (g - c);
gradL = Grad[L, {x, y, λ}];
solutions = Solve[gradL == 0, {x, y, λ}, Reals]
f /. solutions

Try modifying the code to solve problems in more variables!

The stationary points of the Lagrangian are: \[(0, 0, 0), (\tfrac{1}{\sqrt{5}}, \tfrac{2}{\sqrt{5}}, \tfrac{3}{5 \sqrt{5} e}), (-\tfrac{1}{\sqrt{5}}, -\tfrac{2}{\sqrt{5}}, -\tfrac{3}{5 \sqrt{5} e}).\] The first is the minimum (\(f=0\)) and the last two are maxima (\(f=\frac{2}{5e}\)).

Stewart, James, Daniel K. Clegg, and Saleem Watson. 2020. Calculus: Early Transcendentals. 9th ed. Cengage Learning.