Interactive Lagrange Multiplier Calculator
Find constrained extrema for a quadratic objective function in two variables using a linear constraint.
What this Lagrange multiplier calculator solves
This calculator helps you optimize a two-variable quadratic function under one linear equality constraint. It computes the constrained stationary point (x*, y*), the Lagrange multiplier λ, and the objective value at that point. It also provides a quick classification of the point as a constrained minimum, constrained maximum, or flat/inconclusive case.
Quick refresher: the Lagrange multiplier method
When you need to optimize a function with a constraint, Lagrange multipliers convert the constrained problem into a system of equations. For a function f(x,y) with constraint g(x,y)=0, the key condition is:
In this tool, the constraint is entered as gx + hy = k, which is equivalent to gx + hy - k = 0.
First-order conditions used by the calculator
- 2ax + cy + d = λg
- cx + 2by + e = λh
- gx + hy = k
These three equations are solved simultaneously for x, y, and λ.
How to use this calculator
- Enter coefficients for your objective function.
- Enter coefficients for your linear constraint.
- Click Calculate.
- Read the stationary point, multiplier, objective value, and classification.
Interpreting the output
The stationary point
This is the feasible point where the constrained gradient condition holds. If the system is singular, the tool reports that there is no unique solution.
The Lagrange multiplier (λ)
The multiplier measures the sensitivity of the optimal value to changes in the constraint level k. In many applications (economics, engineering, operations), it is interpreted as a shadow value.
Constrained min/max classification
For a line constraint, movement is only possible along one direction. The calculator checks curvature along that feasible direction:
- Positive curvature → constrained minimum
- Negative curvature → constrained maximum
- Near zero curvature → flat or non-isolated/inconclusive case
Worked example
Try the default values:
- f(x,y) = x² + y²
- x + y = 10
The calculator returns x = 5, y = 5, λ = 10, and objective value 50. Since curvature along the feasible line is positive, this point is a constrained minimum.
Common mistakes to avoid
- Entering a zero constraint gradient (g = 0 and h = 0), which is not a valid equality constraint.
- Assuming every constrained problem has a unique solution; some systems are singular or degenerate.
- Using this tool for nonlinear constraints. This calculator is specifically for linear constraints.
Final notes
If you are studying constrained optimization, this is a practical way to verify hand calculations and quickly test scenarios. For nonlinear constraints or higher-dimensional problems, use symbolic algebra tools or numerical optimizers with KKT conditions.