The Student Room Group

lagrange multiplier technique

hey, i have this question on a uni past paper.. i've never heard of the lagrange multiplier technique, nor has the lecturer really discussed it properly..


the question is;

by using the langrange multiplier technique, find the values of x and y that either maximize or minimize f(x,y) = -x + y +xy - y^2 subject to the constraint y^2 = x .

I am just wondering how i would go about doing this question please! I cant find anything that covers the subject at my level on the internet.

thanks
Reply 1
I wonder what "your level" is, as that would aid explanation. Anyway...

1) Form the new function g(x,y) which is the constraint with zero on the rhs

2) Form the new function h(x,y,a) = f(x,y) - a g(x,y)

3) Differentiate h(x,y,a) partially wrt x, then wrt y, then wrt a, set all three derivatives = 0 and solve; the stationary points are the max/min of your function subject to your constraint (note the constraint is enforced via the derivative wrt a = 0)

4) Note that the method generalises to functions of as many variables as you want

======

In your example
1)
g(x,y) = y^2 - x

2)
h(x,y,a) = -x + y +xy - y^2 s - a(y^2 - x)

3) left as an exercise

====

You can check your answer in this case by noticing that along the curve specified by your constraint f(x,y) = -x + y +xy - y^2 = f(x) = -x + x^{1/2} + x^{3/2} - x and differentiating normally wrt x. The point of Lagrange multpliers is that by using the method you can avoid the horrible algebra that would sometimes be involved in back-substituting your constraint into your function.
miggeros
I wonder what "your level" is, as that would aid explanation. Anyway...

1) Form the new function g(x,y) which is the constraint with zero on the rhs

2) Form the new function h(x,y,a) = f(x,y) - a g(x,y)

3) Differentiate h(x,y,a) partially wrt x, then wrt y, then wrt a, set all three derivatives = 0 and solve; the stationary points are the max/min of your function subject to your constraint (note the constraint is enforced via the derivative wrt a = 0)

4) Note that the method generalises to functions of as many variables as you want

======

In your example
1)
g(x,y) = y^2 - x

2)
h(x,y,a) = -x + y +xy - y^2 s - a(y^2 - x)

3) left as an exercise

====

You can check your answer in this case by noticing that along the curve specified by your constraint f(x,y) = -x + y +xy - y^2 = f(x) = -x + x^{1/2} + x^{3/2} - x and differentiating normally wrt x. The point of Lagrange multpliers is that by using the method you can avoid the horrible algebra that would sometimes be involved in back-substituting your constraint into your function.

Following the partial differentiation, you get:
-1 + y - a = 0; 1 + x - 2y + 2ay = 0; [y^2] - x = 0.
The 1st and 3rd equations give you y = [a + 1] and x = [a + 1]^2.
Substitute that into the 2nd equation and you'll get a = 0 or a = -2/3.
Hence you get x = 1, y = 1, function = 0; x = 1/9, y = 1/3, function = 4/27.
In this case, the multiplier method is much longer than the standard method - provided that you express the original function in terms of y. Moreover, the multiplier method doesn't distinguish between max and min.Can anyone provide a problem where the multiplier method really is an advantage over the usual method?
Reply 3
I agree it is a little difficult to think of very good examples, but I'd be happy if someone could show me one.

Anything where the constraint curve is not one-one would be a bit more work using direct substitution; for example if constraint was something like x^2+y^2=1 you'd need to consider both cases x = +root(1-y^2) and x=-root(1-y^2) separately to make sure you get both sides of the circle. When the constraint curve were not so familiar you might forget to do this.

The multipliers way also generalises easily to multiple constraints and to more than two dimensions.
Reply 4
hey all. thanks for the help. when i meant "my level" i was just looking for an explanation in plain english really.. a lot of the sites concentrate heavily on mathematical definitions, which i find hard to grasp at this level.

so which bit of this is considered the lagrange multiplier technique? finding g(x,y) and h (x,y,a) ??? thanks
cool beans
hey all. thanks for the help. when i meant "my level" i was just looking for an explanation in plain english really.. a lot of the sites concentrate heavily on mathematical definitions, which i find hard to grasp at this level.

so which bit of this is considered the lagrange multiplier technique? finding g(x,y) and h (x,y,a) ??? thanks

The Lagrange method was well given by miggeros in his 1st posting. Since then we have been discussing whether the technique is all that it is cracked up to be.
Reply 6
Maths Buster
Following the partial differentiation, you get:
-1 + y - a = 0; 1 + x - 2y + 2ay = 0; [y^2] - x = 0.
The 1st and 3rd equations give you y = [a + 1] and x = [a + 1]^2.
Substitute that into the 2nd equation and you'll get a = 0 or a = -2/3.
Hence you get x = 1, y = 1, function = 0; x = 1/9, y = 1/3, function = 4/27.
In this case, the multiplier method is much longer than the standard method - provided that you express the original function in terms of y. Moreover, the multiplier method doesn't distinguish between max and min.Can anyone provide a problem where the multiplier method really is an advantage over the usual method?



just working through this question now..

wouldn't the differential, wrt to x be -1 + y + a, because when you multiply out the brackets next to a, it becomes + xa..

I'm also working through another question and will post my solution later, would love it for you guys to look through it (answers aren't available from these past papers :frown: )
cool beans
just working through this question now..

wouldn't the differential, wrt to x be -1 + y + a, because when you multiply out the brackets next to a, it becomes + xa..

I'm also working through another question and will post my solution later, would love it for you guys to look through it (answers aren't available from these past papers :frown: )

I always do f(x, y) +ag(x, y) and then differentiate that partially. It leads to the same result in the end. I'll look out for your next question.
Reply 8
Maths Buster
I always do f(x, y) +ag(x, y) and then differentiate that partially. It leads to the same result in the end. I'll look out for your next question.


On that question i get all the answers as previously stated, except with the alteration i said, i get a = 0 or +2/3

Is that the final answer? are they just looking for what x, y and a is? What is this function = thing? How was that worked out??

And here is the other question, completed up to the same point...

f (x,y) = -3x + y +1/3(xy) - 2x^2 with constraint y = x^2

which gives x = 1 or 3, y = 1 or root 3, and a = 2 or 4/3

thanks
Reply 9
Sorry for the double post, just noticed..

the question also says find the values of the lagrange multiplier and the objective function at both solutions. is the lagrange multiplier just the values of a??

but ii) also states, for one of the points found in part i) use appropiate second order conditions to find if the point is a min or a max.

Do i just do f''(x) and substitute in a set of values and determine a stationary point like normal?

thank you, this has been extremely helpful - i hope a question like this comes up now!!
cool beans
On that question i get all the answers as previously stated, except with the alteration i said, i get a = 0 or +2/3

Is that the final answer? are they just looking for what x, y and a is? What is this function = thing? How was that worked out??

And here is the other question, completed up to the same point...

f (x,y) = -3x + y +1/3(xy) - 2x^2 with constraint y = x^2

which gives x = 1 or 3, y = 1 or root 3, and a = 2 or 4/3

thanks

They are only looking for the x and y values - not the "a" value, because that depends upon the person carrying out the method. I then finished off by getting f(1, 1) = 0 and f(1/9, 1/3) = 4/27, but the question didn't actually ask for that bit!
For your 2nd question, I get x = 3 with y = 9 and, here we differ, x = -1 with y = 0. Have another look and post your working if necessary.
PS Iassume that the 3rd term in the function is [xy]/3?
cool beans
Sorry for the double post, just noticed..

the question also says find the values of the lagrange multiplier and the objective function at both solutions. is the lagrange multiplier just the values of a??

but ii) also states, for one of the points found in part i) use appropiate second order conditions to find if the point is a min or a max.

Do i just do f''(x) and substitute in a set of values and determine a stationary point like normal?

thank you, this has been extremely helpful - i hope a question like this comes up now!!

The value of the Lagrange multiplier will be the values that you found for your a.
The values of the objective function will be f(x, y) evaluated at the found points for x and y - which is what I did for your 1st post.
To distinguish between max and min, you would express your objective function in terms of one variable only and then do the usual 2nd derivative stuff. In your example, I think the objective function can be written as -3x + x^2 + [x^3]/3 - 2x^2. Etc

Latest