#### lynxman72

Hi all, I was wondering how to go about solving an optimization problem for a function f(x,y,z) where the two constraint equations are given by:

a is less than or equal to g(x,y,z) is less than or equal to b
(a and b are two distinct numbers)
h(x,y,z) is less than or equal to c
(c is another number distinct from a and b)

Can Lagrange Multipliers solve this problem? In other words, is there some trick to put the constraint equation in the standard form for which Lagrange Multipliers works? Any help is appreciated. Thanks

#### JasonRox

##### ... to graduate school.
Homework Helper
Gold Member
lynxman72 said:
Hi all, I was wondering how to go about solving an optimization problem for a function f(x,y,z) where the two constraint equations are given by:
a is less than or equal to g(x,y,z) is less than or equal to b
(a and b are two distinct numbers)
h(x,y,z) is less than or equal to c
(c is another number distinct from a and b)
Can Lagrange Multipliers solve this problem? In other words, is there some trick to put the constraint equation in the standard form for which Lagrange Multipliers works? Any help is appreciated. Thanks

When you have one constraint, you write it as (let p be the lambda thing or whatever you use)...

Note: f_x is the partial derivative with respect to x.

f_x (x,y,z) = p * g_x (x,y,z)
f_y (x,y,z) = p * g_y (x,y,z)
f_z (x,y,z) = p * g_z (x,y,z)
g(x,y,z) = k

... where k is the constraint.

For multiple constraints, simply write as (where w is your lambda_2)...

f_x (x,y,z) = p * g_x (x,y,z) + w * h_x (x,y,z)
f_y (x,y,z) = p * g_y (x,y,z) + w * h_y (x,y,z)
f_z (x,y,z) = p * g_z (x,y,z) + w * h_z (x,y,z)
g(x,y,z) = k
h(x,y,z) = j

...where k and j are the constraints.

See the pattern here? You can add as many as you want, but I do know that it's not fun solving, for most of them anyways. :tongue:

If you have a <= or >= as a constraint, you simply find the critical points within the boundaries, evaluate them, and evaluate all the points on the boundary, and then take the largest value. This is basically the same thing as finding a maximum/minimum.

#### lynxman72

Jason, thanks for the response. I understand how to use the Lagrange multipliers for an equality constraint. I think I didn't describe my problem clearly, the inequality constraints are on the variables, not on the function itself...here is my specific problem: the function to be maximized is

f(x,y,z,t,w)=ln((y^2-x^2)(z^2-t^2)w^3))+.8x-1.2y-20z/17+14t/17-w^3/pi^3

subject to the constraints:
x/2+y+3z+3t+2.5w<=30
1800<=130x+150y+200z+70t+110a<=3000

I computed all of the partials (for any values of the variables) and set them equal to zero and found (2,3,7/3,10/3/pi) to be the only critical point but this gives a value of -3 which doesn't make much sense for the problem I'm working with, so I don't think I went about it right...

#### JasonRox

##### ... to graduate school.
Homework Helper
Gold Member
lynxman72 said:
Jason, thanks for the response. I understand how to use the Lagrange multipliers for an equality constraint. I think I didn't describe my problem clearly, the inequality constraints are on the variables, not on the function itself...here is my specific problem: the function to be maximized is
f(x,y,z,t,w)=ln((y^2-x^2)(z^2-t^2)w^3))+.8x-1.2y-20z/17+14t/17-w^3/pi^3
subject to the constraints:
x/2+y+3z+3t+2.5w<=30
1800<=130x+150y+200z+70t+110a<=3000
I computed all of the partials (for any values of the variables) and set them equal to zero and found (2,3,7/3,10/3/pi) to be the only critical point but this gives a value of -3 which doesn't make much sense for the problem I'm working with, so I don't think I went about it right...
Did you check the values around the boundaries as well?

You must check those at the critical points AND those on the boundary, and then take the maximum value.

#### lynxman72

That's my problem, I don't understand how to do that; I have two constraint equations for five variables and so I don't know how to figure out the boundaries of each variable...

#### matt grime

Homework Helper
I tihnk the thing you need are called slack variables. google for details about them cos it's been too long since i did anything them with them to know i'll get it right.

Homework Helper
Gold Member

#### lynxman72

Thanks for the link. Where I'm confused is what to do about having both an upper and lower bound as my constraints, if it was just upper bound I see what to do but I don't know how to handle both.

### The Physics Forums Way

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving