Skip to main content
Mathematics LibreTexts

14.7: Maxima and minima

  • Page ID
    149577
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)

    ( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\id}{\mathrm{id}}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\kernel}{\mathrm{null}\,}\)

    \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\)

    \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\)

    \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    \( \newcommand{\vectorA}[1]{\vec{#1}}      % arrow\)

    \( \newcommand{\vectorAt}[1]{\vec{\text{#1}}}      % arrow\)

    \( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vectorC}[1]{\textbf{#1}} \)

    \( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)

    \( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)

    \( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)

    \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)

    Suppose a surface given by \(f(x,y)\) has a local maximum at \((x_0,y_0,z_0)\); geometrically, this point on the surface looks like the top of a hill. If we look at the cross-section in the plane \(y=y_0\), we will see a local maximum on the curve at \((x_0,z_0)\), and we know from single-variable calculus that \(\displaystyle \dfrac{\partial z} {\partial x}=0\) at this point.

    Likewise, in the plane \(x=x_0\), \(\displaystyle \dfrac{\partial z}{\partial y}=0\). So if there is a local maximum at \((x_0,y_0,z_0)\), both partial derivatives at the point must be zero, and likewise for a local minimum. Thus, to find local maximum and minimum points, we need only consider those points at which both partial derivatives are \(0\). As in the single-variable case, it is possible for the derivatives to be zero at a point that is neither a maximum or a minimum, so we need to test these points further.

    You will recall that in the single variable case, we examined three methods to identify maximum and minimum points; the most useful is the second derivative test, though it does not always work. For functions of two variables there is also a second derivative test; again it is by far the most useful test, though it doesn't always work.

    Theorem \(\PageIndex{1}\): The Discriminant

    Suppose that the second partial derivatives of \(f(x,y)\) are continuous near \((x_0,y_0)\), and that \(f_x(x_0,y_0)= f_y(x_0,y_0) =0\). We denote by \(D\) the discriminant: \[D(x_0,y_0)= f_{xx}(x_0,y_0) f_{yy}(x_0,y_0)- f_{xy}(x_0,y_0)^2.\nonumber\]

    If \(D\gt 0\) and \(f_{xx}(x_0,y_0) \lt 0\), there is a local maximum at \((x_0,y_0)\); if \(D\gt 0\) and \(f_{xx}(x_0,y_0) \gt 0\) there is a local minimum at \((x_0,y_0)\); if \(D \lt 0\) there is neither a maximum nor a minimum at \((x_0,y_0)\); if \(D=0\), the test fails.

    Example \(\PageIndex{2}\)

    Verify that \(f(x,y)=x^2+y^2\) has a minimum at \((0,0)\).

    Solution

    First, we compute all the needed derivatives: \[f_x=2x \qquad f_y=2y \qquad f_{xx}=2 \qquad f_{yy}=2 \qquad f_{xy}=0. \nonumber\]

    The derivatives \(f_x\) and \(f_y\) are zero only at \((0,0)\). Applying the second derivative test there: \[D(0,0)=f_{xx}(0,0)f_{yy}(0,0)-f_{xy}(0,0)^2= 2\cdot2-0=4 \gt 0, \nonumber\] so there is a local minimum at \((0,0)\), and there are no other possibilities.

    Example \(\PageIndex{3}\)

    Find all local maxima and minima for \(f(x,y)=x^2-y^2\).

    Solution

    The derivatives: \[f_x=2x \qquad f_y=-2y \qquad f_{xx}=2 \qquad f_{yy}=-2 \qquad f_{xy}=0. \nonumber\]

    Again there is a single critical point, at \((0,0)\), and \[D(0,0)= f_{xx}(0,0)f_{yy}(0,0)- f_{xy}(0,0)^2= 2\times(-2)-0= -4 \lt 0,\nonumber\] so there is neither a maximum nor minimum there, and so there are no local maxima or minima. The surface is shown in figure \(\PageIndex{1}\).

    Figure \(\PageIndex{1}\): A saddle point, neither a maximum nor a minimum.

    Example \(\PageIndex{4}\)

    Find all local maxima and minima for \(f(x,y)=x^4+y^4\).

    Solution

    The derivatives: \[f_x=4x^3 \qquad f_y=4y^3 \qquad f_{xx}=12x^2 \qquad f_{yy}=12y^2 \qquad f_{xy}=0.\nonumber\]

    Again there is a single critical point, at \((0,0)\), and \[D(0,0)= f_{xx}(0,0)f_{yy}(0,0)- f_{xy}(0,0)^2= 0\cdot 0-0=0,\nonumber\] so we get no information. However, in this case it is easy to see that there is a minimum at \((0,0)\), because \(f(0,0)=0\) and at all other points \(f(x,y) \gt 0\).

    Example \(\PageIndex{5}\)

    Find all local maxima and minima for \(f(x,y)=x^3+y^3\).

    Solution

    The derivatives: \[f_x=3x^2 \qquad f_y=3y^2 \qquad f_{xx}=6x^2 \qquad f_{yy}=6y^2 \qquad f_{xy}=0.\nonumber\]

    Again there is a single critical point, at \((0,0)\), and \[D(0,0)= f_{xx}(0,0)f_{yy}(0,0)- f_{xy}(0,0)^2= 0\cdot 0-0=0,\nonumber\] so we get no information. In this case, a little thought shows there is neither a maximum nor a minimum at \((0,0)\): when \(x\) and \(y\) are both positive, \(f(x,y) \gt 0\), and when \(x\) and \(y\) are both negative, \(f(x,y) \lt 0\), so there are points of both kinds arbitrarily close to \((0,0)\). Alternatively, if we look at the cross-section when \(y=0\), we get \(f(x,0)=x^3\), which does not have either a maximum or minimum at \(x=0\).

    Example \(\PageIndex{6}\)

    Suppose a box with no top is to hold a certain volume \(V\). Find the dimensions for the box that result in the minimum surface area.

    Solution

    The area of the box is \(A=2hw+2hl+lw\), and the volume is \(V=lwh\), so we can write the area as a function of two variables, \[A(l,w)= \dfrac{2V}{l}+ \dfrac{2V}{w}+lw.\nonumber\]

    Then differentiating, \[A_l= -\dfrac{2V}{l^2}+w \qquad \text{and} \qquad A_w=-\dfrac{2V}{w^2}+ l.\nonumber\] To find the minimum for \(A\), these must be set to zero, which allows us to solve for \(l\) and \(w\) in terms of \(V\). We find \(w=(2V)^{1/3}\) and \(l=(2V)^{1/3}\), and the corresponding height is \(h=V/(2V)^{2/3}\).

    The second derivatives are \[A_{ll}= \dfrac{4V}{l^3} \qquad A_{ww}= \dfrac{4V}{w^3} \qquad A_{lw}=1,\nonumber\] so the discriminant is \[D= \dfrac{4V}{l^3} \dfrac{4V}{w^3}-1= 4-1=3 \gt 0.\nonumber\]

    Since \(A_{ll}\) is \(2\), there is a local minimum at the critical point. Is this a global minimum? It is, but it is difficult to see this analytically; physically and graphically it is clear that there is a minimum, in which case it must be at the single critical point.

    Note that we must choose a value for \(V\) in order to graph it.

    Recall that when we did single variable global maximum and minimum problems, the easiest cases were those for which the variable could be limited to a finite closed interval, for then we simply had to check all critical values and the endpoints. The previous example is difficult because there is no finite boundary to the domain of the problem---both \(w\) and \(l\) can be in \((0,\infty)\). As in the single variable case, the problem is often simpler when there is a finite boundary.

    Theorem \(\PageIndex{7}\)

    If \(f(x,y)\) is continuous on a closed and bounded subset of \(\mathbb{R}^2\), then it has both a maximum and minimum value.

    As in the case of single variable functions, this means that the maximum and minimum values must occur at a critical point or on the boundary; in the two variable case, however, the boundary is a curve, not merely two endpoints.

    Example \(\PageIndex{8}\)

    The length of the diagonal of a box is to be \(1\) meter; find the maximum possible volume.

    Solution

    If the box is placed with one corner at the origin, and sides of length \(x, y, z\) along the axes, the length of the diagonal is \(1= \sqrt{x^2+y^2+z^2}\), and the volume is \[V=xyz= xy\sqrt{1-x^2-y^2}.\nonumber\]

    Clearly, \(x^2+y^2\le 1\), so the domain we are interested in is the quarter of the unit disk in the first quadrant. Computing derivatives: \[\eqalign{V_x&= \dfrac{y-2yx^2-y^3} {\sqrt{1-x^2-y^2}}\cr V_y&= \dfrac{x-2xy^2-x^3} {\sqrt{1-x^2-y^2}}\cr }\nonumber\]

    If these are both \(0\), then \(x=0\) or \(y=0\), or \(x=y=1/\sqrt 3\). The boundary of the domain is composed of three curves: \(x=0\) for \(y\in[0,1]\); \(y=0\) for \(x\in[0,1]\); and \(x^2+y^2=1\), where \(x\ge 0\) and \(y\ge 0\). In all three of those cases, the volume \(xy\sqrt{1-x^2-y^2}\) is \(0\), so the maximum occurs at the only critical point \((1/\sqrt 3,1/\sqrt 3,1/\sqrt 3)\), and the volume there is therefore \(1/(3\sqrt 3)\). See Figure \(\PageIndex{2}\).

    Figure \(\PageIndex{2}\): The volume of a box with fixed length diagonal.

    Exercises \(\PageIndex{}\)

    Exercise \(\PageIndex{1}\)

    Find all local maximum and minimum points of \(f=x^2+4y^2−2x+8y−1\).

    Answer

    Minimum at \((1,−1)\)

    Exercise \(\PageIndex{2}\)

    Find all local maximum and minimum points of \(f=x^2−y^2+6x−10y+2.\)

    Answer

    None

    Exercise \(\PageIndex{3}\)

    Find all local maximum and minimum points of \(f=xy\).

    Answer

    None

    Exercise \(\PageIndex{4}\)

    Find all local maximum and minimum points of \(f=9+4x−y−2x^2−3y^2\).

    Answer

    Maximum at \((1,−1/6)\)

    Exercise \(\PageIndex{5}\)

    Find all local maximum and minimum points of \(f=x^2+4xy+y^2−6y+1.\)

    Answer

    None

    Exercise \(\PageIndex{6}\)

    Find all local maximum and minimum points of \(f=x^2−xy+2y^2−5x+6y−9\).

    Answer

    Minimum at \((2,−1)\)

    Exercise \(\PageIndex{7}\)

    Find the absolute maximum and minimum points of \(f=x^2+3y−3xy\) over the region bounded by \(y=x,\;y=0,\;\) and \(\;x=2.\)

    Answer

    \(f(2,2)=−2,\quad f(2,0)=4\)

    Exercise \(\PageIndex{8}\)

    A six-sided rectangular box is to hold \(1/2\) cubic meter. What shape and size should the box be to minimize its surface area?

    Answer

    A cube, \(1/\sqrt[3]{2}\text{ meters}\approx 0.79\)cm on a side.

    Exercise \(\PageIndex{9}\)

    The (United States) post office will accept packages whose combined length and girth is at most \(130\) inches. (USPS Ground Advantage service. Girth is the maximum distance around the package perpendicular to the length, and for a rectangular box, the length is the largest of the three dimensions.) What is the largest volume that can be sent in a rectangular box?

    Answer

    \(\dfrac{65}{3}\times \dfrac{65}{3}\times \dfrac{130}{3}=\dfrac{2\times 65^3}{27}\approx 20343\) cubic inches.

    Exercise \(\PageIndex{10}\)

    The bottom of a rectangular box costs twice as much per unit area as the sides and top. Find the shape for a given volume that will minimize cost.

    Answer

    It has a square base, and is one and a half times as tall as it is wide. If the volume is \(V\), the dimensions are \(\sqrt[3]{2V/3} \times \sqrt[3]{2V/3} \times \sqrt[3]{9V/4}\).

    Exercise \(\PageIndex{11}\)

    Using the methods of this section, find the shortest distance from the origin to the plane \(x+y+z=10\).

    Answer

    \(\sqrt{100/3}\)

    Exercise \(\PageIndex{12}\)

    Using the methods of this section, find the shortest distance from the point \((x_0,y_0,z_0)\) to the plane \(ax+by+cz=d\). You may assume that \(c \ne 0\).

    Answer

    \(\dfrac{|ax_0+by_0+cz_0 −d|} {\sqrt{a^2+ b^2+ c^2}}\)

    Exercise \(\PageIndex{13}\)

    A trough is to be formed by bending up two sides of a long metal rectangle so that the cross-section of the trough is an isosceles trapezoid, similar to figure 6.2.6. If the width of the metal sheet is \(2\) meters, how should it be bent to maximize the volume of the trough?

    Answer

    The sides and bottom should all be \(2/3\) meter in width, and both sides should be bent up through an angle of \(60^{\circ}\).

    Exercise \(\PageIndex{14}\)

    Given the three points \((1,4), (5,2), (3,−2)\), \(\;S= (x−1)^2+(y−4)^2+ (x−5)^2+(y−2)^2+ (x−3)^2+(y+2)^2\;\) is the sum of the squares of the distances from some other point \((x,y)\) to these three points. Find \(x\) and \(y\) so that this quantity \(S\) is minimized.

    Answer

    \((x,y)=(3,4/3)\)

    Exercise \(\PageIndex{15}\)

    Suppose that \(f(x,y)=x^2+y^2+kxy\). Find and classify the critical points, and discuss how they change when \(k\) takes on different values.

    Exercise \(\PageIndex{16}\)

    Find the shortest distance from the point \((0,b)\) to the parabola \(y=x^2\).

    Answer

    \(|b|\) if \(b \le 1/2,\quad\) otherwise \(\;\sqrt{b−1/4},\quad\) if \(b \gt 1/2.\)

    Exercise \(\PageIndex{17}\)

    Find the shortest distance from the point \((0,0,b)\) to the paraboloid \(z=x^2+y^2\).

    Answer

    \(|b|\) if \(b \le 1/2,\quad\) otherwise \(\;\sqrt{b−1/4},\quad\) if \(b \gt 1/2.\)

    Exercise \(\PageIndex{18}\)

    Consider the function \(f(x,y)=x^3−3x^2y+y^3\).

    (a) Show that \((0,0)\) is the only critical point of \(f\).

    (b) Show that the discriminant test is inconclusive for \(f\).

    (c) Determine the cross-sections of \(f\) obtained by setting \(y=kx\) for various values of \(k\).

    (d) What kind of critical point is \((0,0)\)?

    Exercise \(\PageIndex{19}\)

    Find the volume of the largest rectangular box with edges parallel to the axes that can be inscribed in the ellipsoid \(2x^2+72y^2+18z^2=288\).

    Answer

    \(256/\sqrt{3}\)

    Contributors


    This page titled 14.7: Maxima and minima is shared under a CC BY-NC-SA 4.0 license and was authored, remixed, and/or curated by David Guichard via source content that was edited to the style and standards of the LibreTexts platform.