KTU S1

Constrained Optimisation and Lagrange Multipliers

By the end you should be able to: Solve a constrained optimisation problem by elimination and by Lagrange multipliers, show the two agree, and explain the geometric meaning of the multiplier condition.

Module 3 optimised with the variables free to take any value. Real problems are rarely so generous: a budget is fixed, a length of fencing is given, a probability must sum to one.

minimise f(x,y)subject to g(x,y)=0\text{minimise } f(x,y) \quad \text{subject to } g(x,y) = 0

Method 1 — elimination

Use the constraint to remove a variable, then optimise what is left with ordinary single-variable calculus.

Minimise f=x2+y2f = x^2+y^2 subject to x+y=1x+y=1.

From the constraint, y=1−xy = 1-x. Substitute:

f=x2+(1−x)2=2x2−2x+1f = x^2 + (1-x)^2 = 2x^2 - 2x + 1

Now a one-variable problem:

dfdx=4x−2=0  ⟹  x=12  ⟹  y=12,f=12\frac{df}{dx} = 4x - 2 = 0 \implies x = \tfrac12 \implies y = \tfrac12, \qquad f = \tfrac12

Second derivative is 4>04 > 0, so it is a minimum.

When it works: when the constraint can be rearranged cleanly. Often it cannot — try eliminating a variable from x2+y2+z2=1x^2+y^2+z^2=1 and the square roots make a mess.

Method 2 — Lagrange multipliers

Build one function combining objective and constraint:

L(x,y,λ)=f(x,y)−λ g(x,y)\mathcal{L}(x,y,\lambda) = f(x,y) - \lambda\, g(x,y)

Set all three partial derivatives to zero:

∂L∂x=0,∂L∂y=0,∂L∂λ=0\frac{\partial \mathcal L}{\partial x} = 0, \qquad \frac{\partial \mathcal L}{\partial y} = 0, \qquad \frac{\partial \mathcal L}{\partial \lambda} = 0

The third simply returns the constraint, so nothing is lost. The first two are equivalent to

∇f=λ∇g\nabla f = \lambda \nabla g

What that condition means

At a constrained optimum the two gradients are parallel.

Picture the contours of ff and the curve g=0g=0. Walking along the constraint curve, you cross contours of ff and its value changes. You can keep improving until the constraint curve is tangent to a contour of ff — at that point moving either way along the constraint no longer improves anything.

Tangent curves have parallel normals. The gradient is normal to its own level curve, so ∇f\nabla f and ∇g\nabla g point the same way, differing only by the scale factor λ\lambda.

That is the entire geometric content of the method, and stating it earns marks that reciting the recipe does not.

The same problem by Lagrange

f=x2+y2,g=x+y−1=0f = x^2+y^2, \qquad g = x+y-1 = 0 L=x2+y2−λ(x+y−1)\mathcal L = x^2+y^2-\lambda(x+y-1) Lx=2x−λ=0  ⟹  x=λ2\mathcal L_x = 2x-\lambda = 0 \implies x = \tfrac{\lambda}{2} Ly=2y−λ=0  ⟹  y=λ2\mathcal L_y = 2y-\lambda = 0 \implies y = \tfrac{\lambda}{2} Lλ=−(x+y−1)=0  ⟹  x+y=1\mathcal L_\lambda = -(x+y-1) = 0 \implies x+y = 1

The first two give x=yx = y. With x+y=1x+y=1 that forces x=y=12x = y = \tfrac12, and λ=1\lambda = 1.

f(12,12)=14+14=12f\left(\tfrac12,\tfrac12\right) = \tfrac14+\tfrac14 = \tfrac12

Identical to elimination, as it must be. Two correct methods on one problem cannot disagree, which makes each a check on the other.

What λ\lambda means

The multiplier is not a bookkeeping device to be discarded. It measures the sensitivity of the optimum to the constraint: relax the constraint by one unit and the optimal value changes by approximately λ\lambda.

In economics this is the shadow price — what one more unit of a scarce resource is worth. Here λ=1\lambda = 1: raising the constraint from x+y=1x+y=1 to x+y=2x+y=2 would change the minimum by roughly 1. (Exactly: the new minimum is 2×12=22 \times 1^2 = 2, an increase of 32\tfrac32 — approximate because λ\lambda is a derivative, accurate for small changes.)

Choosing a method

EliminationLagrange
Constraint easy to rearrangeSimplerWorks, more steps
Constraint implicit or messyOften impossibleWorks
Several constraintsImpracticalOne multiplier each
Gives sensitivity informationNoYes, via λ\lambda