Skip to main content

Section 10.2 Examples

Subsection 10.2.1 Extrema on an Ellipse

In the first example, we find the greatest and smallest values of a function whose domain is restricted to a curve in the plane, namely an ellipse.

Example 10.4. Extrema of \(f(x,y) = xy\) on an Ellipse.

Find the greatest and smallest values that the function \(f(x,y) = xy\) takes over the ellipse
\begin{equation} \frac{x^2}{8} + \frac{y^2}{2} = 1.\tag{10.7} \end{equation}
Solution.
If we picture the graph of \(f(x,y) = xy\text{,}\) a saddle-shaped surface, then restricting the inputs \((x,y)\) to the ellipse traces a curve on that surface, and we are after the highest and lowest points of this curve. We wish to find the extrema of \(f(x,y) = xy\) subject to the constraint
\begin{equation} g(x,y) = \frac{x^2}{8} + \frac{y^2}{2} - 1 = 0.\tag{10.8} \end{equation}
We begin by computing the gradients of both functions:
\begin{align*} \nabla f \amp= y\,\mathbf i + x\,\mathbf j\\ \nabla g \amp= \frac{x}{4}\,\mathbf i + y\,\mathbf j. \end{align*}
The Lagrange multiplier equation gives
\begin{align*} \nabla f \amp= \lambda\,\nabla g\\ \amp\;\Rightarrow\; y\,\mathbf i + x\,\mathbf j = \lambda\frac{x}{4}\,\mathbf i + \lambda y\,\mathbf j\\ \amp\;\Rightarrow\; y = \lambda\frac{x}{4}, \quad x = \lambda y. \end{align*}
After substituting \(x = \lambda y\) into \(y = \lambda\frac{x}{4}\text{,}\) we get
\begin{align*} y = \frac{\lambda^2}{4}\, y \amp\;\Rightarrow\; \lambda = \pm 2 \;\Rightarrow\; x = \pm 2y. \end{align*}
After plugging \(x = \pm 2y\) into the constraint equation we get
\begin{align*} g(\pm 2y, y) \amp= \frac{y^2}{2} + \frac{y^2}{2} - 1 = 0\\ \amp\;\Rightarrow\; y^2 = 1 \;\Rightarrow\; y = \pm 1. \end{align*}
Note that \(y = 0\) is another solution of \(y = \frac{\lambda^2}{4}y\text{;}\) however, when \(y = 0\text{,}\) from \(x = \lambda y\) we know that \(x = 0\text{,}\) and the point \((0,0)\) does not satisfy the constraint equation, i.e. \(g(0,0) = -1 \neq 0\text{.}\)
Therefore there are four local extrema:
\begin{align*} (\pm 2, 1)\colon \amp\quad f(2,1) = 2, \quad f(-2,1) = -2\\ (\pm 2, -1)\colon \amp\quad f(2,-1) = -2, \quad f(-2,-1) = 2. \end{align*}
Since the ellipse is a closed and bounded curve and \(f\) is continuous, \(f\) attains its absolute extrema over the ellipse, and they are among these four values. The absolute maximum of \(f(x,y) = xy\) over the ellipse \(\frac{x^2}{8} + \frac{y^2}{2} = 1\) is \(2\) and its absolute minimum is \(-2\text{.}\)
FigureΒ 10.5 shows the constraint ellipse together with several level curves of \(f\text{:}\) the hyperbolas \(xy = c\text{,}\) with \(|c|\) increasing as the curves move away from the origin. Exactly as promised by (10.5), the level curves \(xy = 2\) and \(xy = -2\) are tangent to the ellipse at the four extremal points, and at each of them \(\nabla f\) and \(\nabla g\) are collinear. For instance, at \((2,1)\) we have \(\nabla f = \mathbf i + 2\,\mathbf j\) and \(\nabla g = \frac{1}{2}\,\mathbf i + \mathbf j\text{,}\) so \(\nabla f = 2\,\nabla g\text{,}\) matching the multiplier \(\lambda = 2\text{.}\)
Diagram Exploration Keyboard Controls
Key Action
Enter, A Activate keyboard driven exploration
B Activate menu driven exploration
Escape Leave exploration mode
Cursor down Explore next lower level
Cursor up Explore next upper level
Cursor right Explore next element on level
Cursor left Explore previous element on level
X Toggle expert mode
W Extra details if available
Space Repeat speech
M Activate step magnification
Comma Activate direct magnification
N Deactivate magnification
Z Toggle subtitles
C Cycle contrast settings
T Monochrome colours
L Toggle language (if available)
K Kill current sound
Y Stop sound output
O Start and stop sonification
P Repeat sonification output
Figure 10.5. The ellipse \(\frac{x^2}{8} + \frac{y^2}{2} = 1\) and the level curves of \(f(x,y) = xy\text{.}\) The hyperbolas \(xy = \pm 2\) are tangent to the ellipse at the four extremal points, where \(\nabla f = \lambda\,\nabla g\text{.}\)

Subsection 10.2.2 Shortest Distance to a Plane

In ExampleΒ 9.16 we found the shortest distance from a point to a plane by substituting the equation of the plane into the distance function and minimizing the resulting function of two variables with the second derivative test. In the next example we solve the same problem with Lagrange multipliers, and then once more using the normal vector to the plane.

Example 10.6. Shortest Distance to a Plane, Revisited.

Find the shortest distance from the point \((1,0,-2)\) to the plane \(x + 2y + z = 4\text{.}\)
Solution 1.
We find the closest point on the plane \(x + 2y + z = 4\) to the point \((1,0,-2)\text{.}\) The distance from a point \((x,y,z)\) to \((1,0,-2)\) is \(\sqrt{(x-1)^2 + y^2 + (z+2)^2}\text{,}\) and, as before, minimizing the distance is the same as minimizing its square. So we minimize
\begin{equation} f(x,y,z) = (x-1)^2 + y^2 + (z+2)^2\tag{10.9} \end{equation}
subject to the constraint
\begin{equation} g(x,y,z) = x + 2y + z - 4 = 0.\tag{10.10} \end{equation}
We compute the gradients:
\begin{align*} \nabla f \amp= 2(x-1)\,\mathbf i + 2y\,\mathbf j + 2(z+2)\,\mathbf k\\ \nabla g \amp= \mathbf i + 2\,\mathbf j + \mathbf k. \end{align*}
The Lagrange multiplier equation gives
\begin{align*} \nabla f = \lambda\,\nabla g \amp\;\Rightarrow\; 2(x-1)\,\mathbf i + 2y\,\mathbf j + 2(z+2)\,\mathbf k\\ \amp= \lambda\,\mathbf i + 2\lambda\,\mathbf j + \lambda\,\mathbf k. \end{align*}
so that
\begin{equation} x = \frac{\lambda}{2} + 1, \qquad y = \lambda, \qquad z = \frac{\lambda}{2} - 2.\tag{10.11} \end{equation}
We substitute these into the equation of the constraint to find \(\lambda\text{:}\)
\begin{align*} g(x,y,z) = x + 2y + z - 4 \amp= 0\\ \amp\;\Rightarrow\; 3\lambda - 5 = 0 \;\Rightarrow\; \lambda = \frac{5}{3}. \end{align*}
Therefore the closest point on the plane \(x + 2y + z = 4\) to the point \((1,0,-2)\) is
\begin{equation} \left(\frac{11}{6},\; \frac{5}{3},\; -\frac{7}{6}\right)\tag{10.12} \end{equation}
and their distance is
\begin{equation} d = \sqrt{\left(\frac{11}{6} - 1\right)^2 + \left(\frac{5}{3}\right)^2 + \left(-\frac{7}{6} + 2\right)^2} = \frac{5}{6}\sqrt{6},\tag{10.13} \end{equation}
in agreement with ExampleΒ 9.16.
Solution 2. Another Solution, Using the Normal to the Plane
To find the closest point on the plane \(x + 2y + z = 4\) to the point \(P_0(1,0,-2)\text{,}\) we assume that the point \(P(x,y,z)\) on the plane is the closest point to \(P_0\text{.}\) As FigureΒ 10.7 shows, the segment realizing the shortest distance meets the plane perpendicularly, so the vector \(\vec{P_0 P}\) must be parallel to the normal vector \(\mathbf n = \mathbf i + 2\,\mathbf j + \mathbf k\) of the plane:
\begin{align*} \vec{P_0 P} = \langle x - 1,\; y,\; z + 2\rangle \amp= \lambda\,\langle 1, 2, 1\rangle\\ \amp\;\Rightarrow\; x = \lambda + 1, \quad y = 2\lambda, \quad z = \lambda - 2. \end{align*}
We then substitute the above equations into the equation of the plane:
\begin{align*} (\lambda + 1) + 2(2\lambda) + (\lambda - 2) \amp= 4 \;\Rightarrow\; \lambda = \frac{5}{6}\\ \amp\;\Rightarrow\; x = \frac{11}{6}, \quad y = \frac{5}{3}, \quad z = -\frac{7}{6}, \end{align*}
and therefore the minimum distance is again \(d = \frac{5}{6}\sqrt{6}\text{.}\)
The two solutions are closely related. At the closest point, \(\nabla f = 2\langle x-1,\, y,\, z+2\rangle = 2\,\vec{P_0 P}\text{,}\) while \(\nabla g = \langle 1,2,1\rangle = \mathbf n\text{.}\) So the Lagrange condition \(\nabla f = \lambda\,\nabla g\) says precisely that \(\vec{P_0 P}\) is parallel to the normal \(\mathbf n\text{:}\) the method of Lagrange multipliers rediscovers the geometry on its own.
Diagram Exploration Keyboard Controls
Key Action
Enter, A Activate keyboard driven exploration
B Activate menu driven exploration
Escape Leave exploration mode
Cursor down Explore next lower level
Cursor up Explore next upper level
Cursor right Explore next element on level
Cursor left Explore previous element on level
X Toggle expert mode
W Extra details if available
Space Repeat speech
M Activate step magnification
Comma Activate direct magnification
N Deactivate magnification
Z Toggle subtitles
C Cycle contrast settings
T Monochrome colours
L Toggle language (if available)
K Kill current sound
Y Stop sound output
O Start and stop sonification
P Repeat sonification output
Figure 10.7. A schematic, edge-on view of the plane \(x + 2y + z = 4\) and the point \(P_0(1,0,-2)\text{.}\) The shortest segment from \(P_0\) to the plane is along the normal vector \(\mathbf n\text{;}\) the dashed segments, which reach the plane in any other direction, are longer.

Subsection 10.2.3 Absolute Extrema on a Circle

Example 10.8. Absolute Extrema on a Circle.

Find the absolute maximum and minimum of \(f(x,y) = x^2 + y^2 - 2x + 2y + 5\text{,}\) given the constraint \(x^2 + y^2 = 4\text{.}\)
Solution.
Completing the squares shows that
\begin{equation} f(x,y) = (x-1)^2 + (y+1)^2 + 3,\tag{10.14} \end{equation}
so the graph of \(f\) is a paraboloid with vertex at \((1,-1,3)\text{.}\) The constraint can be thought of as \(g(x,y) = x^2 + y^2 - 4 = 0\text{,}\) which is a circle of radius \(2\) centered at the origin in the \(xy\)-plane. Restricting \(f\) to this circle traces a curve on the paraboloid, and the goal is to find the highest and lowest points of that curve. By (10.14), the level curves of \(f\) are the circles \((x-1)^2 + (y+1)^2 = c - 3\) centered at \((1,-1)\text{,}\) and we are looking for the smallest and largest values of \(c\) for which the level curve still meets the constraint circle; as FigureΒ 10.10 shows, at those values the two circles are tangent and the gradients are collinear, \(\nabla f = \lambda\,\nabla g\text{.}\)
We compute the gradients:
\begin{align*} \nabla f \amp= (2x-2)\,\mathbf i + (2y+2)\,\mathbf j\\ \nabla g \amp= 2x\,\mathbf i + 2y\,\mathbf j. \end{align*}
The Lagrange multiplier equation gives
\begin{align*} \nabla f \amp= \lambda\,\nabla g\\ \amp\;\Rightarrow\; (2x-2)\,\mathbf i + (2y+2)\,\mathbf j = 2\lambda x\,\mathbf i + 2\lambda y\,\mathbf j\\ \amp\;\Rightarrow\; x - 1 = \lambda x, \quad y + 1 = \lambda y. \end{align*}
Adding the two equations yields
\begin{equation} x + y = \lambda(x + y).\tag{10.15} \end{equation}
This equation is satisfied if \(\lambda = 1\) or if \(x + y = 0\text{.}\) The case \(\lambda = 1\) is impossible, since substituting it into \(x - 1 = \lambda x\) gives \(-1 = 0\text{.}\) Hence \(y = -x\text{,}\) which we substitute into the constraint:
\begin{align*} x^2 + y^2 = 4 \amp\;\Rightarrow\; 2x^2 = 4 \;\Rightarrow\; x = -y = \pm\sqrt{2}. \end{align*}
Therefore the solutions are \((x,y) = (\sqrt 2, -\sqrt 2)\) and \((x,y) = (-\sqrt 2, \sqrt 2)\text{.}\) Using (10.14),
\begin{align*} f(\sqrt 2, -\sqrt 2) \amp= 2(\sqrt 2 - 1)^2 + 3 = 9 - 4\sqrt 2\\ f(-\sqrt 2, \sqrt 2) \amp= 2(\sqrt 2 + 1)^2 + 3 = 9 + 4\sqrt 2. \end{align*}
Since the circle is closed and bounded and \(f\) is continuous, these are the absolute extrema: \(f(\sqrt 2, -\sqrt 2) = 9 - 4\sqrt 2\) is the absolute minimum and \(f(-\sqrt 2, \sqrt 2) = 9 + 4\sqrt 2\) is the absolute maximum.
The answer agrees with the geometry of (10.14): on the constraint circle, \(f\) equals \(3\) plus the square of the distance to the point \((1,-1)\text{.}\) The point of the circle farthest from \((1,-1)\) is \((-\sqrt 2, \sqrt 2)\text{,}\) at distance \(2 + \sqrt 2\text{,}\) giving \(f = 3 + (2+\sqrt 2)^2 = 9 + 4\sqrt 2\text{,}\) and the nearest point is \((\sqrt 2, -\sqrt 2)\text{,}\) at distance \(2 - \sqrt 2\text{,}\) giving \(f = 3 + (2-\sqrt 2)^2 = 9 - 4\sqrt 2\text{.}\) Note also that in FigureΒ 10.10 the gradients \(\nabla f\) and \(\nabla g\) point in the same direction at both extrema, but with different multipliers: from \(x - 1 = \lambda x\text{,}\) we get \(\lambda = 1 - \frac{1}{\sqrt 2}\) at the minimum and \(\lambda = 1 + \frac{1}{\sqrt 2}\) at the maximum.
The video below animates this picture. The completed-square form (10.14) shows that, with no constraint, \(f\) would take its least possible value \(3\) at the vertex \((1,-1)\)β€”the bottom of the paraboloid. But that vertex lies inside the constraint circle (a distance \(\sqrt 2 \lt 2\) from the origin), so it is not available to us here: the method of Lagrange multipliers instead locates the highest and lowest points of \(f\) along the circle. As the level circles of \(f\) expand outward from \((1,-1)\text{,}\) the first one to reach the constraint circle gives the constrained minimum \(9 - 4\sqrt 2\) and the last gives the maximum \(9 + 4\sqrt 2\text{;}\) at each of these contacts the two circles are tangent and \(\nabla f\) is parallel to \(\nabla g\text{.}\)
Figure 10.9. The extrema of \(f\) on the constraint circle \(x^2 + y^2 = 4\text{.}\) The level circles of \(f\text{,}\) centered at the vertex \((1,-1)\) where \(f = 3\text{,}\) expand until they touch the constraint circle; the points of tangency are the constrained minimum and maximum.
Diagram Exploration Keyboard Controls
Key Action
Enter, A Activate keyboard driven exploration
B Activate menu driven exploration
Escape Leave exploration mode
Cursor down Explore next lower level
Cursor up Explore next upper level
Cursor right Explore next element on level
Cursor left Explore previous element on level
X Toggle expert mode
W Extra details if available
Space Repeat speech
M Activate step magnification
Comma Activate direct magnification
N Deactivate magnification
Z Toggle subtitles
C Cycle contrast settings
T Monochrome colours
L Toggle language (if available)
K Kill current sound
Y Stop sound output
O Start and stop sonification
P Repeat sonification output
Figure 10.10. The constraint circle \(x^2 + y^2 = 4\) and three level curves of \(f(x,y) = x^2+y^2-2x+2y+5\text{,}\) which are circles centered at \((1,-1)\text{.}\) The extreme level curves \(f = 9 \pm 4\sqrt 2\) are tangent to the constraint circle, while an intermediate level curve (dashed) crosses it. At each point of tangency \(\nabla f = \lambda\,\nabla g\text{.}\)
You have attempted of activities on this page.