Ma · Mathematics

How to Find the Minimum or Maximum of a Constrained Function

Published By the 9to5Science editorial team

At a glance

  1. 1. Define the problem

    Identify the objective, the feasible set, and whether you need extrema of one function or a minimum of a maximum.

  2. 2. Check existence

    If the feasible set is compact and the objective is continuous, both a minimum and a maximum exist.

  3. 3. Find candidates

    Check interior critical points, boundary points, and corners; use Lagrange multipliers or KKT conditions when appropriate.

  4. 4. Compare values

    Evaluate the objective at every feasible candidate and compare the results.

Advertisement

The phrase “minimum maximum” can mean either finding the minimum and maximum of one function on a constrained domain, or minimizing an objective that is itself the maximum of several functions. The method depends on which problem you have. In either case, you need the function and the constraints to calculate a numerical answer.

First identify the optimization problem

A constrained minimum or maximum of one function has the form

min⁡x∈Cf(x)ormax⁡x∈Cf(x),\min_{x\in C} f(x) \qquad\text{or}\qquad \max_{x\in C} f(x),

where CC is the feasible set: the collection of points satisfying all constraints.

A minimax problem instead has an objective such as

min⁡x∈C  max⁡1≤i≤nfi(x).\min_{x\in C}\;\max_{1\leq i\leq n} f_i(x).

Here, at each feasible point xx, you first take the largest of the values fi(x)f_i(x); then you choose xx to make that largest value as small as possible. This objective can have corners where the usual derivative test does not apply directly.

When do a minimum and maximum exist?

A useful first check is the extreme value theorem: if CC is nonempty and compact (in ordinary Euclidean space, closed and bounded) and ff is continuous on CC, then ff attains both a minimum and a maximum on CC. If the feasible set is not compact, an extremum might not exist. For example, a function can approach a limiting value as xx grows without ever reaching it.

Existence does not identify the extremizers. To find them, list all possible candidates and compare the function values.

Find constrained extrema of one function

For a differentiable function on a region with an interior, a typical checklist is:

  1. Find feasible interior points where the gradient is zero: ∇f=0\nabla f=0.
  2. Examine the boundary, including endpoints or corners. The boundary may itself require a constrained optimization problem.
  3. Evaluate ff at every candidate and compare the values.

For an equality constraint h(x)=0h(x)=0, Lagrange multipliers can help find candidates. At a regular constrained local extremum, if ff and hh are differentiable and ∇h(x)≠0\nabla h(x)\ne 0, solve

∇f(x)=λ∇h(x),h(x)=0.\nabla f(x)=\lambda\nabla h(x),\qquad h(x)=0.

For inequalities, such as gi(x)≤0g_i(x)\leq 0, Karush–Kuhn–Tucker (KKT) conditions generalize this approach. They include feasibility, nonnegative multipliers for inequality constraints, complementary slackness, and a stationarity equation. These conditions require suitable regularity assumptions to be necessary, and a candidate they produce need not be a global extremum. You still need to check feasibility and compare objective values (or establish convexity).

Worked example: extrema on a disk

Find the minimum and maximum of f(x,y)=x+yf(x,y)=x+y subject to x2+y2≤1x^2+y^2\leq 1. The feasible set is the closed unit disk, so it is compact, and the continuous function has both extrema.

By the Cauchy–Schwarz inequality,

x+y=(x,y)⋅(1,1)≤x2+y22≤2.x+y=(x,y)\mathbin{\cdot}(1,1)\leq \sqrt{x^2+y^2}\sqrt{2}\leq\sqrt{2}.

Equality holds at (x,y)=(1/2,1/2)(x,y)=(1/\sqrt{2},1/\sqrt{2}), so the maximum is 2\sqrt{2}. Applying the same inequality to −(x+y)-(x+y) gives x+y≥−2x+y\geq-\sqrt{2}, with equality at (−1/2,−1/2)(-1/\sqrt{2},-1/\sqrt{2}). Thus the minimum is −2-\sqrt{2}. Both extrema occur on the boundary of the disk, not at its interior critical point (0,0)(0,0), where f=0f=0.

Minimize a maximum using an epigraph variable

For a minimax objective max⁡ifi(x)\max_i f_i(x), introduce a new variable tt and require fi(x)≤tf_i(x)\leq t for every ii. Then solve

min⁡x,ttsubject tox∈C,fi(x)≤t(i=1,…,n).\min_{x,t} t\quad\text{subject to}\quad x\in C,\qquad f_i(x)\leq t\quad(i=1,\ldots,n).

For each fixed xx, the smallest feasible tt is exactly max⁡ifi(x)\max_i f_i(x). Therefore the reformulation has the same infimum as the original minimax problem, and the same minimum value whenever that minimum is attained. It is especially useful when the functions and constraints are convex, because the reformulated problem is then a convex optimization problem.

Worked example: balance two errors

Minimize max⁡(∣x∣,∣1−x∣)\max(|x|,|1-x|) for 0≤x≤10\leq x\leq 1. At x=1/2x=1/2, both absolute values equal 1/21/2, so the maximum is 1/21/2. No point can do better: the triangle inequality gives

1=∣x+(1−x)∣≤∣x∣+∣1−x∣≤2max⁡(∣x∣,∣1−x∣),1=|x+(1-x)|\leq |x|+|1-x|\leq 2\max(|x|,|1-x|),

so the maximum is at least 1/21/2 for every xx. The minimum is therefore 1/21/2, attained at x=1/2x=1/2. In epigraph form, minimize tt subject to ∣x∣≤t|x|\leq t, ∣1−x∣≤t|1-x|\leq t, and 0≤x≤10\leq x\leq1.

Common mistakes

  • Checking only stationary points: A constrained extremum may lie on the boundary or at a corner.
  • Assuming a candidate is global: Lagrange multiplier or KKT equations usually locate candidates; they do not by themselves prove a global optimum.
  • Ignoring whether the extremum is attained: On an unbounded or nonclosed feasible set, the infimum or supremum may not be reached.
  • Differentiating a maximum as if it were smooth: The active function can change, creating a corner. Use the epigraph formulation or appropriate nonsmooth optimization methods.
  • Mixing up min–max and max–min: In general, min⁡xmax⁡yf(x,y)\min_x\max_y f(x,y) and max⁡ymin⁡xf(x,y)\max_y\min_x f(x,y) are different problems. Equality needs additional assumptions.

References

  1. Convex Optimization, Stephen Boyd and Lieven Vandenberghe
  2. Numerical Optimization, Jorge Nocedal and Stephen J. Wright

Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.