
|
  
Lagrange Multipliers: constrained optimization Summary: Lagrange multipliers are a mathematical technique to minimize an expression, while meeting constraints. This page shows a worked out example using the Maxima computer algebra system.
| The approach outlined below is straightforward to implement in a computer algebra system. However, it may be not the shortest way for a pen-and-paper calculation.
Lagrange Multipliers Consider the following example: Our task is to find the length, width and height , and . of a milk box. The following requirements have been given:
- a target volume
, for example one liter - the width
should be twice as long as the length  - The total surface area of all sides
should be as small as possible Written as equations, we get one expression for the area, that is to be minimized:
Further, there are two constraints:
- meeting the target volume:
 - the width / length requirement:
 The constraint equations can be moved over to one side: and It follows, that for , and solving the problem, the left-hand sides will become zero. Next they are multiplied with the so-called "Lagrange Multipliers" , , and subtracted from the expression we want to minimize. The following expression results:
Now the derivative is taken with regard to all unknown variables , , , , . The derivatives are set equal to zero, leading to five equations. Intuitively, the reasoning behind this step is: - The derivative of the original "cost equation" in all variables must be zero for a minimum
- Since the constraints are met in a solution point, the cost expressions are zero, and so are their derivatives, taken against the Lagrange Multipliers
At this point we are dealing with a system of five (nonlinear!) equations in five variables, which isn't that easy to solve. Now and can be eliminated from the equation system, since we are not interested in their actual values. What remains is a system of three equations in three variables , , , its solution solves also the initial problem.
Verifying the result Putting the result back into the constraint equations shows that they are met. Also, has a minimum, as expected. When dealing with more complex problems, one needs to check also the 2nd derivative.
Maxima CAS script Download
  
© Markus Nentwig 2007-2008
The content of this page is provided without any warranty and may not be reproduced without permission.
Comments? Questions?
Please send me a mail!
mnentwig@elisanet.fi
|