In this explainer, we will learn how to find the domain and range of a piecewise-defined function.

We start by recalling what is meant by the domain and range of a function.

### Definition: Domain and Range of a Function

The domain of a function is the set of all input values of the function.

The range of a function is the set of all possible outputs of the function, given its domain.

The domain tells us all of the inputs โallowedโ for the function. For example, since we cannot input into the function , as it would be undefined, its domain will not include this value of . We can input any other value of , so the domain of this function is .

The range of a function tells us all of the possible outputs of this function, given its domain. For example, consider the function , which has a domain of . Since the square of any real number is nonnegative, , therefore, this function only outputs nonnegative real numbers, but we need to check which of these nonnegative real numbers are outputs of the function. To do this, we will show that any nonnegative number is an output of this function. If , then

Hence, the range of this function on is the set of nonnegative real numbers, given by .

We can use different algebraic techniques and the properties of the function to determine its domain and range. However, it is often easier to do this by using a sketch. Consider the following sketch of .

In the sketch of any function, a point on the curve has the form , where is the input of the function and is the output. In other words, the -coordinate of every point on the curve tells us an input of the function and the -coordinate tells us an output of the function.

Therefore, we can use the graph of a function to determine its domain and range. To determine the domain of this function, we want to find the -coordinate of every point on the curve. We can do this by considering which vertical lines intersect the curve.

For example, if we sketch the vertical line , we see this intersects our curve at the point . Hence, 2 is in the domain of our function and 3 is in its range. To determine the full domain of our function, we need to do this with every possible vertical line. We can see any vertical line, , will intersect this curve. In particular, for , we have the following:

Since the graph of has a solid dot at , we know the function is defined at this point. So, the vertical line intersects the curve and . Therefore, since all vertical lines intersect the curve, its domain is .

We can find the range of this function by considering horizontal lines.

For example, the line intersects the curve at the point , so 1 is in the range of this function. We can also see that the line does not intersect the curve.

Since the curve has a hollow dot at the origin, it does not intersect this horizontal line; in fact, for any , the line will not intersect our curve and all other horizontal lines do intersect our curve. Hence, the range of this function is .

Before we discuss finding the domain and range of a piecewise-defined function, letโs start by recalling what we mean by these types of functions.

### Definition: Piecewise Function

A piecewise function is a function that consists of multiple subfunctions, with each subfunction defined over a subset of the main functionโs domain, called a subdomain.

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 when and when .

In a piecewise-defined function, the possible inputs of the function are given by the subdomains, in this case and . Therefore, to find all the possible inputs of this function, we will need to take the union of all the subdomains. For this piecewise function, we can take inputs of and also ; combining these, we can see this is any real value of , so its domain is .

To find the range of a piecewise function, we can instead consider the range of each subfunction over its subdomain. Therefore, to find the range of , we consider the range of each subfunction separately.

First, when . Therefore, if we input a value of into the function, we get

Hence, all values of are in the range of this subfunction.

Second, when . Adding 1 to both sides of the inequality of our subdomain gives us . Hence, when , . This is not enough to determine the range of this subfunction; we need to determine which values our subfunction achieves. To do this, we will let so that ; this means

Therefore, all values of are in the range of this subfunction. Combining the ranges of each subfunction, we get that the range of is and ; we can represent this in interval notation as .

We can summarize the results shown in the example above as follows.

### Definition: Domain and Range of a Piecewise Function

The domain of a piecewise-defined function is the union of its subdomains.

The range of a piecewise-defined function is the union of the ranges of each subfunction over its subdomain.

Letโs see some examples of how to find the domain and range of a piecewise-defined function from its graph.

### Example 1: Determining the Domain of a Piecewise-Defined Function given Its Graph

Determine the domain and the range of the function

### Answer

We recall that the domain of a function is the set of all input values of the function and the range of a function is the set of all possible outputs of the function, given its domain.

We can determine both of these from the graph of the function. Remember, any point on the curve is in the form , where will be in the domain of and will be in the range of .

To find the domain of , we need to determine the -coordinates of all points on the curve.

Consider the following vertical lines.

In diagram (1), we can see that any vertical line for intersects the curve. Similarly, in diagram (2), we can see that any vertical line for intersects the line. So, all of these values of must be in the domain of this function. We need to check if is in the domain of this function; we can check this by sketching the line .

Since our curve has hollow circles on the line , it is not defined at this value of ; therefore, 0 is not in the domain of . Hence, the domain of this function is all real values of not equal to 0, which we can write in set notation as .

It is worth noting that we can verify that 0 is not in the domain of by considering the subdomains of the function, and , which both do not include 0. The union of these subdomains is also the domain of the function, .

To find the range of this function, we could consider which horizontal lines intersect the graph. However, in this case, we can find the range by considering the coordinates of the points on the graph.

We can see that if , then . Similarly, if , then . This means the only possible outputs of our function are 6 and , so the range of this function is .

Hence, the domain is , and the range is .

### Example 2: Determining the Range of a Piecewise-Defined Function given Its Graph

Find the range of the function

### Answer

We recall that the range of a function is the set of all possible outputs of the function, given its domain. To find the range of this function, we can consider which horizontal lines intersect the graph.

In diagram (1), we can see that the highest output of the function is . In diagram (2), we can see that the lowest output of the function is . All the values between these are possible outputs giving us the range .

Hence, the range is .

### Example 3: Determining the Range of Piecewise-Defined Functions from Their Graphs

Determine the range of the function represented by the given graph.

### Answer

We recall that the range of a function is the set of all possible outputs of the function, given its domain. Remember, any point on our graph will be in the form , where will be in the range of the function. Therefore, we can find the range of this function by determining the -coordinates of the points on its graph.

In diagram (1), since our graph has a solid dot at , we can see that the lowest output of the function is . In the second diagram, we can see that the largest output of the function is 7.

We can see that any horizontal line between these values also intersects the curve, so the range of this function is any value between and 7, inclusive. In set notation, this is .

Hence, the range is .

In our next example, we will see how to determine the domain of a piecewise-defined function without being given its graph.

### Example 4: Determining the Domain of a Piecewise-Defined Function

Determine the domain of the function

### Answer

We recall that the domain of a function is the set of all input values of the function, and for a piecewise-defined function, it is the union of its subdomains.

For this function, the subdomains are and . We want to take the union of these two sets to find the domain of :

Hence, the domain is .

In our final example, we will see how to determine both the domain and the range of a piecewise-defined function without being given its graph.

### Example 5: Determining the Domain and the Range of a Piecewise Function

Determine the domain and range of the function

### Answer

We recall that the domain of a function is the set of all input values of the function, and for a piecewise-defined function, it is the union of its subdomains.

To find the union of the subdomains, we will start by writing them in terms of sets. First, is the same as . Second, is the same as .

Therefore, the domain is the union of these sets:

The range of a function is the set of all possible outputs of the function, given its domain. For a piecewise-defined function, this will be the range of the subfunctions over their subdomains. So, we can determine the range of this function by considering each subfunction separately.

First, if , since , we can cancel the shared factor of :

We can then sketch this subfunction.

It is the line with the point when removed. The range of this subfunction is all of the possible outputs. The only horizontal line that does not intersect this line is , so the range of this subfunction is .

The second subfunction is the constant function on the domain . Since the output is constant, its range is .

Taking the union of the ranges of the subfunctions gives us

It is worth noting that we could also sketch the second subfunction on the same graph to fully sketch . The second subfunction is only defined when , so it consists of a single point. We have , so we add the point to our sketch.

We can then see that is function .

Hence, the domain is and the range is .

Letโs finish by recapping some of the important points of this explainer.

### Key Points

- The domain of a piecewise-defined function is the union of its subdomains.
- The range of a piecewise-defined function is the union of the ranges of each subfunction over its subdomain.
- We can find the domain of a function from its graph by considering the intersections of the curve with vertical lines.
- We can find the range of a function from its graph by considering the intersections of the curve with horizontal lines.