Lesson 1.2 · Functions and Linear Systems
Piecewise and absolute value functions
A phone plan charges a flat fee up to a data limit and then a per-gigabyte rate after that. A parking garage charges one price for the first hour and another for each hour after. In situations like these, one formula isn't enough: the rule changes depending on the input. Functions built this way are called piecewise functions, and the absolute value function is the most famous one.
What a piecewise function is
Definition
Piecewise function
A piecewise function uses different formulas on different parts of its domain. Each formula comes with a condition that says which inputs it applies to:
To evaluate a piecewise function, first decide which condition the input satisfies, then use only that formula. Each input gets exactly one output, so the conditions never overlap.
Worked example: Evaluating a piecewise function
Let
Find , , and .
- , so use the first piece: .
- satisfies (not ), so use the second piece: .
- satisfies : .
- , so use the third piece: .
Common mistake
Pay close attention to the boundary values. At above, it's tempting to use because it's listed first, but the condition does not include . Check versus every time you land exactly on a boundary.
Graphing piecewise functions
Graph each piece as if it were a whole function, but draw only the part over its own interval. Then mark each endpoint:
- a closed dot (filled) when the endpoint is included ( or ),
- an open dot (hollow) when it is not included ( or ).
Worked example: Graphing three pieces
Graph
Left piece. The line for . At it would reach , but is not included, so draw an open dot at and draw the line to the left.
Middle piece. The parabola from to . Both ends are included: closed dots at and .
Right piece. The horizontal line for , with an open dot at .
The graph "jumps" at and at . That's allowed. What's not allowed is two filled dots stacked at the same -value, because then one input would have two outputs.
Absolute value as a piecewise function
The absolute value of a number is its distance from . For a nonnegative number, that's the number itself. For a negative number, it's the opposite of the number (so ). That description is already a piecewise function:
The two pieces are lines with slopes and that meet at the vertex .
Graphing absolute value functions
From the previous lesson, every absolute value function can be written in the transformation form below.
Vertex form of an absolute value function
The graph of is a V with
- vertex ,
- slopes to the right of the vertex and to the left,
- opening up if (the vertex is a minimum) and down if (the vertex is a maximum).
To graph one, plot the vertex, then use the slope to step off a point on each side.
Worked example: A downward V
Graph . Find its -intercepts and range.
The vertex is and , so the V opens down. To the right of the vertex, the slope is : over , down , giving . To the left, the slope is as you move right, so moving left also goes down , giving .
-intercepts. Set :
Range. The highest point is the vertex, so the range is .
Rewriting absolute value without the bars
Sometimes you need an absolute value function as ordinary pieces, for instance to find where it equals a line. Split at the vertex, where the expression inside the bars equals .
Worked example: Writing an absolute value function in pieces
Write as a piecewise function with no absolute value bars.
The inside is negative when and nonnegative when .
- For : , so .
- For : , so .
Both pieces give at the boundary, which matches the vertex .
Tip
A quick check for any piecewise form of an absolute value function: both pieces must give the same value at the vertex, since the V is one connected graph. If they don't match, a sign is wrong.
Absolute value inequalities in two variables
An inequality like describes a region. Graph the boundary V (solid for or , dashed for or ), then shade the side that works. Test the origin: is true, so shade the side containing , which is the inside of the V.
Practice
Let . Find .
Enter a number. Fractions like 3/4 and sqrt(2) are OK.
Using the same function from the previous problem, find .
Enter a number. Fractions like 3/4 and sqrt(2) are OK.
What is the vertex of ?
Enter a point like (2, -3)
Find both -intercepts of .
Separate answers with commas, e.g. 2, -5
Which piecewise function is equal to ?
Which function is graphed below?
A shipping company charges $6.00 for a package weighing up to pounds. For heavier packages it charges $6.00 plus $1.50 for each pound over . The cost for a package weighing pounds is
What is the cost, in dollars, to ship a -pound package?
Enter a number. Fractions like 3/4 and sqrt(2) are OK.
The graph of passes through the point . Find .
Enter a number. Fractions like 3/4 and sqrt(2) are OK.