Skip to content
AriadneTechnology

The Inner Ring · Chamber 8 of 9

Optimisation: Convexity and Constraints

When a local minimum is the global one, and how Lagrange multipliers solve problems that come with rules.

45 min 60 XP + 9 questions + 1 challengeMathVideoPapersProofsCodeLab

In this chamber you will

  • Test functions for convexity with chords, tangents and Hessians
  • Prove that a local minimum of a convex function is a global minimum
  • Solve equality-constrained problems with Lagrange multipliers
  • Read the KKT conditions behind support vector machines
DiscoverLearnRead beyondPapers & lecturesYour turn

A support vector machine chooses a separating plane while requiring examples to stay on the correct side of a margin. The objective and the constraints must be solved together. Convexity tells us when a local solution is also globally best.

Spotted in the wild

min⁡w,b12∥w∥2subject toyi(wTxi+b)≥1\min_{w,b}\frac12\|w\|^2\quad\text{subject to}\quad y_i(w^Tx_i+b)\ge1
Support-vector networks
DiscoverLearnRead beyondPapers & lecturesYour turn
Symbols for this chamber
  • f((1−t)x+ty)f((1-t)x+ty)“f on a line segment”
    Used to compare the graph with its chord.
  • H⪰0H\succeq0“H is positive semidefinite”
    Every quadratic directional curvature is nonnegative.
  • L\mathcal L“Lagrangian”
    Objective plus multiplier-weighted constraints.
  • λ\lambda“lambda”
    A multiplier for an inequality or equality, with sign rules depending on the constraint.
  • gi(x)≤0g_i(x)\le0“inequality constraint”
    Our convention for writing feasible inequalities.
  • λigi(x)=0\lambda_i g_i(x)=0“complementary slackness”
    An inequality with positive multiplier must be tight.

A chord above the graph

On a convex domain, ff is convex when for every x,yx,y and t∈[0,1]t\in[0,1],

f((1−t)x+ty)≤(1−t)f(x)+tf(y).f((1-t)x+ty)\le(1-t)f(x)+tf(y).

For a differentiable convex function this is equivalent to the supporting-plane inequality f(y)≥f(x)+∇f(x)T(y−x)f(y)\ge f(x)+\nabla f(x)^T(y-x). If the function is twice continuously differentiable on an open convex domain, it is convex exactly when its Hessian is positive semidefinite everywhere.

The word everywhere matters. A positive Hessian at one point says something local. Strict convexity guarantees at most one minimiser; convexity alone permits a flat set of minimisers.

Quick check +20 XP

A smooth function has a positive Hessian at one point. Does that prove global convexity?

Why local is global

Suppose xx were a local minimiser but some feasible yy had a lower value. Points xt=(1−t)x+tyx_t=(1-t)x+ty are arbitrarily close to xx for small positive tt. Convexity gives f(xt)≤(1−t)f(x)+tf(y)<f(x)f(x_t)\le(1-t)f(x)+tf(y)<f(x), contradicting local minimality. This argument needs a convex feasible set as well as a convex objective.

For an unconstrained differentiable convex function, ∇f(x)=0\nabla f(x)=0 therefore certifies a global minimum by the supporting-plane inequality. Under constraints the gradient need not be zero: it may point into forbidden directions.

Equality constraints and tangency

For g(x)=0g(x)=0, define L(x,λ)=f(x)+λg(x)\mathcal L(x,\lambda)=f(x)+\lambda g(x). At a regular constrained optimum, where the constraint gradient is nonzero,

∇f+λ∇g=0,g=0.\nabla f+\lambda\nabla g=0,\qquad g=0.

The objective gradient must be perpendicular to every feasible tangent, hence parallel to the constraint normal. These equations find candidates, which still need classification and comparison.

Minimise x2+y2x^2+y^2 subject to x+y=1x+y=1. Stationarity gives 2x+λ=02x+\lambda=0 and 2y+λ=02y+\lambda=0, so x=y=1/2x=y=1/2 and the value is 1/21/2. The same result follows by substituting y=1−xy=1-x and completing the square.

Quick check +20 XP

Minimise x2+y2x^2+y^2 subject to x+y=1x+y=1. What is x?

Inequalities and KKT

For minimisation with inequalities gi(x)≤0g_i(x)\le0 and equalities hj(x)=0h_j(x)=0, the Karush–Kuhn–Tucker conditions are:

  1. Primal feasibility: obey all constraints.
  2. Dual feasibility: inequality multipliers satisfy λi≥0\lambda_i\ge0.
  3. Stationarity: ∇f+∑iλi∇gi+∑jνj∇hj=0\nabla f+\sum_i\lambda_i\nabla g_i+\sum_j\nu_j\nabla h_j=0.
  4. Complementary slackness: λigi(x)=0\lambda_i g_i(x)=0 for every inequality.

An inactive constraint has a zero multiplier. An active constraint may also have a zero multiplier. Equality multipliers have no sign restriction. KKT conditions require a constraint qualification to be necessary in general; for a convex problem they provide a global optimality certificate when satisfied.

For the SVM write gi=1−yi(wTxi+b)≤0g_i=1-y_i(w^Tx_i+b)\le0. Stationarity in ww gives w=∑iλiyixiw=\sum_i\lambda_i y_ix_i. Positive multipliers can occur only on the margin, explaining the support-vector representation.

Quick check +20 XP

An inequality constraint is strictly inactive at a KKT point. What is its multiplier?

DiscoverLearnRead beyondPapers & lecturesYour turn

Read beyond

Book · free online · ~20 min

Convex Optimization

Boyd & Vandenberghe · Chapters 3–5: convexity, optimisation and duality

Connect the chord definition to first-order conditions and multipliers.

Book · free online · ~20 min

Mathematics for Machine Learning

Deisenroth, Faisal & Ong · Chapter 7: continuous optimisation

Work through a Lagrange multiplier example.

Book · free online · ~20 min

Calculus, Volume 3

OpenStax · Section 4.8: Lagrange multipliers

Draw the constraint and the objective contours before solving equations.

DiscoverLearnRead beyondPapers & lecturesYour turn

Read the equation in context

Support-vector networksCorinna Cortes & Vladimir Vapnik · 1995

The paper develops support-vector networks including nonseparable data. Here we examine its separable starting point. Both the quadratic objective and the feasible half-spaces are convex. Multipliers identify which training constraints support the final boundary.

Decode the paper · Separable maximum-margin formulation, in modern vector notation

Support-vector networks

Corinna Cortes & Vladimir Vapnik · 1995

+25 XP
min⁡w,b12∥w∥2subject toyi(wTxi+b)≥1\min_{w,b}\frac12\|w\|^2\quad\text{subject to}\quad y_i(w^Tx_i+b)\ge1

The paper develops support-vector networks including nonseparable data. Here we examine its separable starting point. Both the quadratic objective and the feasible half-spaces are convex. Multipliers identify which training constraints support the final boundary.

w,bw,b
yiy_i
xix_i
12∥w∥2\frac12\|w\|^2

Options

Support Vector Machines, Clearly ExplainedStatQuest with Josh Starmer
DiscoverLearnRead beyondPapers & lecturesYour turn

Your turn

Move along a constraint and watch the objective and gradient alignment. Find both constrained extremes for each of three objectives.

Interactive lab

Tangency hunter

Stay on the constraint while maximising or minimising the objective. At an extreme, the objective gradient and constraint normal align or point in opposite directions.

x + 2y on the unit circle

Constraint curve and two normalised gradient directions-3-3-1.5-1.5001.51.533xy
● Constraint● Objective gradient direction● Constraint normal direction● Feasible point

Objective

1.75154

Derivative with respect to angle in radians

1.39000

Extremes found: 0/6

Challenge: Tangency hunterFind the constrained maximum and minimum of three problems, where the gradients line up.+40 XP

Match · Expression ↔ Meaning

KKT roles

+20 XP
gi(x)≤0g_i(x)\le0
λi≥0\lambda_i\ge0
λigi(x)=0\lambda_i g_i(x)=0

Options

Match · Expression ↔ Meaning

Geometry and conditions

+20 XP
∇f=0\nabla f=0
∇f+λ∇g=0\nabla f+\lambda\nabla g=0
H⪰0H\succeq0 everywhere on an open convex domain

Options

Proof puzzle

Local is global

+25 XP

Claim

A local minimum of a convex function on a convex feasible set is global.

Tap lines in the order they should appear. Tap a line in your proof to send it back.

Your proof

  1. Pick the first line below.

Available lines

Prove it yourself

A constrained minimum without calculus

+35 XP

Claim

Prove x2+y2≥1/2x^2+y^2\ge1/2 whenever x+y=1x+y=1, with equality only at x=y=1/2.

Preview

Your typeset proof appears here.

Coding problems

Problem 22·Warm-up

Allocate a fixed total

+20 XP

Minimise x2+2y2+4z2x^2+2y^2+4z^2 subject to x+y+z=14x+y+z=14. Report the minimum value.

An exact integer (or a fraction like 7/12)

Problem 23·Standard

Project onto a budget

+35 XP

Minimise 12∥x−(3,−1,2)∥2\tfrac12\|x-(3,-1,2)\|^2 subject to xi≥0x_i\ge0 and ∑ixi=1\sum_i x_i=1. Report the first coordinate of the minimiser.

An exact integer (or a fraction like 7/12)

Problem 24·Challenge

Count convex quadratics

+50 XP

For integers a,b∈{−10,…,10}a,b\in\{-10,\ldots,10\}, how many functions f(x,y)=ax2+2bxy+4y2f(x,y)=ax^2+2bxy+4y^2 are convex on R2\mathbb R^2?

An exact integer (or a fraction like 7/12)

Key takeaways

  • Convexity controls the whole domain and its feasible line segments.
  • Convex local minima are global; strict convexity gives uniqueness.
  • Lagrange multipliers enforce tangency under regularity assumptions.
  • KKT adds sign and slackness conditions for inequalities.

Checkpoint

Prove it to the labyrinth

Answer every question to clear this chamber. First-try answers earn the most XP.

0/6
Question 1 of 6 +20 XP

What does strict convexity guarantee if a minimiser exists?

Question 2 of 6 +20 XP

For min⁡x2\min x^2 subject to 1−x≤01-x\le0, the optimum is x=1. What is the KKT multiplier?

Question 3 of 6 +20 XP

For a differentiable unconstrained convex objective, a zero gradient certifies what?

Question 4 of 6 +20 XP

Which multiplier has no sign restriction?

Question 5 of 6 +20 XP

What is the minimum value of x2+y2x^2+y^2 subject to x+y=1x+y=1?

Question 6 of 6 +20 XP

Does an active inequality necessarily have a positive multiplier?

End of the chamber

Clear this chamber

+60 XPConvexityLocal is GlobalLagrange MultipliersKKT Conditions