# How to find the minimum of this constrained expression?

Let $x$, $y$, $z$ be three nonegative real numbers and $x^2 + y^2 + z^2 = 5.$ Find the minimum of the expression $$E=\dfrac{1}{2}x^2 y^2 + y^2 z^2 + z^2 x^2 + \dfrac{96}{x + y + z + 1}.$$ I tried

Minimize[{1/2 x^2 y^2 + y^2 z^2 + z^2 x^2 + 96/(x + y + z + 1),
x >= 0, y >= 0, z >= 0, x^2 + y^2 + z^2 == 5}, {x, y, z}]

What should I do find the minimum of this expression?

-
Are you the same person that posted the same problem here? Is this some kind of homework? –  belisarius Apr 28 '13 at 14:25
Your code returns the correct answer in v9.0.1, albeit a little slowly. (Less than 3 min. on my computer.) –  Michael E2 Apr 28 '13 at 14:43
@belisarius I am a teacher. I only want check my problem. –  minthao_2011 Apr 28 '13 at 15:06
My problem is Minimize[{1/2 (x^2 y^2 + y^2 z^2 + z^2 x^2) + 96/(x + y + z + 1), x >= 0 && y >= 0 && z >= 0 && x^2 + y^2 + z^2 == 5}, {x, y, z}]. But I typed wrong. –  minthao_2011 Apr 28 '13 at 15:13
@minthao_2011 NMinimize[{1/2 (x^2 y^2 + y^2 z^2 + z^2 x^2) + 96/(x + y + z + 1), x >= 0 && y >= 0 && z >= 0 && x^2 + y^2 + z^2 == 5}, {x, y, z}] :D –  belisarius Apr 28 '13 at 16:45

What about using a Lagrange multiplier to reduce the optimization problem to one target function and then use Reduce or Solve, to find the local maxima and minima. This gives you analytic expressions and you just have to select the one which is the smallest:

expr1 = 1/2 x^2 y^2 + y^2 z^2 + z^2 x^2 + 96/(x + y + z + 1);
expr2 = x^2 + y^2 + z^2 - 5;
lagrangian = expr1 + l*expr2

$$l \left(x^2+y^2+z^2-5\right)+\frac{x^2 y^2}{2}+x^2 z^2+\frac{96}{x+y+z+1}+y^2 z^2$$

Now you calculate the partial derivatives and solve for the roots

problem = Flatten[{Thread[D[lagrangian, {{x, y, z, l}}] == 0], x > 0, y > 0, z > 0}];
sol = Solve[problem, {x, y, z, l}];

sol contains now the analytic solutions. You could now put the numerical values into E and into the constraints and see that the constraints are indeed fulfilled.

{expr1, expr2} /. N[sol]
(*
{{25.5712, 8.88178*10^-16},
{26.963, 1.42553*10^-13},
{24.9556, -1.72706*10^-12},
{24.6693, 2.04281*10^-14},
{24.6693, 1.66543*10^-10}}
*)

N[sol[[4]]]
(* {x -> 0.879965, y -> 2.00209, z -> 0.466144, l -> 0.663595} *)

Note that you have the solution given as large analytic expressions but they are too large to post them here.

-
@belisarius Sorry, haven't seen that. Nevertheless, one has to make them instead of getting everything from the solution. –  halirutan Apr 28 '13 at 15:38
It's odd that Minimize does not seem to do this even if you box in the domain with 0 <= x <= Sqrt[5] etc. The refs suggest it would use Lagrange multipliers, but it ran for an hour before I gave up, as opposed to half a second for yours. –  Michael E2 Apr 28 '13 at 15:47

Use a numerical approach:

NMinimize[{1/2 x^2 y^2 + y^2 z^2 + z^2 x^2 + 96/(x + y + z + 1),
x >= 0 && y >= 0 && z >= 0 && x^2 + y^2 + z^2 == 5}, {x, y, z}]

{24.6693, {x -> 2.00209, y -> 0.879965, z -> 0.466144}}

By symmetry considerations exchanging x and y will give the same minimum.

-
@minthao_2011 You haven't required that in your question. Please try to be very precise in your requirements so our time is well spent. –  belisarius Apr 28 '13 at 12:48
I am sory. Thank you very much. –  minthao_2011 Apr 28 '13 at 13:10

You could use a similar approach as @halirutan together with spherical coordinates to take care of one constraint and remove the need for multipliers.

f[x_, y_, z_] = 1/2 x^2 y^2 + y^2 z^2 + z^2 x^2 + 96/(x + y + z + 1);

r = Sqrt[5];
subs = {x -> r Sin[t] Cos[f], y -> r Sin[t] Sin[f], z -> r Cos[t]};
constr = {x >= 0, y >= 0, z >= 0, 0 <= t <= Pi, 0 <= f <= 2 Pi} /. subs ;

g[t_, f_] = f[x, y, z] /. subs ;

allSolutions = Solve[Join[Thread[Grad[g[t, f], {t, f}] == 0], constr], {t, f}] ;

possibleResults = {N[#], subs /. N[#], g[t, f] /. N[#]} & /@ allSolutions ;

Select[possibleResults, #[[3]] ==  Min[possibleResults[[All, 3]]] &][[All, 2 ;;]]
(* {{{x -> 2.00209, y -> 0.879965, z -> 0.466144}, 24.6693},
{{x -> 0.879965, y -> 2.00209, z -> 0.466144}, 24.6693}} *)

You can remove N from the first entry in possibleResults to get the analytical solution.

-