Log inStart free
LESSON 2.35 · 6 STAGES · 3 CONTROLS · 3 CHECKSPRO · PREVIEW

Constrained optimization and Lagrange multipliers

Watch a constraint move the lowest point, and a number λ price it.


Pro lesson. Stage 1 is free to watch. Pro opens all 6 stages, 3 controls and 3 checks, in this lesson and every other.

Go Pro · $8.25/mo
EXPLAINER · 2.35 · CONSTRAINT BAYm = (1.5, 1) · F = 0 · ∇F = (0, 0)
01
Stage 1 of 6 · Free minimum
With no limits, gradient descent walks to m = (1.5, 1). There ∇f = 0 and f = 0.
Explain it simply

The map shows f, a long bowl. Each gray line joins points with the same f. With no rules on x and y, gradient descent rolls downhill along the teal trail to m, the bottom. Any point is allowed, so this is unconstrained optimization.

A contour map of f(x, y) = (x − 1.5)² + 2(y − 1)². A gradient descent trail starts at (−0.5, −0.5) and ends at m = (1.5, 1). The chart shows f falling to 0 step by step.

inputs x, y and their pathsconstraint g, budget c, ∇g and λvalues of f and the minimum∇f and slopes of fcontour lines
map of f(x, y) = (x − 1.5)² + 2(y − 1)²48−2−2−1−100112233xystartm02468051015gradient descent stepf at each step, no constraintf = 0 at mmap of f(x, y) = (x − 1.5)² + 2(y − 1)²48−2−2−1−100112233xystartm02468051015gradient descent stepf at each step, no constraintf = 0 at m
Toy: f(x, y) on a 6 × 6 map · one constraint g ≤ c
STAGE 1 / 6
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
min⁡x, y f(x, y)⇒∇f=0\min_{\sy{x}{data}{x},\, \sy{y}{data}{y}}\ \sy{f}{out}{f}(x,\ y)\quad\Rightarrow\quad \sy{gradf}{grad}{\nabla f} = 0
∇f=(2(x−1.5), 4(y−1))=(0, 0) at m=(1.5, 1)\nabla f = (2(x - 1.5),\ 4(y - 1)) = (0,\ 0)\ \text{at}\ m = (1.5,\ 1)

With no constraint, the minimum is where the gradient is zero.

Common mix-ups

MYTHA constraint always moves the minimum.

The fix, and 1 more mix-up with the diagram to show them, come with Pro.

Predict, then reveal
3 CHECKS · PRO
Q01Raise the budget c from 1 to 2. Does the price λ go up or down?

Make your guess, then test it in the diagram. All 3 checks come with Pro.

PRO LESSON · YOU WATCHED STAGE 1 OF 6
Unlock the full explainer
  • 5 more stages and 3 live controls
  • 2 mix-up cards and 3 predict-then-reveal checks
  • Watch it as a narrated video, in three voices
  • Every Pro lesson and capstone · 656 in total

$99 a year, or $15 a month. Cancel any time.