Question about Lagrange multipliers for maximizing a function with two constraints

johndoe69

New member
Joined
Nov 16, 2017
Messages
8
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 \(\displaystyle x\) and \(\displaystyle 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 \(\displaystyle \lambda\). I can simply solve \(\displaystyle L_{\lambda_{1}} = 0\) and \(\displaystyle L_{\lambda_{2}} = 0\). This will enough to yield my results (the \(\displaystyle x\) and \(\displaystyle 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 \(\displaystyle \lambda\) all together.

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


My constraints are these:
\(\displaystyle 2x + y = 44,000\)
\(\displaystyle y = 20,000\)


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


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:
\(\displaystyle L(x, y, \lambda_{1}, \lambda_{2}) = -0,01x^2 + 395x + 100y - \lambda_{1} * (2x + y - 44,000) - \lambda_{2} * (y - 20,000)\)

I then proceed by figuring out the partial differentials of \(\displaystyle L\) with respect to \(\displaystyle x\), \(\displaystyle y\), \(\displaystyle \lambda_{1}\) and \(\displaystyle \lambda_{2}\) to ultimately isolate \(\displaystyle x\) and \(\displaystyle y\). I am getting the correct results, but there's no need to solve \(\displaystyle L_x = 0\) and \(\displaystyle L_y = 0\). This is what's confusing me and what I'm having a hard time putting into words.
 
Last edited:
Please show your four partial derivatives.

\(\displaystyle L_x = -0.02x + 395 - 2\lambda_{1}\)

\(\displaystyle L_y = 100 - \lambda_{1}\)

\(\displaystyle L_{\lambda_{1}} = -2x - y + 44,000\)

\(\displaystyle L_{\lambda_{2}} = -y + 20,000\)
 
Last edited:
-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. \(\displaystyle \lambda_{1}\;and\;y\) 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 \(\displaystyle \lambda_{1}\;and\;x\), we get x = 9,750, but using \(\displaystyle y\;and\;x\), we get x= 12,000. How do you suppose we should reconcile that?
 
Last edited:
The difficulty is this, using \(\displaystyle \lambda_{1};and\;x\), we get x = 9,750, but using \(\displaystyle y\;and\;x\), 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:
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 \(\displaystyle 494.9999.\)

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 \(\displaystyle \lambda\).

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

\(\displaystyle \lambda_1,\ ...\ \lambda_n.\)
 
Well in English terminology this function is a constant equal to \(\displaystyle 494.9999.\)

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

I suppose I should add some context to the problem. The function \(\displaystyle f(x, y)\) is a contribution margin function where \(\displaystyle x\) and \(\displaystyle y\) are variables of two separate products. It is made up of two price functions for each product minus the variable costs. Product \(\displaystyle x\) has different options for pricing, while product \(\displaystyle y\) 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 \(\displaystyle x\) and \(\displaystyle y\) that are within my constraints. The constraints are the restrictions set by a hypothetical factory, which produce the products \(\displaystyle x\) and \(\displaystyle y\).

Well, in English terminology, both constraints are incomplete. Two plus what?
What does not exceed 20,000?

The production time mustn't exceed \(\displaystyle 44,000\) hours. Product \(\displaystyle x\) has a production time of 2 hours per \(\displaystyle x\) and product \(\displaystyle y\) has a production time of 1 hour per product \(\displaystyle y\)​.
The amount of \(\displaystyle y\) produced mustn’t exceed \(\displaystyle 20,000\) 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:
That is MUCH better.

The objective function is the contribution margin:

\(\displaystyle c(x, y) = -\ 0.1x^2 + 395x + 100y.\)

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

\(\displaystyle 2x + y \le 44,000 \text {; and}\)

\(\displaystyle y \le 20,000.\)

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 \(\displaystyle \lambda\). If there is more than one constraint, they are conventionally distinguished by subscripts. So with two constraints, you will have \(\displaystyle \lambda_1\) and \(\displaystyle \lambda_2\) but no \(\displaystyle \lambda\). Is that clear?

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

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

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

\(\displaystyle \dfrac{ \delta L}{ \delta \lambda_2} = 0 \implies 20,000 - y = 0 \implies y = 20,000.\)

\(\displaystyle \dfrac{ \delta L}{ \delta \lambda_1} = 0 \implies 44,000 - 2x - y = 0 \implies 2x = 44,000 - 20,000 \implies x = 12,000.\)

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:
As I read what you have written, I must assume that the objective function is:

\(\displaystyle c(x, y) = -\ 0.1x^2 + 395x + 100y.\)

But I see only one relevant constraint, namely \(\displaystyle 2x + y \le 20,000.\)

How did you derive the two constraints?
 
Really, though, you fix the problem by writing L2 instead of the incorrect L1 in the second equation. :)
 
Yes, sorry for the lack of clarification. I’m bouncing between multiple math problems, which is causing myself confusion. Excuse the naming conventions for my functions (literal translations from my own language).

I believe that you’ve already given me my answer, which is that the problem is very simple. This is why I only have to solve for the two partial derivatives. I’m going to go ahead and answer your question anyway to be on the safe side.

How did you derive the two constraints?

Basically, I have two products (\(\displaystyle x\) and \(\displaystyle y\)). The first constraint deals with the production time for the two products, which are produced in the same factory. The limiting factor is the amount of time that can be spent on producing the two products. The second constraint is the maximum amount of \(\displaystyle y\) that can be produced.

The contribution margin function is made up of an equation consisting of revenue and variable cost functions for each of the products. Now the price of the first product, \(\displaystyle x\), is described by a linear function because the price is dependant on the sales. The second product, \(\displaystyle y\), has a fixed price and sale amount. This is why the function that I’m trying to maximize is a parabola too.

Again, excuse the lack of proper terms for the different aspects of the problem. I’m not used to doing math in English, so I’m translating everything very literally.

Let me know if you’d like more information. I’m writing this on my phone, so I can get into much more detail on my computer later if needed.
 
Last edited:
Yes, sorry for the lack of clarification. I’m bouncing between multiple math problems, which is causing myself confusion. Excuse the naming conventions for my functions (literal translations from my own language).

I believe that you’ve already given me my answer, which is that the problem is very simple. This is why I only have to solve for the two partial derivatives. I’m going to go ahead and answer your question anyway to be on the safe side.



Basically, I have two products (\(\displaystyle x\) and \(\displaystyle y\)). The first constraint deals with the production time for the two products, which are produced in the same factory. The limiting factor is the amount of time that can be spent on producing the two products. The second constraint is the maximum amount of \(\displaystyle y\) that can be produced.

The contribution margin function is made up of an equation consisting of revenue and variable cost functions for each of the products. Now the price of the first product, \(\displaystyle x\), is described by a linear function because the price is dependant on the sales. The second product, \(\displaystyle y\), has a fixed price and sale amount. This is why the function that I’m trying to maximize is a parabola too.

Again, excuse the lack of proper terms for the different aspects of the problem. I’m not used to doing math in English, so I’m translating everything very literally.

Let me know if you’d like more information. I’m writing this on my phone, so I can get into much more detail on my computer later if needed.
OK, but did you not say in post # 8 that the factory could only run for 20,000 hours per period and that it took 2 hours to produce one unit of x and only 1 hour to produce one unit of y. In that case the constraint should be

\(\displaystyle 2x + y \le 20,000.\)
 
Last edited:
OK, but did you not say in post # 8 that the factory could only run for 20,000 hours per period and that it took 2 hours to produce one unit of x and only 1 hour to produce one unit of y.

Ah, I see. Yeah, I seem to have mixed up different math problems while writing the equations and inequalities. I’ll try to go back and correct it once I have some time. It was indeed supposed to be 44,000 hours and not 20,000 hours. Product \(\displaystyle y\) has a max production of 20,000.
 
Last edited:
Top