Tutorials › Calculus I › Piecewise Functions on Closed Intervals

Critical Points and Monotonicity · Tutorial 777 of 1495

Piecewise Functions on Closed Intervals

Build a complete candidate set for a continuous piecewise function on a closed interval, then determine when its values can be compared finitely and when further analysis is needed.

Intermediate 10 min read

What You'll Learn

  • State the continuity condition at a joining point of piecewise formulas.
  • Identify endpoints and joining points that must be checked.
  • Find interior candidates from derivative zeros and derivative failures.
  • Explain why every absolute extremum must appear among these candidates.
  • Compare candidate values when the candidate set is finite.
  • Analyze infinite candidate sets without assuming they reduce to finitely many points.

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.

Continuity at a joining point: If the left and right formulas are continuous up to an interior joining point \(c\), the piecewise function is continuous at \(c\) exactly when their values at \(c\) agree. In that case, both one-sided limits and \(f(c)\) have the same value.

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.

Definition: For this method, the candidate set consists of the two endpoints, all interior joining points, all other interior points where \(f'(x)\) does not exist, and all interior points where \(f'(x)=0\). A point may belong to more than one of these categories.

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.

1
Check the endpoints.
If \(x_0=a\) or \(x_0=b\), it is already in the candidate set.
2
Check joining points.
If \(x_0\) is an interior join, it is included whether or not \(f'(x_0)\) exists.
3
Apply Fermat’s theorem elsewhere.
If \(x_0\) is interior, is not a joining point, and \(f\) is differentiable there, then \(f'(x_0)=0\).
4
Include derivative failures.
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.

Theorem: If \(f\) is continuous on \([a,b]\), every point where \(f\) attains an absolute maximum or minimum belongs to the candidate set just defined. When that set is finite, evaluating \(f\) at all its points and comparing the values determines the absolute extrema. If the set is infinite, it must be analyzed rather than treated as a finite checklist.

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:

$$ f(-2)=(-2)^2=4,\qquad f(0)=0,\qquad f(1)=1(2-1)=1,\qquad f(2)=2(2-2)=0. $$

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:

$$ f(-1)=(-1)^2=1,\qquad f(0)=0,\qquad f(1)=0^{2/3}-1=-1,\qquad f(2)=1^{2/3}-1=0. $$

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.

  1. Check that the function is continuous on the whole closed interval, including every join.
  2. Record both endpoints and every interior joining point.
  3. Differentiate each formula on its piece; solve for interior derivative zeros.
  4. Find any other interior points where the derivative does not exist.
  5. Evaluate the function at every candidate and compare values if the candidate set is finite.
  6. 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.

  1. What equality must hold between adjacent formulas at an interior join for the piecewise function to be continuous there?
  2. Why must an interior joining point be checked even if the derivatives on the two pieces have no zeros?
  3. State the condition Fermat’s theorem gives at a differentiable interior local extremum.
  4. For \(f(x)=|x|\) on \([-1,1]\), what goes wrong if the join at \(0\) is omitted?
  5. 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.

Test yourself: Calculus I final exam practice

Ready to check what you know? Work a full-length practice final, then open the complete worked solutions.

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers the full Calculus AB & BC curriculum (the core of Calculus I and II): full review, every practice question, and step-by-step solutions to each one.

QR code to download the Calc Pass app

Get the Calc Pass App

Scan to download and practice on the go, with instant scoring.

Calc Pass Volume 1: 1,114 Practice Questions book cover

Vol. 1: 1,114 Questions

The complete practice question bank, organized by AB & BC topic.

View on Amazon
Calc Pass Volume 2: Solutions Manual book cover

Vol. 2: Solutions Manual

Fully worked solutions to every question in Volume 1.

View on Amazon