Why Piecewise Optimization Needs Care
A one-variable optimization problem may use different formulas in different ranges, or its constraints may allow different ranges of the variable in different cases. The resulting problem is still about finding the largest or smallest feasible objective value, but the case boundaries need special attention.
A point where the formula changes may be an endpoint of one piece and the start of another. It can be a global optimum even when the derivative is nonzero on both sides, or when the derivative does not exist there. A constraint can also exclude a boundary, in which case a nearby limiting value need not be attained.
The reliable approach is to identify the feasible set first, split it into its smooth pieces, and account for endpoints and breakpoints as well as critical points. Continuity matters: it is one of the conditions that guarantees global extrema exist on a closed bounded feasible set.
Translate the Cases into a Feasible Set
Before differentiating, write down exactly which values of \(x\) are allowed. For example, if a case-based constraint permits \(0\le x\le1\) or \(2\le x\le4\), then the feasible set is \(D=[0,1]\cup[2,4]\). The gap \((1,2)\) is not feasible, so there is no reason to search it for an optimum.
Record whether each boundary is included. A closed endpoint, such as \(x=1\) in \([0,1]\), can be a candidate for an attained optimum. An excluded boundary is not itself a feasible candidate, even if objective values approach a limiting value there. The earlier material on endpoints and critical points and on feasible boundaries that are not attained addresses these distinctions; here they are essential because different cases often produce different boundary behavior.
Next, list the points where either the objective formula or the description of the feasible set changes. At each such breakpoint, determine whether the point is feasible, evaluate the objective at the point if it is, and compare that value with the behavior on both sides. Do not assume the two formulas give the same value there.
Candidate Points for a Continuous Piecewise-Smooth Objective
Suppose the feasible set is a finite union of closed, bounded intervals, and \(f\) is continuous on that set. Suppose also that the intervals can be divided at finitely many breakpoints so that \(f\) is differentiable on the interior of each resulting piece. Then the Extreme Value Theorem guarantees that \(f\) attains both a global maximum and a global minimum on the feasible set.
Every point where either global extremum is attained must be an endpoint, a breakpoint, or an interior critical point of a smooth feasible piece. An interior critical point means a point in that piece where \(f'(x)=0\); if differentiability fails at an interior point, that point must also be treated as a candidate. For a piecewise-smooth objective whose only interior failures of differentiability are the listed breakpoints, the breakpoint list already accounts for them.
This theorem identifies where to look; it does not guarantee that the candidate set is finite. A differentiable function can have infinitely many critical points, and the set of critical values can also be infinite. You may compare a finite list only when an additional fact ensures that there are finitely many candidates. Otherwise, use the existence result and analyze the candidate set without treating it as a finite list.
Why These Are the Right Candidates
The reasoning combines existence of extrema with Fermat’s theorem. The Extreme Value Theorem says that a continuous function on a closed, bounded feasible set attains a maximum and a minimum. Take a point \(x_*\) where either is attained. If it is an endpoint or breakpoint, it is already on the list. Otherwise, it lies inside a smooth piece, so there is a small open interval around \(x_*\) that remains inside that piece. There, \(x_*\) is a local extremum of a differentiable function.
Fermat’s theorem says that if a differentiable function has a local maximum or minimum at an interior point, its derivative there is zero. Thus \(f'(x_*)=0\). This proves the candidate-location claim. It does not prove that the list is finite: neither the Extreme Value Theorem nor Fermat’s theorem limits how many critical points there can be.
Write the allowed values as a set, preserving included and excluded boundaries.
List the endpoints and every point where the formula or feasible-set description changes.
Differentiate each formula on the interior of its feasible piece and find its critical points.
Evaluate the actual objective at feasible endpoints and breakpoints; compare with one-sided behavior where needed.
Use continuity and compactness when their hypotheses hold. Compare values directly only when the candidate set is known to be finite.
Worked Example: A Continuous Objective with a Breakpoint
Worked Example: A Continuous Objective with a Breakpoint
Find the global maximum and minimum of \(f\) on \([0,4]\), where
At the breakpoint \(x=2\), the first formula gives \(f(2)=2^2=4\). The right-hand formula approaches \(4-(2-2)^2=4\), so \(f\) is continuous there. It is continuous on the entire closed interval, so global extrema exist.
On the first piece, \(f'(x)=2x\). The equation \(2x=0\) gives \(x=0\), an endpoint, so there are no interior critical points in \((0,2)\). On the second piece, \(f'(x)=-2(x-2)\). Setting this equal to zero gives \(x=2\), which is the breakpoint, not an interior point of \((2,4)\). Thus we check \(x=0,2,4\).
The values are \(f(0)=0^2=0\), \(f(2)=4\), and \(f(4)=4-(4-2)^2=4-4=0\). Therefore the global maximum is \(4\), attained at \(x=2\), and the global minimum is \(0\), attained at \(x=0\) and \(x=4\). Substituting each point into its applicable formula confirms the values.
Worked Example: A Feasible Set with a Gap
Worked Example: A Feasible Set with a Gap
Find the global maximum and minimum of \(f(x)=5-(x-3)^2\) on the feasible set \(D=[0,1]\cup[2,4]\).
The feasible set has two closed components. The objective is a polynomial, hence continuous on \(D\), so it attains both extrema. Its derivative is \(f'(x)=-2(x-3)\), and the only critical point is \(x=3\), which belongs to \([2,4]\).
Check the endpoints of both components and the critical point: \(f(0)=5-(0-3)^2=5-9=-4\); \(f(1)=5-(1-3)^2=5-4=1\); \(f(2)=5-(2-3)^2=5-1=4\); \(f(3)=5-(3-3)^2=5\); and \(f(4)=5-(4-3)^2=5-1=4\).
The largest of these values is \(5\), attained at \(x=3\), and the smallest is \(-4\), attained at \(x=0\). The gap \((1,2)\) contributes no candidates because its points are infeasible. Direct substitution verifies both reported values.
Worked Example: A Discontinuous Breakpoint Can Prevent a Maximum
Worked Example: A Discontinuous Breakpoint Can Prevent a Maximum
Consider \(f\) on \([0,2]\), defined by
On the left of \(1\), the values approach \(1\), since \(x\) approaches \(1\). On the right, the values also approach \(1\), since \(2-x\) approaches \(1\). But the actual breakpoint value is \(f(1)=0\), so \(f\) is not continuous at \(1\).
For every feasible \(x\), \(f(x)<1\): on \(0\le x<1\), \(f(x)=x<1\); at \(x=1\), \(f(x)=0\); and on \(1<x\le2\), \(f(x)=2-x<1\). Nevertheless, values can be made arbitrarily close to \(1\) by taking \(x<1\) sufficiently close to \(1\). Thus the supremum is \(1\), but no feasible point attains it, so there is no global maximum.
The minimum is \(0\): the formulas give nonnegative values on their respective pieces, and \(f(0)=0\), \(f(1)=0\), and \(f(2)=0\). This example shows why continuity cannot be omitted from the existence argument, and why a one-sided limiting value at a breakpoint is not automatically an attained objective value.
A Common Mistake: Assuming There Are Only Finitely Many Candidates
A common error is to say that endpoint, breakpoint, and critical-point checks always produce a finite list that can be compared. The candidate-location theorem does not say this. A differentiable piece can contain infinitely many critical points, and their objective values need not reduce to a finite set. The correct conclusion is that, under the theorem’s hypotheses, extrema occur among the stated types of points. A finite comparison is justified only if the problem also ensures finitely many candidates.
Another error is to differentiate one formula across a breakpoint as though it were valid on both sides. Instead, differentiate each formula only on its own smooth piece, then check the breakpoint itself if it is feasible. Even when the formulas meet continuously, a corner can be an extremum without having derivative zero.
Check Your Understanding
Use the definitions and candidate-point reasoning above to answer these questions.
- For a piecewise objective on a closed interval, why must a feasible breakpoint be checked even if neither adjacent derivative is zero?
- What hypotheses allow the Extreme Value Theorem to guarantee both a global maximum and a global minimum?
- Does the candidate-location theorem imply that there are finitely many critical points? Explain.
- If the objective approaches a value at an excluded boundary, why might that value fail to be a maximum?
- For \(f(x)=5-(x-3)^2\) on \([0,1]\cup[2,4]\), which feasible points are endpoints or critical points, and what are the corresponding objective values?