Tutorials › Calculus I › Piecewise Linear Functions at a Join

The Derivative from First Principles · Tutorial 354 of 1495

Piecewise Linear Functions at a Join

Use the sign of the increment to select each branch and compute how its slope determines the corresponding one-sided difference-quotient limit.

Intermediate 10 min read

What You'll Learn

  • Define the difference quotient at a join using an increment measured from the join point.
  • Select the correct piecewise formula for negative and positive increments.
  • Derive why each one-sided quotient limit equals the slope of its branch when the branches meet.
  • Compute exact left- and right-hand limits for piecewise linear examples.
  • Recognize how a mismatch at the join can prevent the quotient from reducing to a branch slope.

Why a Join Requires Care

A piecewise linear function follows one line on one side of a point and possibly a different line on the other side. At the point where the formulas meet, the difference quotient samples values from both branches, depending on the direction of approach.

The key is to keep track of that direction. A negative increment takes us to the left of the join; a positive increment takes us to the right. If the branches meet at the same function value, the difference quotient on each side simplifies exactly to the slope of the branch used there.

The Difference Quotient at a Join

Let \(c\) be the join point. For a nonzero increment \(h\), the difference quotient based at \(c\) is

$$ \frac{f(c+h)-f(c)}{h}. $$

When \(h<0\), the input \(c+h\) lies to the left of \(c\). When \(h>0\), it lies to the right. The one-sided limits are therefore computed with the left-branch formula and right-branch formula, respectively.

Definition: The left-hand difference-quotient limit at \(c\) is \(\displaystyle\lim_{h\to 0^-}\frac{f(c+h)-f(c)}{h}\), and the right-hand difference-quotient limit is \(\displaystyle\lim_{h\to 0^+}\frac{f(c+h)-f(c)}{h}\). The notation \(h\to0^-\) restricts \(h\) to negative values; \(h\to0^+\) restricts it to positive values.

Suppose the function is given by two linear formulas, with the value at the join agreeing with both branches:

$$ f(x)= \begin{cases} m_L(x-c)+L, & x\le c,\\ m_R(x-c)+L, & x>c. \end{cases} $$

Here \(L=f(c)\), \(m_L\) is the slope on the left, and \(m_R\) is the slope on the right. The shared value \(L\) matters: it ensures that subtracting \(f(c)\) removes the constant part of either branch.

Why the Quotients Equal the Branch Slopes

The result follows directly from the definition of the difference quotient. On the left, \(h<0\), so \(c+h<c\) and the left formula applies. On the right, \(h>0\), so \(c+h>c\) and the right formula applies.

1
Use the left branch.
For \(h<0\), substitute \(c+h\) into the formula \(m_L(x-c)+L\), and use \(f(c)=L\).
2
Simplify the left quotient.
The numerator becomes \(m_Lh\), so division by the nonzero increment \(h\) gives \(m_L\).
3
Use the right branch.
For \(h>0\), the same calculation with \(m_R\) gives the constant quotient \(m_R\).

In equations, the left-side calculation is

$$ \frac{f(c+h)-f(c)}{h} = \frac{m_L((c+h)-c)+L-L}{h} = \frac{m_Lh}{h} = m_L \qquad (h<0). $$

For the right side, the calculation is

$$ \frac{f(c+h)-f(c)}{h} = \frac{m_R((c+h)-c)+L-L}{h} = \frac{m_Rh}{h} = m_R \qquad (h>0). $$

These equalities hold for every allowed nonzero \(h\) on the indicated side, not just for increments close to zero. Since each quotient is constant on its side, taking the corresponding one-sided limit leaves that constant unchanged.

Theorem: If the two linear branches meet at \(c\), so both give \(f(c)=L\), then $$ \lim_{h\to0^-}\frac{f(c+h)-f(c)}{h}=m_L \qquad\text{and}\qquad \lim_{h\to0^+}\frac{f(c+h)-f(c)}{h}=m_R. $$ Thus each one-sided difference-quotient limit is the slope of the branch approached from that side.

Worked Examples

Worked Example: Different Slopes at a Join

Consider

$$ f(x)= \begin{cases} 2x+1, & x\le 2,\\ -x+7, & x>2. \end{cases} $$

First find the function value at the join. The left formula gives \(f(2)=2(2)+1=5\). The right formula also gives \(-(2)+7=5\), so the branches meet at the value \(5\).

For \(h<0\), \(2+h<2\), so use the left formula:

$$ \frac{f(2+h)-f(2)}{h} = \frac{2(2+h)+1-5}{h} = \frac{4+2h+1-5}{h} = \frac{2h}{h} = 2. $$

Therefore the left-hand limit is \(2\). For \(h>0\), \(2+h>2\), so use the right formula:

$$ \frac{f(2+h)-f(2)}{h} = \frac{-(2+h)+7-5}{h} = \frac{-2-h+7-5}{h} = \frac{-h}{h} = -1. $$

Therefore the right-hand limit is \(-1\). As a check, the quotient identities hold for every negative \(h\) and every positive \(h\), respectively, and the resulting constants are exactly the slopes \(2\) and \(-1\) of the two branches.

Worked Example: A Join with Fractional Slopes

Let

$$ f(x)= \begin{cases} \frac{1}{2}x+7, & x\le -2,\\ 3x+12, & x>-2. \end{cases} $$

At \(x=-2\), the left formula gives \(\frac{1}{2}(-2)+7=-1+7=6\). The right formula gives \(3(-2)+12=-6+12=6\). Hence \(f(-2)=6\).

For \(h<0\), the input \(-2+h\) is left of the join. Substitution gives

$$ \begin{aligned} \frac{f(-2+h)-f(-2)}{h} &= \frac{\frac{1}{2}(-2+h)+7-6}{h}\\ &= \frac{-1+\frac{h}{2}+1}{h}\\ &= \frac{h/2}{h} = \frac{1}{2}. \end{aligned} $$

For \(h>0\), the right formula applies:

$$ \begin{aligned} \frac{f(-2+h)-f(-2)}{h} &= \frac{3(-2+h)+12-6}{h}\\ &= \frac{-6+3h+12-6}{h}\\ &= \frac{3h}{h} = 3. \end{aligned} $$

The left-hand limit is \(\frac{1}{2}\), and the right-hand limit is \(3\). Checking against the formulas, the left branch has slope \(\frac{1}{2}\) and the right branch has slope \(3\), as the quotient calculations show.

Worked Example: Finding the Join Value from the Formulas

Consider the function with join at \(x=1\):

$$ f(x)= \begin{cases} -3x+4, & x\le 1,\\ 2x-1, & x>1. \end{cases} $$

The value at the join from the assigned left branch is \(f(1)=-3(1)+4=1\). The right-hand line also has value \(2(1)-1=1\), so both branches meet.

When \(h<0\), use the left formula at \(1+h\):

$$ \begin{aligned} \frac{f(1+h)-f(1)}{h} &= \frac{-3(1+h)+4-1}{h}\\ &= \frac{-3-3h+4-1}{h}\\ &= \frac{-3h}{h} = -3. \end{aligned} $$

When \(h>0\), use the right formula:

$$ \begin{aligned} \frac{f(1+h)-f(1)}{h} &= \frac{2(1+h)-1-1}{h}\\ &= \frac{2+2h-1-1}{h}\\ &= \frac{2h}{h} = 2. \end{aligned} $$

Thus the left-hand limit is \(-3\) and the right-hand limit is \(2\). Substituting each result into the quotient identity verifies it for all nonzero \(h\) of the required sign; these are also the respective branch slopes.

A Common Mistake: Using the Wrong Branch

In the first example, if \(h<0\), then \(2+h<2\), so the left formula \(2x+1\) must be used. A common error is to use the right formula anyway, because it appears second in the piecewise definition. That would give

$$ \frac{-(2+h)+7-5}{h} = \frac{-h}{h} = -1. $$

This is a valid simplification of the right-branch expression, but it is not the quotient for negative \(h\): the right formula only applies when the input is greater than \(2\). For \(h<0\), the correct calculation uses the left branch and gives \(2\). Always determine whether \(c+h\) lies to the left or right of \(c\) before substituting.

Why the Matching Value Matters

The slope calculation depends on subtracting the actual value \(f(c)\). If the two branches do not agree at the join, the numerator may contain a nonzero constant as well as a term proportional to \(h\). For example, define \(g(x)=x\) for \(x\le0\) and \(g(x)=x+1\) for \(x>0\). Then \(g(0)=0\), while for \(h>0\),

$$ \frac{g(0+h)-g(0)}{h} = \frac{h+1}{h} = 1+\frac{1}{h}. $$

This is not simply the right-branch slope \(1\). The extra term comes from the difference between the right-hand branch value at the join and the assigned value \(g(0)\). Therefore, before using the slope conclusion, check that both formulas give the same value at the join.

What the Calculation Tells Us

For a continuously joined piecewise linear function, the side-specific difference quotient is not merely close to a slope: it equals that slope for every nonzero increment on the relevant side. The limits therefore record the two branch slopes directly. If the slopes happen to agree, the two one-sided quotient limits have the same value; if they differ, the limits retain that difference. The important task here is to compute each limit with the correct branch and the correct value at the join.

Key takeaway: At a join \(c\), use \(h<0\) with the left branch and \(h>0\) with the right branch. When the branches share the value \(f(c)\), cancellation leaves the corresponding branch slope as the one-sided difference-quotient limit.

Check Your Understanding

For each question, identify the branch used on each side before simplifying the quotient.

  1. For \(f(x)=2x-1\) when \(x\le 3\), and \(f(x)=-x+8\) when \(x>3\), first verify the shared value at the join. What are the left- and right-hand difference-quotient limits there?
  2. Why does \(h<0\) imply that \(c+h<c\)?
  3. For a joined pair of linear branches with slopes \(m_L\) and \(m_R\), what expressions result for the quotient on the left and right, respectively?
  4. What feature of the branch values allows the constant terms to cancel in the slope calculation?
  5. In the example \(g(x)=x\) for \(x\le0\) and \(g(x)=x+1\) for \(x>0\), why is the right-hand quotient not equal to the right-branch slope?

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