## 17Calculus Precalculus - Piecewise Functions

Are you a little apprehensive about piecewise functions? If so, it may help to read this article called Piecewise Functions - The Mystery Revealed before going on.

This is an incredibly important concept that you need to understand for limits, which are the key to calculus. To understand this topic, you need to know why the domain of a function is important.
Many students think this is a difficult concept but I have had students that come into my class not understanding this and, after they get it, they look at me and say, 'That's it?!" as if it should be harder. But it is not hard, it just stretches your brain a tad bit but you can get it.

Before we get into the details, watch this video to get overview of piecewise functions.

### Dr Chris Tisdell - What is a split function (piecewise function)? [9min-12secs]

video by Dr Chris Tisdell

A regular function usually has a single domain, which may or may not be explicitly stated. If it is not stated, you can imply it from the equation. In contrast, a piecewise function always specifies the domain AND the domain is usually broken into pieces. Graphically, you can think about breaking up the xy-plane with vertical lines. First, let's look at a graph and then we will discuss what the equations look like.

Plot 1

Look at plot 1. Notice that at $$x = 1$$ something strange is happening. We can divide the xy-plane into two parts, one to the left of $$x = 1$$ and one to the right. So, what we do is consider each side separately. There is no overlap (Otherwise it would not be a function, would it?).

So, if we cover up the part of the plane from $$x = 1$$ to the right (take a piece of paper and do that now, if you need to), we have something that looks like part of a parabola, right? Now, we if cover up the part of the plane from $$x = 1$$ to the left, we have something that looks like part of an upside-down parabola, right? So this graph could be described by the equation

$$\displaystyle{ f(x) = \left\{ \begin{array}{rrl} x^2 & & x < 1 \\ -(x-2)^2+3 & & x \geq 1 \end{array} \right. }$$

Okay, we have seen how an equation might fit a graph. But what if you are given the equation and you need to come up with a graph? I will show you how I do it and see if this helps you.

Let's start with the same equation above, i.e. $$\displaystyle{ f(x) = \left\{ \begin{array}{rrl} x^2 & & x < 1 \\ -(x-2)^2+3 & & x \geq 1 \end{array} \right. }$$ and let's try to build the graph shown in plot 1.

Start by just graphing both functions on the same set of axes to get the plot 2 below. The red graph is $$y = x^2$$. The blue graph is $$-(x-2)^2+3$$. At this point, we show the complete graphs of both equations without taking into account the domains. You can tell this is not a function, right?

What we need to do now is implement the domain of each part of $$f(x)$$. To do this we notice that $$y=x^2$$ is defined only for $$x < 1$$. So we 'erase' or remove all of the red graph that is to the right of $$x = 1$$. We also notice that $$x < 1$$ means that x must be less than one but not equal to one. So we need an open circle on the red graph to indicate this exclusion of one. The result of these changes is the plot 3 below.

Plot 2

Plot 3

Plot 1 (again)

Okay, we are almost done. Now we need to implement the domain of $$x \geq 1$$ on the blue graph. The equation tells us that the blue graph is defined only for $$x \geq 1$$. So we 'erase' or remove all of the blue graph to the left of $$x= 1$$. We also notice that this graph includes $$x = 1$$ since the greater than or equal sign is used. So we need a closed circle at $$x = 1$$. The result is plot 1, repeated here.

So, that's one way to do it. This idea can be extended to more than two parts, i.e. the graph may be broken at more than just one point. Just break the domain into the separate sections and deal with as many sections as you have in your equation. Before working some practice problems, here is a video with an example that will help you understand this better.

### Dr Chris Tisdell - Split function (piecewise function) example [7min-7secs]

video by Dr Chris Tisdell

FAQ: Can sections of piecewise functions overlap?

Long Answer - - As with many questions, the answer depends on the wording of the question. When writing down the piecewise equation of a graph, sections can certainly overlap. The mathematics is there to allow such a graph. However, since the word 'function' is used in the question, if there were any overlaps in the definition or the graph, we would no longer have a function (since the graph would not pass the vertical line test). So in order to define a piecewise function, none of the sections may overlap.

Note: We are assuming here that the question is implying that 'overlap' means there exists at least one x-value with two possible corresponding y-values, i.e. there is at least one vertical line that crosses the graph at more than one point.

### Practice

Instructions - - Unless otherwise instructed, write equations for these graphs.

Problem Statement

Solution

There are several ways to describe this graph. We are restricted by the fact that the problem statement says that this is a function. So we have to be careful how to describe the point $$(-1,1)$$ since functions are required to pass the vertical line test.

First we notice that we have two straight lines, so that simplifies things a bit. Since we have two points on each line, we can easily find the equation of the line using the equation for slope and one of the points. Doing that we get $$y=x+2$$ for the line to the left of $$x=-1$$ and $$y=-x/2+1/2$$ for the line to the right of $$x=-1$$. Now we need to restrict the domain.

Notice that we have definite endpoints for both ends of the lines. So we need to take that into account. Also, the point $$(-1,1)$$ can be included in the domain for the left line or the right line but not both. That's because we know this is a function and the equation (and graph) must pass the vertical line test. So here are three possible answers.

$$\displaystyle{ f(x) = \left\{ \begin{array}{lr} x+2 & -2 \leq x \leq -1 \\ -x/2+1/2 & -1 < x \leq 3 \end{array} \right. }$$

$$\displaystyle{ f(x) = \left\{ \begin{array}{lr} x+2 & -2 \leq x < -1 \\ -x/2+1/2 & -1 \leq x \leq 3 \end{array} \right. }$$

$$\displaystyle{ f(x) = \left\{ \begin{array}{lr} x+2 & -2 \leq x < -1 \\ 1 & x = -1 \\ -x/2+1/2 & -1 < x \leq 3 \end{array} \right. }$$

Answer 3 is certainly a valid and correct answer. However, you probably won't see it written like this very often since it is not as concise as the previous two.
Notice in all three cases, there is no overlap in the domain, which means that this is a function and, therefore it passes the vertical line test.

Problem Statement

Solution

### 336 video

video by Krista King Math

Problem Statement

Solution

### 342 video

video by PatrickJMT

Instructions - - Unless otherwise instructed, plot these piecewise functions.

$$\displaystyle{f(x)=\left\{\begin{array}{lr}2x+1 & x< 0 \\ 2x+2 & x\geq 0\end{array}\right.}$$

Problem Statement

$$\displaystyle{f(x)=\left\{\begin{array}{lr}2x+1 & x< 0 \\ 2x+2 & x\geq 0\end{array}\right.}$$

Solution

The red part of the graph represents the function $$2x+1~~~x< 0$$. Notice there is an open circle at $$x=0$$ since the domain is all values less than zero not including zero.

The blue part of the graph represents the function $$2x+2~~~x\geq 0$$. The solid circle indicates that $$x=0$$ is included in the domain.

Notice that both ends of the lines do not have end points, i.e. there is no circle, open or closed, at the left end of the red line and the right end of the blue line. This indicates that the lines go off to infinity and never stop. Some instructors require arrows to represent the same idea. Check with your instructor to clarify what they want to see in your work.

Note that we used two colors in the graph to represent different parts to clarify what is going on. However, the function f(x) is the entire graph and the sections would not normally be in different colors.
Also notice that the axes are not labeled, i.e. there is no way to know what the scales of the gridlines are. In this graph, the grids (both x and y) are units of one. This is extremely unusual on this site and it is not recommended as standard practice to leave off the labels. However, check with your instructor to see what they require as far as labeling the axes your graphs.

$$\displaystyle{f(x)=\left\{\begin{array}{lr}1-x & x< 1 \\ \sqrt{x-1} & x\geq 1\end{array}\right.}$$

Problem Statement

$$\displaystyle{f(x)=\left\{\begin{array}{lr}1-x & x< 1 \\ \sqrt{x-1} & x\geq 1\end{array}\right.}$$

Solution

In this graph, the straight line to the left of $$x=1$$ represents the function $$y=1-x~~~x< 1$$. If we were graphing only this part of the graph, there would be an open circle at $$x=1$$ to represent the fact that $$x=1$$ is not included in the domain of this part of the function. However, the second part of the graph, $$\sqrt{x-1}~~~x\geq 1$$, actually fills in the open circle at $$x=1$$. So we can't see the open circle for the first part of the graph. We have made the circle obvious in this graph to emphasize this. However, it is not necessary to do so to be correct.

Notice that both ends of the lines do not have end points, i.e. there is no circle, open or closed, at the left end of the straight line and the right end of the curved line. This indicates that the lines go off to infinity and never stop. Some instructors require arrows to represent the same idea. Check with your instructor to clarify what they want to see in your work.

Also, notice that the axes are not labeled, i.e. there is no way to know what the scales of the gridlines are. In this graph, the grids (both x and y) are units of one. Check with your instructor to see what they require as far as labeling the axes your graphs.

$$\displaystyle{f(x)=\left\{\begin{array}{lr}x+1 & -3\leq x< 0 \\ x^2 & 0\leq x\leq 2\end{array}\right.}$$

Problem Statement

$$\displaystyle{f(x)=\left\{\begin{array}{lr}x+1 & -3\leq x< 0 \\ x^2 & 0\leq x\leq 2\end{array}\right.}$$

Solution

### 339 video

video by PatrickJMT

$$\displaystyle{f(x)=\left\{\begin{array}{lr}x & -3\leq x\leq 0 \\ 2 & 0< x< 1 \\ \sqrt{x} & 1\leq x< 4\end{array}\right.}$$

Problem Statement

$$\displaystyle{f(x)=\left\{\begin{array}{lr}x & -3\leq x\leq 0 \\ 2 & 0< x< 1 \\ \sqrt{x} & 1\leq x< 4\end{array}\right.}$$

Solution

### 340 video

video by PatrickJMT

$$\displaystyle{f(x)=\left\{\begin{array}{lr}-2 & x\leq -3 \\ 4-x & -3< x< 0 \\ x & x\geq 0\end{array}\right.}$$

Problem Statement

$$\displaystyle{f(x)=\left\{\begin{array}{lr}-2 & x\leq -3 \\ 4-x & -3< x< 0 \\ x & x\geq 0\end{array}\right.}$$

Solution

### 341 video

video by PatrickJMT

Find the domain and range of the piecewise function
$$\displaystyle{f(x) = \left\{\begin{array}{lr}x+1 & -3 \leq 0 \\ x^2 & 0\leq x\leq 2\end{array}\right.}$$

Problem Statement

Find the domain and range of the piecewise function
$$\displaystyle{f(x) = \left\{\begin{array}{lr}x+1 & -3 \leq 0 \\ x^2 & 0\leq x\leq 2\end{array}\right.}$$

Solution

### 338 video

video by PatrickJMT

Find the domain and range of the piecewise function
$$\displaystyle{f(x)=\left\{\begin{array}{lr}x & -3 \leq x \leq 0\\ 2 & 0< x< 1 \\ \sqrt{x} & 1\leq x< 4\end{array}\right.}$$

Problem Statement

Find the domain and range of the piecewise function
$$\displaystyle{f(x)=\left\{\begin{array}{lr}x & -3 \leq x \leq 0\\ 2 & 0< x< 1 \\ \sqrt{x} & 1\leq x< 4\end{array}\right.}$$

Solution

### 442 video

video by PatrickJMT

For the piecewise function
$$\displaystyle{ f(x) = \left\{ \begin{array}{lr} x+1 & x \leq -2 \\ 3 & -2 < x \leq 1 \\ -x^2 & 1 < x \end{array} \right. }$$
a) evaluate $$f(-4), f(0), f(4)$$
b) over what interval is the function increasing?

Problem Statement

For the piecewise function
$$\displaystyle{ f(x) = \left\{ \begin{array}{lr} x+1 & x \leq -2 \\ 3 & -2 < x \leq 1 \\ -x^2 & 1 < x \end{array} \right. }$$
a) evaluate $$f(-4), f(0), f(4)$$
b) over what interval is the function increasing?

Solution

### 337 video

video by PatrickJMT

### piecewise functions 17calculus youtube playlist

Really UNDERSTAND Precalculus

### Calculus Topics Listed Alphabetically

Single Variable Calculus

Multi-Variable Calculus

### Search Practice Problems

Do you have a practice problem number but do not know on which page it is found? If so, enter the number below and click 'page' to go to the page on which it is found or click 'practice' to be taken to the practice problem.

free ideas to save on bags & supplies

 The 17Calculus and 17Precalculus iOS and Android apps are no longer available for download. If you are still using a previously downloaded app, your app will be available until the end of 2020, after which the information may no longer be available. However, do not despair. All the information (and more) is now available on 17calculus.com for free.

When using the material on this site, check with your instructor to see what they require. Their requirements come first, so make sure your notation and work follow their specifications.

DISCLAIMER - 17Calculus owners and contributors are not responsible for how the material, videos, practice problems, exams, links or anything on this site are used or how they affect the grades or projects of any individual or organization. We have worked, to the best of our ability, to ensure accurate and correct information on each page and solutions to practice problems and exams. However, we do not guarantee 100% accuracy. It is each individual's responsibility to verify correctness and to determine what different instructors and organizations expect. How each person chooses to use the material on this site is up to that person as well as the responsibility for how it impacts grades, projects and understanding of calculus, math or any other subject. In short, use this site wisely by questioning and verifying everything. If you see something that is incorrect, contact us right away so that we can correct it.