Skip to main content
\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)
Mathematics LibreTexts

4.2: Absolute Value

  • Page ID
    19700
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    Now that we have the fundamentals of piecewise-defined functions in place, we are ready to introduce the absolute value function. First, let’s state a trivial reminder of what it means to take the absolute value of a real number.

    In a sense, the absolute value of a number is a measure of its magnitude, sans (without) its sign. Thus,

    \[|7|=7 \qquad \text { and } \qquad |-7| =7\]

    Here is the formal definition of the absolute value of a real number.

    Definition

    To find the absolute value of any real number, first locate the number on the real line.

    WeChatfe21ab7cdaad1f1de591d514b27d3961.png

    The absolute value of the number is defined as its distance from the origin.

    For example, to find the absolute value of 7, locate 7 on the real line and then find its distance from the origin.

    WeChata761aa5433a8c3d11266fd5abcd2913b.png

    To find the absolute value of −7, locate −7 on the real line and then find its distance from the origin.

    WeChatc39901c112b7c3e585128057661b2373.png

    Some like to say that taking the absolute value “produces a number that is always positive.” However, this ignores an important exception, that is,

    \[|0|=0\]

    Thus, the correct statement is “the absolute value of any real number is either positive or it is zero,” i.e., the absolute value of a real number is “not negative.”2 Instead of using the phrase “not negative,” mathematicians prefer the word “nonnegative.” When we take the absolute value of a number, the result is always nonnegative; that is, the result is either positive or zero. In symbols,

    \[|x| \geq 0 \text { for all real numbers } x\]

    This makes perfect sense in light of Definition 2. Distance is always nonnegative.

    However, the discussion above is not of sufficient depth to handle more sophisticated problems involving absolute value.

    A Piecewise Definition of Absolute Value

    Because absolute value is intimately connected with distance, mathematicians and scientists find it an invaluable tool for measurement and error analysis. However, we will need a formulaic definition of the absolute value if we want to use this tool in a meaningful way. We need to develop a piecewise definition of the absolute value function, one that will define the absolute value for any arbitrary real number x.

    We begin with a few observations. Remember, the absolute value of a number is always nonnegative (positive or zero).

    1. If a number is negative, negating that number will make it positive. | − 5| = −(−5) = 5, and similarly, | − 12| = −(−12) = 12. Thus, if x < 0 (if x is negative), then |x| = −x.
    2. If x = 0, then |x| = 0.
    3. If a number is positive, taking the absolute value of that number will not change a thing.

    \[|5|=5, \text { and similarly, }|12|=12\]

    Thus, if \(x>0\) (if \(x\) is positive), then \(|x|=x\).

    We can summarize these three cases with a piecewise definition.

    \[|x|=\left\{\begin{array}{ll}{-x,} & {\text { if } x<0} \\ {0,} & {\text { if } x=0} \\ {x,} & {\text { if } x>0}\end{array}\right.\]

    It is the first line in our piecewise definition (4) that usually leaves students scratching their heads. They might say “I thought absolute value makes a number positive (or zero), yet you have \(|x| = −x\); that is, you have the absolute value of x equal to a negative x.” Try as they might, this seems contradictory. Does it seem so to you?

    However, there is no contradiction. If x < 0, that is, if x is a negative number, then −x is a positive number, and our intuitive notion of absolute value is not dissimilar to that of our piecewise definition (4). For example, if x = −8, then −x = 8, and even though we say “negative x,” in this case −x is a positive number.

    If this still has you running confused, consider the simple fact that x and −x must have “opposite signs.” If one is positive, the other is negative, and vice versa. Consequently,

    • if x is positive, then −x is negative, but
    • if x is negative, then −x is positive.

    Let’s summarize what we’ve learned thus far.

    Summarizing the Definition on a Number Line

    We like to use a number line to help summarize the definition of the absolute value of x.

    WeChatd6ba895737ff52a6a145279fafa8da67.png

    Some remarks are in order for this summary on the number line.

    • We first draw the real line then mark the “critical value” for the expression inside the absolute value bars on the number line. The number zero is a critical value for the expression x, because x changes sign as you move from one side of zero to the other.
    • To the left of zero, x is a negative number. We indicate this with the minus sign below the number line. To the right of zero, x is a positive number, indicated with a plus sign below the number line.
    • Above the number line, we simplify the expression |x|. To the left of zero, x is a negative number (look below the line), so |x| = −x. Note how the result −x is placed above the line to the left of zero. Similarly, to the right of zero, x is a positive number (look below the line), so |x| = x. Note how the result x is placed above the line to the right of zero.

    In the piecewise definition of |x| in (4), note that we have three distinct pieces, one for each case discussed above. However, because |0| = 0, we can include this case with the piece |x| = x, if we adjust the condition to include zero.

    Definition

    \[|x|=\left\{\begin{array}{ll}{-x,} & {\text { if } x<0} \\ {x,} & {\text { if } x \geq 0}\end{array}\right.\]

    Note that this piecewise definition agrees with our discussion to date.

    1. In the first line of equation (6), if x is a negative number (i.e., if \(x < 0\)), then the absolute value must change x to a positive number by negating. That is, |x| = −x.
    2. In the second line of equation (6), if x is positive or zero (i.e., if \(x \geq 0\)), then there’s nothing to do except remove the absolute value bars. That is, |x| = x.

    Because |0| = −0, we could just as well include the case for zero on the left, defining the absolute value with

    \[|x|=\left\{\begin{array}{ll}{-x,} & {\text { if } x \leq 0} \\ {x,} & {\text { if } x>0}\end{array}\right.\]

    However, in this text we will always include the critical value on the right, as shown in Definition 5.

    Constructing Piecewise Definitions

    Let’s see if we can determine piecewise definitions for other expressions involving absolute value.

    Example \(\PageIndex{1}\)

    Determine a piecewise definition for |x − 2|.

    Solution

    First, set the expression inside the absolute value bars equal to zero and solve for x.

    \[\begin{aligned} x-2 &=0 \\ x &=2 \end{aligned}\]

    Note that x − 2 = 0 at x = 2. This is the “critical value” for this expression. Draw a real line and mark this critical value of x on the line. Place the expression x − 2 below the line at its left end.

    WeChatcde0f7a6577ffaa8ef9bef52276b8462.png

    Next, determine the sign of x − 2 for values of x on each side of 2. This is easily done by “testing” a point on each side of 2 in the expression x − 2.

    • Take x = 1, which lies to the left of the critical value 2 on our number line. Substitute this value of x in the expression x − 2, obtaining

    \[x-2=1-2=-1\]

    which is negative. Indeed, regardless of which x-value you pick to the left of 2, when inserted into the expression x − 2, you will get a negative result (you should check this for other values of x to the left of 2). We indicate that the expression x − 2 is negative for values of x to the left of 2 by placing a minus (−) sign below the number line to the left of 2.

    WeChata4b5e37ed22bde976a06d30e0de4c72e.png

    • Next, pick x = 3, which lies to the right of the critical value 2 on the number line. Substitute this value of x into the expression x − 2, obtaining

    \[x-2=3-2=1\]

    which is positive. Indeed, regardless of which x-value you pick to the right of 2, when inserted into the expression x − 2, you will get a positive result (you should check this for other values of x to the right of 2). We indicate that the expression x − 2 is positive for values of x to the right of 2 by placing a plus (+) sign below the number line to the right of 2 (see the number line above).

    The next step is to remove the absolute value bars from the expression |x−2|, depending on the sign of x − 2.

    • To the left of 2, the expression x − 2 is negative (note the minus sign (−) below the number line), so |x − 2| = −(x − 2). That is, we have to negate x − 2 to make it positive. This is indicated by placing −(x − 2) above the line to the left of 2.

    WeChat5d2a2507db05ef85ac6bd6f581abc31d.png

    • To the right of 2, the expression x − 2 is positive (note the plus sign (+) below the line), so |x − 2| = x − 2. That is, we simply remove the absolute value bars because the quantity inside is already positive. This is indicated by placing x − 2 above the line to the right of 2 (see the number line above).

    We can use this last number line summary to construct a piecewise definition of the expression |x − 2|.

    \[|x-2|=\left\{\begin{array}{ll}{-(x-2),} & {\text { if } x<2,} \\ {x-2,} & {\text { if } x \geq 2}\end{array}=\left\{\begin{array}{ll}{-x+2,} & {\text { if } x<2} \\ {x-2,} & {\text { if } x \geq 2}\end{array}\right.\right.\]

    Our number line and piecewise definition agree: |x − 2| = −(x − 2) to the left of 2 and |x − 2| = x − 2 to the right of 2. Further, note how we’ve included the critical value of 2 “on the right” in our piecewise definition.

    Let’s summarize the method we followed to construct the piecewise function above.

    Constructing a Piecewise Definition for Absolute Value

    When presented with the absolute value of an algebraic expression, perform the following steps to remove the absolute value bars and construct an equivalent piecewise definition.

    1. Take the expression that is inside the absolute value bars, and set that expression equal to zero. Then solve for x. This value of x is called a “critical value.” (Note: The expression inside the absolute value bars could have more than one critical value. We will not encounter such problems in this text.)
    2. Place your critical value on a number line.
    3. Place the expression inside the absolute value bars below the number line at the left end.
    4. Test the sign of the expression inside the absolute value bars by inserting a value of x from each side of the critical value and marking the result with a plus (+) or minus (−) sign below the number line.
    5. Place the original expression, the one including the absolute value bars, above the number line at the left end.
    6. Use the sign of the expression inside the absolute value bars (indicated by the plus and minus signs below the number line) to remove the absolute value bars, placing the results above the number line on each side of the critical value.
    7. Construct a piecewise definition that mimics the results on the number line.

    Let’s apply this technique to another example.

    Example \(\PageIndex{2}\)

    Determine a piecewise definition for |3 − 2x|.

    Solution

    Step 1: First set the expression inside the absolute value bars equal to zero and solve for x.

    \[\begin{aligned} 3-2 x &=0 \\ x &=3 / 2 \end{aligned}\]

    Note that 3 − 2x = 0 at x = 3/2. This is the “critical value” for this expression.

    Steps 2 and 3: Draw a number line and mark this critical value on the line. The next step requires that we place the expression inside the absolute value bars, namely 3 − 2x, underneath the line at its left end.

    WeChatf8b53e9cd145037bb92c2487876b4dcc.png

    Step 4: Next, determine the sign of 3 − 2x for values of x on each side of 3/2. This is easily done by “testing” a point on each side of 3/2 in the expression 3 − 2x.

    • Take x = 1, which lies to the left of 3/2. Substitute this value of x into the expression 3 − 2x, obtaining \[3-2 x=3-2(1)=1\] which is positive. Indicate this result by placing a plus sign (+) below the number line to the left of 3/2.

    WeChat8da60f46fba3967ac0b8402201967d12.png

    • Next, pick x = 2, which lies to the right of 3/2. Substitute this value of x into the expression 3 − 2x, obtaining \[3-2 x=3-2(2)=-1\] which is negative. Indicate this result by placing a negative sign (−) below the line to the right of 3/2 (see the number line above).

    Steps 5 and 6: Place the original expression, namely |3 − 2x|, above the number line at the left end. The next step is to remove the absolute value bars from the expression |3 − 2x|.

    • To the left of 3/2, the expression 3 − 2x is positive (note the plus sign (+) below the number line), so |3−2x| = 3−2x. Indicate this result by placing the expression 3 − 2x above the number line to the left of 3/2.

    WeChate88fa939bcad9116505b9db0e36610c4.png

    • To the right of 3/2, the expression 3−2x is negative (note the minus sign (−) below the numberline), so |3−2x| = −(3−2x). That is, we have to negate 3−2x to make it positive. This is indicated by placing the expression −(3 − 2x) above the line to the right of 3/2 (see the number line above).

    Step 7: We can use this last number line summary to write a piecewise definition for the expression |3 − 2x|.

    \[|3-2 x|=\left\{\begin{array}{ll}{3-2 x,} & {\text { if } x<3 / 2 .} \\ {-(3-2 x),} & {\text { if } x \geq 3 / 2}\end{array}=\left\{\begin{array}{ll}{3-2 x,} & {\text { if } x<3 / 2} \\ {-3+2 x,} & {\text { if } x \geq 3 / 2}\end{array}\right.\right.\]

    Again, note how we’ve included the critical value of 3/2 “on the right.”

    Drawing the Graph of an Absolute Value Function

    Now that we know how to construct a piecewise definition for an expression containing absolute value bars, we can use what we learned in the previous section to draw the graph.

    Example \(\PageIndex{3}\)

    Sketch the graph of the function f(x) = |3 − 2x|.

    Solution

    In Example \(\PageIndex{2}\), we constructed the following piecewise definition.

    \[f(x)=|3-2 x|=\left\{\begin{array}{ll}{3-2 x,} & {\text { if } x<3 / 2} \\ {-3+2 x,} & {\text { if } x \geq 3 / 2}\end{array}\right.\]

    We now sketch each piece of this function.

    • If x < 3/2, then f(x) = 3 − 2x (see equation (10)). This is a ray, starting at x = 3/2 and extending to the left. At x = 3/2,

    \[f(3 / 2)=3-2(3 / 2)=3-3=0\]

    Thus, the endpoint of the ray is located at (3/2, 0).

    Next, pick a value of x that lies to the left of 3/2. At x = 0,

    \[f(0)=3-2(0)=3-0=3\]

    Thus, a second point on the ray is (0, 3).

    A table containing the two evaluated points and a sketch of the accompanying ray are shown in Figure \(\PageIndex{1}\). Because f(x) = 3 − 2x only if x is strictly less than 3/2, the point at (3/2, 0) is unfilled.

    WeChat2c8e9cc2c837b034a14b7ab0d6cba1d9.png

    Figure \(\PageIndex{1}\). f(x) = 3 − 2x when x < 3/2.

    • If x ≥ 3/2, then f(x) = −3 + 2x (see equation (10)). This is a ray, starting at x = 3/2 and extending to the right. At x = 3/2, \[f(3 / 2)=-3+2(3 / 2)=-3+3=0\] 

    Thus, the endpoint of the ray is located at (3/2, 0).

    Next, pick a value of x that lies to the right of 3/2. At x = 3, \[f(3)=-3+2(3)=-3+6=3\] 

    Thus, a second point on the ray is (3, 3). A table containing the two evaluated points and a sketch of the accompanying ray are shown in Figure \(\PageIndex{2}\). Because f(x) = −3 + 2x for all values of x that are greater than or equal to 3/2, the point at (3/2, 0) is filled in this plot.

    WeChat3613b3f7c1afba3a162e113ba0c40789.png

    Figure \(\PageIndex{2}\). f(x) = −3 + 2x when \(x \geq 3/2\).

    • To sketch the graph of f(x) = |3 − 2x|, we need only combine the two pieces from Figures \(\PageIndex{1}\) and \(\PageIndex{2}\). The result is shown in Figure \(\PageIndex{3}\).

    WeChatb2a984d19c2b20f7acf88440c04a68d2.png

    Figure \(\PageIndex{3}\). The graph of f(x) = |3 − 2x|.

    Note the “V-shape” of the graph. We will refer to the point at the tip of the “V” as the vertex of the absolute value function.

    In Figure \(\PageIndex{3}\), the equation of the left-hand branch of the “V” is y = 3 − 2x. An alternate approach to drawing this branch is to note that its graph is contained in the graph of the full line y = 3 − 2x, which has slope −2 and y-intercept at (0, 3). Thus, one could draw the full line using the slope and y-intercept, then erase that part of the line that lies to the right of x = 3/2. A similar strategy would work for the right-hand branch of y = |3 − 2x|.

    Using Transformations

    Consider again the basic definition of the absolute value of x.

    \[f(x)=|x|=\left\{\begin{array}{ll}{-x,} & {\text { if } x<0} \\ {x,} & {\text { if } x \geq 0}\end{array}\right.\]

    Some basic observations are:

    • If x < 0, then f(x) = −x. This ray starts at the origin and extends to the left with slope −1. Its graph is pictured in Figure \(\PageIndex{4}\)(a).
    • If \(x \geq 0\), then f(x) = x. This ray starts at the origin and extends to the right with slope 1. Its graph is pictured in Figure \(\PageIndex{4}\)(b).
    • We combine the graphs in Figures \(\PageIndex{4}\)(a) and \(\PageIndex{4}\)(b) to produce the graph of f(x) = |x| in Figure \(\PageIndex{4}\)(c).

    WeChatb35cead7dee4a378f294d349de9abfd4.png

    Figure \(\PageIndex{4}\). Combine left and right branches to produce the basic graph of f(x) = |x|.

    You should commit the graph of f(x) = |x| to memory. Things to note:

    • The graph of f(x) = |x| is “V-shaped.”
    • The vertex of the graph is at the point (0, 0).
    • The left-hand branch has equation y = −x and slope −1.
    • The right-hand branch has equation y = x and slope 1.
    • Each branch of the graph of f(x) = |x| forms a perfect 45◦ angle with the x-axis.

    Now that we know how to draw the graph of f(x) = |x|, we can use the transformations we learned in Chapter 2 (sections 5 and 6) to sketch a number of simple graphs involving absolute value.

    Example \(\PageIndex{4}\)

    Sketch the graph of f(x) = |x − 3|.

    Solution

    First, sketch the graph of y = f(x) = |x|, as shown in Figure \(\PageIndex{5}\)(a). Note that if f(x) = |x|, then

    \[y=f(x-3)=|x-3|\]

    To sketch the graph of y = f(x − 3) = |x − 3|, shift the graph of y = f(x) = |x| three units to the right, producing the result shown in Figure \(\PageIndex{5}\)(b).

    WeChat524d23968d3e5cdb28aaa257acc37620.png

    Figure \(\PageIndex{5}\). To draw the graph of y = |x − 3|, shift the graph of y = |x| three units to the right.

    We can check this result using the graphing calculator. Load the function f(x) = |x − 3| into Y1 in the Y= menu on your graphing calculator as shown in Figure \(\PageIndex{6}\)(a). Push the MATH button, right-arrow to the NUM menu, then select 1:abs( (see Figure \(\PageIndex{6}\)(b)) to enter the absolute value in Y1. Push the ZOOM button, then select 6:ZStandard to produce the image shown in Figure \(\PageIndex{6}\)(c).

    WeChat16d0696921470053ece851cd33a69cf9.png

    Figure \(\PageIndex{6}\). Using the graphing calculator to draw the graph of f(x) = |x − 3|.

    Let’s look at another simple example.

    Example \(\PageIndex{5}\)

    Sketch the graph of f(x) = |x| − 4.

    Solution

    First, sketch the graph of y = f(x) = |x|, as shown in Figure \(\PageIndex{7}\)(a). Note that if f(x) = |x|, then \[y=f(x)-4=|x|-4\]

    To sketch the graph of y = f(x) − 4 = |x| − 4, shift the graph of y = f(x) = |x| downward 4 units, producing the result shown in Figure \(\PageIndex{5}\)(b).

    WeChat58998e76a8afc038b41ce420e0686609.png

    Figure \(\PageIndex{7}\). To draw the graph of y = |x| − 4, shift the graph of y = |x| downward 4 units.

    Let’s look at one final example.

    Example \(\PageIndex{6}\)

    Sketch the graph of f(x) = −|x| + 5. State the domain and range of this function.

    Solution

    • First, sketch the graph of y = f(x) = |x|, as shown in Figure \(\PageIndex{8}\)(a).
    • Next, sketch the graph of y = −f(x) = −|x|, which is a reflection of the graph of y = f(x) = |x| across the x-axis and is pictured in Figure \(\PageIndex{8}\)(b).
    • Finally, we will want to sketch the graph of y = −f(x) + 5 = −|x| + 5. To do this, we shift the graph of y = −f(x) = −|x| in Figure \(\PageIndex{8}\)(b) upward 5 units to produce the result in Figure \(\PageIndex{8}\)(c).

    To find the domain of f(x) = −|x| + 5, project all points on the graph onto the x-axis, as shown in Figure \(\PageIndex{9}\)(a). Thus, the domain of f is \((-\infty, \infty)\). To find the range, project all points on the graph onto the y-axis, as shown in Figure \(\PageIndex{9}\)(b). Thus, the range is \((-\infty, 5]\).

    WeChat1ba1933705a816e6e2028e4ee7afd8f4.png

    Figure \(\PageIndex{8}\). To draw the graph of y = −|x| + 5, first reflect the graph of y = |x| across the x-axis to produce the graph of y = −|x|, then shift this result up 5 units to produce the graph of y = −|x| + 5.

    WeChat595353df8fad83065a7e84ba8d2a5174.png

    Figure \(\PageIndex{9}\). Projecting onto the axes to find the domain and range.