Optimization of functions is just as important for functions of several variables as it was in one variable. Let's first look at things graphically. The interactive surface to the right below is the graph of $$z\ = \ f(x, \,y) \ = \ \sin x\sin y \,, \quad -\pi \le x, \,y \le \pi\,.$$
In topographical terms, it has

  Mountains: Local Maxima such as $P$,

  Basins: Local Minima such as $Q$,

both of which occured for graphs in the plane.

It also has a pass through the mountains at $R$, at which the terrain slopes up in one direction and down in another direction just like a saddle. Not surprisingly, this is called a saddle point. Saddle points are a new phenomenon, unlike anything that you saw with functions of one variable.

Just as with functions of one variable, calculus will provide both an algebraic and graphical understanding of local extrema. So for a general function we introduce the following

 Definition: At $(a, \,b)$ a function $z=f(x, \,y)$ is said to have a

     Local Maximum :   $f(x, \,y) \le f(a, \,b)$ for all $(x,\, y)$ near $(a, \,b)$,

     Local Minimum :  $f(x, \,y) \ge f(a, \,b)$ for all $(x,\, y)$ near $(a, \,b)$.

The point $(a,\,b)$ is said to be a Local Extremum of $z = f(x,\,y)$ if it is a local maximum or a local minimum.


In one variable locating local extrema usually meant finding where $f'(x) = 0$. In $2$ variables we replace $f'(x)$ by $\nabla f (x,\,y)$.

  Definition: A point $(a, \,b)$ is said to be a critical point of $f(x, y)$ when $$\nabla f(a,\,b) \ = \ f_x(a,\,b)\, {\bf i} + f_y(a,\,b)\, {\bf j} \ = \ 0\,,$$ i.e. , $\ f_x(a,\,b) = f_y(a,\,b) = 0\,,$ or when $\nabla f$ is not defined, i.e. when or at least one of $f_x(a, \,b),\, f_y(a,\, b)$ does not exist.

The crucial observation: Since $\nabla f$ always points uphill and $-\nabla f$ always points downhill, a point where $\nabla f$ exists and isn't zero cannot be a local extremum. In other words, all local extrema are critical points. However, we have seen that not all critical points are local extrema. We have points of inflection, as in one dimension, and we can have saddle points.

We can express this geometrically, in terms of the tangent plane to the surface $z=f(x,y)$. The tangent plane exists and is horizontal precisely where $\nabla f = 0$. In one dimension, critical points were where the tangent line was horizontal or did not exist. In two dimensions, critical points are where the tangent plane is horizontal or does not exist.

The previous graph of $z = \sin x \sin y$ shows that $\nabla f(a,\,b) = 0$ and the tangent plane is horizontal at $P,\, Q,$ and $R$. Let's see in detail how this works algebraically to find all critical points:

  Start with the function $$z\ = \ f(x, \,y) \ = \ \sin x \sin y\,, \quad -\pi \le x, \,y \le \pi\,.$$ By the Product Rule, $$f_x\ = \ \cos x\sin y\,, \qquad f_y \ = \ \sin x \cos y\,.$$ As $f_x,\, f_y$ are always defined for $-\pi < x, \,y < \pi$, the only critical points occur when $(x,\,y)$ satisfy the equations $$\cos x \sin y \ = \ 0\ = \ \sin x \cos y\,.$$ But $$\cos \Bigl(-\frac{\pi}{2}\Bigr)\ = \ \sin 0 \ = \ \cos \frac{\pi}{2} \ = \ 0\,,$$ so the critical points $(a,\,b)$ occur at $\color{darkerblue}(0,\,0)$ and at $$\Big( \frac{\pi}{2}, \, \frac{\pi}{2} \Big), \ \ \Big( \frac{\pi}{2}, \, -\frac{\pi}{2} \Big), \ \ \Big(-\frac{\pi}{2}, \, -\frac{\pi}{2} \Big), \ \ \Big( -\frac{\pi}{2},\, \frac{\pi}{2} \Big).$$