Graphing Piecewise-Defined Functions
Graphing Piecewise-Defined Functions
Sometimes, we come across a function that requires more than one formula in order to obtain the given output. For example, in the toolkit functions, we introduced the absolute value function . With a domain of all real numbers and a range of values greater than or equal to
, absolute value can be defined as the magnitude, or modulus, of a real number value regardless of sign. It is the distance from
on the number line. All of these definitions require the output to be greater than or equal to
.
If we input , or a positive value, the output is the same as the input.
If we input a negative value, the output is the opposite of the input.
Because this requires two different processes or pieces, the absolute value function is an example of a piecewise function. A piecewise function is a function in which more than one formula is used to define the output over different pieces of the domain.
We use piecewise functions to describe situations in which a rule or relationship changes as the input value crosses certain "boundaries". For example, we often encounter situations in business for which the cost per piece of a certain item is discounted once the number ordered exceeds a certain value. Tax brackets are another real-world example of piecewise functions. For example, consider a simple tax system in which incomes up to are taxed at
, and any additional income is taxed at
. The tax on a total income
would be
if
and
if
.
PIECEWISE FUNCTION
A piecewise function is a function in which more than one formula is used to define the output. Each formula has its own domain, and the domain of the function is the union of all these smaller domains. We notate this idea like this:
In piecewise notation, the absolute value function is
HOW TO
Given a piecewise function, write the formula and identify the domain for each interval.
- Identify the intervals for which different rules apply.
- Determine formulas that describe how to calculate an output from an input in each interval.
- Use braces and if-statements to write the function.
EXAMPLE 11
Writing a Piecewise Function
A museum charges per person for a guided tour with a group of 1 to 9 people or a fixed
fee for a group of 10 or more people. Write a function relating the number of people,
, to the cost,
.
Solution
Two different formulas will be needed. For -values under
. For values of
that are 10 or greater,
.
Analysis
The function is represented in Figure 23. The graph is a diagonal line from to
and a constant after that. In this example, the two formulas agree at the meeting point where
, but not all piecewise functions have this property.
Figure 23
EXAMPLE 12
Working with a Piecewise Function
A cell phone company uses the function below to determine the cost, , in dollars for
gigabytes of data transfer.
Find the cost of using gigabytes of data and the cost of using
gigabytes of data.
Solution
To find the cost of using gigabytes of data,
, we first look to see which part of the domain our input falls in. Because
is less than 2, we use the first formula.
To find the cost of using 4 gigabytes of data, , we see that our input of 4 is greater than 2, so we use the second formula.
Analysis
The function is represented in Figure 24. We can see where the function changes from a constant to a shifted and stretched identity at . We plot the graphs for the different formulas on a common set of axes, making sure each formula is applied on its proper domain.
Figure 24
HOW TO
Given a piecewise function, sketch a graph.
1. Indicate on the -axis the boundaries defined by the intervals on each piece of the domain.
2. For each piece of the domain, graph on that interval using the corresponding equation pertaining to that piece. Do not graph two functions over one interval because it would violate the criteria of a function.
EXAMPLE 13
Graphing a Piecewise Function
Sketch a graph of the function.
Solution
Each of the component functions is from our library of toolkit functions, so we know their shapes. We can imagine graphing each function and then limiting the graph to the indicated domain. At the endpoints of the domain, we draw open circles to indicate where the endpoint is not included because of a less-than or greater-than inequality; we draw a closed circle where the endpoint is included because of a less-than-or-equal-to or greater-than-or-equal-to inequality.
Figure 25 shows the three components of the piecewise function graphed on separate coordinate systems.
Analysis
Note that the graph does pass the vertical line test even at and
because the points
and
are not part of the graph of the function, though
and
are.
TRY IT #8
Graph the following piecewise function.
Q&A
Can more than one formula from a piecewise function be applied to a value in the domain?
No. Each value corresponds to one equation in a piecewise formula.
Source: Rice University, https://openstax.org/books/college-algebra/pages/3-2-domain-and-range
This work is licensed under a Creative Commons Attribution 4.0 License.