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: LaGrange Multipliers

  1. Dec 11, 2007 #1
    I'm having a little trouble with another old test question. It states:

    Use LaGrange multipliers to find the point on the line 2x + 3y = 3 that is closest to the point P(4, 2).

    I assume that my constraint is g(x, y) = 2x + 3y = 3, and I have to come up with a function f(x, y) to be maximized or minimized. I recall part of the solution, and it had to do with constructing a line that goes through the point P(4, 2).

    If I went this route, I'd have something like y = 14/3 - 2/3*x from the first equation. I obtained the slope from g(x, y) ---> y = 1 - 2/3*x. Then I would turn y = 14/3 - 2/3*x into a function of x and y ---> f(x, y) = 14/3 - 2/3*x - y = 0 (I'm not even sure if this is mathematically correct). The thing is, once I take the partial derivatives of f and g, I have no x terms and no y terms. I really don't know how to go about finding the solution.

    Any help is appreciated.
  2. jcsd
  3. Dec 11, 2007 #2


    User Avatar
    Science Advisor
    Homework Helper

    Minimize the Euclidian distance function from (x,y) to P subject to the constraint.
  4. Dec 11, 2007 #3


    User Avatar
    Science Advisor

    One way to do this problem would be to write the equation of the line through (4, 2) perpendicular to the given line. However, that is not "using LaGrange multipliers".

    You are mixing two completely different methods. From simple geometry it is clear that the shortest distance from a point P to a line is along the line through P perpendicular to the line. Yes, the line given has slope -2/3 so any line perpendicular to it has slope 3/2. In order to pass through (4,2) it must have equation y= (3/2)(x- 4)+ 2. Find where that line intersects y= 1- (2/3)x and find the distance between that point and (4, 2). No need to take any derivatives.

    Have you reviewed your text book on exactly what the "LaGrange multiplier" method is?

    You are asked to minimize distance from a point (x,y) to (4,2). That distance is, of course, [itex]\sqrt{(x-4)^2+ (y-2)^2}[/itex] but it is easy to see that minimizing that is exactly the same as minimizing its square, [itex](x-4)^2+ (y-2)^2[/itex]. (The derivative of y2 is 2y dy/dx and, as long as y is not 0, that is 0 if and only if dy/dx is 0.)

    That is, you are asked to minimize [itex]f(x,y)= (x-4)^2+ (y-2)^2[/itex]. Its gradient vector will point in the direction of fastest increase so you want to go in the opposite direction to minimize it. (Obviously the gradient vector points directly outward along the line through the point (4, 2). If you moved in the opposite direction, you would be moving directly toward (4, 2).

    But here you are required to stay on the line 2x+ 3y= 3 so you CAN'T move directly along that line. What you can do is move "left" or "right" along that line depending on whether the gradient vector points left or right of the vertical. The place where you can't do that and are the closest possible to (4,2) is precisely where the gradient vector of [itex]f(x,y)= (x-4)^2+ (y-2)^2[/itex] is perpendicular to the line.

    Of course, you know that if the line is a "level curve" of a function g(x,y)= 2x+3y= 3, then g is constant along that line and so the gradient vector of g is perpendicular to that line. That is the whole point of the "LaGrange multiplier" method: The minimum (or maximum) value of f(x,y) subject to the constraint that g(x,y)= constant, occurs where the two gradient vectors are parallel. That is, one is a multiple of the other: [itex]\nabla f= \lamba \nabla g[/itex]. ([itex]\lambda[/itex] is the "LaGrange multiplier".)

    [itex]\nabla f= \lamba \nabla g[/itex] gives you two equations for the three unknown numbers x, y, and [itex]\lambda[/itex]. The third equation is the constraint 2x+ 3y= 3.
  5. Dec 11, 2007 #4
    Thank you both for the replies.

    I tried this method and found the point (30/13, -7/ 13) is the point closest to P(4, 2). This is the same answer my professor arrived at, thank you very much. I have reviewed my text book on the subject, but I wasn't able to grasp too much from their examples. I'm not a big fan of my text book. My exam is in an hour, and I know I should have worked these exercises much earlier, shame on me =/ But I appreciate the detailed post, and I'll be sure to review it next time I have a free minute. Thanks again for your reply.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook