Expand menu menu_open Minimize Start chapters Home History history History expand_more
{{ item.displayTitle }}
navigate_next
No history yet!
Progress & Statistics equalizer Progress expand_more
Student
navigate_next
Teacher
navigate_next
{{ filterOption.label }}
{{ item.displayTitle }}
{{ item.subject.displayTitle }}
arrow_forward
{{ searchError }}
search
{{ courseTrack.displayTitle }}
{{ statistics.percent }}% Sign in to view progress
{{ printedBook.courseTrack.name }} {{ printedBook.name }}

# Graphing Piecewise and Step Functions

Some functions are discontinuous or have gaps. To graph these functions it is often necessary to divide them into two or more parts and graph them individually.
Theory

## Piecewise Function

A function is said to be piecewise if it is defined by different rules for different parts of its domain. One example of a piecewise function is $f(x) = \begin{cases} \text{-} x-2 & \quad x < 0 \\ 2x+1 & \quad x\geq 0 . \end{cases}$ This function is defined by one linear function for values of $x$ smaller than $0$ and another linear function for values of $x$ that are greater than or equal to zero. The graph of $f$ is shown.

For functions, each input can only correspond to one output. Therefore, when two pieces of a function end at the same $x$-value, only one of the pieces can be defined for that $x$-value. For $f,$ it can be seen that, although $x=0$ splits the pieces, only the second piece is defined for $x=0.$ Additionally, it's possible for a piecewise function to be undefined across other domain intervals.
Method

## Graphing Piecewise Functions

When graphing a piecewise function, each piece must be considered separately. First, a piece is graphed for the values of its domain. Then an end or ends of the piece are marked with

• a closed circle for an $x$-value for which the function is defined, or
• an open circle for an $x$-value for which the function is undefined.

Consider the piecewise function $f(x) = \begin{cases} 4x+6 & \quad x \leq \text{-} 1 \\ \text{-} x+3 & \quad x> \text{-} 1 . \end{cases}$ The function consists of two pieces, where each is a linear function. The first of these is defined when $x$ is less than or equal to $\text{-} 1.$ As this piece is not defined for $x=0,$ the $y$-intercept can not be used to graph. Instead it can be graphed using a table of values.

$x$ $4x+6$ $f(x)$
$\text{-} 2.5$ $4({\color{#0000FF}{\text{-} 2.5}})+6$ $\text{-} 4$
$\text{-} 2$ $4({\color{#0000FF}{\text{-} 2}})+6$ $\text{-} 2$
$\text{-} 1.5$ $4({\color{#0000FF}{\text{-} 2.5}})+6$ $0$

These points are then marked and, as it is a linear function, joined with a straight line across the corresponding domain. The rule states that this piece is defined at $x=\text{-} 1.$ Therefore, the end is marked with a closed circle.

The second piece of the function is defined for $x=0.$ Therefore, the $y$-intercept can be used when graphing the function. The equation $f(x)=\text{-} x+3$ gives a linear function in slope-intercept form with $m=\text{-} 1 \quad \text{and} \quad b=3.$ By using the $y$-intercept and the slope, two points can be marked and then connected with a line across the corresponding domain. Since only $x$-values greater than $\text{-} 1$ are in the interval, the endpoint is not included in the function. Therefore, it is marked with an open circle.

Removing all unnecessary information, the final graph of $f$ is shown.

fullscreen
Exercise

Consider the rule of a piecewise function, $f.$ $f(x) = \begin{cases} 2 x+1 & \quad x \leq 1 \\ 1 & \quad 1< x < 2 \\ 2x-6 & \quad x\geq 2 \end{cases}$ Use the rule to determine $f(\text{-} 1)$ and $f(3.5).$ Then verify the points on the function's graph.

Show Solution
Solution

When determining points on a piecewise function, it is important to make sure that the correct piece of the function is used.

To evaluate $f(\text{-} 1)$ we must use the first piece of the function, $2 x+1,$ because $x=\text{-} 1$ is an element of that domain. Therefore, we find that $f({\color{#0000FF}{\text{-} 1}})=2({\color{#0000FF}{\text{-} 1}})+1=\text{-} 2+1=\text{-} 1.$ Thus, $(\text{-} 1,\text{-}1)$ should be a point on the graph of $f.$ We can find $f(3.5)$ in the same way. However, $2x-6$ will be used. $f({\color{#0000FF}{3.5}})=2\cdot {\color{#0000FF}{3.5}}-6=7-6=1.$ Thus, the point $(3.5, 1)$ should also lie on the graph. We'll plot both to verify.

Both points lie on the graph of $f,$ which verifies that $f(\text{-} 1)=\text{-} 1 \quad \text{and} \quad f(3.5)=1.$

Method

## Graphing Step Functions

A piecewise function that is defined by a constant value on each part of its domain is called a step function The following equation is one example of a step function. $f(x) = \begin{cases} 0 & \quad 0\leq x < 1 \\ 2 & \quad 1\leq x < 2 \\ 4 & \quad 2\leq x < 3 \\ 6 & \quad 3\leq x < 4 \end{cases}$ Graphs to step functions consist of two or more line segments that are horizontal lines. The function $f(x)$ has four segments.

When graphing step functions, as when graphing any piecewise function, each piece must be considered separately. Graph each piece across its domain. Mark the end or ends of with

• a closed circle when the endpoint is included in the function, or
• an open circle when the endpoint is not included in the function.
fullscreen
Exercise

To park a car at the Sombra Brothers Amusement Park costs $$5$ for the first two hours, then another$$1.50$ for each additional hour. Graph a function which describes the parking fee.

Show Solution
Solution

To begin, we'll make sense of the given information. The cost for parking the car starts at $$5.$ That cost remains unchanged for the first two hours. If you stay less than two hours, the entire amount must be paid. Each additional hour costs$$1.50.$ $\ 5 + \1.50 + \1.50 + \1.50 + \dots$ This is true even if you only go one minute into the next hour. Therefore, the fee for parking the car can be described as follows.

total cost number of hours parked
$$5$ $0\leq t <2$$$6.50$ $2\leq t <3$
$$8$ $3\leq t <4$$$9.5$ $4\leq t <5$
$\vdots$ $\vdots$

Since the parking fee is constant across each interval this is a step function. We can graph each piece of the function separately by drawing a horizontal line at the total cost for the corresponding number of hours.

The lower end of each piece is marked with a closed circle, while the upper end is marked with an open circle.

{{ 'mldesktop-placeholder-grade-tab' | message }}
{{ 'mldesktop-placeholder-grade' | message }} {{ article.displayTitle }}!