topic badge
AustraliaVIC
VCE 11 General 2023

3.06 Piecewise and step graphs

Lesson

Piecewise linear graphs

Sometimes more than one linear equation is needed to create a linear model for a given situation. Piecewise graphs are formed by two or more graphs. When a piecewise linear graph has no gaps or breaks, where all the lines are connected to one another, it creates a continuous piecewise function.

A domain is given for each individual graph in a piecewise function. For continuous piecewise functions, each domain gives you information on where the graphs intersect.

-1
1
2
3
4
5
6
7
x
1
2
3
4
5
6
7
y

Here are two linear graphs that form a piecewise linear graph.

\text{Line 1: } y = 3x + 3, \, x \leq 1 \\ \text{Line 2: } y = -x + 7, x > 1

Line 1 is drawn for x-values less than and including x = 1 and line 2 is only drawn for x-values larger than 1. Together they intersect at x = 1 and form a piecewise linear function.

If the domain wasn't given for each graph, the point of intersection would need to be found by letting equation 1 equal equation 2 and solving for x.

\displaystyle 3x + 3\displaystyle =\displaystyle -x+7
\displaystyle 4x\displaystyle =\displaystyle 4
\displaystyle 4\displaystyle =\displaystyle 1

Since both lines intersect when x = 1, this means line 1 has the domain x \leq 1 and line 2 has the domain x > 1.

Examples

Example 1

Consider the following piecewise relationship.

y = \begin{cases} 2 & \text{when } x \lt 0 \\ x + 2 & \text{when } x \gt 0 \end{cases}

Draw the piecewise graph.

Worked Solution
Create a strategy

Graph each linear function over each interval.

Apply the idea
-4
-3
-2
-1
1
2
3
4
5
6
x
-1
1
2
3
4
5
6
7
8
9
y

For x \lt 2, we need to graph the constant function y=2. At x=2 we should have a hollow circle since the inequality is "less than" 0 and not "equal to".

When x=2 we get y=0+2=2. From the point (0,2) we draw a line with a slope of 1.

For x \gt 0, we need to graph the straight line function y = x + 2. At x=2 we should use a hollow circle since the inequality is "greater than" 0 and not "equal to".

Example 2

What is the function definition of the graph?

-5
-4
-3
-2
-1
1
2
3
4
5
x
-5
-4
-3
-2
-1
1
2
3
4
5
y
A
y = \begin{cases} \dfrac{3}{2}x + 3 & \text{if } x \leq 0 \\ 3 - x & \text{if } 0 \leq x \leq 3 \\ 2x - 6 & \text{if } x > 3 \\ \end{cases}
B
y = \begin{cases} \dfrac{3}{2}x + 3 & \text{if } x \leq 0 \\ 3 - x & \text{if } 0 < x \leq 3 \\ 2x - 6 & \text{if } 3 < x < 5 \\ \end{cases}
C
y = \begin{cases} \dfrac{3}{2}x + 3 & \text{if } -5 \leq x \leq 0 \\ 3 - x & \text{if } 0 < x \leq 3 \\ 2x - 6 & \text{if } x > 3 \\ \end{cases}
D
y = \begin{cases} \dfrac{3}{2}x + 3 & \text{if } -5 \leq x \leq 0 \\ 3 - x & \text{if } 0 < x \leq 3 \\ 2x - 6 & \text{if } 3 < x \leq 5 \\ \end{cases}
Worked Solution
Create a strategy

Consider each piece of the function and its domain separately.

Apply the idea
-5
-4
-3
-2
-1
1
2
3
4
5
x
-5
-4
-3
-2
-1
1
2
3
4
5
y

This part of the function is defined from the end point (0, 3) up to the negative infinity on the x-axis. So the interval would be x \leq 0.

Using the (0,3) and another point on the line, (-2,0) we can find the slope: \begin{aligned} b&= \dfrac{y_2-y_1}{x_2-x_1} \\ &= \dfrac{0-3}{-2-0} \\ &= \dfrac{3}{2} \end{aligned}

We can see that the y-intercept is at (0,3) so using the slope-intercept form of an equation we find the equation to be y=\dfrac{3}{2}x+3.

-5
-4
-3
-2
-1
1
2
3
4
5
x
-5
-4
-3
-2
-1
1
2
3
4
5
y

This part is defined between the end points: (0, 3) and (3, 0). So the interval would be 0 \lt x \leq 3.

Using the above points we can find the slope: \begin{aligned} b &= \dfrac{0-3}{3-0} \\ &= -1 \end{aligned}We can see that the y-intercept is at (0,3) so using the slope-intercept form of an equation we find the equation to be y=3-x.

-5
-4
-3
-2
-1
1
2
3
4
5
x
-5
-4
-3
-2
-1
1
2
3
4
5
y

This part is defined between the end points: (3, 0) and a hollow circle at (5, 4). So the interval would be 3 \lt x \lt 5.

Using the above points we can find the slope: \begin{aligned} b &= \dfrac{4-0}{5-3} \\ &= 2 \end{aligned}

Using the slope-intercept form the equation is y=a+2x. By substituting the point (3,0) we can find a:\begin{aligned} 0&=a+2(3) \\ a&=-6 \end{aligned}

So the equation is y=-6+2x. This can also be written as y=2x-6.

So the piecewise function is:y = \begin{cases} \dfrac{3}{2}x + 3 & \text{if } x \leq 0 \\ 3 - x & \text{if } x < 0 \leq 3 \\ 2x - 6 & \text{if } 3 < x < 5 \\ \end{cases} Option B is the correct answer.

Idea summary

Piecewise graphs are formed by two or more graphs. A piecewise linear function is made up of line segments of various linear graphs.

We use filled and hollow circles to indicate whether a point is included at the end of each line segment.

We can define a piecewise function using an function equation of the form:y = \begin{cases} ⬚ &\text{if } ⬚ \leq x \leq ⬚ \\ ⬚ &\text{if } ⬚ \leq x \leq ⬚ \\ ⬚ & \text{if } ⬚ \lt x \leq ⬚ \\ ... \end{cases}

Step graphs

A step graph is formed by two or more horizontal lines. A step graph is a type of piecewise graph where the lines do not join one another, as parallel lines never intersect one another. So when moving from left to right along a horizontal line, the graph will either step up or step down to a different horizontal line.

-4
-3
-2
-1
1
2
3
4
x
-4
-3
-2
-1
1
2
3
4
y

Here is a step graph, defined by the following equations.y = -1, \, x \leq 0 \\ y = 1, x > 1

For negative values of x, the graph follows the horizontal line y=-1. The step occurs when x=0. So moving from left to right along the x-axis, the graphs steps up when x=0 and then graph follows the horizontal line y=1 for increasing, positive values of x.

What is the value of y when x=0? Does it equal -1,\, 1 or perhaps some value in between? The answer lies in the given domains. The graph y=-1 has the domain x \leq 0, which means that x is less than or equal to o. So this domain includes x=0. Whereas the graph y=1 has the domain x>0, which means that x is greater than 0. This domain does not include x=0. Therefore when x=0, \, y=-1 and not 1.

Examples

Example 3

Consider the following piecewise graph.

-2
-1
1
2
3
4
5
6
x
-5
-4
-3
-2
-1
1
2
3
y
a

State the equation for x>3.

Worked Solution
Create a strategy

Consider the piece of the function whose domain is x>3.

Apply the idea
-2
-1
1
2
3
4
5
6
x
-5
-4
-3
-2
-1
1
2
3
y

This part of the function is defined by the interval x>3.

The graph is always constant at y=2.

So the equation for x>3 is the constant function y=2.

b

State the equation for x \leq 3.

Worked Solution
Create a strategy

Consider the piece of the function whose domain is x \leq 3.

Apply the idea
-2
-1
1
2
3
4
5
6
x
-5
-4
-3
-2
-1
1
2
3
y

This part of the function is defined by the interval x \leq 3.

The graph is always constant at y=-3.

So the equation for x \leq 3 is the constant function y=-3.

Idea summary

A step graph is formed by two or more horizontal lines. A step graph is a type of piecewise graph where the lines do not join one another, as parallel lines never intersect one another. So when moving from left to right along a horizontal line, the graph will either step up or step down to a different horizontal line.

Model with piecewise functions and step graphs

Sometimes when attempting to create a linear model that describes a relationship between two variables, one linear model is not enough. As one (independent) variable changes, it's relationship to the other (dependent) variable may also change. When this occurs, piecewise functions and step graphs can be used, so that multiple linear models can be applied to the one real-life scenario.

Examples

Example 4

The line graph shows the amount of petrol in a car’s tank.

A piecewise graph showing the Petrol consumption of a car in a day. Ask your teacher for more information.
a

How much petrol was initially in the tank?

Worked Solution
Create a strategy

Find the value on the graph corresponding to the start time.

Apply the idea

The time starts at 8 am and its corresponding value on the graph is 16 litres.

So the tank initially has 16 litres of petrol.

b

What happened at 9 am and 1 pm?

A
The driver filled the tank.
B
The amount of petrol being used increased.
C
The car was travelling at a fast speed.
Worked Solution
Create a strategy

Use the given graph.

Apply the idea

Using the graph we can see that the corresponding value at 9 am and 1 pm is at the highest. So this means that the driver filled the tank.

So the correct answer is option A.

c

How much petrol was used between 1 pm and 5 pm?

Worked Solution
Create a strategy

Find the difference of the litres using the vertical axis.

Apply the idea

The amount of petrol at 1 pm is 32 litres and the amount of petrol at 5 pm is 16 litres.32-16=16

So the amount of petrol used was 16litres.

d

To the nearest hour, when did the petrol in the tank first fall below 18 litres?

Worked Solution
Create a strategy

Use the graph and find the earliest time that the level of petrol in the tank fell to 18 litres.

Apply the idea

From the graph we can see that at 9am, the level of petrol was increasing, not decreasing.

So the petrol in the tank first fall below 18 litres is approximately at 12 noon.

Example 5

The graph shows the cost of sending parcels of various weight overseas:\text{Postal Charges}

50
100
150
200
250
300
350
\text{Weight (g)}
0.5
1
1.5
2
2.5
3
3.5
4
4.5
5
5.5
\text{Cost } (\$)
a

Find the cost of sending a letter weighing 100 grams.

A
\$5.50
B
\$2
C
\$1
D
\$1.50
Worked Solution
Create a strategy

Use the step graph.

Apply the idea
50
100
150
200
250
300
350
\text{Weight (g)}
0.5
1
1.5
2
2.5
3
3.5
4
4.5
5
5.5
\text{Cost } (\$)

From the 100 on the x-axis, we trace up to the filled circle on the step and across to the y-axis we get a cost of 1.

So the cost of sending a letter weighing 100 grams is \$1.

Option C is the correct answer.

b

Find the cost of sending a letter weighing 300 grams.

A
\$5.50
B
\$2
C
\$1
D
\$6
Worked Solution
Create a strategy

Use the step graph.

Apply the idea
50
100
150
200
250
300
350
\text{Weight (g)}
0.5
1
1.5
2
2.5
3
3.5
4
4.5
5
5.5
\text{Cost } (\$)

From the 300 on the x-axis, we trace up to the filled circle on the step and across to the y-axis we get a cost of 5.50.

So the cost of sending a letter weighing 300 grams is \$5.50.

Option A is the correct answer.

c

What is the heaviest letter that can be sent for \$2?

A
75 grams
B
100 grams
C
175 grams
D
300 grams
Worked Solution
Create a strategy

Use the step graph.

Apply the idea
50
100
150
200
250
300
350
\text{Weight (g)}
0.5
1
1.5
2
2.5
3
3.5
4
4.5
5
5.5
\text{Cost } (\$)

From 2 on the y-axis, we trace to the filled circle on the right of the step and down to the x-axis to get 175.

Because this point is at the right end of the step, we know it is the largest number of minutes. Also because the circle is filled we know we can include this x-value.

So the the heaviest letter that can be sent for \$2 is 175 grams.

Option C is the correct answer.

Idea summary

Piecewise functions can be useful to model scenarios where the relationship between the variables changes over time. Such as speed over a long journey, amount of money in a bank account.

Outcomes

U1.AoS4.4

situations that can be modelled by piecewise linear graphs

U1.AoS4.9

use piecewise linear graphs to model and analyse practical situations

What is Mathspace

About Mathspace