# How to Graph a Piecewise Function

In mathematics, a piecewise function is a function that has multiple sub-functions, each valid for particular values of x. In other words, a piecewise function behaves differently on different parts of the number line. A graph will give you a visual representation of these different parts and their behavior, helping you understand how the function works. Need to graph a piecewise function?

## Steps

1. 1
Get your piecewise function. When you look at a piecewise function, you will see the common functional notation. The body of the function is actually an array of functions and associated subdomains.
• As an example, let’s take the following function, with its list of sub-functions listed for particular intervals of x:
• F(x) = x + 1 where x is greater to or equal to -1; and x - 1 where x is less that -1
• Note that this piecewise function has two sub-functions: f(x) = x + 1 and f(x) = x-1. Each of these sub-functions are valid on different parts of the number line, where x≥-1 and x<-1, respectively.
2. 2
Draw two lines in a + shape on your paper. The horizontal line is your x axis; the vertical line is your y axis.
3. 3
Mark both lines with equally spaced numbers. For the x axis, numbers are positive on the right side and negative on the left side; for the y axis numbers are positive above the x axis and negative below it.
4. 4
Calculate f(x) for every x. Once you’ve got your axes set up, take your piecewise function and begin calculating values of f(x). To do this, replace the x in the function f(x) with its value. For example: f(x) = x + 1 at x = -1 is replaced with f(-1) = -1 + 1 = 0.
• Remember that in piecewise functions, your calculation will change depending on the value of x. In this example, recall that if x is greater than or equal to -1, then you should use the equation f(x) = x + 1. If x is less than -1, though, you should use the equation f(x) = x – 1.
5. 5
Draw the graph points for each pair. Once you have calculated these values, you can draw a graph point for each pair. Sketch imaginary lines (red lines) vertically on the x axis and horizontally on the y axis for each pair. Graph points will be where these lines intersect.
• Be careful to ensure the validity of the sub-functions on the x axis.
6. 6
Draw all the graph points on the plane. You will now have a number of graph points represented on your x-y plane. Remove all your imaginary lines to reveal all of your points.
7. 7
Join all the graph points. To complete your graph, join these graph points smoothly in continuous lines.
• Note that because this is a piecewise function with two sub-functions, your graph will have two separate lines, which do not meet.

## Tips

• When you graph piecewise functions, remember to use the sub-functions only on their assigned intervals. Choose the length of your x axis accordingly.
• You can choose any spacing between the numbers on your x and y axes. Be aware, though, that the closer the points are (in other words, the smaller the spacing), the more accurate your graph will be.

## Article Info

Categories: Algebra