Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: Question about Lagrange multipliers for maximizing a function with two constraints

  1. #1

    Lagrange multiplier for maximizing a function with two constraints?

    Hi everyone.

    I'm not that familiar with English math terminology so I hope that you'll bear with me.

    Currently, I'm trying to maximize a function with two constraints, but I got stuck because of one of my constraints. My first constraint has both the variables [tex]x[/tex] and [tex]y[/tex], but my second constraint only has the variabley. The reason why I'm confused by this is that when I proceed to solve the problem, I have no use for the Lagrange multiplier [tex]\lambda[/tex]. I can simply solve [tex]L_{\lambda_{1}} = 0[/tex] and [tex]L_{\lambda_{2}} = 0[/tex]. This will enough to yield my results (the [tex]x[/tex] and [tex]y[/tex] coordinates). It is frustrating me because I need to put it into words, what I am doing (in terms of using Lagrange multipliers) and why I apparently had to skip the [tex]\lambda[/tex] all together.

    The function that I'm trying to maximize is as follows:
    [tex]f(x,y) = -0,01x^2 + 395x + 100y[/tex]


    My constraints are these:
    [tex]2x + y = 44,000[/tex]
    [tex]y = 20,000[/tex]


    I know that the correct answer (through using other methods of optimization) is:
    [tex]x = 12,000[/tex]
    [tex]y = 20,000[/tex]


    The way that I've proceeded to solve this problem is by putting the respective functions and constraints into a formula that was taught at school:
    [tex]L(x, y, \lambda_{1}, \lambda_{2}) = -0,01x^2 + 395x + 100y - \lambda_{1} * (2x + y - 44,000) - \lambda_{2} * (y - 20,000)[/tex]

    I then proceed by figuring out the partial differentials of [tex]L[/tex] with respect to [tex]x[/tex], [tex]y[/tex], [tex]\lambda_{1}[/tex] and [tex]\lambda_{2}[/tex] to ultimately isolate [tex]x[/tex] and [tex]y[/tex]. I am getting the correct results, but there's no need to solve [tex]L_x = 0[/tex] and [tex]L_y = 0[/tex]. This is what's confusing me and what I'm having a hard time putting into words.
    Last edited by johndoe69; 11-19-2017 at 01:55 PM.

  2. #2
    Elite Member
    Join Date
    Apr 2005
    Location
    USA
    Posts
    8,905
    Please show your four partial derivatives.
    "Unique Answers Don't Care How You Find Them." - Many may have said it, but I hear it most from me.

  3. #3
    Quote Originally Posted by tkhunny View Post
    Please show your four partial derivatives.
    [tex]L_x = -0.02x + 395 - 2\lambda_{1}[/tex]

    [tex]L_y = 100 - \lambda_{1}[/tex]

    [tex]L_{\lambda_{1}} = -2x - y + 44,000[/tex]

    [tex]L_{\lambda_{2}} = -y + 20,000[/tex]
    Last edited by johndoe69; 11-18-2017 at 04:55 PM.

  4. #4
    Elite Member
    Join Date
    Apr 2005
    Location
    USA
    Posts
    8,905
    -0,02x -- but that doesn't seem to have bothered anything, since your complain is why this equation even exited.

    You should not be disturbed that the solution is simple. [tex]\lambda_{1}\;and\;y[/tex] are immediate. Part of the idea of the method is to turn harder problems into simpler problems. Using the method, we've gone from quadratic to linear. This is good!

    The difficulty is this, using [tex]\lambda_{1}\;and\;x[/tex], we get x = 9,750, but using [tex]y\;and\;x[/tex], we get x= 12,000. How do you suppose we should reconcile that?
    Last edited by tkhunny; 11-19-2017 at 04:26 PM.
    "Unique Answers Don't Care How You Find Them." - Many may have said it, but I hear it most from me.

  5. #5
    Quote Originally Posted by tkhunny View Post
    The difficulty is this, using [tex]\lambda_{1};and\;x[/tex], we get x = 9,750, but using [tex]y\;and\;x[/tex], we get x= 12,000.
    Very interesting! I haven't even thought about using the partial derivatives of L with respect to λ1 and x to isolate x.

    My immediate guess to solve this "new" problem would be to plug x = 9,750 into the partial derivative of λ1 and isolate y, which would yield the result y = 24,500. This new coordinate (9,750; 24,500) on my graph looks to be on the same linear function y = -2x + 44,000 as the initial coordinate (12,000; 20,000). Obviously, however, this solution does not adhere to my constraint of y < 20,000.
    Last edited by johndoe69; 11-17-2017 at 01:53 PM.

  6. #6
    Quote Originally Posted by tkhunny View Post
    How do you suppose we should reconcile that?
    I suppose the solution would be to compare the different values of x and y and pick the combination that fits the constraints?

  7. #7
    Senior Member
    Join Date
    Sep 2012
    Posts
    2,391
    Quote Originally Posted by johndoe69 View Post
    Hi everyone.

    I'm not that familiar with English math terminology so I hope that you'll bear with me.

    Currently, I'm trying to maximize a function with two constraints, but I got stuck because of one of my constraints. My first constraint has both the variables x and y, but my second constraint only has the variabley. The reason why I'm confused by this is that when I proceed to solve the problem, I have no use for the Lagrange multiplier λ. I can simply solve the partial differential for λ1 and λ2. This will enough to yield my results (the x and y coordinates). It is frustrating me because I need to put it into words, what I am doing (in terms of using Lagrange multipliers) and why I apparently had to skip the λ all together.

    The function that I'm trying to maximize is as follows:
    𝑓(𝑥, y) = −0,01𝑥2 + 395𝑥 + 100
    Well in English terminology this function is a constant equal to [tex]494.9999.[/tex]

    Or is it supposed to be a function in which the variable y appears or perhaps even two variables such as x and y?

    My constraints are these:
    2𝑥 + 𝑦 ≤ 44,000
    𝑦 ≤ 20,000
    Well, in English terminology, both constraints are incomplete. Two plus what?
    What does not exceed 20,000?

    I know that the correct answer (through using other methods) is:
    x = 12,000
    y = 20,000

    The way that I've proceeded to solve this problem is by putting the respective functions and constraints into an algorithm:
    L(x ,y, λ1, λ2) = −0,01𝑥2 + 395𝑥 + 100y - λ1 * (2𝑥 + 𝑦 - 44,000) - λ2 * (𝑦 - 20,000)
    In English terminology, this sort of looks like a LaGrangian function for a DIFFERENT objective function. The original objective function contained no variables, but this seems to involve an objective function containing the variable y (but not x). But it is meaningless because the Lagrangian multipliers are simply multiplying constants and so their derivatives will be zero everywhere.

    Then finding the partial differentials of x, y, λ1 and λ2 to ultimately isolate x and y. I am getting the correct results, but there's no need to find the partial differentials of x and y?
    To use LaGrangian multipliers, you set up the function L, take ALL of its partial derivatives, set them ALL to zero, and solve the resulting system of simultaneous equations.

    If you have one constraint, you have one multiplier, usually labeled [tex]\lambda[/tex].

    If you have n constraints, you have n multipliers, not n + 1, and they are usually labeled

    [tex] \lambda_1,\ ...\ \lambda_n.[/tex]

  8. #8
    Quote Originally Posted by JeffM View Post
    Well in English terminology this function is a constant equal to [tex]494.9999.[/tex]

    Or is it supposed to be a function in which the variable [tex]y[/tex] appears or perhaps even two variables such as [tex]x[/tex] and [tex]y[/tex]?
    I suppose I should add some context to the problem. The function [tex]f(x, y)[/tex] is a contribution margin function where [tex]x[/tex] and [tex]y[/tex] are variables of two separate products. It is made up of two price functions for each product minus the variable costs. Product [tex]x[/tex] has different options for pricing, while product [tex]y[/tex] only has one available price point. This is why the one is linear and the other is constant.

    What I'm trying to accomplish is to find the optimal amounts of both [tex]x[/tex] and [tex]y[/tex] that are within my constraints. The constraints are the restrictions set by a hypothetical factory, which produce the products [tex]x[/tex] and [tex]y[/tex].

    Quote Originally Posted by JeffM View Post
    Well, in English terminology, both constraints are incomplete. Two plus what?
    What does not exceed 20,000?
    The production time mustn't exceed [tex]44,000[/tex] hours. Product [tex]x[/tex] has a production time of 2 hours per [tex]x[/tex] and product [tex]y[/tex] has a production time of 1 hour per product [tex]y[/tex]​.
    The amount of [tex]y[/tex] produced mustnít exceed [tex]20,000[/tex] units.

    Hopefully that should've cleared up some things about the problem.

    EDIT 1: I have a suspicion that the functions aren't showing up properly for you? Perhaps it's because I haven't used the LaTeX formatting? I shall try to rewrite my main post at some point soon.
    EDIT 2: Done.
    Last edited by johndoe69; 11-19-2017 at 07:41 AM.

  9. #9
    Senior Member
    Join Date
    Sep 2012
    Posts
    2,391
    That is MUCH better.

    The objective function is the contribution margin:

    [tex]c(x, y) = -\ 0.1x^2 + 395x + 100y.[/tex]

    I shall assume that this is correct. Obviously, it is to be maximized. But it is subject to two constraints, namely:

    [tex]2x + y \le 44,000 \text {; and}[/tex]

    [tex]y \le 20,000.[/tex]

    Now, as you have explained the problem so far, these two constraints do not make much sense to me, but I am going to assume that they do make sense when the problem is fully specified. I should point out that you probably also have non-negativity constraints, but let's ignore that little wrinkle.

    Let's dispense with one minor source of confusion. There is a LaGrangian multiplier for each constraint. If there is only one constraint, the multiplier is conventionally shown as [tex]\lambda[/tex]. If there is more than one constraint, they are conventionally distinguished by subscripts. So with two constraints, you will have [tex]\lambda_1[/tex] and [tex]\lambda_2[/tex] but no [tex]\lambda[/tex]. Is that clear?

    So we set up the LaGrangian function as you did (assuming those are the correct constraints).

    [tex]L = -\ 0.01x^2 + 395x + 100y - \lambda_1(44,000 - 2x - y) - \lambda_2(20,000 - y).[/tex]

    We now take all four partials and set each to zero. It is frequently convenient to start with the lambdas in order of simplicity.

    [tex]\dfrac{ \delta L}{ \delta \lambda_2} = 0 \implies 20,000 - y = 0 \implies y = 20,000.[/tex]

    [tex]\dfrac{ \delta L}{ \delta \lambda_1} = 0 \implies 44,000 - 2x - y = 0 \implies 2x = 44,000 - 20,000 \implies x = 12,000.[/tex]

    So in this case, we do not even need to take the other two partials.

    EDIT: I wish I felt more confident about this. I do not know how you came up with the objective function or the constraints. I have got you to the answer that you say is correct, but I cannot confirm it.
    Last edited by JeffM; 11-18-2017 at 05:59 PM.

  10. #10
    Senior Member
    Join Date
    Sep 2012
    Posts
    2,391
    As I read what you have written, I must assume that the objective function is:

    [tex]c(x, y) = -\ 0.1x^2 + 395x + 100y.[/tex]

    But I see only one relevant constraint, namely [tex]2x + y \le 20,000.[/tex]

    How did you derive the two constraints?

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •