Skip to main content

Chapter 7 CA7: Local and Global Extrema

Section 7.1 Critical Points

Recall that a function of one variable, \(f(x)\) has a “critical point” at \(x=x_0\) if the tangent line to the curve at \(x=x_0\) is horizontal or if the derivative does not exist at that point. This critical point can be either a (local) maximum, minimum or horizontal point of inflection or vertical point of inflection. (The first three possibilities are shown in Figure 7.1 below.)
Figure 7.1. A plot of \(y=f(x)\) with stationary points labelled.
The idea of critical points can be applied to functions of two variables.

Definition 7.2. Critical Point.

The function \(z=f(x,y)\) has a critical point at \((x_0,y_0)\) if the tangent plane to the surface at the point \((x_0,y_0,z_0)\) is horizontal or if one of the directional derivatives does not exist.
As with functions of one variable, critical points of functions of two variables will be one of three types.
  1. If at a critical point \(f(x,y) \leq f(x_0,y_0)\) for all points in some open disk centred on \((x_0,y_0)\) then the critical point is a local maximum.
  2. If at a critical point \(f(x,y) \geq f(x_0,y_0)\) for all points in some open disk centred on \((x_0,y_0)\) then the critical point is a local minimum.
  3. For a smooth function (i.e. a function for which all derivatives exist) if a critical point is not a local maximum or a local minimum then it is a saddle point.

Example 7.3.

The graph of the function
\begin{equation*} f(x,y) = x(5x+2)(3y-2)e^{-\left( \frac{x^2+y^2}{5} \right)} \end{equation*}
is given below with local maxima and local minima labelled.
Figure 7.4. 3D plot of \(f(x,y) = x(5x+2)(3y-2)e^{-\left( \frac{x^2+y^2}{5} \right)}\) with local minima and maxima labelled.

Example 7.5.

The graph of the function \(f(x,y) = x^2-y^2\) is given below with a saddle point labelled.
Figure 7.6. 3D plot of \(f(x,y) = x^2-y^2\) with a saddle point labelled.
For smooth functions we can find the critical points by looking for those points where the tangent plane is horizontal. If the function \(z=f(x,y)\) has a tangent plane at the point \((x_0,y_0,z_0)\) we can determine algebraically that it is horizontal by checking that:
  • The normal vector for the plane is parallel to the vector \(\langle 0,0,1 \rangle\text{,}\) or
  • The directional derivative at \((x_0,y_0)\) is zero in every direction, or
  • The gradient vector at \((x_0,y_0)\) is \(\langle 0,0 \rangle\text{.}\)
These conditions are all equivalent and they lead us to the following theorem.
Note: For the most part, we will assume that the function is smooth, i.e. has derivatives of all orders. In particular a smooth function does not have any discontinuities or cusps. Such critical points will occur for functions of two variables when at least one of the partial derivatives does not exist at the critical point.

Example 7.8.

Locate, and determine the nature of, the critical points of the function
\begin{equation*} z = 2x^3 + (x+1)y^2 + 5x^2\text{.} \end{equation*}
Answer.
\(\left(0,0\right)\) is a local minimum; \(\left(-\dfrac{5}{3},0\right)\) is a local maximum; \(\left(-1,2\right)\) and \(\left(-1,-2\right)\) are saddle points.
Solution.
To locate the critical points we solve the equations \(z_x = z_y = 0\text{,}\) and check for any points where they do not exist. Since this function is given by a polynomial, the partial derivatives exist. We set them to zero below.
\begin{align} 6x^2 + y^2 + 10x \amp = 0\tag{7.1}\\ 2(x+1)y \amp = 0\tag{7.2} \end{align}
From (7.2)
\begin{equation*} x=-1 \: \text{ or } \: y=0\text{.} \end{equation*}
Putting \(y=0\) into (7.1) gives
\begin{equation*} x=0 \: \text{ or } \: x=-\dfrac{5}{3}\text{.} \end{equation*}
Putting \(x=-1\) into (7.1) gives
\begin{equation*} y=2 \: \text{ or } \: y=-2\text{.} \end{equation*}
Thus there are 4 critical points at
\begin{equation*} \left( 0, 0 \right), \left( -\dfrac{5}{3}, 0 \right), \left( -1, 2 \right) \: \text{ and } \left( -1, -2 \right)\text{.} \end{equation*}
If we have the graph of the function then we can usually determine the nature of these critical points by inspection. From the (computer generated) graph shown below we can see with very careful inspection that the critical point at \((0,0)\) is a local minimum, the critical point at \(\left( -\dfrac{5}{3}, 0 \right)\) is a local maximum and the critical points at \((-1,2)\) and \((-1,-2)\) are saddle points.
Figure 7.9. 3D plot of \(z = 2x^3 + (x+1)y^2 + 5x^2\text{.}\)
Sometimes the nature of the critical points is not clear on such graphs or we don’t have access to the graph. Another approach to determining the nature of the critical points is to sketch the level curves for the function.
Figure 7.10. Sketch of the level curves \(z = k\) for various \(k\text{.}\)
From this diagram we can see that as we move away from the critical points at \(\left(0,0\right)\) in any direction the function value is increasing and hence \(\left(0,0\right)\) is local minimum. Similarly as we move away from the critical point at \(\left(-\dfrac{5}{3},0\right)\) in any direction the function value is decreasing is hence \(\left(-\dfrac{5}{3},0\right)\) is a local maximum. For the critical points at \(\left(-1,2\right)\) and \(\left(-1,-2\right)\) we can move away in some directions and have the function value increase while in other directions the function value will decrease. Hence these critical points are saddle points.
The below Sage cell plots the critical points (in red) of the function
\begin{equation*} f(x,y)=2x^3+(x+1)y^2+5x^2 \end{equation*}
on the 3D surface plot and on the 2D contour plot.

Exercises Example Tasks

1.
Find the critical points of the function \(f(x,y) = 3x-x^3-2y^2+y^4\) and use the plot of level curves given below to determine the nature of each critical point.
Figure 7.11.

Section 7.2 Second Derivative Test

An algebraic method for determining what type of critical points a function has is given by the following theorem.

Outline of Proof.

For the sake of simplicity assume that the critical point is at the point \((x_0,y_0)=(0,0)\text{.}\) Now using a Taylor expansion for functions of two variables about \((a,b) = (0,0)\) we have (up to the quadratic terms)
\begin{equation*} f(x,y); f(0,0) + f_x (0,0)x + f_y (0,0) y + \dfrac{f_{xx}(0,0)}{2} x^2 + f_{xy} (0,0) xy + \dfrac{f_{yy}(0,0)}{2} y^2\text{.} \end{equation*}
Since \((x_0,y_0) = (0,0)\) is a critical point of the function \(f_x (0,0) = f_y (0,0) = 0\text{.}\) Thus
\begin{equation*} f(x,y); f(0,0) + \dfrac{f_{xx}(0,0)}{2}x^2 + f_{xy} (0,0) xy + \dfrac{f_{yy} (0,0)}{2}y^2\text{.} \end{equation*}
On completing the square (and dropping the evaluation at \((0,0)\) for brevity)
\begin{align*} f(x,y) \amp \simeq f + \dfrac{f_{xx}}{2} \left \{x^2 + \dfrac{2f_{xy}}{f_{xx}} + \left( \dfrac{f_{xy}}{f_{xx}} \right)^2 y^2 \right \} - \dfrac{f_{xx}}{2} \left( \dfrac{f_{xy}}{f_{xx}} \right)^2 y^2 + \dfrac{f_{yy}}{2}y^2\\ \amp = f + \dfrac{f_{xx}}{2} \left( x + \dfrac{f_{xy}}{f_{xx}} y \right)^2 + \dfrac{1}{2 f_{xx}} y^2 \left( f_{xx} f_{yy} - f_{xy}^2 \right)\text{.} \end{align*}
From this we can see that if \(f_{xx} > 0\) and \(D = f_{xx} f_{yy} - f_{xy}^2 > 0\) then when \(x\) and \(y\) are varied from \((0,0)\text{,}\) \(f(x,y)\) increases and so \((x_0,y_0) = (0,0)\) will be a local minimum.

Example 7.13.

Locate and identify the critical points of the function \(f(x,y) = 2x^3 + (x+1)y^2 + 5x^2\text{.}\)
Answer.
\(\left(0,0\right)\) is a local minimum; \(\left(-\dfrac{5}{3},0\right)\) is a local maximum; \(\left(-1,2\right)\) and \(\left(-1,-2\right)\) are saddle points.
Solution.
We located the critical points of this function in an earlier example. We found that there are 4 critical points at
\begin{equation*} \left( 0, 0 \right), \left( -\dfrac{5}{3}, 0 \right), \left( -1, 2 \right) \: \text{ and } \left( -1, -2 \right)\text{.} \end{equation*}
To determine the nature of these critical points, in this example we will use the second derivative test. To this end, note that
\begin{equation*} f_{xx} = 12x+10, \: f_{xy} = 2y, \: \text{ and } f_{yy} = 2x+2\text{.} \end{equation*}
Thus
\begin{align*} D \amp = f_{xx} f_{yy} - f_{xy}^2 = (12x+10)(2x+2) - (2y)^2\\ \amp = 24x^2 + 44x -4y^2+20\text{.} \end{align*}
Now, applying the second derivative test:
  • At \((0,0)\text{,}\) \(D=20>0\text{,}\) \(f_{xx}=10>0\) and so \((0,0)\) is a local minimum.
  • At \((-\dfrac{5}{3},0)\text{,}\) \(D=\dfrac{40}{3}>0\text{,}\) \(f_{xx}=-10 < 0\) and so \((-\dfrac{5}{3},0)\) is a local maximum.
  • At \((-1,2)\text{,}\) \(D=-16 < 0\) and so \((-1,2)\) is a saddle point.
  • At \((-1,-2)\text{,}\) \(D=-16 < 0\) and so \((-1,-2)\) is also a saddle point.
This is in agreement with the conclusions we made on the nature of these critical pointson the basis of the level curves of the function.

Example 7.14.

Locate and identify the critical points of the function
\begin{equation*} g(x,y) = 2 - \sqrt{x^2+y^2}\text{.} \end{equation*}
Answer.
\((0,0)\) is a local maximum.
Solution.
Here
\begin{equation*} g_x = \dfrac{-x}{\sqrt{x^2+y^2}} \: \text{ and } \: g_y = \dfrac{-y}{\sqrt{x^2+y^2}}\text{.} \end{equation*}
For this function both partial derivatives are undefined at \((x, y) = (0,0)\) and so this point will be a critical point. However we cannot use the second derivative test to determine the nature of this critical point. In this case we can see from the graph of the function that the critical point at \((x, y) = (0,0)\) is a local maximum.
Figure 7.15.

Exercises Example Tasks

1.
Locate and identify the critical points of the function \(z=3x-x^3-2y^2+y^4\text{.}\)
2.
Locate and identify the critical points of the function \(z=\exp \left(xy-\frac{2}{3}x^3 - \frac{2}{3}y^3 \right)\text{.}\)
Figure 7.16.

Section 7.3 Global Extrema

Definition 7.17. Global Extrema.

Consider the function of two variables \(f(x,y)\) on the domain D.
  • If there exists some point \((x_0,y_0)\) in \(D\) such that \(f(x,y) \leq f(x_0,y_0)\) for all points \((x,y)\) in \(D\) then the function has a global maximum at \((x_0,y_0)\text{.}\)
  • Similarly, if there exists some point \((x_0,y_0)\) in \(D\) such that \(f(x,y) \geq f(x_0,y_0)\) for all points \((x,y)\) in \(D\) then the function has a global minimum at \((x_0,y_0)\text{.}\)

Example 7.18.

The graph of the function
\begin{equation*} f(x,y) = x(5x+2)(3y-2)e^{-\left(\frac{x^2+y^2}{5} \right)} \end{equation*}
over the domain \(D = \left \{ (x,y): -5 \leq x \leq 5, \, -5 \leq y \leq 5 \right \}\) is shown below.
Figure 7.19. 3D plot of \(f(x,y) = x(5x+2)(3y-2)e^{-\left(\frac{x^2+y^2}{5} \right)}\) with global maximum and minimum labelled.
Before discussing global extrema for functions of two variables, recall the situation for a function of one variable \(y=f(x)\text{.}\) If \(f(x)\) is continuous on the closed interval \(I=[a,b]\) then \(f(x)\) is guaranteed to have both a global maximum and a global minimum on \(I\text{.}\)
Figure 7.20. Plot of \(y=f(x)\) with global maximum and minimum, and critical points labelled.
These global extrema can be found by evaluating \(f(x)\) at
  • All of the critical points of \(f(x)\) in \(I\text{,}\) and
  • The endpoints of \(L\text{.}\)
The procedure for finding the global extrema of functions of two variables is very similar and is based on the following theorem.
Note that a closed region, \(D \subset \mathbb{R}^2\text{,}\) is a region in the plane that contains its boundary. For example in the diagram below Region \(D_1\) would be a closed region whereas Region \(D_2\) is not closed.
Figure 7.22. Example of a region \(D_1\) which is closed, and a region \(D_2\) which is not closed.
A bounded region, \(D \subset \mathbb{R}^2\text{,}\) is a region in the plane that doesn’t extend to infinity in any direction. For example in the diagram below Region \(D_1\) would be a bounded region whereas Region \(D_2\) is not bounded.
Figure 7.23. Example of a region \(D_1\) which is bounded, and a region \(D_2\) which is not bounded.

Remark 7.24. Locating Global Extrema.

To locate the global extrema of the continuous function \(f(x,y)\) on the closed and bounded domain \(D \subset \mathbb{R}^2\text{:}\)
  • Find all of the critical points in the interior of \(D\text{;}\)
  • Find the maximum and minimum values of \(f(x,y)\) on the boundary of \(D\text{;}\)
  • Evaluate \(f(x,y)\) at each of the above points and compare.

Example 7.25.

The below Sage cell plots the global maximum and global minimum (shown in red) of the surface
\begin{equation*} f(x,y)=2x^2+x+y^2-2 \end{equation*}
on the disc \(D=\{(x,y)\in\mathbb{R}^2\big\vert x^2+y^2\leq 4\}\) (shown in green).

Example 7.26.

Find the global extrema of the function \(z(x,y) = x^2 + 2xy + 3y^2\) on the closed triangular region \(D\) with vertices \((-1,1)\text{,}\) \((2,1)\) and \((-1,-2)\text{.}\)
Answer.
Global maximum: \(17\) at \((x,y) = (-1,2)\)
Global minimum: \(0\) at \((x,y)=(0,0)\text{.}\)
Solution.
Figure 7.27.
Firstly note that \(D\) is a closed and bounded region in the plane and so we can use the method outlined above. So begin by finding the critical points of \(z\text{.}\) Here
\begin{equation*} z_x = 2x+2y \: \text{ and } \: z_y = 2x+6y\text{.} \end{equation*}
Critical points occur when \(z_x = z_y = 0\) and so this function has only one critical point at \((x,y) = (0,0)\text{.}\) This is inside \(D\) and so we evaluate the function at this point, i.e.
\begin{equation*} z(0,0) = 0\text{.} \end{equation*}
To find the maximum and minimum values of the function on the boundary we will have to consider the 3 sides of the triangle separately. Firstly, consider the side of the triangle defined by
\begin{equation*} y=1, \: -1 \leq x \leq 2\text{.} \end{equation*}
On this interval we think of \(z\) as a function of \(x\) only, i.e.
\begin{equation*} z(x) = x^2 + 2x + 3\text{.} \end{equation*}
Figure 7.28.
This has a maximum value \(11\) at \(x=2\) and minimum value \(2\) at \(x=-1\text{.}\)
Next consider the side of the triangle defined by
\begin{equation*} x=-1, \: -2 \leq y \leq 1\text{.} \end{equation*}
On this interval we think of \(z\) as a function of \(y\) only, i.e.
\begin{equation*} z(y) = 1-2y+3y^2\text{.} \end{equation*}
Figure 7.29.
Again, using the technique given above for locating the global extrema for a function of one variable (or by looking at the graph) we find that the largest value of \(z\) occurs at \(y=-2\) (giving \(z=17\)) and the smallest value of \(z\) occurs at \(y=1/3\text{,}\) (giving \(z=2/3\)).
Finally on the interval defined by
\begin{equation*} y=x-1, \: -1 \leq x \leq 2\text{,} \end{equation*}
we can think of \(z\) as a function of \(x\) only, i.e.
\begin{equation*} z(x) = 6x^2-8x+3\text{.} \end{equation*}
Figure 7.30.
For this function the global maximum is \(17\) at \(x=-1\) and the global minimum is \(1/3\) at \(x=2/3\text{.}\)
On comparing the value of the function \(z(x,y) = x^2 + 2xy + 3y^2\) at each of the global extrema on the sides of the triangle and at the critical point inside the region we conclude that the function has a global maximum of \(17\) at \((x,y) = (-1,2)\) and a global minimum of \(0\) at \((x,y)=(0,0)\text{.}\)

Exercises Example Tasks

1.
Find the global extrema of \(z=2x^2 + x +y^2 - 2\) on \(D = \left \{ (x,y): x^2+y^2 \leq 4 \right \}\text{.}\)
2.
Find the global extrema of \(R(x,y) = x \sqrt{8-x^2-y^2}\) on \(D = \left \{ (x,y): x^2+y^2 \leq 8 \right \}\text{.}\)