Construct a function which has a minimum, two saddle points and no more critical points. Construct a polynomial $p(x) \in \mathbb{R}[x]$ that the function $f(x,y)=y^2+p(x)$ of $\mathbb{R}^2$ has a minimum, two saddle points and no more critical points.
I do not know how to solve it but also I need more general approach that I could use for such questions.
 A: Since $f_y=2y$ and $f_x=p^{\prime}(x)$, you need to find $p(x)$ so that $p^{\prime}(x)=0$ for 3 values of $x$, 
and since $D=f_{xx}f_{yy}-(f_{xy})^2=2p^{\prime\prime}(x)$, 
you also need $p^{\prime\prime}(x)<0$ at two of the critical points and $p^{\prime\prime}(x)>0$ at the other critical point.
A: We want there to be three appropriate solutions to 
$$\frac{\partial f}{\partial x} = \frac{\partial f}{\partial y} = 2y = 0$$
Consequently, we will have $y = 0$ and so $$\frac{\partial f}{\partial x} = \frac{dp}{dx} = 0$$
at each critical point. Since there are three critical points of $p$, it will have a degree of at least 4. Lastly, we need to ensure that these critical points are saddle points. Along the $x$ axis, the surface will be "concave up" in the $y$ direction; so we want one critical point for $x$ which is concave up (so it will be a local minimum), and two which are concave down (these will be saddle points). 
Assuming $p$ can be of degree $4$, only a polynomial with a negative leading coefficient can have these property. $p'(x)$ should be a degree three polynomial with three roots (one at $0$). We should also have $p'' < 0$ at each nonzero root, and $p''(0)>0$. Then $p''(x) = 1-x^2$ has the desired behavior. Integrate to get $p' = x - \frac{x^3}{x}$ (there is no constant term because we need $p'(0) = 0$), which also has the desired behavior. Finally, integrate one more time to get $p(x) = \frac{-x^4}{12} + \frac{x^2}{2}$. The constant term is irrelevant for $p$, so we're done. 
