# Lesson Explainer: Piecewise Functions Mathematics

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

A piecewise function is a function for which different rules are used to find the function’s output over different intervals of the function’s domain. One well-known function that we can write as a piecewise function is the absolute value function, . The graph of for this function is shown below.

We can see that when is less than 0, the graph of the function is a straight line with a slope of , and when is greater than 0, it is a straight line with a slope of 1. When rewriting as a piecewise function, the equation of each of these lines is called a subfunction, and the interval over which each line is defined is called a subdomain. Each subdomain is written as an inequality.

Notice that the two lines meet at the origin. At the origin, only one subfunction can be used to find the piecewise function’s output, so we could either say that

• on the subdomain ,
• on the subdomain ,

or that

• on the subdomain ,
• on the subdomain .

The equation of a piecewise function is written with a curly bracket to indicate that it is comprised of more than one subfunction, so we could rewrite either as or as

In either case, we could use what we have written to evaluate the function for a specific input value, but when the allocation is arbitrary, it is conventional to include the left endpoint, and exclude the right endpoint, from the subfunctions. Say that we have rewritten in the conventional way as and we want to find the value of . To decide which subfunction will give us this value, we must determine the subdomain in which lies. We know that lies in the subdomain , and when .

Evaluating this subfunction at gives us which is the same value of we would have arrived at had we evaluated the absolute value function as it was originally written.

### Definition: Piecewise Function

A piecewise function is a function that consists of multiple subfunctions, with each subfunction defined over an interval of the main function’s domain, called a subdomain. The union of the subdomains is the domain of the piecewise function.

The equation of a piecewise function is written with a curly bracket to indicate that it is comprised of more than one subfunction. An example of a piecewise function is where on the subdomain , and on the subdomain .

Sometimes the different parts of a piecewise function’s graph do not meet at a point. For example, consider the following graph of for a piecewise function. The function’s equation is also shown.

A closed circle indicates that the function is defined at the point at which it appears, while an open circle indicates that the function is not defined. This means the -coordinates of the points where the closed circles appear will be included in the subdomain of the corresponding subfunction, while the -coordinates of the points where the open circles appear will not be included.

In our graph, the line segment representing the first subfunction has open circles at both endpoints, so the -coordinates of these endpoints will not be included in this subfunction’s subdomain. Thus, the subdomain of the first subfunction, given as an inequality, is .

The line segment representing the second subfunction has closed circles at both endpoints, so the -coordinates of these endpoints will be included in this subfunction’s subdomain. Thus, the subdomain of the second subfunction, given as an inequality, is .

We can find the union of the two subdomains to determine the domain of the main function. Since neither nor 4 are included in the first subfunction’s subdomain, and both 4 and 7 are included in the second subfunction’s subdomain, the main function is defined at both and , but not at . Therefore, the domain of the main function, given as an inequality, is .

Let’s now look at some examples of evaluating piecewise functions at specific values.

### Example 1: Evaluating a Piecewise Function at a Given Point

Given the function find the value of .

### Answer

We can see that the function we have been given, , is a piecewise function. Recall that a piecewise function is a function that consists of multiple subfunctions, with each subfunction defined over an interval of the main function’s domain, called a subdomain.

We want to evaluate this piecewise function at . To do this, we need to determine which subdomain, if any, 4 is in. The main function has three subdomains given as inequalities:

• ,
• ,
• .

We can see that 4 is in the subdomain , and we know that when .

Now that we know which subfunction gives the function’s output, we can evaluate this subfunction at . Doing so, we get

In conclusion, we can say that the value of for our piecewise function is .

In the example that follows, we will evaluate a piecewise function using the concept of composite functions.

### Example 2: Evaluating a Point of a Piecewise Function

Consider the function

Find .

### Answer

In this problem, we are given the piecewise function . Remember, a piecewise function is a function that consists of multiple subfunctions, with each subfunction defined over an interval of the main function’s domain, called a subdomain.

Here, we are asked to determine . The function is a composite function, which can alternatively be written as . To evaluate at a specific value of , we first evaluate at this value of . Then we evaluate again, this time using the output we just got as our input value.

Thus, to determine , we need to start by finding . We can see that 2 is in the subdomain , and we know that when .

Evaluating this subfunction at , we get

The function evaluated at is . So, since we know that , this tells us that .

To decide which subfunction gives the function’s output for an input value of 4, we must determine which subdomain, if any, 4 is in. We can see that it is in the subdomain , and we know for values of in this subdomain, .

Evaluating this subfunction at tells us that

Therefore, we know that the value of for our piecewise function is 8.

Next, we will evaluate a piecewise function for three different input values so that we can complete a table of values.

### Example 3: Completing a Table of Values for a Piecewise Function

Find the missing table values for

 𝑥 𝑔(𝑥) −3 0 3

### Answer

We are given the piecewise function . Recall that a piecewise function is a function that consists of multiple subfunctions, with each subfunction defined over an interval of the main function’s domain, called a subdomain. To fill in the missing values in the table, we must decide which subfunction to use for three different input values, or three different values of : , 0, and 3.

To do this, we need to determine which subdomains, if any, , 0, and 3 are in. The main function has three subdomains given as inequalities:

• ,
• ,
• .

Let’s begin by deciding which subfunction to use when the input value is . Since the subdomain is the one in which is included, we know the subfunction that gives the function’s output for this input value. Thus, we should evaluate the subfunction at to get

Recall that the negative exponent rule tell us that for any real number .

This means that we can rewrite as so the first missing value in our table is .

Next, let’s decide which subfunction to use when the input value is 0. We can see that the subdomain is the one in which is included, so we also know what the subfunction for this input value is. We should therefore evaluate the subfunction at to get

Remember, the zero exponent rule states that any nonzero base raised to the power 0 is equal to 1. That is, when . This means that we can rewrite as so the second missing value in our table is 1.

Finally, let’s decide which subfunction to use when the input value is 3. Since the subdomain is when , we can also determine the subfunction for this input value. Substituting 3 into the subfunction for , we get so the third missing value in our table is 8. Now that we know the three missing values in our table, we can fill in the blank cells so that the table appears as follows:

 𝑥 𝑔(𝑥) −3 0 3 18 1 8

We will now turn our attention to graphs. First, we will evaluate a piecewise function for a given input value by using the graph of the function.

### Example 4: Evaluating a Point from a Graph of a Piecewise Function

Determine using the graph below.

### Answer

We can see that our graph is that of a piecewise function, or a function that consists of multiple subfunctions, with each subfunction defined over an interval of the main function’s domain, called a subdomain. This is because the graph consists of five different line segments with either closed circles or open circles at the ends, as well as two points with coordinates of and .

Recall that a closed circle indicates that the function is defined at the point at which it appears, while an open circle indicates that the function is not defined.

We want to evaluate the function that the graph represents at . To do this, we can see where the graph intersects the line .

We can see that the line passes through the open circle at and . Since the function is not defined at , we know that the value of must be the -coordinate of the point , which is 4.

Finally, we will look at an example of how to evaluate a piecewise function when the given input value is not included in any of the main function’s subdomains.

Determine .

### Answer

Because our graph consists of parts of two different curves, we know that it is the graph of a piecewise function, or a function that consists of multiple subfunctions, with each subfunction defined over an interval of the main function’s domain, called a subdomain.

We can see that the two curves are joined by an open circle at the point . Remember that an open circle indicates that the function is not defined at the point at which it appears.

We want to evaluate the function that the graph represents at . To do this, we can see where the graph intersects the line .

We can see that the line passes through only the open circle at . Since the function is not defined at , we know that 1 is not in the function’s domain, so the value of is undefined.

### Note:

Even though our function is undefined at , it is defined at various other points. For example, we can see from our graph that the curve on the left passes through the point , and that the curve on the right passes through the point . This means that our function is defined for input values of both and 5. In fact, it is defined for an infinite number of input values, because an infinite number of points lie on each of the two curves.

Now let’s finish by recapping some key points.

### Key Points

• A piecewise function is a function that consists of multiple subfunctions, with each subfunction defined over an interval of the main function’s domain, called a subdomain. The union of the subdomains is the domain of the piecewise function.
• To decide which rule to use when evaluating a piecewise function for a specific input value, we must determine the subdomain in which the input value lies.
• The graph of a piecewise function can sometimes be used to evaluate the function for a specific input value.
• A closed circle on a graph indicates that the -coordinate of the point at which it appears is included in the domain of the function that the graph represents, while an open circle indicates that the -coordinate of the point is not included.
• When an input value is not included in any of the subdomains of a piecewise function, the function is undefined at that input value.

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