Lagrange multipliers provide a systematic way to find the local maxima and minima of a function subject to one or more equality constraints. Suppose we seek extrema of given the constraint . By introducing an auxiliary variable , we form the Lagrangian
The method rests on the insight that at an extremum subject to the constraint, gradients of and are parallel. Setting the partial derivatives of to zero yields the system
combined with the original constraint . Solving these equations simultaneously pinpoints stationary points that may correspond to constrained maxima or minima.
In practice, we differentiate with respect to , , and . Setting , , and yields three equations in the three unknowns. Solving this system gives candidate points. We then evaluate at each candidate to determine which provide maxima or minima along the constraint curve.
Consider finding the extrema of subject to . The Lagrangian is . Taking partial derivatives gives
Setting these to zero yields a system solvable for , , and . Substituting back into reveals whether each solution is a maximum or minimum on the line . This procedure generalizes easily to more variables and multiple constraints by adding one multiplier per constraint.
Geometrically, the gradient of points in the direction of greatest increase, while the gradient of is normal to the constraint curve. At a constrained extremum, movement along the constraint cannot increase or decrease , meaning its gradient must be parallel to the gradient of . The multiplier quantifies how strongly the constraint influences the optimum. This geometric viewpoint helps explain why the Lagrange multiplier technique is so widely used across calculus, physics, and economics.
To apply the method with this calculator, enter any differentiable function of two variables and a single constraint . Optional initial guesses for and let you guide the numerical solver toward different branches of solutions; adjusting these seeds can reveal multiple extrema when they exist. The tool relies on the symbolic differentiation capabilities of math.js to compute partial derivatives. After solving the resulting system numerically, the calculator reports the stationary point, the associated multiplier, and the objective value.
Lagrange multipliers appear in diverse settings: optimizing production subject to resource limits, maximizing entropy with fixed energy, or finding shortest paths constrained to surfaces. The method links optimization to geometry, revealing how constraints shape feasible solutions. By experimenting with different functions and constraints, you will see how the multiplier value reflects the trade-off between satisfying the constraint and optimizing the objective. For instance, in economics, represents the shadow price of relaxing a constraint by one unit, while in physics it can correspond to a reaction force enforcing a holonomic restriction.
Multiple constraints introduce additional multipliers, one per condition. The principle extends to higher dimensions by treating as a function of many variables and solving the expanded system. Inequality constraints require the Karush–Kuhn–Tucker conditions, a generalization that adds complementary slackness and non-negativity requirements to the multipliers. Although this calculator focuses on a single equality constraint in two variables, the same ideas power nonlinear programming packages.
Classification of the resulting stationary point demands second-order analysis. After locating a candidate point, one can examine the bordered Hessian matrix to determine whether the solution is a constrained maximum, minimum, or saddle point. The sign of its determinant provides the verdict, mirroring the second derivative test from single-variable calculus. Future versions of this tool may automate that classification step.
Historically, Joseph-Louis Lagrange introduced the technique in the 18th century as part of his work on mechanics. The elegant algebraic method replaced earlier geometric reasoning and paved the way for modern variational calculus. Today, Lagrange multipliers underlie algorithms in machine learning, statistical estimation, and computer graphics, where constraints must be enforced without explicitly solving for them at every iteration.
This calculator aims to demystify the process by automating the tedious algebra. Understanding the underlying theory, however, remains essential for interpreting the results. With practice, you will recognize patterns—for example, that equality constraints often represent level curves or surfaces along which we seek tangency with . By mastering Lagrange multipliers, you gain a versatile tool for tackling constrained optimization problems in calculus, economics, and engineering. Experiment with different starting guesses and observe how the solution shifts—a reminder that many optimization problems harbor multiple feasible extrema.
Compute the Lagrange interpolating polynomial that passes through a set of points.
Estimate positions of the collinear Lagrange points L1, L2, and L3 for any two-body system.
Estimate daily calories burned using the Mifflin-St Jeor equation and activity multipliers, then explore nutrition strategies in an extensive guide.