Lesson Video: Piecewise Functions | Nagwa Lesson Video: Piecewise Functions | Nagwa

Lesson Video: Piecewise Functions Mathematics • Second Year of Secondary School

Join Nagwa Classes

Attend live General Mathematics sessions on Nagwa Classes to learn more about this topic from an expert teacher!

In this video, we will learn how to identify, write, and evaluate a piecewise function.

11:33

Video Transcript

In this lesson, we’ll learn how to identify, write, and evaluate a piecewise function given both the function equation and the graph of the function.

Let’s begin with a definition. A piecewise function is a function that’s made up from pieces of more than one different function. And each part of the function is defined on a given interval. For example, let’s imagine we have the function 𝑓 of 𝑥, and it’s a piecewise function defined by 𝑥 plus one when 𝑥 is less than three and two 𝑥 minus two if 𝑥 is greater than or equal to three. In other words, for all values of 𝑥 up to but not including 𝑥 equals three, we would use the function 𝑓 of 𝑥 equals 𝑥 plus one. Then, when 𝑥 is equal to and greater than three, we use the function two 𝑥 minus two. And then if we wanted to evaluate the function at a specific value of 𝑥, we need to be careful to follow these rules.

We can also sketch the graph of this piecewise function. Up to but not including 𝑥 equals three, we use the function 𝑓 of 𝑥 equals 𝑥 plus one. The graph of this function looks as shown. Notice that I’ve included an empty dot at 𝑥 equals three, and that’s because the function isn’t defined by 𝑓 of 𝑥 equals 𝑥 plus one here. It is, however, defined at 𝑥 equals three but by the function two 𝑥 minus two. And so the graph could look a little something like this. We could also include a solid dot at 𝑥 equals three to show that the function is defined here if we chose. Let’s have a look at an example of how to evaluate a piecewise function at a given value of 𝑥.

Given that the function 𝑓 of 𝑥 is equal to six 𝑥 minus two if 𝑥 is less than negative six, negative nine 𝑥 squared minus one if 𝑥 is greater than or equal to negative six and less than or equal to eight, and negative five 𝑥 cubed plus four if 𝑥 is greater than eight, find the value of 𝑓 of four.

We see that 𝑓 of 𝑥 is a piecewise function, and it’s defined by three separate functions. When 𝑥 is less than negative six, we’re going to use the function 𝑓 of 𝑥 equals six 𝑥 minus two. When 𝑥 is between negative six and eight and including those values, we use the function negative nine 𝑥 squared minus one. And when 𝑥 is greater than eight, we use the function 𝑓 of 𝑥 is negative five 𝑥 cubed plus four. Now we want to find the value of 𝑓 of four. And so we need to make sure that we correctly select the function that we need to use when 𝑥 is equal to four. Well, four is between negative six and eight. So we’re going to use this part of the function: 𝑓 of 𝑥 is negative nine 𝑥 squared minus one.

And so, 𝑓 of four is found by substituting 𝑥 equals four into this function. It’s negative nine times four squared minus one. Now, of course, the order of operations, which is sometimes abbreviated to PEMDAS or BIDMAS, tells us to begin by working out the value of the number being raised to some exponent. So in this case, we begin by working out four squared. That’s four times four which is 16. And so our calculation becomes negative nine times 16 minus one. We then perform the multiplication part of this calculation, remembering that a negative multiplied by a positive is a negative. We get negative 144 minus one. Negative 144 minus one is negative 145. And so, given the piecewise function 𝑓 of 𝑥, we see that 𝑓 of four is negative 145.

We’re now going to look at how to apply this process but when working with composite functions based off of an individual piecewise function.

Consider the function 𝑓 of 𝑥 is equal to 𝑥 plus four if 𝑥 is greater than four, two 𝑥 if 𝑥 is greater than or equal to negative one and less than or equal to four, and negative three if 𝑥 is less than negative one. Find 𝑓 of 𝑓 of two.

𝑓 of 𝑓 of two is a composite function. It’s a function of a function. We’re going to begin by looking at the inner function first, so we’re going to begin by thinking about 𝑓 of two. Now, our 𝑓 of 𝑥 is a piecewise function, and it’s defined by different functions on different intervals of 𝑥. We’re told that when 𝑥 is greater than four to use the function 𝑥 plus four. When 𝑥 is between and including negative one and four, we use the function two 𝑥. And when 𝑥 is less than negative one, we use the function 𝑓 of 𝑥 equals negative three. Two, of course, lies between negative one and four, and so we’re going to use the second part of our function. That is, when 𝑥 is equal to two, 𝑓 of 𝑥 is equal to the function two 𝑥.

And so, 𝑓 of two is found by substituting two into this equation. We get two times two, which is four. So we found 𝑓 of two; it’s four. If we replace 𝑓 of two with its value of four, we see that we now need to evaluate 𝑓 of four. And we need to be really careful here. We’re actually still using this second part of the function. And this is because we only use the first part of the function when 𝑥 is strictly greater than four. When it’s less than or equal to four, we use the function two 𝑥. And so once again, we substitute our value of 𝑥 into the function 𝑓 of 𝑥 equals two 𝑥, so it’s two times four which is equal to eight. Given our piecewise function, 𝑓 of 𝑓 of two is eight.

In our next example, we’ll see how to complete a table of values for a piecewise function.

Find the missing table values for the piecewise function 𝑔 of 𝑥, which is equal to two to the power of 𝑥 if 𝑥 is less than negative two, three to the power of 𝑥 if 𝑥 is greater than or equal to negative two and less than three, or two to the power of 𝑥 if 𝑥 is greater than or equal to three. And then we have a table with the values of 𝑥, negative three, zero, and three.

Remember, when we have a function defined by different functions depending on its value of 𝑥, we call it a piecewise function. And according to our table, we’re looking to find the value of 𝑔 of 𝑥 when 𝑥 is negative three. So that’s 𝑔 of negative three. We also want to find 𝑔 of zero and 𝑔 of three. And so we need to pay extra careful attention to the part of the function we’re going to use for each value of 𝑥. Let’s begin with 𝑔 of negative three. Here, 𝑥 is equal to negative three. And so, since negative three is less than negative two, we need to use the first part of our function, that is, two to the power of 𝑥.

And so to find 𝑔 of negative three, we’re going to substitute 𝑥 equals negative three into that part of the function. And we get 𝑔 of negative three is two to the power of negative three. And at this stage, we might recall that a negative power tells us to find the reciprocal. So 𝑎 to the power of negative 𝑏, for instance, is one over 𝑎 to the power of 𝑏. And this means then that two to the power of negative three is one over two cubed, which is equal to one over eight. And so the first value in our table is one-eighth. Let’s repeat this process for 𝑥 equals zero.

This time zero is between negative two and three, so we’re going to use the second part of our function. And so, 𝑔 of zero is found by substituting 𝑥 equals zero into the function 𝑔 of 𝑥 equals three to the power of 𝑥. So that’s three to the power of zero. Now, of course, at this stage, we might recall that anything to the power of zero is equal to one, so 𝑔 to the power of zero is simply equal to one. And that’s the second value in our table. Let’s repeat this process for the third and final column in our table.

The third part of our piecewise function is used when 𝑥 is greater than or equal to three. So we’re going to use this value when 𝑥 is equal to three. And this means that 𝑔 of three is two cubed, which is simply equal to eight. And so we pop eight in the final part of our table. The missing table values for our piecewise function 𝑔 of 𝑥 are one-eighth, one, and eight.

We’re now going to look at a couple of examples on evaluating a function at a point given its graph.

Determine 𝑓(0) using the graph.

Let’s look at the graph of our function. It must be a piecewise function, and this is because it’s made up of pieces of graphs of various functions over various intervals on 𝑥. For instance, let’s take the first portion of graph here. This portion is defined by a specific function over the interval from negative 10 to eight. In fact, we could even define this as the left-closed, right-open interval. And that’s because the solid dot tells us that it’s defined at 𝑥 equals negative 10 but not defined by this part of the function at 𝑥 equals negative eight. Then, the second part of the function allows us to define 𝑓 of 𝑥 at 𝑥 equals negative eight with the solid dot here.

But when 𝑥 is equal to zero, we can’t use this part of the graph to determine 𝑓 of zero. The empty dot tells us it’s not defined by this part of our function. So, how are we going to determine 𝑓 of zero? Well, when 𝑥 is zero, we’re looking for a part of the function that lies on the 𝑦-axis. We’ve already seen this can’t be defined by this function here, but we do have a solid dot here. And so, the function is actually defined when 𝑥 is equal to zero. This point has coordinates zero, four. So we see that 𝑓 of zero must be equal to four.

Let’s consider one further example of this type.

Determine 𝑓 of one.

Here we see the function 𝑓 of 𝑥 is a piecewise function. We know this because it’s made up of the graphs of two different functions. The first part of the graph is defined over the interval from negative two to one. But of course, this empty circle tells us that it’s not defined by this graph at this point. Then the second part of the function is defined over the interval from one to eight. Once again, the empty dot tells us that it’s not defined at 𝑥 equals one by this portion of the graph.

And so, how are we going to determine 𝑓 of one? Well, we can’t. 𝑓 of one is totally undefined according to our graph. There are plenty of values that we can find. For example, 𝑓 of five is equal to one, as is 𝑓 of negative one. But 𝑓 of one is completely undefined according to our graph.

In this video, we learned that a piecewise function is a function made up from pieces of more than one different function. We saw that each function is defined on some given interval. Finally, we saw that we can evaluate a piecewise function using the graph or its individual function parts, but we must be careful to ensure the function is actually defined at that point.

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