Lagrange multipliers
Setting the gradient to zero finds the extremes of a function over an open region. Where are its largest and smallest values when the inputs must stay on a curve or a surface, such as a budget line or a sphere, that is awkward to solve for one variable?
Where you are 8 in Partial derivatives
Why this exists
Extrema and the second derivative test found extremes on a closed bounded region from the critical points inside and the values on the boundary, parametrizing each edge of a rectangle. Many constraints arrive as an equation instead: the sphere x^2 + y^2 + z^2 = 9, a budget 2x + y = 12, the surface z^2 = xy + 4. Solving for one variable may be impossible, may split the set (two signs of a square root), or may break a symmetry.
Lagrange’s condition replaces the substitution with a statement about gradients: at an extreme of f on the level set g = k, \nabla f is a multiple of \nabla g. It treats every variable alike, and the multiple measures how the best value changes as the constraint is loosened. Hannah and Owen use that to split a budget (Example 3).
Definition
Throughout, U \subseteq \mathbb{R}^n is open, f, g : U \to \mathbb{R} are of class C^1 (first partials exist and are continuous on U), and k is a number.
- The constraint set is S = \{\mathbf{x} \in U : g(\mathbf{x}) = k\}, a level curve or level surface of g (Functions of several variables and level sets); f is the objective.
- f has a local maximum on S at \mathbf{a} \in S if some open ball B about \mathbf{a} has f(\mathbf{x}) \le f(\mathbf{a}) for every \mathbf{x} \in B \cap S; a local minimum reverses the inequality, and an absolute extremum on S compares with all of S. Only points of S are compared.
- \mathbf{a} \in S is regular if \nabla g(\mathbf{a}) \ne \mathbf{0}.
- A Lagrange point of f on S is a point \mathbf{a} for which some number \lambda, a Lagrange multiplier, solves the Lagrange system
n + 1 equations in a_1, \dots, a_n, \lambda. With two constraints g = k, h = c, the system is \nabla f = \lambda \nabla g + \mu \nabla h with both constraints.
Intuition
Move along a constraint curve by a path \mathbf{r}(t). By the chain rule in gradient form (Result 1 of Gradient and directional derivatives), f changes at the rate \nabla f \cdot \mathbf{r}'(t), which is 0 at a constrained extremum. So \nabla f is perpendicular to the curve, and so is \nabla g, since g is constant on it (Result 4 there). A plane curve has one normal direction, so the gradients are parallel.
In Figure 1, where a level curve xy = c crosses the ellipse, as xy = 1 does, f is above c on one side of the crossing and below it on the other: no extreme. Extremes sit where a level curve just touches the constraint, sharing its tangent line, so the normals \nabla f and \nabla g are parallel. In three variables the level surface of f touches the surface S the same way; Results 1 and 2 make this exact.
Results
Result 1 (implicit function theorem, one equation). Let g be of class C^1 on an open set U \subseteq \mathbb{R}^n, n \ge 2, and \mathbf{a} \in U with g(\mathbf{a}) = k and g_{x_n}(\mathbf{a}) \ne 0. Write points as (\mathbf{x}', x_n) with \mathbf{x}' \in \mathbb{R}^{n-1}, and \mathbf{a} = (\mathbf{a}', a_n). Then there are an open ball B' about \mathbf{a}', an open interval J about a_n with B' \times J \subseteq U, and a C^1 function \varphi : B' \to J with \varphi(\mathbf{a}') = a_n, such that a point (\mathbf{x}', x_n) of B' \times J has g(\mathbf{x}', x_n) = k exactly when x_n = \varphi(\mathbf{x}'). The same holds for any variable whose partial at \mathbf{a} is nonzero.
Result 2 (Lagrange’s theorem). Let f, g be of class C^1 on an open set U \subseteq \mathbb{R}^n and S = \{g = k\}. If f has a local extremum on S at a regular point \mathbf{a}, then \nabla f(\mathbf{a}) = \lambda \nabla g(\mathbf{a}) for exactly one number \lambda.
Result 3 (two constraints). Let f, g, h be of class C^1 on an open set U \subseteq \mathbb{R}^n, n \ge 3, and S = \{g = k,\ h = c\}. If f has a local extremum on S at \mathbf{a} and \nabla g(\mathbf{a}), \nabla h(\mathbf{a}) are linearly independent, then \nabla f(\mathbf{a}) = \lambda \nabla g(\mathbf{a}) + \mu \nabla h(\mathbf{a}) for some numbers \lambda, \mu.
Result 4 (closed bounded constraint sets). With f, g as in Result 2, if S is nonempty, closed and bounded, then f has an absolute maximum and minimum on S, each taken at a point where \nabla g = \mathbf{0} or at a Lagrange point.
Result 5 (the multiplier as a rate). Let I be an open interval and, for each k \in I, let \mathbf{x}^*(k) \in U satisfy g(\mathbf{x}^*(k)) = k and \nabla f(\mathbf{x}^*(k)) = \lambda(k) \nabla g(\mathbf{x}^*(k)). If k \mapsto \mathbf{x}^*(k) is differentiable, then M(k) = f(\mathbf{x}^*(k)) has M'(k) = \lambda(k).
Why it is true
Result 1 is stated without proof: for two and three variables it is the implicit function theorem stated in The multivariable chain rule, and the n-variable form is proved in Real Analysis.
Result 2. Let \mathbf{u} = \nabla g(\mathbf{a}) \ne \mathbf{0}.
Step 1: every \mathbf{v} with \mathbf{u} \cdot \mathbf{v} = 0 is the velocity of a path in S. Rename the variables so that g_{x_n}(\mathbf{a}) \ne 0, and take B', J, \varphi from Result 1. Write \mathbf{v} = (\mathbf{v}', v_n) and, for small \lvert t \rvert, let \mathbf{r}(t) = (\mathbf{a}' + t\mathbf{v}', \varphi(\mathbf{a}' + t\mathbf{v}')), a path in S with \mathbf{r}(0) = \mathbf{a}. As \varphi has continuous partials it is differentiable (Result 2 of Tangent planes and linear approximation), and the chain rule gives \mathbf{r}'(0) = (\mathbf{v}', s) with s = \nabla\varphi(\mathbf{a}') \cdot \mathbf{v}'. Differentiating g(\mathbf{r}(t)) = k at t = 0 gives \mathbf{u} \cdot \mathbf{r}'(0) = 0; subtracting \mathbf{u} \cdot \mathbf{v} = 0 leaves g_{x_n}(\mathbf{a})(s - v_n) = 0, so \mathbf{r}'(0) = \mathbf{v}.
Step 2: \nabla f(\mathbf{a}) \cdot \mathbf{v} = 0. For small \lvert t \rvert, \mathbf{r}(t) \in B \cap S, B the ball of the local extremum, so F(t) = f(\mathbf{r}(t)) has a local extremum at 0. By the chain rule F'(0) = \nabla f(\mathbf{a}) \cdot \mathbf{v}, and Fermat’s theorem (Critical points and local versus absolute extrema) makes it 0.
Step 3. Let \lambda = \dfrac{\nabla f(\mathbf{a}) \cdot \mathbf{u}}{\lVert \mathbf{u} \rVert^2} and \mathbf{w} = \nabla f(\mathbf{a}) - \lambda\mathbf{u}. Then \mathbf{w} \cdot \mathbf{u} = 0, so Step 2 with \mathbf{v} = \mathbf{w} gives
So \nabla f(\mathbf{a}) = \lambda\mathbf{u}, and \lambda is unique because \mathbf{u} \ne \mathbf{0}.
Result 3. The rows \nabla g(\mathbf{a}), \nabla h(\mathbf{a}) have rank 2, so some 2 \times 2 minor, the Jacobian of (g, h) in two of the variables, is nonzero at \mathbf{a}. The implicit function theorem for two equations, proved in Real Analysis, solves the constraints near \mathbf{a} for those two variables as C^1 functions of the others. Step 1 runs as before: for \mathbf{v} perpendicular to both gradients, the solved components of the path’s velocity and of \mathbf{v} satisfy one 2 \times 2 linear system with nonzero determinant, so they agree. So \nabla f(\mathbf{a}) \cdot \mathbf{v} = 0 for every \mathbf{v} perpendicular to W = \operatorname{span}\{\nabla g(\mathbf{a}), \nabla h(\mathbf{a})\}. Write \nabla f(\mathbf{a}) = \mathbf{p} + \mathbf{w} with \mathbf{p} \in W, \mathbf{w} perpendicular to W (Orthogonal bases and projection onto a subspace); then 0 = \nabla f(\mathbf{a}) \cdot \mathbf{w} = \mathbf{w} \cdot \mathbf{w}, so \nabla f(\mathbf{a}) = \mathbf{p} \in W.
Result 4. The extremes exist by the extreme value theorem (Result 5 of Extrema and the second derivative test, stated there without proof). An absolute extremum on S is a local one; at a regular point Result 2 makes it a Lagrange point.
Result 5. f and g are differentiable, having continuous partials, so by the chain rule
Differentiating g(\mathbf{x}^*(k)) = k the same way makes the last dot product 1.
Worked examples
Hyperbolas that touch an ellipse
Find the maximum and minimum of f(x, y) = xy on the ellipse x^2 + 4y^2 = 8.
Solution\nabla g = \langle 2x, 8y \rangle is \mathbf{0} only at the origin, off the ellipse, which is closed and bounded; so by Result 4 both extremes are Lagrange points. With \nabla f = \langle y, x \rangle the system is
Putting the first into the second gives x = 16\lambda^2 x. If x = 0, then y = 0, off the ellipse; so \displaystyle \lambda = \pm\frac14. For \displaystyle \lambda = \frac14, \displaystyle y = \frac{x}{2} and 2x^2 = 8: the points (2, 1) and (-2, -1), where f = 2. For \displaystyle \lambda = -\frac14: the points (2, -1) and (-2, 1), where f = -2. The maximum is 2 and the minimum -2 (Figure 1).
Check: on the ellipse 8 - 4xy = (x - 2y)^2 \ge 0, so xy \le 2; the same with x + 2y gives xy \ge -2.
A closed disk, inside and on the rim
Find the absolute maximum and minimum of f(x, y) = x^2 + 3y^2 - 2x on the closed disk x^2 + y^2 \le 4.
SolutionBy Result 5 of Extrema and the second derivative test the extremes are at critical points inside or on the circle. Inside, f_x = 2x - 2 and f_y = 6y vanish only at (1, 0), where f = -1. On the circle, where \nabla g = \langle 2x, 2y \rangle \ne \mathbf{0}, the system is
The second equation is 2y(3 - \lambda) = 0. If y = 0, then x = \pm 2, with f(2, 0) = 0 and f(-2, 0) = 8. If \lambda = 3, then \displaystyle x = -\frac12, \displaystyle y^2 = \frac{15}{4}, and \displaystyle f = \frac14 + \frac{45}{4} + 1 = \frac{25}{2}. So the absolute maximum is \displaystyle \frac{25}{2}, at \displaystyle \left(-\frac12, \pm\frac{\sqrt{15}}{2}\right), and the absolute minimum is -1, at (1, 0) (Figure 2). The Lagrange point (-2, 0) is only a local minimum on the circle, where f = 12 - 2x^2 - 2x.
Zine fairs or online ads
Hannah and Owen publish a zine. A day at a zine fair costs them \$200; ads they buy by the hundred dollars. They model the new subscribers from x fair days and y hundred dollars of ads as Q(x, y) = 12x + 10y - x^2 - y^2, with x, y continuous. How should they spend \$1200, and about how many subscribers would one more hundred dollars bring?
SolutionIn hundreds of dollars the budget is 2x + y = 12, with \nabla g = \langle 2, 1 \rangle. The system gives 12 - 2x = 2\lambda and 10 - 2y = \lambda, so x = 6 - \lambda, \displaystyle y = 5 - \frac{\lambda}{2}, and the budget reads \displaystyle 17 - \frac52\lambda = 12. So \lambda = 2 and (x, y) = (4, 4): four fair days and \$400 of ads, for 48 + 40 - 16 - 16 = 56 subscribers. A line is unbounded, so Result 4 does not apply; directly, on y = 12 - 2x,
so 56 is the absolute maximum on the line. For a budget of k the same steps give \displaystyle \lambda = \frac{34 - 2k}{5}, and since Q = 61 - (x - 6)^2 - (y - 5)^2,
Then \displaystyle M'(k) = \frac{34 - 2k}{5} = \lambda, as Result 5 says: one more hundred dollars brings about 2 subscribers. Exactly, M(13) - M(12) = 57.8 - 56 = 1.8.
The nearest points of a hyperboloid
Find the points of the surface z^2 = xy + 4 nearest the origin.
SolutionMinimize f = x^2 + y^2 + z^2 subject to g = z^2 - xy = 4; \nabla g = \langle -y, -x, 2z \rangle vanishes only at the origin, off the surface S.
S is unbounded, so first show a minimum exists. (0, 0, 2) \in S has f = 4, and the points of S with f \le 4 form a closed, bounded, nonempty set, on which f has a minimum. Every other point of S has f > 4, so this is the minimum on S, and by Result 2 a Lagrange point. The system is
- If z \ne 0, then \lambda = 1, so y = -2x and -4x = -x: x = y = 0, z = \pm 2, f = 4.
- If z = 0, then xy = -4. Multiplying the first two equations gives 4xy = \lambda^2 xy, so \lambda = \pm 2. For \lambda = 2, y = -x: the points (2, -2, 0) and (-2, 2, 0), with f = 8. For \lambda = -2, x^2 = -4, no point.
The nearest points are (0, 0, \pm 2), at distance 2. The other Lagrange points are no extremes: \displaystyle (t, -\frac4t, 0) \in S has \displaystyle f - 8 = \left(t - \frac4t\right)^2 \ge 0, while \displaystyle (2 - s, s - 2, \sqrt{4s - s^2}) \in S for 0 < s < 4 has f = 8 - 4s + s^2 < 8.
The highest point of a tilted circle
The plane 2x - y + 2z = 0 cuts the sphere x^2 + y^2 + z^2 = 9 in a circle. Find its highest and lowest points.
SolutionExtremize f = z subject to g = x^2 + y^2 + z^2 = 9 and h = 2x - y + 2z = 0. The circle is closed and bounded. \nabla g = \langle 2x, 2y, 2z \rangle and \nabla h = \langle 2, -1, 2 \rangle are dependent only at points t\langle 2, -1, 2 \rangle, which lie on the plane only at the origin, off the sphere. So Result 3 applies:
The first two give \mu = -\lambda x = 2\lambda y, so \lambda(x + 2y) = 0; \lambda = 0 would make \mu = 0 and 1 = 0. So x = -2y, the plane gives \displaystyle z = \frac52 y, and the sphere gives \displaystyle \frac{45}{4}y^2 = 9. The highest point is \displaystyle \left(-\frac{4\sqrt5}{5}, \frac{2\sqrt5}{5}, \sqrt5\right) and the lowest is its negative.
Check: the circle is centered at the origin with radius 3, and its highest point lies along the projection of \mathbf{k} onto the plane, \displaystyle \mathbf{k} - \frac23\mathbf{n} = \frac19\langle -4, 2, 5 \rangle with \displaystyle \mathbf{n} = \frac13\langle 2, -1, 2 \rangle; that has length \displaystyle \frac{\sqrt5}{3}, and scaled to length 3 it is the point found.
Proof: a quadratic form on the unit sphere
Let A be a real symmetric n \times n matrix and Q(\mathbf{x}) = \mathbf{x} \cdot A\mathbf{x}, the column \mathbf{x} being the vector \langle x_1, \dots, x_n \rangle. Prove that the maximum of Q on the unit sphere is an eigenvalue of A, taken at a unit eigenvector, and is at least every real eigenvalue; likewise the minimum is the least.
SolutionQ(\mathbf{x}) = \sum_{i, j} a_{ij} x_i x_j is a polynomial, and
since a_{im} = a_{mi} (The transpose and symmetric matrices). So \nabla Q = 2A\mathbf{x}. The constraint \mathbf{x} \cdot \mathbf{x} = 1 has gradient 2\mathbf{x} \ne \mathbf{0} on the sphere, which is closed and bounded. By Result 4 the maximum is at a unit \mathbf{u} with 2A\mathbf{u} = 2\lambda\mathbf{u}: an eigenvector with the real eigenvalue \lambda (Eigenvalues and eigenvectors), and the maximum is Q(\mathbf{u}) = \mathbf{u} \cdot \lambda\mathbf{u} = \lambda. A real eigenvalue \nu with unit eigenvector \mathbf{v} has \nu = Q(\mathbf{v}) \le \lambda. The minimum is the same with the inequality reversed. In particular every real symmetric matrix has a real eigenvalue, the step that starts one proof of the spectral theorem stated in Diagonalization.
Boundaries
Regularity. On the cusp y^2 = x^3, x \ge 0, so f = x has its minimum at the origin, where \nabla g = \langle -3x^2, 2y \rangle = \mathbf{0} and \nabla f = \langle 1, 0 \rangle is no multiple of it. Points with \nabla g = \mathbf{0} are checked on their own (Exercise 15).
Necessary, not sufficient. A Lagrange point need not be an extremum (Example 4), and Result 2 does not say which kind. On a closed bounded set compare values; otherwise argue directly, as in Examples 3 and 4. Second-order tests (the bordered Hessian) are beyond this lesson.
Unbounded constraints and corners. On the line x + y = 2, xy has one Lagrange point, its maximum, and no minimum. On the circle x^2 + y^2 = 1, \lvert x \rvert + \lvert y \rvert is least where it is not differentiable. Many inequality constraints lead to the Karush-Kuhn-Tucker conditions of optimization courses.
Where this goes next
The proof of Result 3 extends to m constraints with independent gradients, \nabla f = \lambda_1 \nabla g_1 + \dots + \lambda_m \nabla g_m. Result 5 is why economists call \lambda a shadow price. The course now turns to integrals, starting with Double integrals as volume.
Exercises
Two variables
- Find the maximum and minimum of f(x, y) = x + 3y on the circle x^2 + y^2 = 10.
- Find the maximum and minimum of f(x, y) = x^2 y on the circle x^2 + y^2 = 3.
- Find the maximum and minimum of x^2 + y^2 on the ellipse x^2 + xy + y^2 = 3.
- Find the points of the curve x^2 y = 16 nearest the origin, and prove that a nearest point exists.
Three variables and two constraints
- Find the maximum and minimum of f(x, y, z) = x + 2y - 2z on the sphere x^2 + y^2 + z^2 = 4.
- Find the maximum and minimum of f(x, y, z) = xyz on the ellipsoid x^2 + 2y^2 + 4z^2 = 12.
- The plane x + y + z = 1 cuts the cylinder x^2 + y^2 = 1 in an ellipse. Find its highest and lowest points.
- Find the absolute maximum and minimum of f(x, y) = xy + y on the closed disk x^2 + y^2 \le 1.
At the zine
- With the model of Example 3, find the best split of a budget of \$1500, the number of subscribers, and the multiplier.
- For which budget is the multiplier of Example 3 zero? What should Hannah and Owen do with a larger budget?
- Owen asks the reverse question: what is the least budget that reaches Q = 56? Minimize 2x + y on the curve Q(x, y) = 56, and compare the multiplier \mu in \nabla(2x + y) = \mu\nabla Q with \lambda of Example 3.
Proofs
- Prove that for positive x, y, z, \displaystyle xyz \le \left(\frac{x + y + z}{3}\right)^3, with equality only when x = y = z.
- Let \mathbf{a} \ne \mathbf{0} in \mathbb{R}^n. Prove with Result 4 that the maximum of \mathbf{a} \cdot \mathbf{x} on the unit sphere is \lVert \mathbf{a} \rVert, and deduce \lvert \mathbf{a} \cdot \mathbf{x} \rvert \le \lVert \mathbf{a} \rVert \lVert \mathbf{x} \rVert.
- Prove that the largest box centered at the origin, with faces parallel to the coordinate planes, inside the ellipsoid \displaystyle \frac{x^2}{a^2} + \frac{y^2}{b^2} + \frac{z^2}{c^2} = 1 has volume \displaystyle \dfrac{8abc}{3\sqrt3}.
- The line y = x is also the set g(x, y) = (x - y)^2 = 0. Show that f(x, y) = x^2 + y^2 - 2y has its minimum on it at a point where no \lambda gives \nabla f = \lambda\nabla g. Which hypothesis of Result 2 fails, and what does g = x - y give?
Answers
- Maximum 10 at (1, 3), minimum -10 at (-1, -3). 1 = 2\lambda x and 3 = 2\lambda y give y = 3x, so 10x^2 = 10. The circle is closed and bounded, with \nabla g = \langle 2x, 2y \rangle \ne \mathbf{0} on it, so Result 4 applies.
- Maximum 2 at \displaystyle (\pm\sqrt2, 1), minimum -2 at \displaystyle (\pm\sqrt2, -1). From 2xy = 2\lambda x: x = 0 gives \displaystyle (0, \pm\sqrt3) with f = 0; otherwise \lambda = y, and x^2 = 2\lambda y gives x^2 = 2y^2, so y = \pm 1 and f = 2y. As in Exercise 1, Result 4 applies on the circle.
- Maximum 6 at \displaystyle (\sqrt3, -\sqrt3) and \displaystyle (-\sqrt3, \sqrt3), minimum 2 at (1, 1) and (-1, -1). Multiplying 2x = \lambda(2x + y) by x + 2y and 2y = \lambda(x + 2y) by 2x + y gives 2x(x + 2y) = 2y(2x + y), so x^2 = y^2. The ellipse is bounded since \displaystyle x^2 + xy + y^2 \ge \frac12(x^2 + y^2).
- \displaystyle (\pm 2\sqrt2, 2), at distance \displaystyle 2\sqrt3. (4, 1) is on the curve, and its points with x^2 + y^2 \le 17 form a closed bounded nonempty set, so a nearest point exists; \nabla g = \langle 2xy, x^2 \rangle \ne \mathbf{0} as x \ne 0. 2x = 2\lambda xy gives \lambda y = 1, then 2y = \lambda x^2 gives x^2 = 2y^2, so 2y^3 = 16.
- Maximum 6 at \displaystyle \left(\frac23, \frac43, -\frac43\right), minimum -6 at its negative. The point is \displaystyle \frac{1}{2\lambda}\langle 1, 2, -2 \rangle, and \displaystyle \frac{9}{4\lambda^2} = 4. The sphere is closed and bounded, with \nabla g = 2\langle x, y, z \rangle \ne \mathbf{0} on it.
- Maximum \displaystyle 2\sqrt2, minimum \displaystyle -2\sqrt2, at the points with x^2 = 4, y^2 = 2, z^2 = 1 and xyz of that sign. Multiplying yz = 2\lambda x, xz = 4\lambda y, xy = 8\lambda z by x, y, z gives xyz = 2\lambda x^2 = 4\lambda y^2 = 8\lambda z^2; if xyz \ne 0, x^2 = 2y^2 = 4z^2 and 3x^2 = 12. If xyz = 0, f = 0. The ellipsoid is closed and bounded, with \nabla g = \langle 2x, 4y, 8z \rangle \ne \mathbf{0} on it.
- Highest \displaystyle \left(-\frac{\sqrt2}{2}, -\frac{\sqrt2}{2}, 1 + \sqrt2\right), lowest \displaystyle \left(\frac{\sqrt2}{2}, \frac{\sqrt2}{2}, 1 - \sqrt2\right). \langle 0, 0, 1 \rangle = \lambda\langle 2x, 2y, 0 \rangle + \mu\langle 1, 1, 1 \rangle gives \mu = 1 and 2\lambda x = 2\lambda y = -1, so x = y. The ellipse is closed and bounded, and the gradients are independent on it (only \nabla h has a z-component, and \nabla g \ne \mathbf{0} on the cylinder).
- Maximum \displaystyle \frac{3\sqrt3}{4} at \displaystyle \left(\frac12, \frac{\sqrt3}{2}\right), minimum \displaystyle -\frac{3\sqrt3}{4} at \displaystyle \left(\frac12, -\frac{\sqrt3}{2}\right). Inside, \nabla f = \langle y, x + 1 \rangle vanishes only at (-1, 0), on the circle. On the circle, y = 2\lambda x and x + 1 = 2\lambda y give y^2 = x^2 + x, so 2x^2 + x - 1 = 0: \displaystyle x = \frac12, or x = -1 with f = 0.
- (x, y) = (5.2, 4.6), that is 5.2 fair days and \$460 of ads, for Q = 60.2, with \displaystyle \lambda = \frac45 from \displaystyle \lambda = \frac{34 - 30}{5}.
- k = 17, giving (6, 5), where \nabla Q = \mathbf{0}: the unconstrained maximum 61. For k > 17, \lambda < 0 and M(k) < 61, so they should spend only \$1700.
- \$1200, at (4, 4), with \displaystyle \mu = \frac12 = \frac1\lambda. Q = 56 is the circle (x - 6)^2 + (y - 5)^2 = 5. \langle 2, 1 \rangle = \mu\langle 12 - 2x, 10 - 2y \rangle gives x = 2y - 4, then y^2 - 10y + 24 = 0: (4, 4) with cost 12, and (8, 6) with cost 22, the dearest way to reach 56.
- Let s = x + y + z. On the closed bounded set T of points with nonnegative coordinates summing to s, xyz has a maximum, at least \displaystyle \frac{s^3}{27} > 0, so taken where all coordinates are positive. There it is a local maximum on S = \{x + y + z = s\} inside the open octant, and \nabla g = \langle 1, 1, 1 \rangle. Result 2 gives yz = xz = xy = \lambda; dividing by the positive z and x gives \displaystyle x = y = z = \frac s3. So this is the only maximizer, and \displaystyle xyz \le \frac{s^3}{27} with equality only there.
- The sphere is closed and bounded, \nabla(\mathbf{a} \cdot \mathbf{x}) = \mathbf{a}, and \nabla(\mathbf{x} \cdot \mathbf{x}) = 2\mathbf{x} \ne \mathbf{0} on it. By Result 4 the maximum is at a unit \mathbf{u} with \mathbf{a} = 2\lambda\mathbf{u}, so \displaystyle \mathbf{u} = \pm\frac{\mathbf{a}}{\lVert \mathbf{a} \rVert} and \mathbf{a} \cdot \mathbf{u} = \pm\lVert \mathbf{a} \rVert: the maximum is \lVert \mathbf{a} \rVert. For \mathbf{x} \ne \mathbf{0}, apply this to \displaystyle \pm\frac{\mathbf{x}}{\lVert \mathbf{x} \rVert}; for \mathbf{x} = \mathbf{0} both sides are 0.
- Such a box with corner (x, y, z), x, y, z \ge 0, has volume 8xyz. A box is the convex hull of its corners (\pm x, \pm y, \pm z) and the solid ellipsoid is convex and symmetric, so the box lies inside exactly when \displaystyle q = \frac{x^2}{a^2} + \frac{y^2}{b^2} + \frac{z^2}{c^2} \le 1. If q < 1 and xyz > 0, the corner \displaystyle \frac{1}{\sqrt q}(x, y, z) gives a larger box still inside, so it is enough to compare boxes with corner on the ellipsoid. On the closed bounded part E of the ellipsoid with x, y, z \ge 0, xyz has a maximum, positive (it is \displaystyle \frac{abc}{3\sqrt3} at \displaystyle \frac{1}{\sqrt3}(a, b, c)), so taken where x, y, z > 0, a local maximum on the ellipsoid. \nabla g \ne \mathbf{0} there, and \displaystyle yz = \frac{2\lambda x}{a^2}, \displaystyle xz = \frac{2\lambda y}{b^2}, \displaystyle xy = \frac{2\lambda z}{c^2}. Multiplying by x, y, z gives \displaystyle xyz = \frac{2\lambda x^2}{a^2} = \frac{2\lambda y^2}{b^2} = \frac{2\lambda z^2}{c^2} with \lambda \ne 0, so each ratio is \displaystyle \frac13, and the volume is \displaystyle \frac{8abc}{3\sqrt3}.
- On the line \displaystyle f = 2x^2 - 2x = 2\left(x - \frac12\right)^2 - \frac12, least at \displaystyle \left(\frac12, \frac12\right), where \nabla f = \langle 2x, 2y - 2 \rangle = \langle 1, -1 \rangle. But \nabla g = \langle 2(x - y), -2(x - y) \rangle = \mathbf{0} on the whole line: the point is not regular. With g = x - y, \nabla g = \langle 1, -1 \rangle and \lambda = 1.