# Method of Lagrange Multipliers

The extrema of a function under a constraint can be found using the method of Lagrange multipliers. A condition for an extremum can be expressed by , which means that the level curve gradient and the constraint gradient are parallel. The scalar is called a Lagrange multiplier.
This Demonstration illustrates this method for over 150 different combinations of functions and constraints. It shows the relationship between the normalized level curve gradient and the normalized constraint gradient . The image on the left shows the level curves of the function and the constraint , while the image on the right shows the 3D view of the surface , with the constraint curve projected onto the surface. Use the slider to move the point around the constraint curve to observe the relation between the level curve and the constraint gradients as the point reaches an extremum. The movable point turns from green to red when the two vectors are parallel, signifying that the point is near a local extremum.

### DETAILS

Extrema are detected by computing the value of the dot product of the normalized level curve gradient and the normalized tangent of the constraint curve. The point changes from green to red as the absolute value of the dot product approaches zero. The dot product equals zero if and only if the level curve gradient is perpendicular to the tangent vector of the constraint curve, that is, parallel to the constraint gradient.
Extrema that occur on singular points of the surface or constraint may not be detected by the Lagrange multiplier method.
The constraint curve data used comes from the collection of curves available in the Wolfram Language.

### PERMANENT CITATION

 Share: Embed Interactive Demonstration New! Just copy and paste this snippet of JavaScript code into your website or blog to put the live Demonstration on your site. More details » Download Demonstration as CDF » Download Author Code »(preview ») Files require Wolfram CDF Player or Mathematica.

• Geodesics of a Torus Solved with a Method of LagrangeGerard Balmens
• Gauss Map and CurvatureMichael Rogers (Oxford College/Emory University)
• Soap Film between Two Equal and Parallel RingsS. M. Blinder
• Frenet FrameNick Bykov
• Equation of a Plane in Vector FormWalter Mora Flores
• Equation of a PlaneLaura R. Lynch
• Curl of Some Vector FieldsRyan Zhan
• Roll a Sphere without Changing Orientation to a New Location in Two Straight RollsAaron Becker
• Commutative Matrices Associated with Vector RotationsD. Meliga, A. Ratti and S. Z. Lavagnino
• Curves of Steepest Descent for 3D FunctionsMichael Waters