Tutorials › Calculus I › Absolute Value Functions as Piecewise Rules

Function Notation and Representations · Tutorial 25 of 1495

Absolute Value Functions as Piecewise Rules

Rewrite absolute value expressions as piecewise rules by locating where the quantity inside the bars changes sign.

Beginner 8 min read

What You'll Learn

  • Use the definition of absolute value to remove bars according to the sign of the inside expression
  • Rewrite \(|x-a|\) on the intervals to the left and right of its breakpoint
  • Find the breakpoint of an absolute value containing a linear expression
  • Handle equality at the breakpoint, where both branch formulas agree
  • Check a piecewise rewrite by substituting inputs from each interval

Why Absolute Value Rules Split into Cases

An absolute value measures distance from zero, so its output is never negative. The formula \(|x-4|\), for example, measures the distance between \(x\) and \(4\). When \(x\) is at least \(4\), the quantity \(x-4\) is nonnegative. When \(x\) is less than \(4\), it is negative, and taking its absolute value reverses its sign.

This sign change is why an absolute value formula can be rewritten as a piecewise rule. The formula inside the bars determines where the pieces change; the absolute value definition determines what each piece is.

Definition: For any real number \(u\), its absolute value is $$ |u| = \begin{cases} u, & u \ge 0,\\ -u, & u < 0. \end{cases} $$

The two cases cover every real input: a number is either nonnegative or negative. At \(u=0\), the first case gives \(0\). Using the other expression there would also give \(-0=0\), so the value at the boundary is unambiguous.

Rewriting \(|x-a|\)

For \(|x-a|\), the expression inside the bars is \(x-a\). It is negative when \(x<a\), zero when \(x=a\), and positive when \(x>a\). Applying the definition therefore gives the following rule.

Rule: For any real number \(a\), $$ |x-a| = \begin{cases} a-x, & x<a,\\ x-a, & x\ge a. \end{cases} $$

For \(x<a\), \(x-a<0\), so the absolute value is the negative of the inside expression: \(-(x-a)=a-x\). For \(x\ge a\), \(x-a\ge0\), so the absolute value leaves it unchanged. The breakpoint is \(x=a\), the input at which the inside expression is zero.

The choice of which piece includes the breakpoint is flexible only when both formulas give the same value there. Here, at \(x=a\), the left formula gives \(a-a=0\), and the right formula gives \(a-a=0\). Thus one could place equality with either branch. The convention above assigns it to the second branch.

Worked Example: Rewriting \(|x-3|\)

Find a piecewise rule for \(f(x)=|x-3|\). First find where the inside expression is zero:

$$ x-3=0 \quad\Longrightarrow\quad x=3. $$

If \(x<3\), then \(x-3<0\), so negate the inside expression. If \(x\ge3\), it is nonnegative and remains unchanged. Therefore,

$$ f(x)=|x-3|= \begin{cases} 3-x, & x<3,\\ x-3, & x\ge3. \end{cases} $$

Check one input from each side and the boundary. At \(x=1\), the original rule gives \(|1-3|=|-2|=2\), and the first branch gives \(3-1=2\). At \(x=5\), the original rule gives \(|5-3|=|2|=2\), and the second branch gives \(5-3=2\). At \(x=3\), the original rule gives \(|3-3|=0\), and the second branch gives \(3-3=0\). The pieces agree with the original expression at all three checks.

A Sign Check Explains the Rule

The rewrite is not a memorized pattern that should be applied without checking. It follows directly from the definition of absolute value. To justify it completely, consider the sign of \(x-a\) in each possible case.

1
Locate the zero.
The inside expression \(x-a\) equals zero exactly when \(x=a\).
2
Determine the sign on the left.
If \(x<a\), subtracting \(a\) gives \(x-a<0\). The definition says \(|x-a|=-(x-a)=a-x\).
3
Determine the sign at and to the right.
If \(x\ge a\), then \(x-a\ge0\). The definition says \(|x-a|=x-a\).
4
Check the boundary.
At \(x=a\), both expressions give zero, as does the original absolute value.

Every real \(x\) belongs to exactly one of the two stated intervals, and the formula used on that interval is precisely the one required by the sign of \(x-a\). This proves the rule for all real \(x\), not only for a selection of test values.

Coefficients and Shifts Outside the Bars

A constant multiplier outside the absolute value does not change where the expression inside the bars changes sign. Likewise, adding a constant outside the bars changes the output values but not the breakpoint. First rewrite the absolute value; then apply the outside operations to each branch.

Worked Example: A Scaled and Shifted Absolute Value

Rewrite \(g(x)=2|x+1|-4\) as a piecewise rule. The inside expression is \(x+1\), which is zero at

$$ x+1=0 \quad\Longrightarrow\quad x=-1. $$

For \(x<-1\), \(x+1<0\), so \(|x+1|=-(x+1)=-x-1\). For \(x\ge-1\), \(x+1\ge0\), so \(|x+1|=x+1\). Apply the multiplier \(2\) and then subtract \(4\) in each case:

$$ g(x)= \begin{cases} 2(-x-1)-4=-2x-2-4=-2x-6, & x<-1,\\ 2(x+1)-4=2x+2-4=2x-2, & x\ge-1. \end{cases} $$

Check \(x=-2\), which is in the first interval. The original formula gives \(2|-2+1|-4=2|-1|-4=2-4=-2\); the first branch gives \(-2(-2)-6=4-6=-2\). Check \(x=2\), which is in the second interval. The original gives \(2|2+1|-4=6-4=2\); the second branch gives \(2(2)-2=2\). At the breakpoint, the original gives \(2|0|-4=-4\), and the second branch gives \(2(-1)-2=-4\).

Absolute Values of Other Linear Expressions

The same sign-based method works when the expression inside the bars is \(mx+b\), where \(m\) and \(b\) are real numbers and \(m\ne0\). Its zero, and hence its breakpoint, is \(r=-b/m\). The sign on either side depends on whether the coefficient \(m\) is positive or negative.

Rule: If \(m>0\), then \(mx+b<0\) for \(x<r\), and \(mx+b\ge0\) for \(x\ge r\). If \(m<0\), those sign conditions are reversed. In either case, use \(mx+b\) where it is nonnegative and \(-(mx+b)\) where it is negative.

Solving \(mx+b=0\) identifies the breakpoint, but it is important not to assume that the inside expression increases as \(x\) increases. It increases when \(m>0\) and decreases when \(m<0\). Checking the sign on each side avoids reversing the pieces.

Worked Example: A Negative Coefficient Inside the Bars

Rewrite \(h(x)=|6-2x|+x\) as a piecewise rule. Find the zero of the expression inside the bars:

$$ 6-2x=0 \quad\Longrightarrow\quad -2x=-6 \quad\Longrightarrow\quad x=3. $$

Because the coefficient of \(x\) is negative, the inside expression is positive to the left of \(3\) and negative to its right. For example, \(6-2(0)=6>0\), while \(6-2(4)=-2<0\). Thus, for \(x\le3\), the absolute value leaves \(6-2x\) unchanged; for \(x>3\), it changes its sign:

$$ h(x)= \begin{cases} 6-2x+x=6-x, & x\le3,\\ -(6-2x)+x=-6+2x+x=3x-6, & x>3. \end{cases} $$

Check \(x=1\): the original gives \(|6-2|+1=4+1=5\), and the first branch gives \(6-1=5\). Check \(x=4\): the original gives \(|6-8|+4=2+4=6\), and the second branch gives \(3(4)-6=12-6=6\). At \(x=3\), the original gives \(|6-6|+3=3\); the first branch gives \(6-3=3\), and the second expression would also give \(3(3)-6=3\). The boundary value is consistent.

A Common Mistake: Choosing a Branch Before Checking the Sign

A frequent error is to replace \(|x-a|\) by \(x-a\) for every \(x\), as if absolute value always leaves its inside expression unchanged. That is true only where the inside expression is nonnegative. For instance, the incorrect calculation

$$ |x-2|=x-2 \quad \text{for all }x $$

would give \(|0-2|=0-2=-2\). But the definition gives \(|0-2|=|-2|=2\), so the claimed rule fails. Since \(0<2\), the correct branch is \(2-x\), and \(2-0=2\). The correction is to find where \(x-2\) is negative before removing the bars:

$$ |x-2|= \begin{cases} 2-x, & x<2,\\ x-2, & x\ge2. \end{cases} $$

The check is simple and reliable: choose a test input in each interval and compare the piecewise rule with the original absolute value. Also evaluate at the breakpoint, where the absolute value is zero.

Why Piecewise Rewrites Are Useful

A piecewise rewrite makes the linear behavior on each side of a breakpoint explicit. It can clarify which formula applies at a given input, support direct evaluation, and make it easier to compare an absolute value rule with other piecewise rules. It also prevents a common misunderstanding: the expression inside the bars is not always the output. Its sign determines whether it is kept or negated.

For a basic \(|x-a|\), the two pieces meet at \(x=a\), and both give zero there. If an expression has additional terms outside the bars, as in \(2|x+1|-4\) or \(|6-2x|+x\), the breakpoint still comes from setting the inside expression equal to zero. The outside terms are then included in each branch.

Takeaway: To rewrite an absolute value, find where its inside expression is zero, determine its sign on each side, and use the inside expression where it is nonnegative and its negative where it is negative. Check the boundary and at least one input from each interval.

Check Your Understanding

For each question, identify the breakpoint and use the sign of the inside expression to justify the pieces.

  1. Write \(|x-5|\) as a piecewise rule, and check the result at \(x=2\), \(x=5\), and \(x=7\).
  2. Rewrite \(3|x+2|+1\) as a piecewise rule. Which interval uses the negated inside expression?
  3. Find a piecewise rule for \(|4-2x|\). Explain why its left and right pieces are assigned as they are.
  4. A student claims \(|x+3|=x+3\) for all real \(x\). Give an input that disproves the claim and state the correct branch for that input.
  5. Why do the two branch formulas for \(|x-a|\) give the same value at \(x=a\)?

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