Skip to main content
\(\require{cancel} \newcommand{\lt}{<} \newcommand{\gt}{>} \newcommand{\amp}{&} \)

Section3.AAbsolute Value and Piecewise Functions

  • Solve absolute value equations.

  • Identify and understand translations of absolute value functions.

  • Graph and interpret absolute value and piecewise functions.

  • Determine the domain and range of piecewise functions.

This sections starts with a review of absolute value and then extends the concept to a larger class of functions called “piecewise” functions.

Subsection3.A.1Absolute Value Functions

There are a few ways to describe what is meant by the absolute value \(\lvert x\rvert\) of a real number \(x\text{.}\) You may have been taught that \(\lvert x\rvert\) is the distance from the real number \(x\) to \(0\) on the number line. So, for example, \(\lvert 5\rvert = 5\) and \(\lvert -5\rvert = 5\text{,}\) since each is \(5\) units from \(0\) on the number line.

Note that the distance from zero is a positive number and the absolute value function is often thought of as meaning “whatever comes in, a positive number comes out.” This notion works if you are only considering taking the absolute value of a number: \(\lvert 5 \rvert= 5\) and \(\lvert -5 \rvert= 5.\) But it's a little too simplistic if we consider the absolute value as a function. For functions, we need to keep the “distance” idea firmly in mind.

So, \(f(x) = \lvert x\rvert\) is the function that gives the distance between \(x\) to \(0.\) The domain of this function consists of all real numbers, but the range is \([0,\infty)\) since the distance is nonnegative. When \(x \geq 0\text{,}\) \(f(x) = x\) and the graph of this function is a line with slope \(1\) and vertical intercept \(0.\) When we graph values for negative \(x\)'s the function returns positive values. Mathematically, one way to change the sign on a number is to multiply it by \(-1\text{,}\) so we can say \(f(x) = -x\) if \(x \lt 0\text{.}\) This part of the graph, the section to the left of zero, is a line with slope \(-1\) and intercept \(0.\)

Now that we have the basic shape of the absolute value function, graphing translations of the function should be fairly straight forward.

Example3.A.1Translations of the Absolute Value Function

The function \(g(x) = \lvert x-2\rvert + 3\) is just the absolute value shifted \(2\) units to the right and up \(3\) units.

Notice that the domain remains \((-\infty,\infty)\text{,}\) but the range has been shifted. For \(g(x)\) the output values never get smaller than \(3,\) so the range is \([3,\infty).\)

The function \(h(x) = -3\lvert x+1\rvert\) is a flip over the \(x\)-axis, a vertical stretch by a factor of \(3\) and a shift left by \(1\) unit.

Once again, the domain is unchanged, all real numbers may be used for inputs. (Is there a pattern here?) The output values are all below the \(x\)-axis and so the range is \((-\infty,0].\)

You should be adept at working with absolute value equations by this time, but a little more practice may be helpful.

Example3.A.2Solve Absolute Value Equations

  1. Solve for \(x:\) \(\lvert 2x + 1\rvert = 5\)

    Think of this as \(\lvert \mbox{whatever} \rvert = 5\) and the “whatever” between the absolute value bars can be either \(5\) or \(-5\text{.}\) This gives two equations to solve. The work is shown side-by-side below (even though you probably can't work on both at the same time):

    \begin{align*} 2x + 1 \amp = 5 \amp\amp\text{ or }\amp 2x + 1 \amp = -5\\ 2x \amp = 4 \amp\amp\text{ or }\amp 2x \amp = -6\\ x \amp = 2 \amp\amp\text{ or }\amp x \amp = -3\checkmark \end{align*}
  2. Solve: \(4 - \lvert x - 3\rvert = -10\)

    We know how to deal with an absolute value expression that is equal to a number, so we will rewrite this equation in a form we know how to deal with:

    \begin{align*} 4 - \lvert x-3\rvert\amp =-10\\ -\lvert x-3\rvert\amp = -14\\ \lvert x-3\rvert\amp =14 \end{align*}

    Now, solve this the “usual” way:

    \begin{align*} x - 3\amp = 14\amp\amp\text{ or }\amp x - 3\amp = -14\\ x\amp = 17\amp\amp\text{ or }\amp x\amp = -11\checkmark \end{align*}

    The key idea is to isolate the absolute value on one side and then set up two equations to solve.

  3. Solve: \(\dfrac{\lvert 1-x\rvert}{5} = -2\)

    Notice that when we rewrite the equation to isolate the absolute value (by multiplying both sides by \(5\)) we get \(\lvert 1-x\rvert = -10\text{.}\) Since an absolute value does not output a negative value, there can be no solutions to the original equation. \(\text{No Solution.}\checkmark\)

Subsection3.A.2Piecewise Functions

  • Question: What do you get if you put a nonnegative number into an absolute value?
  • Answer: You get that same number back: \(\lvert 0 \rvert = 0\text{,}\) \(\lvert 1 \rvert= 1\text{,}\) \(\dots\) And so on.

We can say, as a generalization, that \(\lvert x \rvert= x\text{;}\) but only if \(x\) is nonnegative.

  • Question: What happens if you put a negative number into an absolute value?
  • Answer: You get that same number back, but made positive.

How do you make a negative number positive? As mentioned above, you multiply it by \(-1\text{:}\)\(\lvert -5 \rvert= -(-5) = 5\text{.}\) We can say, as a generalization, that \(\lvert x \rvert= -x\) when \(x\) is negative.

So the absolute value function can be defined in two pieces:

\begin{align*} \lvert x \rvert=\left\{\begin{array}{ccc} x , \amp x \geq 0\\ -x , \amp x \lt 0\end{array}\right. \end{align*}

If you've never seen this before, it looks extremely odd. If you try to pin that feeling down, I think you'll find this looks odd for some combination of these three reasons:

  1. The whole idea of a “piecewise function” – that is, a function which is defined differently on different domains – may be unfamiliar. Think about tax brackets when you file your Federal Income tax form. Incomes that fall in one bracket pay a different income rate than in another bracket. So, in fact, functions defined in this “piecewise manner” are more common than you might think.
  2. The \(-x\) looks suspicious. “I thought an absolute value could never be negative!” Well, that's right. But if \(x\) is negative, then \(-x\) is positive. Instead of thinking of the \(-x\) as “negative \(x\)” it may help to think of it as “change the sign of \(x\text{.}\)”
  3. Even if you get past those objections, you may feel that we have taken a perfectly ordinary, easy to understand function, and redefined it in a terribly complicated way. Why bother?

Surprisingly, the reason piecewise functions were “dreamed up” is because in many situations, they are the best model for the situation, – like tax brackets. Sometimes when you order items from a catalog, the price of an item decreases if you buy two or more items at a time. A function which models this situation could look like:

\begin{align*} \text{Cost of a t-shirt}=\left\{\begin{array}{ccc} 10 , \amp 1 \leq x \leq 2 \\ 9.50 , \amp 3 \leq x \leq 4 \\ 8, \amp x \geq 5\end{array}\right. \end{align*}

For this catalog, you pay \(\$10\) if you order one or two t-shirts, but the price per t-shirt drops to \(\$9.50\) if you order three or four and to \(\$8\) if you order five or more.

At this point, you should try working with piecewise functions to feel more comfortable with them.

Example3.A.3Using a Piecewise Function

Determine \(V(0)\) and \(V(5)\) where

\begin{align*} V(t) =\left\{\begin{array}{ccc} t^2+1, \amp t \leq 2 \\ 8, \amp t \gt 2\end{array}\right. \end{align*}

Since \(0\lt 2\text{,}\) we use the first piece of the function to find \(V(0) = 0^2+1 = 1\text{.}\)

The second piece is used to find \(V(5)\) since \(5\gt 2\text{.}\) In this case, \(V(5) = 8.\checkmark\)

Example3.A.4Graphing a Piecewise Function

Graphing a piecewise functions is pretty much like graphing an absolute value function. You just graph each piece of the function on the interval for which it is defined. Let's graph

\begin{align*} f(x) =\left\{\begin{array}{ccc} x+7 , \amp x \leq -2 \\ x^2 + 1 , \amp -2 \lt x \leq 1 \\ 3 , \amp x \gt 1\end{array}\right. \end{align*}

First visualize where the three pieces will be plotted. The domains of the “pieces” start or end at \(x=-2\) and \(x=1.\)

For values of \(x\) smaller than \(-2\) \(f(x)\) is defined by \(x +3\text{,}\) which is a line with slope \(1\) and \(y\)-intercept \(3\text{.}\)

So, we graph this line in it's domain – to the left of \(-2\text{.}\)

At \(x = -2\text{,}\) \(y=-2+7=-5\text{:}\) plot the point \((-2,-5)\text{.}\) Now, count off the slope by moving to the left of this point: one unit down to one unit going left which is \(\frac{-1}{-1} = 1\text{.}\) Draw the line.

To get the next “piece,” it needs to be plotted for its entire domain between \(-2\) and \(1\text{.}\)

Plot points and get the piece of \(f(x)\) where \(-2 \lt x \lt 1\text{:}\)

The last piece is a constant value of \(3\) for \(x \geq 1\text{:}\)

Of course, you don't need to do the three pieces on three different axes. The graph of \(f(x)\) consists of all three together: