In this explainer, we will learn how to graph and analyze a piecewise-defined function and study its different characteristics.
A piecewise function consists of multiple subfunctions defined over individual subdomains. The union of the subdomains makes up the overall piecewise function’s domain. The union of the ranges of the subfunctions makes up the range of the overall piecewise function.
The following data about an amusement park’s ticket prices can be modeled with a piecewise function.
|Amusement Park Ticket Prices|
The table presents three different ticket prices, which depend on the age of the park visitor. Modeling this will require three different subfunctions. We will also need to think carefully about how to interpret the age categories when selecting the domain of each subfunction. Age 5–12 covers people from the moment the clock strikes midnight at the start of their 5th birthday to the instant before the clock strikes midnight at the start of their 13th birthday. Age 13–18 covers people from the moment the clock strikes midnight at the start of their 13th birthday to the instant before the clock strikes midnight at the start of their 19th birthday. Age covers people from the moment the clock strikes midnight at the start of their 19th birthday onward.
Let’s define to be the age (in years) of the park visitor and to be the price of a visitor’s ticket (in dollars). We can then write a definition of our function :
Now, let’s consider how to graph this function. We will need to examine each subdomain separately.
Park visitors aged 5–12 are all charged $8.50, so the value of is equal to 8.5 when . This is represented by a horizontal line on our graph with a -value of 8.5 and -values from 5 (including 5, represented by a solid dot) up to 13 (excluding 13, represented by a hollow dot). We have represented this with the pink line on our graph below.
Park visitors aged 13–18 are all charged $12, so the value of is equal to 12 when . This is represented by a horizontal line on our graph with a -value of 12 and -values from 13 (including 13, represented by a solid dot) up to 19 (excluding 19, represented by a hollow dot). We have represented this with the blue line on our graph below.
Park visitors aged are all charged $15, so the value of is equal to 15 when . This is represented by a horizontal line on our graph with a -value of 15 and -values from 19 (including 19, represented by a solid dot) upward (represented by a ray pointing to the right). Although people do not live forever, the pricing model is defined so that, no matter how old you get, if you are 19 years of age, or older, you will be charged $15 to visit the park. We have represented this with the green ray on our graph below.
Although, in many piecewise functions, the definitions of the subfunctions may be much more complicated than the constant functions in our amusement park example, the principle is the same for graphing them. We need to consider the graph for each subdomain individually, look at what will happen at each end of each subfunction, and graph them alongside each other on the same set of axes.
The piecewise function we defined for the amusement park ticket prices, and have graphed, is only defined for all real -values of 5 or more. Therefore, the domain of the overall function can be written as an inequality, , using interval notation as or in set notation as .
The values that the function can take are only , , or . Therefore, the range of the overall function can be written in set notation as .
Now, let’s consider some examples where we have to work with graphs of piecewise-defined functions.
Example 1: Identifying the Type of Function Represented in a Graph
What kind of function is depicted in the graph?
- An even function
- A logarithmic function
- A piecewise function
- A polynomial function
Let’s consider each of the options.
- An even function is one for which for all values of in the domain of . This means that even functions are symmetrical about the -axis, which is not the case with the given graph. For example, , but , so ; therefore, the function is not even.
- The logarithm of a particular value, say , is the exponent to which another base number has to be raised to produce . Graphs of logarithmic functions have smooth curves which are asymptotic to the -axis, as we can see in the examples below, or they may be transformed. The given graph has sharp corners at and , so it is not smooth across its entire domain, and it also has no vertical asymptotes. Also, logarithmic functions are not defined for negative values of ; in other words, their domain is the set of positive real numbers. The given graph represents a function that has a domain of at least , which includes some negative -values, so the given graph does not look like a logarithmic function.
- The graph of this function consists of three distinct subfunctions.
- For -values between and , the graph is a straight line with slope 1. We could write the equation for this line in the form , where is the slope (1) and is the -intercept, so . We also see that the line passes through the point , so when , which enables us to calculate the value of as 5. Hence, we could write the equation as .
- For -values from to 0, the graph is a horizontal line such that the -value is always 2, so we can write the equation of this line as .
- For -values from 0 to , the graph is again a straight line with slope 1. This time, we can see that the -intercept is 2, so we can write the equation as .
However, from the graph, we can see that the values of the subfunctions are the same as their neighbors at their common endpoints; in other words, the subfunctions join to make a continuous function. It would be equally valid to define the subfunctions as having slightly different subdomains by rearranging which subfunction the points of connection belong to. In this situation, where the allocation is arbitrary, it is conventional to include the left endpoint and exclude the right endpoint from subfunctions.
The fact that our function has to be defined in terms of a series of subfunctions over specific subdomains makes it a piecewise function.
- Polynomial functions involve the addition, subtraction, and multiplication of coefficients and variables with nonnegative integer exponents. The graphs of polynomial functions produce smooth curves and can be defined by a single polynomial equation. The given graph has two points that are not smooth, when and , so it is not the graph of a polynomial function.
Therefore, the function depicted in the graph is a piecewise function (option C).
In our next example, we will examine the endpoints of each subfunction on a graph of a piecewise-defined function to find its domain.
Example 2: Finding the Domain of a Piecewise Function given Its Graph
Determine the domain of the function represented by the given graph.
The domain of a function is the set of all values where the function is defined. On the graph of a function, the domain is all of the -values where the curve is drawn. For a piecewise-defined function, the domain will be the union of the subdomains of each subfunction. This piecewise-defined function has two subfunctions.
The first subfunction is a ray with a hollow dot at . The hollow dot indicates this subfunction is undefined at and, therefore, has a right open interval. The arrow indicates that the subfunction continues indefinitely in the direction of that arrow, here toward negative infinity. Therefore, the first subfunction has a subdomain of
The second subfunction is a ray with a hollow dot at . The hollow dot indicates this subfunction is also not defined for and, therefore, has a left open interval. The arrow indicates this subfunction continues indefinitely in the direction of the arrow, which here is toward positive infinity. Therefore, the domain of the second subfunction will be
The union of these subdomains is
The union of these two subdomains will include all real numbers except for ,
Graphically, we can find the domain by looking at vertical lines on the graph and seeing where they cross a given function. In this case, the vertical line at only intersects the hollow dots of each subfunction.
Neither subfunction is defined for , which means this piecewise function is not defined at . Therefore, the domain of this piecewise-defined function will be the set of all real numbers except for ,
In the previous example, we saw that the domain of a piecewise-defined function is the union of the subdomains for each of the subfunctions. In our next example, we will show the range of a piecewise-defined function will be equal to the union of the ranges of each subfunction over their respective subdomains.
Example 3: Determining the Range of a Piecewise Function from Its Graph
Find the range of the function.
On the given graph, we can identify two specific subfunctions making this a piecewise function. The range of a function is the set of all possible output values for a function, given its domain. The range of a piecewise-defined function is the union of the ranges of each subfunction over their respective subdomains.
We can identify values in the range using horizontal lines. If a horizontal line intersects the graph of our function, then the value of the horizontal line is part of the range. For this piecewise function, the horizontal line intersects the graph of one of the subfunctions, which means 3 is included in the range of this subfunction.
From the graph, we see the behavior of the subfunction that begins at and continues indefinitely toward positive infinity. Any horizontal line above will intersect this subfunction and must be included in the range.
Any horizontal line between and will intersect this subfunction, making its range
It is worth noting here that the other subfunction is the horizontal line over its subdomain .
Therefore, is the only value in the set for the range. The range of this subfunction over its subdomain will be
The union of the ranges for these two subfunctions over their respective subdomains is
Therefore, the range of this piecewise-defined function is
In our next example, we will use the graph of a piecewise-defined function to find a formal definition of the function.
Example 4: Defining a Piecewise Functions from a Given Graph
Give the piecewise definition of the function whose graph is shown.
A piecewise function consists of two or more subfunctions. To define a piecewise function, we need an expression for each of the subfunctions and the subdomains for each of the subfunctions. We will first identify how many subfunctions are part of this piecewise function by looking at the behavior of the graph. In this case, there are two subfunctions.
We have a straight line with a negative slope that ends at and another straight line that begins at and has a positive slope. Each of these lines will form a subfunction of this piecewise function over its respective subdomain. So, we define an equation in terms of for each subfunction and identify their respective subdomains.
The slope-intercept form of a line tells us a line of slope and -intercept has the equation . The slope equals .
The straight line with the negative slope has a -intercept at 3. The slope is identifiable from the graph without doing any formal calculations. As the -value increases by one unit, the -value decreases by one unit.
Therefore, . Hence,
Therefore, the first subfunction is defined as
However, we still need to identify the subdomain of this subfunction; we can graph a vertical line at , and we can confirm that 2 is included in the domain of this piecewise function since it crosses the curve at .
On the graph, 2 appears to be part of both of the subfunctions’ domains. However, when we are defining a piecewise function, we only include 2 in one of the subfunctions’ domains so their domains do not overlap. This is usually determined by the context of the question. As we only have the graph without any other data, we will just let the first subfunction be defined for the subdomain
Therefore, the second subfunction would be defined for the subdomain .
It would be equally valid to define the subfunctions as having slightly different subdomains by rearranging which subfunction the points of connection belong to. In this situation, where the allocation is arbitrary, it is conventional to include the left endpoint, and exclude the right endpoint from subfunctions.
Now that we have defined each subdomain, we use the graph to write a formula for the second subfunction over its subdomain.
The straight line of the second subfunction models the -value increasing by 1 unit as the -value increases by 2 units. Therefore, . We can then identify the -intercept graphically by extending the line to see where this subfunction would cross the -axis if it was part of the domain.
The -intercept of the second subfunction would be 0. Therefore, the formula for the second subfunction is
Combining these two subfunction rules over their respective subdomains defines this piecewise function as
In example 5, we will use the graph of a piecewise-defined function to find a formal definition of the function for a piecewise function with more than two subfunctions.
Example 5: Defining a Piecewise Function from a Given Graph Including a Discontinuity
Give the piecewise definition of the function whose graph is shown.
A piecewise function consists of two or more subfunctions. To define a piecewise function, we need the formula for each of the subfunctions and their respective subdomains. Three distinct behaviors are shown in this graph.
Therefore, we will need to write a total of three expressions and find three subdomains, one for each subfunction.
For straight lines, we can write the equation using the slope-intercept form, , where is the -intercept and is the slope. The slope equals .
For this line, the change in is 1 unit right and the change in is 1 unit down. Therefore, , which simplifies to . The -intercept is 3. Therefore, the expression for this subfunction over its subdomain is
The subdomain of this subfunction is equal to the set of all input values for this subfunction. The hollow endpoint indicates that the upper bound of this subdomain must be an open interval. Therefore, the subdomain would be the open interval from .
The next subfunction has a closed point at .
The closed point at shows the constant function where the subdomain is .
The third subfunction has a hollow dot at and continues indefinitely. Therefore, the subdomain of this subfunction is the interval .
For this subfunction, the -value increases by 2 units as the -value increases by 1 unit. Therefore, . We can then identify the -intercept graphically by extending the line to see where this subfunction would cross the -axis if it was part of its subdomain.
The -intercept for this subfunction is 2. Therefore, the formula for the third subfunction over its subdomain is
Combining each of these three subfunctions in the format for piecewise-defined functions:
Our final example further explores how open and closed intervals for subdomains of piecewise-defined functions are graphed.
Example 6: Identifying the Graph of a Piecewise Function from Its Definition
State which of the following graphs represents the function
We are given the piecewise-defined function
This piecewise-defined function consists of two subfunctions over specified subdomains. The first subfunction is a quadratic function over the subdomain . To graph this quadratic, we can use the subdomain to create a table of input and output values. We know that the subdomain for this function is values of that are less than 2.
Using the table, we can plot these points on a graph. Notice the point on the graph is hollow since is not included in the subdomain of .
Sketching a line through these coordinates produces a graph of over the subdomain .
The second subfunction , is a linear function. Again, we can use the given subdomain to create a table of input and output values to graph this subfunction. For this subfunction, the subdomain is ; therefore, the value is included in the domain.
Next, plot these points onto the same grid as the first subfunction.
Notice that, for the second subfunction, at , we include a solid point since 2 is included in the subdomain for .
Lastly, we sketch a line beginning at and extending through , remembering that this line continues indefinitely in that direction.
By graphing this piecewise-defined function, we have shown that only option D correctly represents this function.
Let’s finish by recapping some basic points.
- A piecewise function consists of multiple subfunctions defined over subdomains.
- A hollow dot on the curve of a function means the function is not defined at this point.
- A filled-in dot on the curve of a function means the function is defined at this point.
- To graph a piecewise-defined function:
- consider each subfunction on its subdomain separately,
- look at what happens at the endpoints of each subfunction’s domain,
- graph each subfunction on the same set of axes.