Lesson Explainer: Graphs of Piecewise Functions | Nagwa Lesson Explainer: Graphs of Piecewise Functions | Nagwa

Lesson Explainer: Graphs of Piecewise Functions Mathematics • Second Year of Secondary School

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
AgePrice
5–12$8.50
13–18$12
19+$15

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 19+ 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 𝑓(π‘₯): 𝑓(π‘₯)=8.55≀π‘₯<13,1213≀π‘₯<19,15π‘₯β‰₯19.

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 5≀π‘₯<13. 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 13≀π‘₯<19. 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 19+ are all charged $15, so the value of 𝑓(π‘₯) is equal to 15 when π‘₯β‰₯19. 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, π‘₯β‰₯5, using interval notation as [5,∞[ or in set notation as {π‘₯βˆˆβ„βˆ£π‘₯β‰₯5}.

The values that the function can take are only 𝑓(π‘₯)=8.5, 𝑓(π‘₯)=12, or 𝑓(π‘₯)=15. Therefore, the range of the overall function can be written in set notation as {8.5,12,15}.

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?

  1. An even function
  2. A logarithmic function
  3. A piecewise function
  4. A polynomial function

Answer

Let’s consider each of the options.

  1. 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, 𝑓(5)=7, but 𝑓(βˆ’5)=0, so 𝑓(5)≠𝑓(βˆ’5); therefore, the function is not even.
  2. 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 π‘₯=βˆ’3 and π‘₯=0, 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 βˆ’10<π‘₯<8, which includes some negative π‘₯-values, so the given graph does not look like a logarithmic function.
  3. The graph of this function consists of three distinct subfunctions.
    1. For π‘₯-values between βˆ’βˆž and βˆ’3, 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 (βˆ’5,0), so 𝑦=0 when π‘₯=βˆ’5, which enables us to calculate the value of 𝑏 as 5. Hence, we could write the equation as 𝑦=π‘₯+5.
    2. For π‘₯-values from βˆ’3 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 𝑦=2.
    3. 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 𝑦=π‘₯+2.
    Although we have not been specifically asked to do this, we could write out the function definition as follows: 𝑓(π‘₯)=𝑦=π‘₯+5π‘₯<βˆ’3,𝑦=2βˆ’3≀π‘₯<0,𝑦=π‘₯+2π‘₯β‰₯0.
    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.
  4. 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 π‘₯=βˆ’3 and π‘₯=0, 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.

Answer

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 (βˆ’4,1). The hollow dot indicates this subfunction is undefined at π‘₯=βˆ’4 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 ]βˆ’βˆž,βˆ’4[.

The second subfunction is a ray with a hollow dot at (βˆ’4,βˆ’2). The hollow dot indicates this subfunction is also not defined for π‘₯=βˆ’4 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 ]βˆ’4,∞[.

The union of these subdomains is ]βˆ’βˆž,βˆ’4[βˆͺ]βˆ’4,∞[.

The union of these two subdomains will include all real numbers except for βˆ’4,β„βˆ’{βˆ’4}.

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 π‘₯=βˆ’4 only intersects the hollow dots of each subfunction.

Neither subfunction is defined for π‘₯=βˆ’4, which means this piecewise function is not defined at π‘₯=βˆ’4. Therefore, the domain of this piecewise-defined function will be the set of all real numbers except for βˆ’4, β„βˆ’{βˆ’4}.

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.

Answer

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 𝑦=3 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 (4,βˆ’1) and continues indefinitely toward positive infinity. Any horizontal line above 𝑦=3 will intersect this subfunction and must be included in the range.

Any horizontal line between 𝑦=βˆ’1 and 𝑦=∞ will intersect this subfunction, making its range [βˆ’1,∞[.

It is worth noting here that the other subfunction is the horizontal line 𝑦=βˆ’1 over its subdomain ]βˆ’βˆž,4].

Therefore, βˆ’1 is the only value in the set for the range. The range of this subfunction over its subdomain will be {βˆ’1}.

The union of the ranges for these two subfunctions over their respective subdomains is {βˆ’1}βˆͺ[βˆ’1,∞[.

Therefore, the range of this piecewise-defined function is [βˆ’1,∞[.

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.

Answer

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 (2,1) and another straight line that begins at (2,1) 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 changeinchangein𝑦π‘₯.

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, changeinchangein𝑦π‘₯=βˆ’11. Hence, π‘š=βˆ’1.

Therefore, the first subfunction is defined as 𝑦=βˆ’π‘₯+3𝑦=3βˆ’π‘₯.or

However, we still need to identify the subdomain of this subfunction; we can graph a vertical line at π‘₯=2, and we can confirm that 2 is included in the domain of this piecewise function since it crosses the curve at (2,1).

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 ]βˆ’βˆž,2[.

Therefore, the second subfunction would be defined for the subdomain [2,∞[.

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, changeinchangein𝑦π‘₯=12. 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 𝑦=π‘₯2.

Combining these two subfunction rules over their respective subdomains defines this piecewise function as β„Ž(π‘₯)=3βˆ’π‘₯π‘₯<2,π‘₯22≀π‘₯.ifif

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.

Answer

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 changeinchangein𝑦π‘₯.

For this line, the change in π‘₯ is 1 unit right and the change in 𝑦 is 1 unit down. Therefore, changeinchangein𝑦π‘₯=βˆ’11, which simplifies to π‘š=βˆ’1. The 𝑦-intercept is 3. Therefore, the expression for this subfunction over its subdomain is βˆ’π‘₯+33βˆ’π‘₯.or

The subdomain of this subfunction is equal to the set of all input values for this subfunction. The hollow endpoint (2,1) indicates that the upper bound of this subdomain must be an open interval. Therefore, the subdomain would be the open interval from ]βˆ’βˆž,2[.

The next subfunction has a closed point at (2,2).

The closed point at (2,2) shows the constant function 𝑦=2, where the subdomain is {2}.

The third subfunction has a hollow dot at (2,3) and continues indefinitely. Therefore, the subdomain of this subfunction is the interval ]2,∞[.

For this subfunction, the π‘₯-value increases by 2 units as the 𝑦-value increases by 1 unit. Therefore, changeinchangein𝑦π‘₯=12. 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 𝑦=π‘₯2+2.

Combining each of these three subfunctions in the format for piecewise-defined functions: 𝑓(π‘₯)=⎧⎨⎩3βˆ’π‘₯π‘₯<2,2π‘₯=2,π‘₯2+22<π‘₯.ififif

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 𝑓(π‘₯)=π‘₯,π‘₯<2,βˆ’2π‘₯+10,π‘₯β‰₯2.

Answer

We are given the piecewise-defined function 𝑓(π‘₯)=π‘₯,π‘₯<2,βˆ’2π‘₯+10,π‘₯β‰₯2.

This piecewise-defined function consists of two subfunctions over specified subdomains. The first subfunction is a quadratic function 𝑦=π‘₯ over the subdomain π‘₯<2. 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.

𝑦=π‘₯
π‘₯𝑦
βˆ’24
βˆ’11
00
11
24

Using the table, we can plot these points on a graph. Notice the point (2,4) on the graph is hollow since π‘₯=2 is not included in the subdomain of 𝑦=π‘₯.

Sketching a line through these coordinates produces a graph of 𝑦=π‘₯ over the subdomain π‘₯<2.

The second subfunction 𝑦=βˆ’2π‘₯+10, 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 π‘₯β‰₯2; therefore, the value π‘₯=2 is included in the domain.

𝑦=βˆ’2π‘₯+10
π‘₯𝑦
26
34
42
50

Next, plot these points onto the same grid as the first subfunction.

Notice that, for the second subfunction, at π‘₯=2, we include a solid point since 2 is included in the subdomain for 𝑦=βˆ’2π‘₯+10.

Lastly, we sketch a line beginning at (2,6) and extending through (5,0), 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.

Key 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.

Join Nagwa Classes

Attend live sessions on Nagwa Classes to boost your learning with guidance and advice from an expert teacher!

  • Interactive Sessions
  • Chat & Messaging
  • Realistic Exam Questions

Nagwa uses cookies to ensure you get the best experience on our website. Learn more about our Privacy Policy