Level curves and critical points How can I find critical points with level curves?
Well I saw this video about a method for find critical points with level curves video but he don´t proof nothing and really I don't understand what is the essential method for find maxima or minima point.
I'm interested in that because I'm reading a article that use this method for find global maxima ref theorem 2
Also if you can give me an explanation of theorem 2 I appreciate
 A: As I understood the video, it is not possible to infer the real shape of the function from a ContourPlot alone. But you can infer certain shape variants based on the concentrics. For example, if in your ContourPlot there is only one concentric behavior, i.e. a sole set of concentric circles (ellipses, ovals, etc.), then this is an indication of a global minimum or maximum.
I have tried to do this with an example and tried to implement it.
Let us use the function $f(x,y)=x^3+5 x^2+x y^2-5 y^2$ and check wether it has critical points using level curves.
In the first step, let us draw the level curves (blue) and the derivatives $\frac{\partial f}{\partial x}$ and $\frac{\partial f}{\partial y}$ (green). Intersections of both green curves are critical points, which are in our case $(0,0)$ and $(-3.33,0)$:

The code (Mathematica) for this is:
F[x_, y_] = x^3 + 5 x^2 + x*y^2 - 5 y^2;
Fx[x_, y_] = D[F[x, y], x];
Fy[x_, y_] = D[F[x, y], y];
cpf = ContourPlot[F[x, y], {x, -5, 5}, {y, -5, 5}, 
   Contours -> {-2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, 
   ContourStyle -> Directive[Blue, Line], ContourShading -> None];
cpfx = ContourPlot[{Fx[x, y] == 0, Fy[x, y] == 0}, {x, -5, 5}, {y, -5,
     5}, ContourStyle -> Directive[Green, Line]];
plot = Show[cpf, cpfx, 
  ListPlot[{{0, 0}, {-10/3, 0}}, PlotStyle -> Red]]

In the next step we need to check whether these two critical points $(0,0)$ and $(-3.33,0)$ are a minimum, maximum or saddle point. In the video it is suggested to sketch a 3D plot including these points. In our case the 3D plot looks as follows and it shows that our point $(0,0)$ is a saddle point and $(-3.33,0)$ is a local maximum:

The code for this plot is:
Plot3D[F[x, y], {x, -5, 5}, {y, -5, 5}, PlotStyle -> None, 
 MeshStyle -> Blue]

To verify this analytically, we may use the Second Partials Test Theorem. Let $d(x,y)=\frac{\partial f}{\partial^2 x}\cdot\frac{\partial f}{\partial^2 y}-\frac{\partial f}{\partial x\partial y}^2$ be our testing function. In our case we have $d(x,y)=(2 x-10) (6 x+10)-4 y^2$.
Since $d(0,0)=-100<0$ our critical point $(0,0)$ is confirmed to be a saddle point. Inserting our second critical point $(-\frac{10}{3},0)$ into this testing function yields $d(-\frac{10}{3},0)=\frac{500}{3}>0$ and $\frac{\partial f}{\partial^2 x}(-\frac{10}{3},0)=-10<0$ which means this point is a local maximum. Note that in the case $\frac{\partial f}{\partial^2 x}(-\frac{10}{3},0)>0$ we would have a local minimum.
You verify this quickly as follows:
Fxx[x_, y_] = D[Fx[x, y], x];
Fyy[x_, y_] = D[Fy[x, y], y];
test[x_, y_] = Fxx[x, y]*Fyy[x, y] - D[Fx[x, y], y]^2;
Print[test[0, 0]];
Print[test[-10/3, 0]];
Print[Fxx[-10/3, 0]];

I provided the full Mathematica Notebook here at GitHub. A corresponding Python Notebook is checked in here as well:

from sympy.plotting.plot import Plot, ContourSeries, MatplotlibBackend
from sympy import plot_implicit, diff
from sympy.solvers.solveset import nonlinsolve
from sympy.abc import x, y

f = x**3 + 5*x**2 + x*y**2 - 5*y**2
f_x = diff(f,x)
f_y = diff(f,y)

ctrs_plot = Plot(
    ContourSeries(f, (x,-5,5), (y,-5,5))
)
ctrs_plot.extend(plot_implicit(f_x, line_color='red', show=False))
ctrs_plot.extend(plot_implicit(f_y, line_color='red', show=False))

critical_points = nonlinsolve([f_x, f_y], [x, y])
print(critical_points)
x_arr = [0,-10/3]
y_arr = [0,0]

ctrs_backend = MatplotlibBackend(ctrs_plot)
ctrs_backend.process_series()
ctrs_backend.fig.tight_layout()
ctrs_backend.ax[0].plot(x_arr, y_arr, "o", color='red')
ctrs_backend.fig.show()

And the verification of the saddle point $(0,0)$ and local maximum $(-\frac{10}{3},0)$ using the Second Partials Test Theorem is done as follows:
f_xx = diff(f_x,x)
f_yy = diff(f_y,y)
f_xy = diff(f_x,y)
test_xy = f_xx*f_yy - f_xy*f_xy
print(test_xy.subs(x, 0).subs(y, 0))
print(test_xy.subs(x, -10/3).subs(y, 0))
print(f_xx.subs(x, -10/3).subs(y, 0))

