Posted by: Dave Richeson | April 18, 2012

## An interesting multivariable calculus example

Earlier this semester in my Multivariable Calculus course we were discussing the second derivative test. Recall the pesky condition that if ${(a,b) }$ is a critical point and ${D(a,b)=f_{xx}(a,b)f_{yy}(a,b)-(f_{xy}(a,b))^{2}=0}$, then the test fails.

A student emailed me after class and asked the following question. Suppose a function ${f}$ has a critical point at ${(0,0)}$ and ${D(0,0)=0}$. Moreover, suppose that as we approach ${(0,0)}$ along ${x=0}$ we have ${f_{xx}(0,y)>0}$ when ${y<0}$ and ${f_{xx}(0,y)<0}$ when ${y>0}$. Is that enough to say that the critical point is a not a maximum or a minimum? His thought process was that if we look at slices ${y=k}$ we get curves that are concave up when ${k<0}$ and curves that are concave down when ${k>0}$—surely that could not happen at a maximum or minimum.

I understood his intuition, but I was skeptical. Indeed, after a little playing around I came up with the following counterexample. The function is

${\displaystyle f(x,y)=\begin{cases} x^{4}+y^{2}e^{-x^{2}} & y\ge 0\\ x^{4}+x^{2}y^{2}+y^{2} & y<0. \end{cases}}$

The first partial derivatives are

${\displaystyle f_{x}(x,y)=\begin{cases} 4x^{3}-2xy^{2}e^{-x^{2}} & y\ge 0\\ 4x^{3}+2xy^{2} & y<0, \end{cases}}$

${\displaystyle f_{y}(x,y)=\begin{cases} 2ye^{-x^{2}} & y\ge 0\\ 2x^{2}y+2y & y<0. \end{cases}}$

Clearly ${(0,0)}$ is a critical point. The second partial derivatives are

${\displaystyle f_{xx}(x,y)=\begin{cases} 12x^{2}-2y^{2}e^{-x^{2}}+4x^{2}y^{2}e^{-x^{2}} & y\ge 0\\ 12x^{2}+2y^{2} & y<0, \end{cases}}$

${\displaystyle f_{yy}(x,y)=\begin{cases} 2e^{-x^{2}} & y\ge 0\\ 2x^{2}+2 & y<0, \end{cases}}$

${\displaystyle f_{xy}(x,y)=f_{yx}(x,y)=\begin{cases} -4xye^{-x^{2}} & y\ge 0\\ 4xy & y<0. \end{cases}}$

Thus ${D(0,0)=f_{xx}(0,0)f_{yy}(0,0)-(f_{xy}(0,0))^{2}=0\cdot 2-0^{2}=0}$. So the second derivative test fails. But observe that when ${x=0}$ we have

${\displaystyle f_{xx}(0,y)=\begin{cases} -2y^{2} & y\ge 0\\ 2y^{2} & y<0. \end{cases}}$

So ${f_{xx}(0,y)>0}$ when ${y<0}$ and ${f_{xx}(0,y)<0}$ when ${y>0}$. Yet it is easy to see that ${(0,0)}$ is a minimum: ${f(0,0)=0}$ and ${f(x,y)>0}$ for all ${(x,y)\ne (0,0)}$. A graph of the function is shown below. You can see the concave down cross sections for $x=0$ and $y>0$.

## Responses

1. I think the functions $(y-x^2)^4 + x^4$ and $((y-x^2)^2 + x^2)^2$ also work. They are inspired by the pitchfork bifurcation (compare with the shape of the contour $f_x=0$).

• I actually meant $(y-x^2)^4 + y^4$ and $((y-x^2)^2 + y^2)^2$, but the other two also work. From the contour plots for all these functions it is clear that they use the same idea.

• Great! Thanks. I haven’t checked the derivatives, but it looks good on Grapher.

• I just realised that the examples I gave are closely related to the Rosenbrock function [1].

• Wow. Cool. Thanks for sharing that!