Concepts / Convex Functions

Convex Functions

The word any matters. Convexity is not established by checking one convenient pair of points. The defining comparison applies to every selected pair of inputs.

  • Programming

Why Convexity Matters

Convexity gives an optimization problem a useful geometric structure. Instead of needing to understand every possible shape of a function, we can study how its graph behaves between selected pairs of points. This structure leads to an important optimization consequence: for a convex function, finding a local minimum is enough to identify a global minimum.

Key point

The word any matters. Convexity is not established by checking one convenient pair of points. The defining comparison applies to every selected pair of inputs.

pfunction value at pline segmentjoins the two functionvaluespsame selected inputconvexity conditionviolatedqfunction value at qqsame selected inputcomparecomparecomparison failscomparison fails
How does the graph of a function compare with the line segment joining the function values at two selected points, and what changes when the convexity condition is violated?

The Graph and the Chord

The geometric definition of convexity compares two points on the graph of a function with the line segment joining their function values. Choose two inputs and look at the corresponding points on the graph. Then examine the segment connecting those two function values. The function is convex when the required comparison holds for every selected pair of inputs.

Worked example

Checking the Definition with Two Points

Use two selected inputs, p and q, to organize a convexity check without relying on a single visual sample.

  1. 1
    Select

    Choose two inputs p and q and locate their corresponding function values on the graph.

  2. 2
    Join

    Form the line segment joining those two function values.

  3. 3
    Compare

    Compare the graph between p and q with that line segment according to the convexity condition.

  4. 4
    Repeat

    Because the condition applies to every selected pair, repeat the reasoning for arbitrary pairs rather than treating one successful pair as proof.

Result

A valid convexity argument must address the graph-to-segment comparison for arbitrary selected pairs of inputs.

function fgraphgraph pointson the graphepigraphgraph and points above itpoints aboveabove the graphcontainshas points aboveincluded inincluded in
Which points lie on or above the graph of a function, and how does this region represent the function's epigraph?

The Epigraph Region

Definition

The epigraph of a function is the set of points on the graph and all points above the graph. It changes the viewpoint from looking only at the curve to looking at the entire region supported by that curve and everything above it.

The epigraph is useful because it turns a property of the graph into a property of a region. When studying convexity, the shape of this region provides another geometric way to reason about the function. The essential membership rule is simple: a point belongs to the epigraph if it is on the graph or above it.

In the real world

Generated illustration: imagine drawing a function's graph on a coordinate plane and then shading every point directly above the graph. The graph itself is included in the shaded region, so the shaded region represents the epigraph rather than only the area strictly above the graph.

Subgradients at a Point

Definition

A subgradient of a convex function f at a point w is one member of the subdifferential set at w. The subdifferential is written as ∂f(w).

Definition

The set ∂f(w) contains all subgradients of f at w. A subgradient is therefore an individual element, while the subdifferential is the complete set of such elements at the point w.

fconvex function∂f(w)all subgradients at wone subgradientone member of ∂f(w)wselected pointevaluate atatcontains
How are the function, the selected point, the subdifferential set, and one chosen subgradient related?

When a problem asks you to calculate a subgradient, the task begins with a convex function f and a point w. The immediate goal is not necessarily to describe the entire set ∂f(w). It is to identify an element of that set. This distinction matters because finding one valid member can be enough for many practical uses.

Differentiability and Singleton Sets

The simplest subgradient construction occurs when f is differentiable at w. In that situation, the subdifferential set contains exactly one element. That element is the gradient of f at w, written as ∇f(w). Therefore, when differentiability is known, the gradient supplies the subgradient to use.

∂f(w)subgradients at wsubgradientmember∂f(w)singleton∇f(w)the single membersubgradientmembercontainscontainscontains
What changes in the subdifferential when the function is differentiable at w?
Worked example

Using Differentiability

Suppose f is known to be differentiable at the selected point w. What must be identified to obtain a subgradient at w?

  1. 1
    Recognize the condition

    The relevant condition is that f is differentiable at w.

  2. 2
    Identify the set structure

    Differentiability makes ∂f(w) a singleton, so the set has one element.

  3. 3
    Name the element

    That single element is the gradient ∇f(w).

Result

The gradient ∇f(w) is the subgradient to use, and there is no need to search through multiple members of ∂f(w).

One Useful Subgradient

Many practical uses require only one element of ∂f(w), not every element. This is why a construction method is valuable: it gives a reliable way to obtain one valid subgradient at the point of interest. Calculating the entire subdifferential can be unnecessary when the downstream task only needs a single member.

f and wconvex function and pointconstruction methodidentify a member of ∂f(w)one subgradientmember of ∂f(w)practical useone member is sufficientstart withproducessupports
When the goal is practical use rather than listing every member, how does the construction process move from a function and point to one subgradient?

The source material also identifies pointwise maximum functions as a second situation with a subgradient construction method. The role of that method is practical: starting from the pointwise maximum structure, it helps produce one member of the subdifferential set. The central lesson is the output, not an obligation to calculate every possible subgradient.

Local and Global Minima

Definition

A local minimum is defined using a neighborhood around a point. It means that the point has the minimum behavior being considered within that surrounding neighborhood. A global minimum is the minimum over the entire domain being considered.

For convex functions, every local minimum is also a global minimum. The reason is the same geometric structure introduced earlier: convexity controls how the function behaves between points. A point cannot be lowest only in a small neighborhood while a lower value exists elsewhere without conflicting with the convexity property.

local minimumminimum in a neighborhoodneighborhoodsurrounding regionconvexityglobal structureglobal minimumminimum everywheredefined withincombined withimplies
How does convexity connect a minimum found in a neighborhood with the minimum over the entire domain?
Worked example

Interpreting a Local Minimum

A point is identified as a local minimum of a convex function. What conclusion follows?

  1. 1
    Start locally

    The given point is lowest according to the comparison within a neighborhood around it.

  2. 2
    Use convexity

    The function has the global structure required by convexity, so its behavior between points is constrained.

  3. 3
    Extend the conclusion

    For a convex function, the local minimum property extends beyond the neighborhood.

Result

The point is a global minimum of the convex function.

Common Reasoning Errors

  • Common mistake

    Treating one successful pair of points as proof of convexity.

    What it looks like

    The graph satisfies the graph-to-segment comparison for one selected pair, so the function is declared convex.

    Why it fails

    The convexity condition applies to every selected pair of inputs.

    Do this instead

    Use the pair as an illustration, then reason about arbitrary pairs.

  • Common mistake

    Using subgradient and subdifferential as if they meant the same thing.

    What it looks like

    The subgradient is described as the entire set ∂f(w).

    Why it fails

    A subgradient is one member, while ∂f(w) contains all subgradients at w.

    Do this instead

    Use subgradient for one element and subdifferential for the set.

  • Common mistake

    Assuming that every subdifferential must contain many elements.

    What it looks like

    A differentiable function is treated as though several different subgradients must be searched for.

    Why it fails

    Differentiability makes ∂f(w) a singleton containing ∇f(w).

    Do this instead

    When differentiability at w is known, use the gradient as the single subgradient.

  • Common mistake

    Assuming that a practical calculation must list every subgradient.

    What it looks like

    The calculation is considered incomplete because it produces one valid member of ∂f(w) rather than the full set.

    Why it fails

    For many practical uses, one member is sufficient.

    Do this instead

    Match the calculation to the task and construct one useful member when that is all the task requires.

  • Common mistake

    Confusing a local minimum with a global minimum without using convexity.

    What it looks like

    A point that is lowest in its neighborhood is automatically called globally lowest for any function.

    Why it fails

    The local-to-global conclusion is guaranteed here because the function is convex.

    Do this instead

    State the convexity condition before extending a local minimum conclusion to the whole function.

Check Your Understanding

MEDIUM

A convex function f is considered at a point w. Explain the difference between a subgradient and the subdifferential set. Then state what ∂f(w) becomes if f is differentiable at w, and explain why finding one subgradient may be enough for a practical task.

Hints
  • Describe the subgradient as one member rather than as the whole collection.
  • Use the differentiability condition to identify the unique member.
  • Connect one-member construction to the fact that many practical uses do not require every member.
MEDIUM

Describe a geometric convexity check using two arbitrary inputs. Include the graph, the line segment joining the two function values, and the reason one pair alone is not enough. Finally, explain what the epigraph contains and why a local minimum of a convex function is also global.

Hints
  • Start with two points on the graph.
  • Compare the graph between them with the joining line segment.
  • The epigraph includes the graph and all points above it.
  • Use convexity when moving from a neighborhood-based minimum to a whole-domain conclusion.

Key Takeaways

  1. 1
    Convexity is defined geometrically by comparing the graph between two points with the line segment joining their function values, and the condition must hold for every selected pair.
  2. 2
    The epigraph is the set of points on the graph together with all points above it.
  3. 3
    A subgradient is one member of the subdifferential set ∂f(w), which contains all subgradients at w.
  4. 4
    If f is differentiable at w, ∂f(w) is a singleton containing the gradient ∇f(w).
  5. 5
    For many practical uses, one constructed subgradient is sufficient, and every local minimum of a convex function is also a global minimum.

At a glance

  • Convexity describes how a function's graph relates to line segments between function values for every pair of selected inputs.
  • The epigraph contains the graph and every point above it.
  • The subdifferential ∂f(w) is the set of all subgradients at w; a subgradient is one member of that set.
  • Differentiability reduces the subdifferential to the single gradient ∇f(w), and many practical tasks need only one subgradient.
  • Convexity guarantees that every local minimum is also a global minimum.

Related concepts

More concepts starting with C