Why the Location of the Input Matters
A piecewise formula can use different expressions on different parts of its domain. To calculate a derivative at an input strictly inside one of those parts, the key question is local: does a sufficiently small change in the input keep us on the same piece?
If it does, the difference quotient uses just that piece's formula. The other branches do not enter the calculation. At a join, however, every sufficiently small two-sided neighborhood reaches more than one branch. There, the interior calculation no longer settles whether a derivative exists.
This distinction lets us use the definition of the derivative efficiently without treating a piecewise function as if it had one formula everywhere.
Interior Points and the Derivative Definition
The condition \(0<|h|<\delta\) keeps the quotient defined and ensures that \(a+h\) stays on the same piece. Thus \(f(a+h)=p(a+h)\) and \(f(a)=p(a)\), so the quotient is \(\frac{p(a+h)-p(a)}{h}\). We can calculate using \(p\) alone.
For an input strictly inside an interval with endpoints \(u\) and \(v\), where \(u<a<v\), one possible choice is any positive \(\delta\) smaller than both \(a-u\) and \(v-a\). The exact size is unimportant; what matters is that such a neighborhood exists.
Why the Polynomial Formula Works
The difference-quotient method does not require us to assume a polynomial differentiation rule. The polynomial expansion around the input shows directly why the derivative is determined by the formula on the active piece.
For a linear piece \(p(x)=mx+b\), the same calculation is especially short: \(p(a+h)-p(a)=mh\), so the difference quotient is \(m\). In either case, the calculation is valid at an interior point because nearby inputs continue to use the same formula.
A Reliable Procedure
Check which interval contains it, and confirm that it is strictly between the interval's endpoints.
Choose a sufficiently small nonzero \(h\) so that \(a+h\) remains in that interval.
Substitute \(a+h\) and \(a\) into that formula in the difference quotient.
Cancel the factor \(h\) only after forming the numerator, then evaluate the limit as \(h\to0\).
Worked Examples
Worked Example: A Derivative Inside a Quadratic Piece
Let $$ f(x)= \begin{cases} x^2+3, & x<2,\\ 5x-3, & x\ge 2. \end{cases} $$ Find \(f'(0)\) from the definition.
Since \(0<2\), the input \(0\) lies strictly inside the region \(x<2\). For example, if \(|h|<1\), then \(h<1<2\), so both \(0\) and \(0+h\) use \(x^2+3\). First, \(f(0)=0^2+3=3\). For such nonzero \(h\), $$ \frac{f(0+h)-f(0)}{h} =\frac{(h^2+3)-3}{h} =\frac{h^2}{h} =h. $$ Therefore, $$ f'(0)=\lim_{h\to0}h=0. $$ As a check, the difference quotient itself is \(h\), whose limit is indeed \(0\). The branch \(5x-3\) is not used in this calculation because nearby inputs to \(0\) remain in the first branch.
Worked Example: Derivatives Inside Two Different Pieces
Consider $$ g(x)= \begin{cases} 2x^2-x+4, & x\le -1,\\ -x^3+2x, & x>-1. \end{cases} $$ Find \(g'(-2)\) and \(g'(0)\) from the definition.
First take \(a=-2\). This input is strictly inside the region \(x\le-1\); for \(|h|<1\), \(-2+h<-1\). The relevant formula gives $$ g(-2)=2(-2)^2-(-2)+4=8+2+4=14. $$ At a nearby input, $$ \begin{aligned} g(-2+h) &=2(-2+h)^2-(-2+h)+4\\ &=2(4-4h+h^2)+2-h+4\\ &=8-8h+2h^2+2-h+4\\ &=14-9h+2h^2. \end{aligned} $$ Thus $$ \frac{g(-2+h)-g(-2)}{h} =\frac{14-9h+2h^2-14}{h} =\frac{-9h+2h^2}{h} =-9+2h. $$ Taking the limit gives \(g'(-2)=-9\), since \(\lim_{h\to0}(-9+2h)=-9\).
Now take \(a=0\), strictly inside the region \(x>-1\). If \(|h|<1\), then \(h>-1\), so both inputs use \(-x^3+2x\). We have \(g(0)=0\), and $$ \frac{g(0+h)-g(0)}{h} =\frac{-h^3+2h-0}{h} =-h^2+2. $$ Consequently, \(g'(0)=\lim_{h\to0}(-h^2+2)=2\).
As checks, the simplified quotients approach \(-9\) at \(-2\) and \(2\) at \(0\). Each calculation used only the branch that applies in a neighborhood of its input.
Worked Example: Interior Derivatives Do Not Decide a Join
Let $$ r(x)= \begin{cases} x+1, & x<0,\\ x^2+1, & 0\le x<2,\\ 3x-3, & x\ge2. \end{cases} $$ Find the derivatives at the interior inputs \(1\) and \(3\), then determine whether the derivative exists at the join \(x=2\).
At \(a=1\), inputs sufficiently close to \(1\) remain in \(0\le x<2\). Since \(r(1)=1^2+1=2\), for sufficiently small \(h\), $$ \frac{r(1+h)-r(1)}{h} =\frac{((1+h)^2+1)-2}{h} =\frac{1+2h+h^2+1-2}{h} =\frac{2h+h^2}{h} =2+h. $$ Hence \(r'(1)=\lim_{h\to0}(2+h)=2\).
At \(a=3\), nearby inputs use \(3x-3\). We have \(r(3)=3(3)-3=6\), and $$ \frac{r(3+h)-r(3)}{h} =\frac{(3(3+h)-3)-6}{h} =\frac{6+3h-6}{h} =3. $$ Therefore \(r'(3)=3\). Both interior derivatives follow from a single branch in a neighborhood of the input.
At the join \(x=2\), the assigned value comes from the third branch: \(r(2)=3(2)-3=3\). For negative \(h\) close to zero, \(2+h\) lies in the middle branch, so $$ \frac{r(2+h)-r(2)}{h} =\frac{((2+h)^2+1)-3}{h} =\frac{4+4h+h^2+1-3}{h} =\frac{2+4h+h^2}{h} =\frac{2}{h}+4+h. $$ This quotient has no finite limit as \(h\to0\) through negative values. For positive \(h\), the third branch applies, and $$ \frac{r(2+h)-r(2)}{h} =\frac{(3(2+h)-3)-3}{h} =\frac{3+3h-3}{h} =3. $$ The one-sided difference quotients do not agree as finite limits, so \(r'(2)\) does not exist. The derivatives at \(1\) and \(3\) cannot answer this join question: they were calculated at different inputs, where a single formula applies nearby.
What Changes at a Join?
At an interior point, the same formula supplies both \(f(a+h)\) and \(f(a)\) for all sufficiently small \(h\). At a join \(c\), the difference quotient must instead be formed using the function's assigned value \(f(c)\) and the branch that applies on each side. The one-sided limits of that quotient must both exist as finite numbers and agree for the two-sided derivative to exist.
This is why merely differentiating each branch at points near a join is not a join test. Those calculations establish derivatives at those nearby points, not at \(c\). Even if the branch derivatives have limits as their inputs approach \(c\), the difference quotient at \(c\) still depends on the actual value \(f(c)\). Use the one-sided derivative test at the join rather than extending the interior argument beyond where its condition holds.
Common Mistake: Using the Wrong Branch
A frequent error is to substitute an input into a convenient branch without checking the interval. For the function \(g\) above, using \(-x^3+2x\) at \(x=-2\) would give the incorrect calculation $$ \frac{[-(-2+h)^3+2(-2+h)]-[-(-2)^3+2(-2)]}{h}. $$ That expression uses the branch for \(x>-1\), even though \(-2\) and all sufficiently close inputs lie in \(x\le-1\). The correct quotient is $$ \frac{[2(-2+h)^2-(-2+h)+4]-14}{h} =-9+2h, $$ so \(g'(-2)=-9\). The correction is to identify the interval first, then use its formula for both terms of the quotient.
Why This Distinction Is Useful
Piecewise formulas appear whenever a rule changes at a threshold: a charge may have different rates in different ranges, or a model may use separate expressions in separate regimes. At inputs away from thresholds, the difference quotient is local and straightforward: one branch controls it. At a threshold, the behavior on both sides and the function's assigned value matter.
Keeping those tasks separate prevents two opposite errors: bringing an irrelevant branch into an interior calculation, and assuming that interior derivatives settle what happens at a join. Always check the input's location before simplifying the quotient.
Check Your Understanding
For each question, pay attention to whether the input is strictly inside a piece or is a join.
- For \(f(x)=x^2\) when \(x<1\) and \(f(x)=3x-2\) when \(x\ge1\), which formula should be used to calculate \(f'(0)\) from the definition, and why?
- If a polynomial formula applies on \(a<x<b\), what condition on a sufficiently small \(h\) ensures that \(a+h\) stays in that piece?
- For \(p(x)=x^2+2x\) on a neighborhood of \(3\), form and simplify the difference quotient at \(3\).
- Why does calculating the derivative of each branch at nearby interior points not by itself determine differentiability at a join?
- What must be checked using one-sided difference quotients to establish a derivative at a join?