Lagrange Multipliers and Constrained Optimization, MATH 215 Lab 3B – Study Notes
offline

Source: Lab 3 Part B Reflection, Math 215 Section 021, University of Michigan

Difficulty: Intermediate | Prerequisites: Partial derivatives, gradient vectors (∇f), level curves and contour plots. Familiarity with multivariable functions f(x, y) is assumed.

Lagrange multipliers are the standard technique in Calculus III for finding extreme values of a multivariable function when you are restricted to a curve or surface (a constraint). Up to this point in MATH 215, you have found maxima and minima of unconstrained functions using partial derivatives and critical points. Now the question changes: what is the largest or smallest value a function can take on a particular curve? This lab explores that question using contour plots, gradient vectors, and the core Lagrange condition ∇f = λ∇g, with a specific focus on cases where the method does and does not find all extrema.


TL;DR

Lagrange multipliers find extreme values of f(x, y) subject to a constraint g(x, y) = c by requiring ∇f = λ∇g, that is, the gradient of the function and the gradient of the constraint must be parallel. Geometrically, this means the level curve of f is tangent to the constraint curve. The method catches smooth extrema but can miss corners or points where ∇g = 0, so you must check those separately.


Key Terms

Lagrange multiplier (λ)

A scalar that appears in the equation ∇f = λ∇g. It scales the constraint gradient so that it matches the function gradient at a constrained extremum.

In simple terms, λ tells you how much the optimum value of f would change if you relaxed the constraint slightly.

Constraint

A condition g(x, y) = c that restricts the domain to a specific curve (in 2D) or surface (in 3D). You are only allowed to evaluate f at points satisfying this condition.

Think of it as a fence: you can walk anywhere along it, but you cannot step off it.

Gradient (∇f)

The vector of partial derivatives, ∇f = (∂f/∂x, ∂f/∂y). It points in the direction of steepest increase of f and is perpendicular to the level curves of f.

In simple terms, the gradient answers "which way is uphill, and how steep?"

Level curve (contour)

The set of points where f(x, y) = k for a constant k. On a contour plot, each line represents one value of k. Lagrange multipliers work by finding where a level curve of f just touches the constraint curve.

Linearly independent constraints

Two or more constraints whose gradient vectors are not scalar multiples of each other at the point in question. When constraints are linearly independent, the standard Lagrange system has the right number of equations. When they are dependent, the system breaks down and you need to handle extra cases.

Critical point (constrained)

A point on the constraint where ∇f = λ∇g for some λ, or where ∇g = 0. These are the candidates for constrained maxima and minima.


Core Content

Finding Extreme Values on a Constraint

The lab examines f(x, y) = x + sin(y - 1/2) constrained to the curve x⁴ - x³ + y² = 0.

  • From the contour plot, the maximum appears near (1, 0) with f ≈ 0.5 and the minimum near (0, 0) with f ≈ -0.5.

  • The minimum occurs at a corner of the constraint curve, a point where the curve is not smooth. Lagrange multipliers require the constraint to be smooth (∇g ≠ 0), so the method does not detect this minimum.

  • Lagrange multipliers will find the maximum, because the constraint curve is smooth there and a level curve of f is tangent to it.

  • Lesson: after solving the Lagrange system, always check endpoints, corners, and points where ∇g = 0 separately. The method finds candidates, not guarantees.

Computing the Gradients

For this problem:

  • ∇f = (1, cos(y - 1/2))

  • ∇g = (4x³ - 3x², 2y)

Setting ∇f = λ∇g gives the system:

  • 1 = λ(4x³ - 3x²)

  • cos(y - 1/2) = λ(2y)

  • x⁴ - x³ + y² = 0 (the constraint)

Solve these simultaneously for x, y, and λ. The solutions are the constrained critical points. Evaluate f at each one (and at any non-smooth points of the constraint) to determine which is the max and which is the min.

Geometric Interpretation of Lagrange Multipliers

Picture two families of curves on the same plane: the level curves of f (where f = k for various k) and the constraint curve g(x, y) = c.

  • Start with a very large k. The level curve f = k may not intersect the constraint at all.

  • Decrease k. At some point, the level curve just touches (is tangent to) the constraint. That tangency point is a constrained extremum.

  • At a tangency, both curves share the same tangent line, which means their normal directions are the same. Since the gradient is perpendicular to the level curve, the gradients ∇f and ∇g point in the same (or opposite) direction.

  • "Same or opposite direction" is exactly ∇f = λ∇g for some scalar λ. Positive λ means same direction, negative λ means opposite.

This is why the algebraic condition ∇f = λ∇g captures the geometric idea of tangency between a level curve and the constraint.

Linear Independence of Constraints

When a problem has more than one constraint, the standard Lagrange system assumes their gradients are linearly independent at any solution point.

  • Linearly independent gradients: ∇g₁ and ∇g₂ point in genuinely different directions. The Lagrange system ∇f = λ₁∇g₁ + λ₂∇g₂ has the right number of equations and the method works as expected.

  • Linearly dependent gradients: ∇g₁ and ∇g₂ are parallel (one is a scalar multiple of the other). The Lagrange system becomes degenerate. You may be able to drop one constraint because it is redundant, or you may need to look for solutions where ∇f = 0 or where the gradients of the constraints are themselves dependent.

  • Practical consequence: if the constraints are dependent, check whether one can be removed without changing the feasible set. If so, remove it and solve the simpler one-constraint problem. If not, find the points where the constraint gradients are dependent and test those points directly.


Formulas and Key Equations

The Lagrange condition (single constraint)

∇f(x, y) = λ ∇g(x, y), together with g(x, y) = c

This expands to:

  • ∂f/∂x = λ · ∂g/∂x

  • ∂f/∂y = λ · ∂g/∂y

  • g(x, y) = c

Three equations, three unknowns (x, y, λ).

The Lagrange condition (two constraints)

∇f = λ₁∇g₁ + λ₂∇g₂, together with g₁ = c₁ and g₂ = c₂

For this lab's specific problem:

  • f(x, y) = x + sin(y - 1/2)

  • g(x, y) = x⁴ - x³ + y² = 0

  • ∇f = (1, cos(y - 1/2))

  • ∇g = (4x³ - 3x², 2y)


Real-World Applications

Constrained optimisation shows up whenever you want the best outcome under a limitation. Engineers maximise the strength of a beam for a given weight of material. Economists maximise utility subject to a budget constraint. In machine learning, regularisation is a constraint that prevents overfitting: you minimise the loss function while keeping model complexity below a threshold. The Lagrange multiplier λ itself has a practical interpretation: it tells you the rate at which your optimum improves per unit of relaxation in the constraint, which in economics is called the shadow price.


Common Misconceptions

  • Students often believe Lagrange multipliers will always find every extremum. They will not. The method misses extrema at non-smooth points of the constraint (corners, cusps) and at points where ∇g = 0. You must check these separately.

  • Students sometimes confuse "∇f = λ∇g" with "∇f = ∇g." The scalar λ matters: the gradients need to be parallel, not equal. Dropping λ eliminates valid solutions.

  • A common error is to forget the constraint equation itself. The system is three equations (in 2D), not two. Solving only the gradient equations without g(x, y) = c gives points that are not on the constraint.

  • Students sometimes think a larger λ means a "better" extremum. It does not. λ measures sensitivity of the optimum to the constraint, not the size of the extremum itself.


Why It Matters / Exam Flags

⚠️ Exam problems frequently ask you to find constrained extrema and then ask whether Lagrange multipliers found all of them. Be ready to explain why the method can miss non-smooth points.

⚠️ You will almost certainly be asked to compute ∇f and ∇g, set up the system ∇f = λ∇g, and solve. Practise the algebra until it is automatic.

⚠️ Geometric interpretation questions are common: "Explain in words what the Lagrange condition means." The answer is tangency between a level curve and the constraint.

⚠️ Problems with two constraints may appear. Know the extended condition ∇f = λ₁∇g₁ + λ₂∇g₂ and the requirement that ∇g₁ and ∇g₂ be linearly independent.


Quick Self-Test

  1. True or false: Lagrange multipliers always find every constrained extremum. (False, they miss non-smooth points and points where ∇g = 0.)

  1. Fill in the blank: At a constrained extremum found by Lagrange multipliers, the gradient of f is ___ to the gradient of g. (Parallel, i.e. a scalar multiple.)

  1. True or false: If ∇g = 0 at a point on the constraint, that point can be ignored. (False, it must be checked separately as a potential extremum.)

  1. Fill in the blank: The Lagrange system for one constraint in two variables has ___ equations and ___ unknowns. (Three equations, three unknowns: x, y, λ.)

  1. True or false: Two constraints whose gradients are linearly dependent can always be reduced to a single constraint. (True, if one is redundant; but you must verify this before dropping it.)


Practice Q&A

Q: Given f(x, y) = x + sin(y - 1/2) and the constraint x⁴ - x³ + y² = 0, write out the full Lagrange system.

A: The system is: 1 = λ(4x³ - 3x²), cos(y - 1/2) = 2λy, and x⁴ - x³ + y² = 0. Solve these simultaneously for x, y, and λ.

Q: Why does the Lagrange method fail to find the minimum of f on the constraint curve x⁴ - x³ + y² = 0 in this lab?

A: The minimum occurs at (0, 0), which is a corner (cusp) of the constraint curve. At that point ∇g = (0, 0), so the condition ∇f = λ∇g cannot be satisfied for any finite λ. The method requires ∇g ≠ 0.

Q: Explain geometrically why ∇f = λ∇g at a constrained maximum.

A: At the maximum, the level curve of f is tangent to the constraint curve. Both curves share the same tangent line, so their normals (the gradients) must point in the same or opposite direction. That parallel condition is ∇f = λ∇g.

Q: Suppose you have two constraints g₁ = c₁ and g₂ = c₂ whose gradients are linearly dependent at every point. What should you do?

A: Check whether one constraint is redundant (implied by the other). If so, drop it and solve with a single constraint. If neither can be dropped, find the points where the constraint gradients are parallel and evaluate f at those points directly.


Connections to Other Topics

Lagrange multipliers build directly on the gradient and level-curve material from earlier in MATH 215. The gradient's role as the normal to a level curve is the geometric engine behind the entire method. This topic also connects forward to the second-derivative test for constrained problems (bordered Hessian), which you may see later in the course or in an optimisation class. In economics and operations research, the multiplier λ becomes the shadow price, linking this calculus tool to cost-benefit analysis and resource allocation.


Related Terms / Search Tags

Lagrange multipliers, constrained optimisation, constrained optimization, gradient condition, ∇f = λ∇g, level curves, contour plots, tangent condition, constraint qualification, linear independence of constraints, shadow price, bordered Hessian, MATH 215, Calculus III, multivariable calculus, extreme values on a curve, constrained critical points, non-smooth constraint, cusp, corner point