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

Homework Help: Very Frustrating (or Easy) Lagrange Multipliers Problem

  1. Jun 7, 2010 #1
    1. The problem statement, all variables and given/known data

    Find the extrema of the given function subject to the given constraint:

    f(x,y)=x2-2xy+2y2, subject to x2+y2=1

    2. Relevant equations

    Lagrange Multipliers

    3. The attempt at a solution

    First, I defined the constraint to be g(x,y)=0, that is,


    I then set up the usual basic system of equations (I did not show my work for this part because I find it unnecessary):




    (*Note: I reduced the first two equations by a factor of 2 for the sake of easier computing).

    So now, I have three sets of equation and the MOST algebraic manipulation I could

    do is the following:





    Another path I took was combining the first two equations, which got me:


    Which got me no where.

    And now, I am stuck! Oh yes, I forgot to mention that I am not allowed to use polar

    coordinates at all (since the constraint is a unit circle...) - I am only allowed to use Lagrange Multipliers. On another note, the answer is

    very, very ugly (it is in decimals). Can anyone please show me how to figure this problem

    out? Thanks!
    Last edited: Jun 7, 2010
  2. jcsd
  3. Jun 7, 2010 #2


    User Avatar
    Gold Member

    Global max is at (-0.525731,0.850651) and (0.525731,-0.850651)
    f(x,y)=x^2-2xy+2y^2, subject to x^2+y^2=1

    Fx = 2*x - 2*y = lambda*2*x
    Fy = -2*x + 4*y = lambda*2*y
    x^2 + y^2 = 1

    x^2+y^2 = 1

    (2*x-2*y)/(2*x) - (-2*x+4*y)/(2*y) = 0
    x^2 + y^2 = 1

    2 equations, 2 unknowns. algebra.
    Last edited: Aug 21, 2010
  4. Jun 7, 2010 #3
    Wow, so my algebra is that bad... Is this what you did? - You set the lambadas equal to

    each other for both equations and attempt to solve it for x or y? I cannot believe I overlooked that possibility.
  5. Jun 7, 2010 #4


    User Avatar
    Gold Member

    Its the same lagrange multiplier. Just a variable. You can generalize the whole optimization by looking at the Lagrangian L defined as:

    L(x,y,lambda) = f(x,y) + lambda*g(x,y), and solving grad L = 0.

    L(x,y,lambda) = x^2-2*x*y+2*y^2 + lambda*(x^2+y^2-1)

    In the algebra below you will find 4 points in that plot, you have to plug in your (x,y) point into the f(x,y) and determine which pair gives you the maximum. The global maximum is reached at (-0.525731,0.850651) and (0.525731,-0.850651) and is equal to 2.61803

    Oh and to address your question, there is only 1 lagrange multiplier per 1 constraint. If you had multiple constraints like g1(x,y) and g2(x,y) you would have 2 lagrange multipliers lambda1 and lambda2
  6. Jun 7, 2010 #5
    Okay, the silly part that I am struggling with is the algebra. I mean that I do not know how to use the two lambdas equation to find the constraint values. Like, how am I suppose to solve for:

    x^2+y^2 = 1

    (2*x-2*y)/(2*x) - (-2*x+4*y)/(2*y) = 0
    x^2 + y^2 = 1

    2 equations, 2 unknowns. algebra."

    Any tips?
  7. Jun 7, 2010 #6


    User Avatar
    Gold Member

    Your set of equations is

    (2*x-2*y)/(2*x) - (-2*x+4*y)/(2*y) = 0
    x^2 + y^2 = 1

    Expand (2*x-2*y)/(2*x) - (-2*x+4*y)/(2*y).

    (2*x-2*y)/(2*x) - (-2*x+4*y)/(2*y) = x/y - y/x - 1

    Now your set of equations is:

    x/y - y/x = 1 ->> x1=1/2*(y-sqrt(5)*y) and x2=1/2*(1+sqrt(5))*y ; y1=-1/2*(1+sqrt(5)*x and y2=1/2*(sqrt(5)-1)*x ->> plug x into bottom and solve for y, then plug y back in and solve for x.
    x^2 + y^2 = 1

    Do you need more help?
    Last edited: Jun 7, 2010
  8. Jun 7, 2010 #7


    User Avatar
    Gold Member

    I'm sure you having a difficulty with x/y - y/x = 1 its a tough bear. Multiply it out by xy

    xy*(x/y) - xy*(y/x) = xy

    x^2 - y^2 = xy
    x^2 = xy + y^2
    x=sqrt(xy+y^2) this yields 2 roots, x1 and x2..

    do same for y.

    Now you can see the solution easier

    x^2 - y^2 = xy
    x^2 + y^2 = 1
  9. Jun 7, 2010 #8
    Yes! This is exactly what I got and got stuck on. Thanks I am seeing the picture much clearer. However, how did you get:

    "x/y - y/x = 1 ->> x1=1/2*(y-sqrt(5)*y) and x2=1/2*(1+sqrt(5))*y ; y1=-1/2*(1+sqrt(5)*x and y2=1/2*(sqrt(5)-1)*x"

    Or in other words, how do you find the root for:


    Sorry if I am asking away cronxeh, but, I am starting to understand much clearer :)
    Last edited: Jun 7, 2010
  10. Jun 7, 2010 #9


    User Avatar
    Gold Member

    x^2 - y^2 = xy
    x^2 + y^2 = 1

    x*(x-y^2/x = y)
    x*(x+y^2/x = 1/x)

    x-y^2/x = y
    x+y^2/x = 1/x

    Do you see it?
  11. Jun 7, 2010 #10


    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper
    Education Advisor

    There's a more straightforward way to get through the algebra. Your three original equations are:

    (1): y = x(1-λ)
    (2): x = y(2-λ)
    (3): x2+y2 = 1

    Note that x=0 or y=0 won't yield a solution, so you can assume these variables are not equal to 0. Substitute equation (2) into (1) and divide out y to get

    1 = (1-λ)(2-λ)

    Use the quadratic equation to solve for λ.

    Substitute equation (1) into the constraint equation (3) to get

    x2 + (1-λ)2x2 = 1

    You can easily solve this for x in terms of λ. Now plug in the values of λ you found before to find x of the extrema, and then use equation (1) to get the corresponding value of y.
    Last edited: Jun 7, 2010
  12. Jun 7, 2010 #11
    Alright! Thank you guys. I finally understand how to approach this problem!
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook