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

# Maxima and Minima

## Critical Points

Just as in Calculus 1, we can use derivatives to find maxima and minima for functions of two variables. Recall that the candidates for these optimal points are the critical points, where the first derivative is zero or does not exist, as shown below.

However, not all critical points correspond to extrema, like the one furthest to the right in the figure above. Thus, once we've found all the critical points, we'll have to test them to determine whether they correspond to maxima, minima, or neither. In Calculus 1, we used the First Derivative Test and the Second Derivative Test, but here we'll just use the Second Derivative Test.

Maxima and minima are defined as follows: if $$f(x,y) \leq f(a,b)$$ at all points near $$(a,b)$$, then $$f(a,b)$$ is a local max. Similarly, if $$f(x,y) \geq f(a,b)$$ at all points near $$(a,b)$$, then $$f(a,b)$$ is a local min.

#### Critical Points

A critical point occurs at $$(a,b)$$ if

1. $$f_x (a,b) = 0$$ and $$f_y (a,b) = 0$$
2. OR
3. at least one of the partial derivatives does not exist.

Find the critical points of $$f(x,y)=4+x^3+y^3-3xy$$.

#### Solution

Find the first derivatives:

\begin{align} f_x (x,y) &= 3x^2-3y\\ f_y (x,y) &= 3y^2-3x \end{align}

Since these exist everywhere, we simply need to find where they equal zero:

$3x^2-3y = 0 \longrightarrow y=x^2$

If $$y=x^2$$, then

\begin{align} 3y^2-3x &= 0\\ 3x^4-3x &= 0\\ 3x(x^3-1) &= 0\\ \implies x = 0,1 \end{align}

Since $$y=x^2$$, these x values correspond to y values of 0 and 1, respectively. Thus the critical points are

$\ans{(0,0) \textrm{ and } (1,1).}$

Just like in the two-dimensional case, not all critical points are maxima or minima, which is why we need the second derivative test.

The figure above shows a saddle point, so named because it resembles a saddle. At this point, the two partial derivatives are both zero, but it is neither a maximum or minimum.

## Second Derivative Test

Suppose the second-order partial derivatives of $$f$$ are continuous near $$(a,b)$$ and $$f_x (a,b) = f_y (a,b) = 0$$.

#### Definition

The discriminant D is $D(a,b) = f_{xx} (a,b)\ f_{yy} (a,b) - \left(f_{xy} (a,b)\right)^2$

Basically, if the discriminant is positive, the surface does the same thing in all directions (rises in all directions or falls in all directions); in this case, we use one of the second derivatives to determine which it does. If the discriminant is negative, the point is a saddle point. If the discriminant equals zero, the Second Derivative Test is inconclusive.

#### Second Derivative Test

• If $$D (a,b) > 0$$, then $$f$$ has a local max or min at $$(a,b)$$.
• If $$f_{xx} (a,b) < 0$$, then it is a $$\ans{\textrm{MAX.}}$$
• If $$f_{xx} (a,b) > 0$$, then it is a $$\ans{\textrm{MIN.}}$$
• If $$D (a,b) < 0$$, then $$f$$ has a saddle point at $$(a,b)$$.
• If $$D (a,b) = 0$$, then the test is inconclusive.

Find the local maxima and minima of $$f(x,y)=4+x^3+y^3-3xy$$.

#### Solution

We already found the critical points:

$(0,0) \textrm{ and } (1,1)$

Next, find the discriminant and evaluate it at the critical points:

\begin{align} D (x,y) &= f_{xx} (x,y)\ f_{yy} (x,y) - \left(f_{xy} (x,y)\right)^2\\ &= 36xy-9\\ \\ D (0,0) &= -9 \longrightarrow \textrm{ Saddle Point}\\ D (1,1) &= 27 \textrm{ and } f_{xx} (1,1) = 6 > 0 \longrightarrow \textrm{ Minimum} \end{align}

We conclude that there is a saddle point at $$(0,0)$$ and a local minimum at $$(1,1)$$.

Find the local maxima and minima of $$f(x,y)=3x^2y+y^3-3x^2-3y^2+2$$.

#### Solution

First, find the critical points. Note that the first partial derivatives exist everywhere, so we need to find the points where $$f_x$$ and $$f_y$$ are zero.

\begin{align} f_x &= 6xy-6x = 0 \longrightarrow x(y-1)=0 \longrightarrow x = 0 \textrm{ or } y=1\\ f_y &= 3x^2+3y^2-6y = 0 \end{align}
• If $$x=0$$: $f_y = 3y^2-6y = 0 \longrightarrow 3y(y-2) = 0 \longrightarrow y = 0,2$
• If $$y=1$$: $f_y = 3x^2-3 = 0 \longrightarrow 3(x+1)(x-1) = 0 \longrightarrow x=1,-1$

Therefore, the critical points are $$(0,0)$$, $$(0,2)$$, $$(1,1)$$, and $$(-1,1)$$.

Next, find the discriminant and evaluate it at the critical points:

\begin{align} D (x,y) &= (6y-6)^2 - (6x)^2 = 36y^2-72y+36-36x^2\\ \\ D (0,0) &= 36 > 0 \textrm{ and } f_{xx} (0,0) = -6 \longrightarrow \textrm{MAX}\\ D (0,2) &= 36 > 0 \textrm{ and } f_{xx} (0,2) = 6 \longrightarrow \textrm{MIN}\\ D (1,1) &= -36 \longrightarrow \textrm{Saddle Point}\\ D (-1,1) &= -3 \longrightarrow \textrm{Saddle Point} \end{align}

#### Try it yourself:

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

1. Find any local extrema and saddle points of $$f(x,y) = 4+2x^2+3y^2$$.
2. Minimum at $$(0,0)$$.

3. Find any local extrema and saddle points of $$f(x,y) = x^4+2y^2-4xy$$.
4. Minima at $$(1,1)$$ and $$(-1,-1)$$; saddle point at $$(0,0)$$.

5. Find any local extrema and saddle points of $$f(x,y) = \sqrt{x^2+y^2-4x+5}$$.
6. Minimum at $$(2,0)$$.

7. Find any local extrema and saddle points of $$f(x,y) = \dfrac{x}{1+x^2+y^2}$$.
8. Minimum at $$(-1,0)$$; maximum at $$(1,0)$$.

9. Find any local extrema and saddle points of $$f(x,y) = ye^x-e^y$$.
10. Saddle point at $$(0,0)$$.

## Applications

Let $$x$$, $$y$$, and $$z$$ be nonnegative numbers that add up to 200: $x+y+z=200$ Find values of $$x$$, $$y$$, and $$z$$ that minimize $x^2+y^2+z^2.$

#### Solution

Use the condition to write the quantity to be minimized as a function of two variables:

$z=200-x-y \longrightarrow f(x,y) = x^2+y^2+(200-x-y)^2$

Next, take the first partial derivatives to find the critical points:

\begin{align} f_x &= 2x-2(200-x-y) = 4x+2y-400\\ f_y &= 2y-2(200-x-y) = 4y+2x-400 \end{align}

If $$4x+2y-400 = 0$$, $$y=200-2x$$. Plug this into $$f_y$$: $4(200-2x)+2x-400 = -6x+400 = 0 \longrightarrow x = \dfrac{200}{3}$ Using this, $$y=200-2x = \dfrac{200}{3}$$. Therefore, the one critical point of this function is $$\left(\dfrac{200}{3},\dfrac{200}{3}\right)$$.

Find the discriminant at this point:

$D (x,y) = (4)(4) - (2)^2 = 12 > 0 \textrm{ and } f_{xx} = 4 > 0$

Therefore, this quantity is minimized when $\ans{x=\dfrac{200}{3},\ y=\dfrac{200}{3},\ \textrm{ and } z=\dfrac{200}{3}.}$

A shipping company handles rectangular boxes if the sum of the length, width, and height of the box does not exceed 96 inches. Find the dimensions of the box that meets this condition and has the largest volume.

#### Solution

The condition in this problem is $$x+y+z = 96$$. The volume, the quantity that we'd like to maximize, is $$V=xyz$$. To write this as a function of two variables, we'll use the condition to eliminate z:

$V(x,y)=xy(96-x-y) = 96xy-x^2y-xy^2$

Take the first partial derivatives to find the critical points:

\begin{align} V_x &= 96y-2xy-y^2 = y(96-2x-y)\\ V_y &= 96x-x^2-2xy = x(96-x-2y) \end{align}

If $$y(96-2x-y) = 0$$, then either $$y=0$$ or $$y=96-2x$$. Plug each of these into $$V_y$$:

• If $$y=0$$: $x(96-x) = 0 \longrightarrow x = 0,96$ This leads to two critical points: $$(0,0)$$ and $$(96,0)$$.
• If $$y=96-2x$$: $x(-96+3x) = 0 \longrightarrow x = 0, 32$ This leads to two critical points: $$(0,96)$$ and $$(32,32)$$.

We have four critical points, but we can save ourselves some work by noticing that only with the fourth one [$$(32,32)$$] is the volume nonzero. We can test to verify that this is a local maximum by finding the discriminant and evaluating it at $$(32,32)$$:

\begin{align} V_{xx} &= -2y, V_{yy} = -2x, V_{xy} = 96-2x-2y\\ \\ D (x,y) &= (-2y)(-2x)-(96-2x-2y)^2\\ D (32,32) &= 3072 > 0 \textrm{ and } V_{xx} (32,32) = -6 < 0 \end{align}

Therefore, the volume is maximized at

$\ans{x=32,\ y=32,\ \textrm{ and } z=32.}$

Build an aquarium with a volume of 200 cubic feet; if the base (made of slate) costs 5 times as much as the sides (made of glass), find the dimensions that minimize the cost of the aquarium.

#### Solution

The condition in this problem is $$xyz = 200$$. The cost, the quantity that we'd like to minimize, is $$C=5xy+2xz+2yz$$. To write this as a function of two variables, we'll use the condition to eliminate z:

$C(x,y)=5xy+\dfrac{400}{y}+\dfrac{400}{x}$

Take the first partial derivatives to find the critical points:

\begin{align} C_x &= 5y-\dfrac{400}{x^2} = 0 \longrightarrow y=\dfrac{80}{x^2}\\ C_y &= 5x-\dfrac{400}{y^2} = 0\\ &= 5x-\dfrac{400}{(80/x^2)^2} = 0 \longrightarrow x^3 = 80 \longrightarrow x \approx 4.31 \end{align}

We can test to verify that this is a local minimum by finding the discriminant and evaluating it at $$(4.31,4.31)$$:

\begin{align} C_{xx} &= \dfrac{800}{x^3}, C_{yy} = \dfrac{800}{y^3}, C_{xy} = 5\\ \\ D (x,y) &= \dfrac{640,000}{x^3y^3}-(5)^2\\ D (4.31,4.31) &= 75 > 0 \textrm{ and } C_{xx} (4.31,4.31) = 10 > 0 \end{align}

Therefore, the cost is minimized at

$\ans{x=4.31\ ft,\ y=4.31\ ft,\ \textrm{ and } z=10.77\ ft.}$

Suppose three houses are located at $$(0,0)$$, $$(2,0)$$, and $$(1,1)$$. A power substation must be located at a point such that the sum of the squares of the distances between the houses and the substation is minimized.

#### Solution

The sum of the squares of the distances is

\begin{align} D &= x^2+y^2+(x-2)^2+y^2+(x-1)^2+(y-1)^2\\ &= 3x^2+3y^2-6x-2y+6 \end{align}

Take the first partial derivatives to find the critical points:

\begin{align} D_x &= 6x-6 = 0 \longrightarrow x=1\\ D_y &= 6y-2 = 0 \longrightarrow y = \dfrac{1}{3}\\ \end{align}

We can test to verify that this is a local minimum by finding the discriminant and evaluating it at $$\left(1,\dfrac{1}{3}\right)$$:

\begin{align} D_{xx} &= 6, D_{yy} = 6, D_{xy} = 0\\ \\ D (x,y) &= 36 > 0 \textrm{ and } D_{xx} > 0 \end{align}

Therefore, the substation should be positioned at

$\ans{\left(1,\dfrac{1}{3}\right).}$