\documentclass{amsart}[11pt]
\usepackage{graphicx}

\addtolength{\textwidth}{1.4in}                          
\oddsidemargin=0in                          
\evensidemargin=0in       

\newtheorem{example}{Example} 
\newtheorem{question}[example]{Question}
\newtheorem{definition}[example]{Definition}
\newtheorem{theorem}[example]{Theorem}
\newtheorem{notation}[example]{Notation}
\newtheorem{fact}[example]{Fact}

\begin{document}

\title{Math 242, Lecture 20}
\maketitle

\section{ The gradient}  

Because we have talked about vectors, we can talk about the construction
which assembles partial derivatives into what might be called a
``total derivative'', namely the gradient vector.    The book does not
cover this topic, and it will not appear on homework, quizzes and the main
part of the last exam, but still might appear somehow (wink wink).  

\begin{definition}
The gradient of a function $f(x,y)$ is the vector 
$\begin{bmatrix}  \frac{\partial f}{\partial x} & \frac{\partial f}{\partial y} \end{bmatrix}$.  
\end{definition}

\begin{example}
Find the gradient of the function $f(x,y) = x^2 - y^2$  
and its value at the point $(1,2)$.  
\end{example}

Using the dot product, we can use the gradient to find the rate
of change of a function in any direction.  

\begin{theorem}
The rate of change of a two-variable function at a point 
in a given direction is the dot product of the gradient vector at that point
with a {\em unit vector} in that direction.  
\end{theorem}

 

\begin{example}
Find the rate of change of the function $x^2 + y^2$ at the point $(1,1)$
in the direction of the unit vectors $\begin{bmatrix}  \frac{1}{\sqrt{2}} \\  \frac{1}{\sqrt{2}}
\end{bmatrix}$   and $\begin{bmatrix}  \frac{3}{5} \\  \frac{4}{5} \end{bmatrix}$.  
\end{example}



\section{ Higher-order partial derivatives}  

As in the case of a single variable, we are free to take
a derivative of a derivative.     The notation works as follows:
\begin{definition}
The partial derivative with respect to $x$ of the partial with respect to 
$x$ is  $f_{xx}$ or $\frac{\partial^2 f}{\partial x^2}$. \\  
The partial derivative with respect to $y$ of the partial with respect to
$x$ is $f_{xy}$ or $\frac{\partial^2 f}{\partial y \partial x}$. \\  
The partial derivative with respect to $x$ of the partial with respect to 
$y$ is  $f_{yx}$ or $\frac{\partial^2 f}{\partial x \partial y}$. \\  
The partial derivative with respect to $y$ of the partial with respect to 
$y$ is  $f_{yy}$ or $\frac{\partial^2 f}{\partial y^2}$. \\  
\end{definition}

\begin{example}
Find second-order partial derivatives of $f(x,y) = x^2 y^3 + e^{xy}$  
and $f(x,y) = \ln(x + y)$  
\end{example}


\section{ Finding relative maxima and minima of multivariable functions}  

In one variable, we found that maxima and minima can occur either at 
endpoints of a constraint interval or at critical points, which were mainly
where the derivative of the function vanished.    In the second third of
the class, we learned about finding maxima and minima of
linear functions,   which all occur on the boundary of the constraint
region (aka linear programming).    Now we will focus on multivariable
critical points.  

\begin{definition}
A critical point of a multivariable function is a point at which all partial
derivatives vanish.  
\end{definition}

We will formalize what can happen at a critical point after looking at
some basic examples.  

\begin{example}
Find the critical point(s), and look at the graphs of the functions near those points,
of the following:  
\begin{itemize}
\item $f(x,y) = x^2 + y^2$   
\item $f(x,y) = -(x-2)^2 - (y+1)^2$  
\item $f(x,y) = x^2 - y^2$  
\end{itemize}
\end{example}

So at a critical point, in every direction we go from increasing to decreasing,
or decreasing to increasing.     At (what looks like) a local maximum, 
a function goes from increasing to decreasing in every direction.  
At a local minimum, the change is from decreasing to increasing in 
every direction.    But in some cases, called saddle points, the
function goes from decreasing to increasing in some directions
and increasing to decreasing in others.    

One way to test what kind of behavior is occurring is to take values
of many points near the critical point.    If, for example, they are all 
less than the value at the critical point, then the critical point
is probably a local maximum.    But one cannot be absolutely
sure with this method.  
There is an intricate 
series of computations which gives certainty in this
determination.  

\begin{theorem}
Let $f(x,y)$ be a function in two variables and let 
$(a, b)$ be a critical point, so that $f_x(a, b) = 0$
and $f_y(a,b) = 0$.     Let $D$ be the quantity
$f_{xx}(a,b) f_{yy}(a,b) - [f_{xy}(a,b)]^2$.  If $D < 0$
then $(a,b)$ is a saddle point.    If $D>0$
and $f_{xx}(a,b) < 0$ then $(a,b)$ is a relative
maximum.    If $D > 0$ and $f_{xx}(a,b) > 0$
then $(a,b)$ is a relative minimum.  
\end{theorem}

We will summarize this theorem as a technique in the next lecture.  
For now, we give one illustration.  

\begin{example}
Find and classify all critical points of the function 
$f(x,y) = x^3 - y^3 + 6xy$.  
\end{example}


\end{document}
 