Lagrange Multipliers Explained: Solving Constrained Optimisation Problems
Learn how Lagrange multipliers work, how to write the system of equations, find every critical point, classify it and read the meaning of the multiplier λ.

Unconstrained optimisation asks where a function is largest or smallest. Real problems almost always add a condition. A company wants the most output for a fixed budget, an engineer wants the strongest beam that fits a given cross-section, a student wants the point on a circle nearest to some target. Lagrange multipliers are the standard tool for these questions in multivariable calculus and economics. This guide explains the idea, the system of equations it produces and the checks you should make, and shows how the free Lagrange Multiplier Calculator handles the solving.
The geometric idea
Picture the level curves of the objective f drawn on a map, and the constraint g = 0 drawn as one more curve on top. Walk along the constraint curve and watch the value of f. Where f reaches a maximum or minimum along your path, the constraint curve cannot cross the level curve of f; it can only touch it. Two curves that touch share a tangent line, so their normal vectors are parallel. The normal to a level curve is its gradient, so at the optimum ∇f is a multiple of ∇g. That multiple is called λ.
Writing the equations
The condition ∇f = λ∇g, together with the constraint itself, gives as many equations as unknowns. For a function of x and y with one constraint you get three equations in x, y and λ. A compact way to produce them is the Lagrangian L = f − λg: setting every partial derivative of L to zero reproduces exactly the gradient equations and the constraint.
With two constraints, g = 0 and h = 0, you add a second multiplier and the condition becomes ∇f = λ∇g + μ∇h. A typical case is finding the point on the line where two planes meet that lies closest to the origin.
Solving the system
This is where most of the effort goes. The equations are usually nonlinear, and the usual trick of dividing one equation by another silently throws away any solution where the divisor is zero. Careful hand solutions split into cases.
The calculator avoids case analysis by solving numerically from hundreds of starting points with Newton's method, then removing duplicates. Results that match fractions, square roots or multiples of π are displayed exactly, but only after substituting them back confirms that every equation holds to within a billionth. You control the size of the search box, so if you expect solutions with large coordinates you simply widen it.
A worked example
Find the largest and smallest values of f = x + 2y on the unit circle x² + y² = 1. The equations are 1 = 2λx, 2 = 2λy and x² + y² = 1. From the first two, y = 2x, and the circle then gives x = ±1/√5. The calculator reports the two points (√5/5, 2√5/5) and (−√5/5, −2√5/5), with λ = √5/2 and −√5/2. Substituting into f gives √5 and −√5. Since the circle is closed and bounded, these are the true maximum and minimum.
The contour map makes the result visible: the straight level lines of x + 2y touch the circle exactly at those two points, and the arrows for ∇f and ∇g point along the same line.
Is it a maximum or a minimum?
Comparing values of f is the simplest classification, and it is decisive whenever the constraint set is closed and bounded, like a circle, an ellipse or a sphere. On an unbounded constraint such as a line, a critical point may be neither. The calculator adds a second-order test: it restricts the Hessian of the Lagrangian to the directions allowed by the constraints and looks at the signs of its eigenvalues. All positive means a local minimum along the constraint, all negative a local maximum, mixed signs a saddle. For two variables and one constraint it also prints the bordered Hessian determinant, the version most textbooks teach.
What λ tells you
The multiplier is more than an algebraic helper. It measures how fast the optimal value changes when the constraint is relaxed. If the constraint is a budget, λ is the extra output per extra unit of money, often called the shadow price. In the Cobb-Douglas example included with the tool, maximising 50x^0.6y^0.4 with 20x + 10y = 1000 gives x = 30 and y = 40, and λ ≈ 1.68 says that one more unit of budget would raise output by about 1.68 units.
Checklist for exam answers
Write the Lagrangian explicitly. List every equation, including the constraint. Solve with care for zero cases, or check your answer against a full list of solutions. Evaluate f at every point you found. State whether the constraint set is bounded before calling the largest value a maximum. Finally, mention any points where ∇g = 0, because the method does not cover them. With a complete list of critical points from the calculator to compare against, it is easy to see whether your hand solution missed a case.


