Why Continuity Must Be Checked First
A piecewise-defined objective can have a simple, smooth formula on each side of a curve and still fail to be continuous where the formulas meet. That matters when finding absolute extrema: the Extreme Value Theorem guarantees that a continuous function on a compact region attains both an absolute maximum and an absolute minimum. Without continuity, that guarantee is unavailable.
For a piecewise objective, checking each formula separately is not enough. The formulas must also fit together continuously along their joining curve. Once continuity is established, the seam—the curve where the formulas change—must still be included in the search for extrema. A continuous function may have a maximum or minimum there even when neither branch has an interior critical point.
Continuity Along a Joining Curve
Suppose a region \(D\) is divided by a curve \(C\) into pieces \(D_1\) and \(D_2\). A piecewise objective is defined using one formula on \(D_1\) and another on \(D_2\). To check continuity at a point \(p\) on \(C\), compare the values given by the two formulas at that point. If the formulas disagree there, the objective cannot be continuous at \(p\). If they agree, and both formulas are continuous up to the curve, then the objective is continuous at \(p\).
Here is why agreement is sufficient. Let the two branch formulas be \(g_1\) and \(g_2\), and suppose that at a seam point \(p\) they both equal \(c\). Given any \(\varepsilon>0\), continuity of each branch at \(p\) provides a distance within which its value differs from \(c\) by less than \(\varepsilon\). Choose the smaller of those two distances. Any nearby point of \(D\) uses one of the branch formulas, so its objective value differs from \(c\) by less than \(\varepsilon\). This is exactly continuity at \(p\).
This test concerns values, not derivatives. The branch formulas may meet continuously while their derivatives disagree, so continuity across a seam does not by itself imply differentiability there.
Worked Example: Checking Continuity Across a Straight Seam
On \(D=[-1,1]\times[-1,1]\), define
The joining curve is \(y=x\). Both branch formulas are polynomials, hence continuous on their respective pieces. On the seam, substitute \(y=x\) into both formulas:
The values agree at every seam point. By the continuity test, \(f\) is continuous throughout \(D\). Since \(D\) is closed and bounded, the Extreme Value Theorem guarantees that \(f\) attains an absolute maximum and minimum on \(D\).
The derivatives do not have to agree for this conclusion. The gradients of the two branch formulas are \((2x,2y)\) and \((2x-1,2y+1)\). At \(y=x\), their difference is \((-1,1)\), so they are unequal. Thus the matching values establish continuity, but the derivative information shows why continuity alone should not be mistaken for smoothness.
Check: At a seam point such as \((1/2,1/2)\), the first branch gives \(1/4+1/4=1/2\). The second gives \(1/4+1/4+(1/2-1/2)=1/2\), confirming the agreement at that point.
What a Failed Continuity Check Means
If the branch values do not agree along the seam, the function is discontinuous there. The Extreme Value Theorem then cannot be used to guarantee that the extrema exist. This does not prove that an extremum fails to exist; it means only that this theorem does not settle the question. The actual behavior must be checked separately.
Worked Example: A Discontinuous Objective With No Absolute Maximum
On the closed square \(D=[0,1]\times[0,1]\), define
The seam is \(y=x\). At any seam point \((a,a)\) with \(a>0\), the value is \(0\). To approach that point from the region \(y>x\), take points \((a-\varepsilon,a)\), where \(\varepsilon>0\) is small enough that \(a-\varepsilon\ge 0\). Their objective values are \(a-\varepsilon\), which approach \(a\), not \(0\). Thus \(f\) is discontinuous at every such seam point.
For all points in the square, \(f(x,y)\le 1\). On the branch \(y>x\), we have \(x<1\), because \(x=1\) would require \(y>1\), outside \(D\). Thus the value \(x\) on that branch is strictly less than \(1\); on the other branch the value is \(0\). The value \(1\) is never attained.
However, for every integer \(n\ge 2\), the point \((1-1/n,1)\) lies in the region \(y>x\), and
These values approach \(1\), so \(1\) is the supremum of the objective values, but it is not a maximum. The objective has no absolute maximum on \(D\). Its minimum is \(0\), attained wherever \(y\le x\). This example confirms that a closed and bounded domain alone does not suffice for the Extreme Value Theorem: continuity is also required.
Where to Search for Extrema When There Is a Seam
Once continuity on a compact region has been verified, the Extreme Value Theorem ensures that both absolute extrema exist. To find them, partition the search according to where an extremum could occur. A seam is an additional candidate set: even if the objective is differentiable inside each piece, it may not be differentiable across the seam. Therefore, an interior critical-point search within each branch does not replace an examination of the seam.
Verify that the branch formulas match on every seam, that the objective is continuous on the entire region, and that the region is compact.
For differentiable branches, check interior critical points within each piece. The usual zero-gradient condition applies to an interior extremum of a differentiable function.
Restrict the objective to each boundary curve or seam and find its extrema there. Include endpoints and junctions when the restricted pieces meet.
Evaluate the objective at the candidates found in the interiors, on the outer boundary, and on the seams. The largest and smallest values are the absolute extrema.
Restricting to a seam means substituting its equation into the applicable formula or formulas. When the formulas agree there, either branch gives the same restricted function. This turns the seam search into a one-variable extrema problem when the seam is parametrized by one variable.
Worked Example: Finding Extrema When the Seam Contains a Maximum
Consider the square \(D=[-1,1]\times[-1,1]\) and the objective
The seam is \(y=0\). On it, both formulas give \(-x^2\), so the objective is continuous across the seam. Each branch is continuous, and \(D\) is closed and bounded. The Extreme Value Theorem therefore guarantees that absolute extrema exist.
First, check for critical points in the interiors of the two pieces. For \(y>0\), the gradient is \((-2x,-1)\), which cannot be zero because its second component is \(-1\). For \(y<0\), the gradient is \((-2x,1)\), which cannot be zero because its second component is \(1\). Neither piece has an interior critical point.
Next, restrict the objective to the seam:
This restriction has maximum \(0\) at \(x=0\), and minimum \(-1\) at \(x=-1\) and \(x=1\). In particular, the seam gives a maximum at the interior point \((0,0)\) of the square, even though neither branch has an interior critical point.
On the whole square, \(0\le x^2\le 1\) and \(0\le |y|\le 1\). The two branch formulas together can be written as \(f(x,y)=-x^2-|y|\), so
The upper bound is attained only when \(x^2=0\) and \(|y|=0\), giving the absolute maximum \(0\) at \((0,0)\). The lower bound is attained when \(x^2=1\) and \(|y|=1\), giving the absolute minimum \(-2\) at \((-1,-1)\), \((-1,1)\), \((1,-1)\), and \((1,1)\).
Check: At \((0,0)\), both formulas give \(0\). At each of the four listed corners, the applicable formula gives \(-1-1=-2\). The calculated values attain the bounds, so they verify the absolute maximum and minimum.
Common Pitfall: Checking Branches but Ignoring Their Meeting
A common error is to differentiate each branch, find its interior critical points, and conclude that the search is complete. That misses points where the formula changes. In the last example, the upper branch has no interior critical point because its \(y\)-derivative is \(-1\), and the lower branch has none because its \(y\)-derivative is \(1\). Yet the absolute maximum occurs at \((0,0)\), on the seam.
The correction is to treat each seam as a candidate set in its own right. A change of formula can create a corner-like feature in the objective, even when the seam itself is a smooth curve. The objective can be continuous there without being differentiable there, so an interior derivative test cannot rule out seam extrema.
Check Your Understanding
Use continuity conditions and candidate locations to answer the following.
- What must be checked about two continuous branch formulas at every point of their joining curve?
- Why does the Extreme Value Theorem apply to a continuous objective on a closed and bounded region in \(\mathbb{R}^2\)?
- If a piecewise objective is discontinuous at a seam, what conclusion can and cannot be drawn about its extrema from the Extreme Value Theorem?
- Why might an objective attain an extremum on a seam even when neither branch has an interior critical point?
- For the final worked example, what is the objective restricted to the seam, and where does that restriction attain its maximum?