Optimization and Local Extrema

To find critical points we need to solve the system of equations $f_x = 0$ and $f_y = 0$. Let $f(x,y)= 2x^4 + 2y^4 - 8xy$.


\begin{maximasession}
f(x,y) := 2 * x^4 + 2 * y^4 - 8 * x * y;
\maximaoutput*
\i...
... y\right)\mathbin{:=}2 x^4+2 y^4+\left(-8\right) x y \\
\end{maximasession}

Let's take a look at a plot of $f$.


\begin{maximasession}
load(draw);
draw3d(enhanced3d = true, explicit(f(x,y), x, ...
...eft[ \mathrm{gr3d}\left(\mathrm{explicit}\right) \right] \\
\end{maximasession}

See Figure BLANK.

Figure 12: A surface plot of $f$
\includegraphics{plot7.eps}

Now let's take a look at a contour plot of $f$. We do it just like the plot of the surface, except we use the argument contour = map.


\begin{maximasession}
draw3d(explicit(f(x,y), x, -2, 2, y, -2, 2),
contour = ma...
...eft[ \mathrm{gr3d}\left(\mathrm{explicit}\right) \right] \\
\end{maximasession}

See Figure BLANK.

Figure 13: The level curves of $f$ which suggest two extrema and a saddle point
\includegraphics{plot8.eps}

Now let's find the first order partial derivatives of $f$, set them equal to zero, and solve for values of $(x,y)$. We do this with the solve function, which assumes that the expressions are set equal to zero by default. Keep in mind that solve finds all real and complex solutions; we only care about the real valued solutions, however, and will ignore the rest.


\begin{maximasession}
fx : diff(f(x,y), x);
fy : diff(f(x,y), y);
solve([fx,fy],...
...ft[ x=1 , y=1 \right] , \left[ x=0 , y=0 \right] \right] \\
\end{maximasession}

Critical points are at $(0,0)$, $(1,1)$, and $(-1,-1)$. (Note that both partial derivatives exist everywhere.) We need to see what the Hessian says at those locations.


\begin{maximasession}
H: hessian(f(x,y), [x,y]);
determinant(H);
\maximaoutput*
...
...\cr } \\
\i9. determinant(H); \\
\o9. 576 x^2 y^2-64 \\
\end{maximasession}

We do the Second Derivative Test by plugging in the above three points into $f_{xx}$ and $\mathrm{det}(\mathrm{H})$. (Of course we can do it mentally but let's try it with Maxima.) A quick way to plug numbers into expressions is with the subst function.


\begin{maximasession}
subst([x = -1, y = -1], diff(fx, x));
subst([x = -1, y = -...
.... subst([x = -1, y = -1], determinant(H)); \\
\o11. 512 \\
\end{maximasession}

From the above we conclude that $(-1,-1)$ is a local minimum of $f$, and the value is


\begin{maximasession}
f(-1,-1);
\maximaoutput*
\i12. f(-1,-1); \\
\o12. -4 \\
\end{maximasession}

Doing the same for $(0,0)$ and $(1,1)$ shows that $(0,0)$ is a saddle point and $(1,1)$ is also a local minimum (we know this already by symmetry).



G. Jay Kerns 2009-12-01