Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Advanced Lagrange Maxima Minima Problems

  1. Dec 18, 2012 #1
    My first post and I am new to forum etiquette, please go easy on me.

    I have an exam in a few days and have a good grasp on the content. Historically the professor has been putting harder Lagrange questions on the exam than are available in my textbook and supplement books or that I can find similar ones of online. I have looked for 2 hours last night and another 3 today at 30 different explanations of Lagrange with constraints and I cannot find any as difficult as these to help guide me.. I am not lazy..any advice or simply point me in the right direction on solving these would be appreciated...I particularly have an issue looking for methods of solving the resulting systems of partial derivative equations. Thank you for any help in advance.

    Type 1
    Absolute Maximum and minimum of f(x,y,z) = x^2 + y^2 + z^2 - xyz
    constrained by x^2 + y^2 + z^2 <= 1

    Type 2
    Maximum and minimum of f(x,y,z) = x^2 + y^2 - z^2 - x -y - z
    in the region 0 <= x^2 + y^2 <= z^2 <= 4
  2. jcsd
  3. Dec 18, 2012 #2


    User Avatar
    Science Advisor

    Here's how I look at it. The vector [itex]\nabla f= <2x-yz, 2y- xz, 2z- xy>[/itex], from each point, points in the direction of fastest increase (and so its negative points in the direction of greatest decrease). If f were all we were given, would follow it (or opposite to find a minimum) until it as 0 and had no direction.

    If we are constrained to [itex]x^2+ y^2+ z^2\le 1[/itex], we can first, look at points where [itex]\nabla f= 0[/itex] inside that sphere. We then need to look for solution on the sphere. If we let [itex]g(x,y,z)= x^2+ y^2+ z^2[/itex] then [itex]\nabla g= <2x, 2y, 2z>[/itex] dot a unit vector, gives the rate of change of g in the direction of the vector. In particular, as long as move along the surface of that sphere, g does not change, g(x, y, z)= 1 so its value is constant, its rate of change is 0 so [itex]\nabla g[/itex] is normal to the surface.

    If we are constrained to that sphere, we cannot move in the direction of [itex]\nabla f[/itex], be we can move in the direction of its projection on the sphere. We can do that until there is no projection- until [itex]\nabla f[/itex] is also perpendicular to the surace- in the same direction as [itex]\nabla g[/itex], so one is multiple of the other: [itex]\nabla f= \lambda\nabla g[/itex] and [itex]\lambda[/itex] is the "Lagrange multiplier".

    Here, that is saying [itex]<2x-yz, 2y- xz, 2z- xy>= \lambda<2x, 2y, 2z>[/itex].
    That gives the three equations, [itex]2x- yz= 2\lambda x[/itex], [itex]2y- xz= 2\lambda y[/itex], and [itex]2z- xy= 2\lambda z[/itex].

    Since a value for [itex]\lambda[/itex] is not part of the solution, I often find it simplest to start by eliminating [itex]\lambda[/itex] by dividing one equation by another: dividing the first equation by the second, (2x- yz)/(2y- xz)= x/y and, dividing the first equation by the third, (2x- yz)/(2z- xy)= x/z. "Cross multiplying" each gives y(2x- yz)= x(2y- xz) and z(2x- yz)= x(2z- xy). The first gives [itex]2xy- y^2z= 2xy- x^2z[/itex] which reduces to [itex]y^2= x^2[/itex] so that either y= x or y= -x. The second gives [itex]2xz- yz^2= 2xz- x^2y[/itex] or [itex]z^2= x^2[/itex] so that either z= x or z= -x.
    Putting those together we have one of (x, x, x), (x, -x, x), (x, x, -x), or (x, -x, -x).
    Put those into the constraint [itex]x^2+ y^2+ z^2= 1[/itex] to determine x.
  4. Dec 18, 2012 #3
    That was superb...thank you very much for your time and effort and being so lucid in your explanation....I was only unfamiliar with term nabal "look at points where \nabal f = 0 inside that sphere"....

    which I guess means I did not have that symbol in my computers font selection?

    ..your answer has allowed me to answer several of the other variations of max min I have...

    ..not to press my luck...but regarding the Type 2 question in my original post....

    when I get to this stage..

    1) 2x-1 = λ2x + (mu)(0)
    2) 2y-1 = λ2y + (mu)(0)
    3) -2z-1 = λ(0) + (mu)(2z)

    and the system of equations becomes..

    1) 2x-1=λ2x
    2) 2y-1=λ2y
    3) -2z-1=(mu)(2z)

    what would you recommend in this situation or more generally what are the main techniques I would try to solve these?

    1) look for a lonely variable x or y to isolate
    2) divide one by another and cross multiply as we did above
    3) .............??

    my goal is always to get two of the three variables and plug it in to my constraint?
    what is the process for two constraints?

    any advice if you have a moment would be much appreciated...and thank you again for your prior insight...
  5. Dec 18, 2012 #4

    Ray Vickson

    User Avatar
    Science Advisor
    Homework Helper

    In general: suppose that for a vector of variables x = (x1,x2,...,xn) we have a problem such as max/min f(x) subject to g1(x) <= 0, g2(x) <= 0,..., gm(x) <= 0. The standard method is to form a Lagrangian and to set its gradient to zero. There are other conditions as well, but let's deal with them later. The main difference between an inequality-constrained problem and an equality-constrained one is that for inequalities the signs of the Lagrange multipliers are known, provided that we form the Lagrangian in the correct manner. Here, the general rule is: form a Lagrangian so that it is better than the objective f for feasible points. Here, "better" means larger in a max problem and smaller in a min problem. So, if our problem is max f subject to g_i <= 0 for i = 1,2,...,m, then for a feasible point we want L to be larger than f; we achieve this by subtracting positive multiples of the g_i from f (because we would be subtracting negative quantities). So we let
    [tex]L(x,u) = f(x) - \sum_{i=1}^m u_i g_i (x),[/tex] where ##u_1, u_2, \ldots, u_m ## are the Lagrange multipliers (often denoted as ##\lambda_i##, but ##u## is just as good a symbol as ##\lambda##). The point is that the signs are known: we have ## u_1 \geq 0, u_2 \geq 0, \ldots, u_m \geq 0.##

    Now we have the optimality conditions:
    [tex] (1)\; \partial L/ \partial x_j = 0, \: j = 1, 2, \ldots, n \\
    (2)\; u_i \geq 0, i = 1, 2, \ldots, m \\
    (3)\; \text{either } g_i = 0 \text{ or } u_i = 0.[/tex]

    What is condition (3) all about? Well, the optimal solution is either in the interior of the ith constraint---where ##g_i(x) < 0##--- or it is on the boundary of the ith constraint---where ##g_i(x) = 0.## If it is in the interior we essentially ignore g_i, and this is achieved by setting u_i = 0 so that g_i does not appear in the optimality condition, and so does not affect x. If it is on the boundary, then we have, essentially, an equality constraint g_i = 0, and so do have a Lagrange multiplier (which could, nevertheless, still = 0 by accident). However, unlike a problem that had an equality constraint from the "get-go", in the present case the sign of the Lagrange multiplier is restricted.

    So, let's look at the first problem in max form.
    max f(x,y,z) = x^2 + y^2 + z^2 - xyz, subject to g(x,y,z) = x^2 + y^2 + z^2 -1 <= 0.

    [tex]L = f - u g = x^2 + y^2 + x^2 - xyz - u (x^2+y^2+z^2-1).[/tex]
    The optimality conditions are:
    [tex] L_x = \partial L / \partial x = 0 \Longrightarrow 2x - yz - 2u x = 0\\
    L_y = \partial L / \partial y = 0 \Longrightarrow 2y - xz - 2u y = 0\\
    L_z = \partial L / \partial z = 0 \Longrightarrow 2z - xy - 2u z = 0[/tex]
    and u = 0 or g = 0.

    If we first try u = 0 we obtain 5 candidate points (where grad f = 0):
    [tex] (x,y,z) = (0,0,0),\: (2,2,2), \: (2,-2,-2),\: (-2,-2,2), \:(-2,2,-2).[/tex]
    Only the first point (0,0,0) satisfies the constraint g <= 0. The Hessian matrix of f at this point is positive-definite, so (0,0,0) is a strict local minimum. Therefore, we have solved the min problem, not the max problem!

    OK, so now we know that a max must be on the boundary, so u may by > 0. Besides the previous solution (x,y,z) = (0,0,0), we get:
    [tex] \begin{array}[cccc] ((x,y,z) &= & (2-2u, 2-2u, 2 - 2u) & (P1) \\
    (x,y,z) &=& (2 - 2u, -2 + 2u, -2 + 2u) & (P2)\\
    (x,y,z) &=& ( -2 + 2u, 2 - 2u, -2 + 2u) & (P3)\\
    (x,y,z) &=& (-2 + 2u, -2 + 2u, 2 - 2u) & (P4)

    Substituting P1 into the equation g1 = 0 gives two solutions:
    [tex] u_1 = 1 + \frac{1}{6}\sqrt{3} \doteq 1.288675, \;
    u_2 = 1 - \frac{1}{6}\sqrt{3} \doteq 0.71132,[/tex]
    Both u_1 and u_2 are > 0, so u = u_1 and u = u_2 give two candidate points for the max:
    [tex] u = u_1 \Longrightarrow (x,y,z) = (-\sqrt{3}/3,-\sqrt{3}/3, -\sqrt{3}/3), \: g = 0, \; f = 1 + \frac{1}{9}\sqrt{3} \doteq 1.19245\\
    u = u_2 \Longrightarrow (x,y,z) = (\sqrt{3}/3,\sqrt{3}/3,\sqrt{3}/3), \; g = 0, \:
    f = 1 - \frac{2}{9}\sqrt{3} \doteq 0.80755 .[/tex]
    The first point above must be a local max of f; the second point may be another local max or may be a constrained saddle point. We would have to perform some second-derivative tests to tell which case applies. (However, the second-derivative tests would be tricky: they involve testing the Hessian of the Lagrangian---NOT of just f itself---projected down into the tangent space of the constraint surface.) Interestingly, we can be sure the second point is not a constrained minimum of f, because the Lagrange multiplier u = u_2 would have the wrong sign for a min problem!

    The points (P2) and (P3) can be analyzed similarly; they lead to two other "mirror images" of the above maximizing point. That makes sense, because for any (x,y,z) there are three other points with the same values of |x|, |y| and |z|, but where two of them have the opposite sign, so that the values of f and g are unchanged.

    The second problem you listed above is harder because it has more inequality constraints. I will leave the fun of solving it up to you.
    Last edited: Dec 18, 2012
  6. Dec 18, 2012 #5


    User Avatar
    Science Advisor
    Homework Helper

    The second problem may be harder, but your first step is to try to visualize the domain you are trying to find extrema over. Have you done that yet? Which constraints you apply will depend on which part of the boundary you are talking about.
  7. Dec 19, 2012 #6

    ..my vertical z plane cannot exceed 2 because z^2 <= 4 and it cannot be lower than 0 where it hits the xy plane..

    my x^2+y^2 is a circle in standard form that cannot exceed radius 2 or be smaller than radius 0..

    so in my mind the constraint is a cylinder shape two units in height...

    when I make x^2+y^2 and z^2 both 4 or both 0 they cancel and leave me with


    In this case fx=-1 fy=-1 fz=+1

    I get the feeling I am supposed to evaluate something like this at the upper bounds and at the lower but Im unsure how to formulate it....

    ..any advice would be appreciated..my exam is in 6 hours... :/
    Last edited: Dec 19, 2012
  8. Dec 19, 2012 #7


    User Avatar
    Science Advisor
    Homework Helper

    It's not a cylinder. If you let r^2=x^2+y^2 then r=z. It's a cone. So you have an upper surface where the constraint z=4 applies, on the sides of the cone z^2=x^2+y^2 applies and they both apply on the circle where they intersect. You also have the point of the cone to think about.
  9. Dec 19, 2012 #8
    I actually got the problem solved and thank you for everything...I found a point inside the region that didn't satisfy the constraint, then I checked the top of the cone boundary and where g(x,y) =x^2+y^2, and again where z is [0,2] it all worked out great....thank you again for your efforts gentlemen..it was much appreciated...

    take care...
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook