Why Piecewise Functions Need Careful Checking
A piecewise formula can change its expression at a joining point. Even if each formula is easy to differentiate, the complete function may fail to be differentiable at that join. An interior absolute maximum or minimum can occur there, so checking only derivative zeros on the separate pieces can miss an extremum.
For a continuous function on a closed interval, the Extreme Value Theorem guarantees that both an absolute maximum and an absolute minimum exist. The practical task is to locate where they could occur. For piecewise functions, that means checking the endpoints, every joining point, and interior points where a derivative is zero or does not exist. The resulting set of candidates need not be finite.
Piecewise Definitions and Continuity at Joins
Suppose an interval \([a,b]\) is divided by finitely many points \(a=c_0<c_1<\cdots<c_n=b\). On each subinterval, a piecewise function is specified by a formula. A point \(c_i\) with \(0<i<n\) is a joining point: the formula to its left and the formula to its right meet there.
For example, if the left-hand formula gives \(L\) at \(c\) and the right-hand formula gives \(R\), continuity requires \(L=R=f(c)\). If these values do not agree, the function is not continuous there, and the closed-interval theorem discussed below cannot be applied to the whole interval as stated.
Continuity does not guarantee differentiability. The left and right derivatives at a join may differ, or one of them may fail to exist. A continuous join must therefore be checked as a possible extremum whether or not its derivative exists.
The Candidate Set
For a continuous function on \([a,b]\), the endpoints are possible locations of absolute extrema. At an interior point where the function is differentiable, Fermat’s theorem says that a local maximum or minimum can occur only if the derivative is zero. An interior point where the derivative does not exist must also be considered. Joining points are included even when a one-sided derivative calculation is available.
This list is complete in the sense that it contains every possible location of an absolute extremum. It is not necessarily a finite list. For instance, if \(f\) is constant on an interval, its derivative is zero at every interior point of that interval.
Why the Candidate List Is Complete
The Extreme Value Theorem applies when \(f\) is continuous on the entire closed, bounded interval \([a,b]\). It guarantees that \(f\) attains an absolute maximum and an absolute minimum there. To locate those extrema, consider any point \(x_0\) where either one is attained.
If \(x_0=a\) or \(x_0=b\), it is already in the candidate set.
If \(x_0\) is an interior join, it is included whether or not \(f'(x_0)\) exists.
If \(x_0\) is interior, is not a joining point, and \(f\) is differentiable there, then \(f'(x_0)=0\).
If \(x_0\) is interior and \(f\) is not differentiable there, it is a candidate by definition.
The key fact in the third step can be seen directly. At an interior local maximum where \(f'\) exists, for small positive \(h\) the quotient \(\frac{f(x_0+h)-f(x_0)}{h}\) is nonpositive. For small negative \(h\), the numerator is nonpositive but the denominator is negative, so the quotient is nonnegative. If the two-sided derivative exists, its limit must be both nonpositive and nonnegative, hence it is zero. At a local minimum, the inequalities reverse and the derivative is again zero.
Worked Example: A Join and a Stationary Point
Worked Example: A Join and a Stationary Point
Find the absolute maximum and minimum of \(f(x)=x^2\) for \(-2\le x\le0\), and \(f(x)=x(2-x)\) for \(0\le x\le2\).
First check continuity at the join \(x=0\). The left formula gives \(0^2=0\), and the right formula gives \(0(2-0)=0\). Thus the formulas agree there, and the function is continuous at the join.
On the left piece, \(f'(x)=2x\), which is zero at \(x=0\). This is the join, so it is included regardless. On the right piece, \(f'(x)=2-2x\). Solving \(2-2x=0\) gives \(x=1\). The candidate points are therefore the endpoints \(-2\) and \(2\), the join \(0\), and the stationary point \(1\).
Evaluate the function at each candidate:
The largest candidate value is \(4\), attained at \(x=-2\). The smallest is \(0\), attained at \(x=0\) and \(x=2\). Since the candidate set is finite and complete, these comparisons establish the absolute extrema. As a check, the listed values come directly from the defining formulas, including the left formula at \(-2\) and the right formula at \(2\).
Worked Example: A Derivative Failure Inside a Piece
Worked Example: A Derivative Failure Inside a Piece
Find the absolute extrema on \([-1,2]\) of \(f(x)=x^2\) for \(-1\le x\le0\), and \(f(x)=(x-1)^{2/3}-1\) for \(0\le x\le2\). Here the fractional power is interpreted using the real cube root, so \((x-1)^{2/3}=(\sqrt[3]{x-1})^2\).
At the join \(x=0\), the first formula gives \(0^2=0\); the second gives \((-1)^{2/3}-1=1-1=0\). The function is continuous there. On the first piece, \(f'(x)=2x\). On the second piece, for \(x\ne1\), \(f'(x)=\frac{2}{3}(x-1)^{-1/3}\), which does not equal zero. The derivative on the second piece fails to exist at \(x=1\).
The join \(x=0\) is also a derivative failure: the derivative from the left is \(0\), while from the right it is \(\frac{2}{3}(-1)^{-1/3}=-\frac{2}{3}\). At \(x=1\), the difference quotient from the right is \(h^{-1/3}\) and from the left is \(-|h|^{-1/3}\); these do not approach a finite common limit. The complete candidate list is \(-1,0,1,2\).
Evaluate each candidate:
Thus the absolute maximum is \(1\), attained at \(x=-1\), and the absolute minimum is \(-1\), attained at \(x=1\). The values have been substituted into their respective formulas: \(x=1\) and \(x=2\) lie in the second piece. In particular, the derivative failure at \(x=1\) is essential; omitting it would miss the minimum.
When the Candidate Set Is Infinite
The complete-candidate result does not promise that there are only finitely many candidates. A constant piece has derivative zero throughout its interior, so its derivative-zero candidates form an interval. In that situation, evaluating a few selected points and calling the list complete would be incorrect. Instead, use the formula or other information about the function to analyze the whole candidate set.
Worked Example: An Interval of Absolute Minima
Consider the continuous piecewise function on \([-2,2]\) given by \(f(x)=x^2\) for \(-2\le x\le-1\), \(f(x)=1\) for \(-1\le x\le1\), and \(f(x)=x^2\) for \(1\le x\le2\). At both joins, the adjacent formulas give \(1\), so the function is continuous.
On the outer pieces, \(f'(x)=2x\), which has no zero in \([-2,-1]\) or \([1,2]\). On the constant piece, \(f'(x)=0\) at every point in \((-1,1)\). The joins \(-1\) and \(1\) are candidates, as are the endpoints. Thus the candidate set is infinite, not a finite list of isolated points.
The formula itself resolves the comparison. On each outer piece, \(1\le x^2\le4\), with \(x^2=4\) at the relevant outer endpoint and \(x^2=1\) at the join. On the entire middle interval, the function equals \(1\). Therefore the absolute minimum is \(1\), attained at every point of \([-1,1]\), and the absolute maximum is \(4\), attained at \(x=-2\) and \(x=2\).
The endpoint and join values check directly: \(f(-2)=4\), \(f(-1)=1\), \(f(1)=1\), and \(f(2)=4\). Every point of the constant interval has value \(1\), confirming both the minimum and its nonunique location.
A Common Mistake: Skipping a Join
Consider \(f(x)=-x\) for \(-1\le x\le0\), and \(f(x)=x\) for \(0\le x\le1\). This is the function \(|x|\), and the two formulas agree at \(0\). A mistaken calculation might differentiate each formula, find derivatives \(-1\) and \(1\), see no derivative zeros, and compare only the endpoint values \(f(-1)=f(1)=1\). It might then incorrectly claim that the minimum is \(1\).
The correction is to include the joining point \(x=0\), where the function is continuous but not differentiable. Its value is \(f(0)=0\), so the absolute minimum is \(0\), attained at \(0\); the absolute maximum is \(1\), attained at both endpoints. This example shows why joins cannot be discarded just because the formulas on either side have simple derivatives.
A Reliable Procedure
For a continuous piecewise function on a closed interval, use the following procedure. It gives a complete set of possible locations, while leaving room for the set to be infinite.
- Check that the function is continuous on the whole closed interval, including every join.
- Record both endpoints and every interior joining point.
- Differentiate each formula on its piece; solve for interior derivative zeros.
- Find any other interior points where the derivative does not exist.
- Evaluate the function at every candidate and compare values if the candidate set is finite.
- If candidates are infinite, analyze the formulas or their behavior on the full candidate set rather than sampling a few points.
The method combines continuity, the Extreme Value Theorem, and Fermat’s theorem. Continuity guarantees that absolute extrema exist; the candidate argument identifies where they can occur. A finite comparison is a useful outcome when the candidate set is finite, not an assumption that is valid for every piecewise function.
Check Your Understanding
Use the definitions and candidate method to answer these questions.
- What equality must hold between adjacent formulas at an interior join for the piecewise function to be continuous there?
- Why must an interior joining point be checked even if the derivatives on the two pieces have no zeros?
- State the condition Fermat’s theorem gives at a differentiable interior local extremum.
- For \(f(x)=|x|\) on \([-1,1]\), what goes wrong if the join at \(0\) is omitted?
- Why is it not always valid to reduce the candidate method to a finite list of points? Give an example of the kind of piece that causes this issue.