# Finding local minima exactly

Is there a way to either make FindMinimum do an exact computation or Minimize find also the local minima? Or other ideas to find local minima exactly?

Example: find all local minima (exact values, not approximations) of $$f(x,y)=x^2 − x + 2y^2$$ on $$E=\{(x,y)\in \mathbb{R}^2 : x^2+y^2\le 1\}$$.

• We need an example from you to see what the problem is. FindMinimum usually does what is required. What do you mean by exact? – Hugh Apr 22 at 10:27
• One may find all the critical points of that differentiable function through Reduce[{D[x^2 - x + 2*y^2 D[x^2 - x + 2*y^2, x] == 0, x] == 0, D[x^2 - x + 2*y^2, y] == 0, x^2 + y^2 <= 1}, {x, y}, Reals] . Its behavior on the boundary should be studied separately. – user64494 Apr 22 at 10:53
• @user64494, yes like that I know how to do it in general. However, I was wondering if there were pre-implemented functions that deal with the boundary altogether. Of course, my question mainly about what happens on the boundary. – Maurizio Moreschi Apr 22 at 11:08
• FindMinimum might also find a global min and miss local ones. To get all of them in some region one can set up a KKT solver. – Daniel Lichtblau Apr 22 at 13:07
• For an exercise class I think I'd go with a cardio machine over a Lagrange multiplier. Just my preference. – Daniel Lichtblau Apr 22 at 21:53

All minima should be searched:

f[x_, y_] = x^2 - x + 2 y^2;
g[x_, y_] = x^2 + y^2 - 1;


First we look for the minima on the edge. With Langrange we get:

L = f[x, y] + λ*g[x, y];
sol = Solve[{Grad[L, {x, y}] == 0, g[x, y] == 0}, {x, y}, λ, Reals] hessian = D[f[x, y], {{x, y}, 2}] /. sol;


hessian: positive definite -> strict local minimum

hessian: negative definite -> strict local maximum

test = Transpose[{{x, y, f[x, y]} /. sol,
PositiveDefiniteMatrixQ /@ hessian,
NegativeDefiniteMatrixQ /@ hessian}];

TableForm[Partition[Flatten[test], 5], TableAlignments -> Right,
TableHeadings -> {None, {"x", "y", "f[x,y]", "pos. definite", "neg. definite"}}] All points are minima! Now we are looking for minima within the region.

rsol = First@Solve[Grad[f[x, y], {x, y}] == 0, {x, y} \[Element] ImplicitRegion[x^2 + y^2 < 1, {x, y}]] rhessian = D[f[x, y], {{x, y}, 2}] /. rsol;
{PositiveDefiniteMatrixQ @ rhessian, NegativeDefiniteMatrixQ @ rhessian}
{True, False}

{f[x, y] /. rsol , rsol} This is the global minimum.

The exact minimization of a function can be done using Minimize:

  f[x_, y_] := x^2 - x + 2 y^2
sol = Minimize[f[x, y], {x, y}]
(*{-(1/4), {x -> 1/2, y -> 0}} <= output of Minimize*)
Show[
Plot3D[f[x, y], {x, y} \[Element] Disk[{0, 0}, 1]],
Graphics3D[{Red, PointSize[Large],
Point[Flatten@{{x, y} /. sol[], sol[]}]}]
] • I want all the points of LOCAL minima – Maurizio Moreschi Apr 22 at 11:04
• @Maurizio, for Minimize[], you need to separately consider the boundary: Minimize[{f[x, y], x^2 + y^2 == 1}, {x, y}] – J. M.'s discontentment Apr 22 at 12:03
• @MaurizioMoreschi, do you really think that your function has more than one minima? it is possible just if you know an alternative algebra.. – Rom38 Apr 22 at 14:22
• @Rom38 Hahaha, that was not really my point, but I understand the misunderstanding! I gave the numerical example because people asked for it in the comment. Your method of course finds the point of minimum it this case, but it uses the information that the minimum is strong and absolute! – Maurizio Moreschi Apr 22 at 14:47
• @MaurizioMoreschi, working with arbitrary function you should divide the domain to sub-domains and run the minimization inside all of them. Thus, you will have all local minima. – Rom38 Apr 22 at 15:58