Lagrange multipliers

In optimization, if you have a constraint (or more than one) that can be written as an equation g(x, y) = 0 (or really, with any constant on the right-hand side), then as long as the gradient ∇g is never zero on the solution set of this constraint equations, then you can use the method of Lagrange multipliers. Here, you set up an equation ∇f(x, y) = λg(x, y), combine this with the equation g(x, y) = 0, and try to solve for x, y, and λ. (Since a vector equation is equivalent to 2 scalar equations, this amounts to a system of 3 equations in 3 variables, so there is hope to solve for it.) If you're working in 3 variables, then you might need two equations to specify the constraint, in which case there are two functions in the place of g and two Lagrange multipliers, making 4 equations in 4 variables. (But you can also have just one g even in 3 dimensions; it's a question of whether the boundary in question is a surface or a curve.) While λ ultimately doesn't matter, the solutions that you get for the original variables give you additional critical points to check for extreme values.

On the other hand, you don't actually need Lagrange multipliers! Writing v for g(x, y), if the constraint is v = 0 (or v equals any constant), then differentiate this to get dv = 0. (In fact, you could take any equation and just differentiate both sides.) Then if you try to solve the system of equations consisting of du = 0 and dv = 0 for the differentials dx and dy, you should immediately see that dx = 0 and dy = 0 is a solution. However, if you actually go through the steps of solving this as a system of linear equations (which you can always do because differentials are always linear in the differentials of the independent variables), you'll find that at some point you need to divide by some quantity involving x and y, which is invalid if that quantity is zero! So, setting whatever you divide by to zero and combining that with the constraint equation v = 0, you get two equations to solve for the two variables x and y. This will give you the other critical points to check for extreme values.

Here is a typical problem: The hypotenuse of a right triangle (maybe it's a ladder leaning against a wall) is fixed at 20 feet, but the other two sides of the triangle could be anything. Still, since it's a right triangle, we know that x2 + y2 = 202, where x and y are the lengths of legs of the triangle. (If we think of x and y as independent variables, then this equation is our constraint.) Differentiating this, 2x dx + 2y dy = 0. Now suppose that we want to maximize or minimize the area of this triangle. Since it's a right triangle, the area is A = ½xy, so dA = ½y dx + ½x dy. If this is zero, then ½y dx + ½x dy = 0, to go along with the other equation 2x dx + 2y dy = 0.

The equations at this point are linear in the differentials (and they always must be), so think of this is a system of linear equations in the variables dx and dy. There are various methods for solving systems of linear equations; I'll use the method of addition aka elimination, but any other method should work just as well. So ½y dx + ½x dy = 0 becomes 2xy dx + 2x2 dy = 0 (multiplying both sides by 4x), while 2x dx + 2y dy = 0 becomes 2xy dx + 2y2 dy = 0 (multiplying both sides by y). Subtracting these equations gives (2x2 − 2y2) dy = 0, so either dy = 0 or x2 = y2. Now, x and y can change freely as long as they're positive, but we have limiting cases: x → 0+ and y → 0+. Since x2 + y2 = 400, we see that x2 → 400, so x → 20, as y → 0. Similarly, y → 20 as x → 0. In those cases, A = ½xy → 0. On the other hand, if x2 = y2, then x = y, so x, y = 10√2, since x2 + y2 = 400. In that case, A = ½xy = 100.

So the largest area is 100 square feet, and while there is no smallest area, the area can get arbitrarily small with a limit of 0.

Go back to the course homepage.
Valid HTML 4.01 Transitional

This web page was written in 2015 and 2016 by Toby Bartels, last edited on 2016 April 26. Toby reserves no legal rights to it.

The permanent URI of this web page is