# Local extrema points of a function of two variables

i need to find local extrema points of a function of two variables, but it doesnt work

FindMaximum[x^3 - 2 y^3 - 3 x + 6 y, {x, y}]


I have this error:

FindMaximum::fmgz: Encountered a gradient that is effectively zero. The result returned may not be a maximum; it may be a minimum or a saddle point.

• saddle point. Plot3D[x^3 - 2 y^3 - 3 x + 6 y, {x, 0, 2}, {y, 0, 2}]  It is always a good idea to plot the given functions to ge an overview. May 21 at 20:13
• @Akku14 yes, i know it, but i need specific answer (number) of max local extreme point May 21 at 20:18
• Solve[Thread[D[x^3 - 2 y^3 - 3 x + 6 y, {{x, y}}] == 0], {x, y}]  yields {{x -> -1, y -> -1}, {x -> 1, y -> -1}, {x -> -1, y -> 1}, {x -> 1, y -> 1}} Plot3D[x^3 - 2 y^3 - 3 x + 6 y, {x, -2, 2}, {y, -2, 2}]  May 21 at 20:23
• Just to compare: see SecondDerivativeTest of Maple. There is room for improvement in this topic in Mathematica. May 22 at 5:55

• If $$D f(x,y)=0$$ and $$\mathrm{Hessian}f(x,y)$$ is a positive definite matrix,then $$f(x,y)$$ get the local minimal.
• If $$D f(x,y)=0$$ and $$\mathrm{Hessian}f(x,y)$$ is a negative definite matrix,then $$f(x,y)$$ get the local minimal.

We use Grad[f[x,y],{x,y}] or D[f[x,y],{{x,y},1}] and D[f[x,y],{{x,y},2} to calculate the Gradient and Hessian.

And we know that a matrix A={{a,b},{c,d}} is positive definite if a>0 and Det[A]>0, and a matrix A={{a,b},{c,d}} is negative definitee if a<0 and Det[A]>0.

Clear[f, localmin, localmax];
f[x_, y_] = x^3 - 2 y^3 - 3 x + 6 y;
localmin =
Solve[{D[f[x, y], {{x, y}, 1}] == 0,
Det[D[f[x, y], {{x, y}, 2}][[;; 1, ;; 1]]] > 0,
Det[D[f[x, y], {{x, y}, 2}][[;; 2, ;; 2]]] > 0}, {x, y}];
localmax =
Solve[{D[f[x, y], {{x, y}, 1}] == 0,
Det[D[f[x, y], {{x, y}, 2}][[;; 1, ;; 1]]] < 0,
Det[D[f[x, y], {{x, y}, 2}][[;; 2, ;; 2]]] > 0}, {x, y}];

Show[Plot3D[f[x, y], {x, -2, 2}, {y, -2, 2}],
Graphics3D[{AbsolutePointSize[20], {Blue,
Point[{x, y, f[x, y]}] /. localmin}, {Red,
Point[{x, y, f[x, y]}] /. localmax}, Arrowheads[.02],
Arrow[{# + {0, 0, 10}, #} &@{x, y, f[x, y]} /. localmin],
Text["local min", {x, y, f[x, y]} + {0, 0, 10} /. localmin,
Background -> Yellow],
Arrow[{# + {0, 0, 10}, #} &@{x, y, f[x, y]} /. localmax],
Text["local max", {x, y, f[x, y]} + {0, 0, 10} /. localmax,
Background -> Yellow]}], PlotRange -> All]


• The same as
FindMaximum[{x^3 - 2 y^3 - 3 x + 6 y, -5 <= x <= 5, -5 <= y <= 5}, {x,
y}]
FindMinimum[{x^3 - 2 y^3 - 3 x + 6 y, -5 <= x <= 5, -5 <= y <= 5}, {x,
y}]


{6., {x -> -1., y -> 1.}}

{-6., {x -> 1., y -> -1.}}