Difficulty: Intermediate | Prerequisites: partial derivatives, gradients, basic constrained optimisation. You should be comfortable with multivariable functions and the idea of a gradient vector before reading these notes.
Lagrange multipliers let you find the extreme values of a function subject to one or more constraints. This lab sits toward the end of the multivariable calculus optimisation unit and ties together gradients, level curves, and the idea of constrained motion. You need to know how to compute partial derivatives, form a gradient vector, and interpret contour plots. The lab also foreshadows linear algebra by introducing the notion of linear independence of constraint gradients, so it is a bridge between Calculus III and later coursework.
Lagrange multipliers find where a function's gradient is parallel to the constraint's gradient, which marks the constrained extrema. The method breaks down when a constraint's gradient is zero (or when multiple constraints have linearly dependent gradients), so you must check those edge cases separately. This lab walks through a worked example on the curve x⁴ − x³ + y² = 0 and shows that the "naive" approach misses the minimum at the origin because ∇g = 0 there.
Lagrange multiplier (λ)
A scalar that scales the constraint gradient so it equals the objective function's gradient at an extremum. Think of it as the exchange rate between how fast the objective changes and how tightly the constraint is pulling.
Gradient (∇f)
The vector of all partial derivatives of f. It points in the direction of steepest increase and its magnitude gives the rate of that increase. In simple terms, the gradient tells you "which way is uphill and how steep."
Constraint function g(x, y) = 0
An equation that restricts the domain to a curve (in 2D) or surface (in 3D). You are only allowed to move along points satisfying this equation.
Level curve (contour)
A curve along which a function takes a constant value. On a contour plot, each line represents one value of f(x, y). In simple terms, contour lines are the "elevation rings" on a topographic map.
Linearly independent (constraints)
Two constraint gradients are linearly independent when neither is a scalar multiple of the other. This is the condition that lets the Lagrange system produce a solvable set of equations. If constraints are linearly dependent, their gradients point in the same (or opposite) direction and the method can fail.
Implicitly defined curve
A curve given by an equation g(x, y) = 0 rather than y = f(x). The constraint x⁴ − x³ + y² = 0 is a good example: you cannot easily isolate y as a single function of x (you get two branches, ±√(x³ − x⁴)).
To optimise f(x, y) subject to g(x, y) = 0, set ∇f = λ∇g.
This gives you a system of equations: one per variable, plus the constraint equation itself.
Solve the system for x, y, and λ. The solutions are candidate extrema.
At a constrained extremum, the gradient of f must be parallel to the gradient of g.
If ∇f and ∇g point in different directions at some point on the constraint, you can still move along the constraint and increase (or decrease) f, so that point is not an extremum.
When ∇f = λ∇g, there is no component of ∇f along the constraint curve, meaning f is neither increasing nor decreasing along the curve at that point.
The method assumes that ∇g is nonzero at the point of interest.
If ∇g = 0, the constraint curve may have a cusp or self-intersection, and the Lagrange system becomes degenerate (you cannot divide by zero to find λ).
Points where ∇g = 0 must be checked separately by direct substitution.
Objective function: f(x, y) = x + sin(y − 1/2)
Constraint: g(x, y) = x⁴ − x³ + y² = 0
Goal: find the maximum and minimum of f on the constraint curve.
Creates a grid over x ∈ [0, 1] and y ∈ [−1, 1], then plots the contours of f(x, y) in 3D.
Solves the constraint for y: y = ±√(x³ − x⁴). This splits the curve into an upper branch (y₁) and a lower branch (y₂).
Plots f evaluated along both branches as red curves on the contour surface, showing how f behaves when restricted to the constraint.
The maximum of f along the constraint appears near (0.91, 0.26), where f ≈ 0.67.
The minimum sits at (0, 0), where f = 0 + sin(−0.5) ≈ −0.48.
∇f = ⟨1, cos(y − 1/2)⟩
∇g = ⟨4x³ − 3x², 2y⟩
At (0, 0), ∇g = ⟨0, 0⟩. The gradient of the constraint vanishes.
Because ∇g = 0, the equation ∇f = λ∇g has no finite λ that works (you would need 1 = λ · 0).
The standard Lagrange system only finds the maximum near (0.91, 0.26). To catch the minimum, you must separately evaluate f at points where ∇g = 0.
The constraint g(x, y) = 0 defines a curve in the xy-plane. The objective f(x, y) assigns a "height" to each point.
Walking along the constraint, you trace out a path on the surface z = f(x, y). Extrema occur where that path has horizontal tangent (in the z direction).
At such a point, the contour line of f is tangent to the constraint curve, which is exactly the condition ∇f ∥ ∇g.
With two constraints, g₁ = 0 and g₂ = 0, the feasible set is the intersection of two curves (generically a set of isolated points in 2D, a curve in 3D).
The Lagrange condition becomes ∇f = λ₁∇g₁ + λ₂∇g₂.
This system is solvable only when ∇g₁ and ∇g₂ are linearly independent, meaning they do not point in the same or opposite direction.
If ∇g₁ = c · ∇g₂ at some point, the two constraints are locally redundant: they are "saying the same thing" about which direction is forbidden.
The system ∇f = λ₁∇g₁ + λ₂∇g₂ becomes under-determined (infinitely many combinations of λ₁, λ₂ give the same right-hand side).
You cannot solve for a unique pair (λ₁, λ₂), and the method stalls. These degenerate points must be investigated separately.
\nabla f = \lambda \nabla gSingle-constraint Lagrange condition. Produces one equation per variable, plus g(x, y) = 0.
\nabla f = \lambda_1 \nabla g_1 + \lambda_2 \nabla g_2Two-constraint Lagrange condition. Requires ∇g₁ and ∇g₂ to be linearly independent.
For this lab's specific problem:
f(x,y) = x + \sin(y - \tfrac{1}{2}), \quad g(x,y) = x^4 - x^3 + y^2 = 0\nabla f = \langle 1,\; \cos(y - \tfrac{1}{2}) \rangle, \quad \nabla g = \langle 4x^3 - 3x^2,\; 2y \rangleLagrange multipliers underpin any engineering or economic problem where you are optimising something subject to a budget, a physical law, or a design envelope. Structural engineers use them to minimise the weight of a beam subject to strength and deflection constraints. Economists use them to maximise utility subject to a budget constraint, and the multiplier λ directly measures the marginal value of relaxing the constraint by one unit (the "shadow price").
"Lagrange multipliers always find every extremum." They do not. The method misses any extremum where ∇g = 0. You must check those points by hand.
"If the system has no solution, there is no extremum." A missing solution often means the extremum occurs at a degenerate point (∇g = 0) rather than that no extremum exists. Always look at the boundary or singular points of the constraint.
"Two constraints are redundant only if they are literally the same equation." Constraints can be locally redundant (linearly dependent gradients) even when the equations look entirely different. The test is on the gradients at a specific point, not on the equations globally.
"λ has no meaning; it is just an algebraic trick." The multiplier has a concrete interpretation: it measures how much the optimum would change if the constraint were relaxed by a small amount. This is the shadow-price interpretation used across economics and engineering.
⚠️ Expect at least one exam question where ∇g = 0 at a candidate point. The standard move: note that the Lagrange system is degenerate there, then evaluate f directly.
⚠️ Be ready to state the linear-independence condition when working with two constraints. Exam phrasing may use "linearly independent gradients" or "constraint qualification."
⚠️ Know both sides of the worked example: the maximum found by Lagrange and the minimum found by checking ∇g = 0 separately.
⚠️ You may be asked to explain geometrically why ∇f ∥ ∇g at a constrained extremum. The key sentence: "The contour of f is tangent to the constraint curve, so there is no component of ∇f along the constraint."
True or false: Lagrange multipliers require ∇g ≠ 0 at the point of interest.
True.
Fill in the blank: At a constrained extremum, ∇f is ______ to ∇g.
Parallel (i.e. ∇f = λ∇g for some scalar λ).
True or false: If two constraint gradients are linearly dependent at a point, the Lagrange system is still guaranteed to have a unique solution there.
False. The system becomes under-determined.
What is ∇g at the origin for g(x, y) = x⁴ − x³ + y²?
⟨0, 0⟩. Both partial derivatives vanish.
True or false: The value of λ has no physical or economic meaning.
False. λ gives the rate of change of the optimum with respect to a small relaxation of the constraint.
Q: Set up the Lagrange system for maximising f(x, y) = x + sin(y − 1/2) subject to x⁴ − x³ + y² = 0.
A: Write ∇f = λ∇g, giving the system: 1 = λ(4x³ − 3x²), cos(y − 1/2) = λ(2y), and x⁴ − x³ + y² = 0. Solve these three equations for x, y, λ.
Q: Why does the standard Lagrange approach fail to find the minimum at (0, 0) in this problem?
A: At (0, 0), ∇g = ⟨0, 0⟩. The equation 1 = λ · 0 has no solution, so the Lagrange system is degenerate. The minimum must be found by checking f at the point where ∇g vanishes.
Q: Explain geometrically why ∇f must be parallel to ∇g at a constrained extremum.
A: If ∇f had a component along the constraint curve, you could move in that direction and increase (or decrease) f while staying on the constraint. At an extremum no such improvement is possible, so the only component of ∇f must be normal to the constraint, which is the direction of ∇g.
Q: What condition on the constraint gradients is required when using Lagrange multipliers with two constraints?
A: The gradients ∇g₁ and ∇g₂ must be linearly independent at the point of interest. If one is a scalar multiple of the other, the constraints are locally redundant and the Lagrange system is under-determined.
Q: A classmate claims that because the Lagrange system produced no solution at (0, 0), there is no extremum there. What is wrong with this reasoning?
A: The absence of a Lagrange solution means the method's assumption (∇g ≠ 0) is violated, not that no extremum exists. Evaluating f(0, 0) = sin(−0.5) ≈ −0.48 and comparing with other values on the constraint shows it is in fact the minimum.
This material connects directly to linear algebra: the requirement that constraint gradients be linearly independent is the same rank condition you will see when solving systems of linear equations. If you go on to take an optimisation course, the Lagrange multiplier becomes the foundation for the KKT (Karush-Kuhn-Tucker) conditions, which handle inequality constraints. The shadow-price interpretation of λ is central to microeconomics (consumer and producer theory) and to operations research (linear and nonlinear programming).
Lagrange multiplier, constrained optimisation, constrained optimization, gradient condition, parallel gradients, level curve tangency, contour plot, constraint qualification, linearly independent constraints, linear dependence, shadow price, KKT conditions, Karush-Kuhn-Tucker, multivariable calculus extrema, implicit curve, MATH 215, Calculus III, University of Michigan, Lab 3B