advanced30 min studyLesson 275 in Mathematics

Subgradients and supporting hyperplanes

Replace a derivative with global affine lower bounds and handle corners without guessing an ordinary slope.

On this page

What you’ll understand

  • Compute subdifferentials of absolute values and finite maxima.
  • Prove the zero-subgradient optimality condition and interpret normal cones.
  • Identify where boundary subgradients can fail to exist.

At a corner, asking for the derivative demands a single slope that the graph cannot provide. A subgradient asks a different question: which slopes define affine functions lying below the entire objective and touching it at the chosen point? At a smooth convex point there is one such slope, while a corner may support an interval of them. Because the inequality is global, a zero subgradient certifies global optimality immediately. The same definition also explains constraint forces through normal cones and exposes why finite boundary values need not have supporting slopes.

A slope must support the whole function

For a proper convex f on Rd\mathbb R^d and a finite-domain point x, a vector g is a subgradient when its affine prediction at x is no larger than f(z) for every z. The collection is the subdifferential. Outside the domain we define it to be empty. A differentiable convex function has subdifferential consisting only of its gradient, because directional derivatives force equality of every component. For |x|, the slope is −1 on the negative side, +1 on the positive side, and any value in [−1,1] at zero.

Subgradients are not arbitrary local trend estimates. A line that sits below a graph near x but crosses above it elsewhere fails the definition. For convex functions, local support around an interior point extends globally, but that conclusion uses convexity. Adding the two subgradient inequalities at x and y also shows monotonicity: the difference of supporting slopes has nonnegative inner product with x−y. In one dimension this generalizes the familiar statement that the derivative of a convex function is nondecreasing, now allowing vertical intervals of slopes at corners.

∂f(x)={g:f(z)≥f(x)+⟨g,z−x⟩ for every z},∂∣⋅∣(0)=[−1,1]\partial f(x)=\{g:f(z)\ge f(x)+\langle g,z-x\rangle\ \text{for every }z\},\qquad \partial|\cdot|(0)=[-1,1]
Only points with finite f(x) enter the defining inequality. Supporting affine functions must lie below the entire extended-value objective.↔ Scroll wide equations horizontally.

Optimality and constraint normals

The condition zero belongs to the subdifferential is equivalent to x being a global minimizer, directly by setting g=0 in the definition. For a convex indicator, its subdifferential is the normal cone: vectors whose inner product with every feasible displacement is nonpositive. At an interior point of a full-dimensional convex set, that cone contains only zero. At a boundary it can contain outward-pointing vectors. A constrained optimum balances the loss gradient against a normal; the gradient alone generally does not vanish at a boundary solution.

When h is convex and differentiable everywhere and C is nonempty closed convex, the sum rule gives the subdifferential of h plus the indicator as gradient h plus the normal cone. More generally, sums of proper convex functions need a domain qualification for equality of subdifferential sums; meeting relative interiors is a standard finite-dimensional sufficient condition. For a maximum of finitely many affine functions, the subdifferential at a point is the convex hull of the active slopes. Inactive pieces do not touch the graph and cannot contribute to its supporting slope set there.

0∈∂f(x)  ⟺  x∈argmin⁡f,NC(x)={g:⟨g,z−x⟩≤0 ∀z∈C},x∈C0\in\partial f(x)\iff x\in\operatorname*{argmin}f,\qquad N_C(x)=\{g:\langle g,z-x\rangle\le0\ \forall z\in C\},\quad x\in C
The normal cone is the subdifferential of the convex indicator. The outward sign convention makes constrained optimality 0∈∇h(x)+N_C(x).↔ Scroll wide equations horizontally.

Boundary support can disappear

In finite dimensions a proper convex function has at least one subgradient at every point in the relative interior of its effective domain. At relative-boundary points this can fail even for a closed convex function. Take f(x)=−√x for x≥0 and infinity otherwise. A finite subgradient g at zero would require −√z≥gz for every positive z, hence g≤−1/√z for arbitrarily small z. No finite g satisfies that requirement. The epigraph has no supporting hyperplane with the nonvertical orientation required by a finite slope there.

This example prevents an unsafe recipe: one cannot always pick a subgradient at any finite point and run an algorithm. The evaluation oracle itself needs a domain guarantee. It also clarifies the role of the relative interior in calculus rules and duality qualifications. Finally, subgradients are exact mathematical lower bounds; inexact numerical slopes require an explicit tolerance and a modified inequality. Treating a noisy estimate as a certified support can produce a false lower bound or an incorrect stopping decision, even when the underlying function really is convex.

A minimum at a crossing of affine pieces

For f(x)=max{2x−1,−x+2}, compute its subdifferential and minimize it.

  1. The pieces cross where 2x−1=−x+2, giving x=1 and value 1. To the left, −x+2 is larger and has slope −1; to the right, 2x−1 is larger and has slope 2.

  2. At the crossing, the active-slope rule gives ∂f(1)=[−1,2]. Since zero lies in this interval, the crossing is a global minimizer.

  3. Every point to the left has cost 2−x>1, and every point to the right has cost 2x−1>1. This also proves the minimum is unique, even though f is not strictly convex on either side.

The result

The unique minimizer is x=1 with cost 1. The corner supplies many subgradients, including the zero vector that certifies optimality.

Explore the model

Interactive lab

Interactive lab · function

One smooth supporting slope

Pause and Reset, then set a=0.5,x=1. Predict y=0.5 and tangent slope 1. Check that the tangent stays below the full quadratic: its gap at any z is (z−1)²/2. For a fresh comparison Reset and set a=−0.5,x=1; the tangent is now an upper support, so it is not a convex subgradient bound. This model has smooth quadratics only and does not render the interval of slopes at a corner.

One smooth supporting slopeThis lab uses only y = ax². Playback traces the curve within the fixed integration interval from 0 to x; it does not estimate numerical error or change the chosen point. Current readings: y at chosen x: 0.608; Tangent slope · 2ax: 1.35; Signed area · ax³/3: 0.182. All parameters are adjustable with the labeled controls below.−2.4−1.201.22.4−9−4.504.59xy(x, ax²)
y = ax²TangentSigned integral
y at chosen x
0.608
Tangent slope · 2ax
1.35
Signed area · ax³/3
0.182
t = 0 s

This lab uses only y = ax². Playback traces the curve within the fixed integration interval from 0 to x; it does not estimate numerical error or change the chosen point. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.

Look forThe support inequality, rather than the existence of a drawn tangent, determines whether a slope is a convex subgradient.

Check your understanding

For f(x)=−√x on x≥0, extended by infinity otherwise, what is ∂f(0)?

Try it yourself

Minimize F(x)=|x|+(x−2)²/2 on R by checking its subdifferential, including x=0.

Take a moment to make a prediction or work it out on paper. Open a hint when you need one.

Give me a hint

On each side of zero, add the absolute-value slope to x−2. At zero, add −2 to the interval [−1,1].

Compare with the solution

For x>0, the slope is 1+x−2=x−1, which vanishes at x=1. For x<0, it is −1+x−2=x−3, whose zero is not in that region. At zero the subdifferential is [−3,−1], which excludes zero. Thus x=1 is the minimizer, with cost 1+1/2=3/2. The quadratic term is strictly convex, so adding the convex absolute value preserves strict convexity and guarantees uniqueness.

Take it with you

  • Subgradients are global supporting affine slopes, including sets of slopes at corners.
  • A zero subgradient is exactly a certificate of global minimum.
  • Finite-dimensional relative-interior points have subgradients; boundary points may not.

Read further

Original sources and deeper explanations to follow at your own pace.

Optional progress, saved in this browser when available. Revisit any lesson at any time.

Lesson not marked complete.