Linear graphs

CONNECT: Graphs
STRAIGHT LINES (LINEAR GRAPHS)
Please imagine you are in a supermarket. Bottled water is on sale for $2 per
bottle. (per bottle means for each bottle.) You grab one, then you see apples
also on sale for $2.98 per kg. Now, you only want one bottle of water, so you
know that you have to pay $2 for that. But you are not sure how much your
apples weigh. If they weigh 1 kg, your total cost will be $2.98 + $2. What if
they weigh 2 kg? Your total cost this time would be $2.98 x 2 + $2. What if
they weigh 3.5 kg? Your total cost would be $2.98 x 3.5 + $2.
Here we have two variables (values that can change). The first is the weight 1
of the apples and the second is the cost, which changes depending on that
weight. There is also a constant (that doesn’t change) in this relationship, the
price of the bottled water. 2
We can use algebra to express this relationship. Think of appropriate letters
to stand for each of the variables. We could use w for the weight of the
apples and C for the total cost of the bottled water and apples.
So the relationship is: C = 2.98 x w + 2
Whenever we have a relationship (or equation) linking 2 variables, we can
graph the relationship. We draw up a table where we choose the values of w
to use to find C because the Cost depends on the weight of apples, that is, C
depends on w. We call w the independent variable and C the dependent
variable. We can choose any value we like for w, except negative values, in
this case, because we can’t have negative weights of apples! As you
complete the table, think about what your answers mean:
w (weight)
C (cost)
0
1
2
7.96
3
4
13.92
For our graph, the Cost depends on the weight, which means that we put the
weight (w) on the horizontal axis. This is the axis we use for the independent
variable. The dependent variable (in this case Cost) goes on the vertical axis.
1
Scientists call this mass but we’ll stick with weight
2
Here, the 2.98 doesn’t change either but because it is multiplied by the weight variable, it has a
different, special name which we’ll meet later.
1
If you look at the diagram, you will see that we mark the values of weights of
apples evenly along the horizontal axis, using an appropriate distance
between whole numbers of kilograms. Then we mark the costs evenly along
the vertical axis, using an appropriate distance between whole numbers of
dollars.
Label the axes with what each represents (Weight of apples, say and Total
cost) and give the graph a title. Then plot each pair of values. For example,
for 2 kg of apples, the cost is $7.96 so you would put a point (a dot or a cross)
above the 2 on the horizontal axis and just under the 8 in line with the vertical
axis. I have used Excel to draw the graph:
Cost of water and apples ($)
16
T
o 14
t 12
a
l 10
c
o
s
t
(
)
$
8
6
4
2
0
0
1
2
3
Weight of apples (kg)
4
5
Now, you can see that the dots all lie in a straight line. We can join the dots to
make the straight line and label the line with its equation:
2
Cost of water and apples ($)
16
T
14
o
t 12
a
10
l
8
c
o
s
t
(
)
$
C = 2.98w+2
6
4
2
0
0
1
2
3
Weight of apples (kg)
4
5
This is an example of a linear relationship between 2 variables.
You can use the graph to work out many different scenarios. For example,
you can work out how much it would cost for the water and ½ kg of apples by
tracing from ½, or 0.5 on the horizontal axis up to the straight line, then across
to the vertical axis. You should find about $3.49, though it’s hard to be so
accurate on this graph! You can also do this by substituting w = ½, or 0.5 into
the equation, which gives the more accurate answer.
The graph also lets us work backwards. We could see how many apples we
can buy for $10 by going across from the $10 on the vertical axis and seeing
that w would be about 2.7. So we could get our bottle of water and about
2.7kg of apples for $10.
Another example of a linear relationship, also using cost as the dependent
variable would be: you need to get someone to fix your fridge. You have
found a repair company that charges $40 for the repair person just to come to
your house, then $50 for each hour they are there fixing the fridge. This
means if they are there for 1 hour your charge would be $90, 2 hours $140, ½
hour $65 and so on. I have completed the table using whole values of hours
(because the calculations are easier). I’ve called the hours h and used C for
cost again.
h
C
3
0
40
1
90
2
140
3
190
4
240
Here is the graph you would get:
Cost of repairing fridge ($)
300
(
250
C
o 200
s
t 150
)
$
C = 50h + 40
100
50
0
0
1
2
3
Time (hours)
4
5
In general, we call the value on the horizontal axis the independent variable,
𝑥, and the value on the vertical axis the dependent variable, 𝑦. So we could
have called the Cost in the fridge problem 𝑦 instead of C and the hours 𝑥
instead of h. The equation would have been written as 𝑦 = 50𝑥 + 40. The
variables are 𝑥 and 𝑦, the constant is 40 and 50 is called the coefficient of 𝑥 .
(Remember the apples and cost relationship we had earlier? 2.98 was the
coefficient of w.)
If you look at the table, or the graph, you can see that the values of C
increase by $50 each time. This means that every time h (hour) increases by
1, C (cost) increases by $50. This is called the gradient of the relationship (or
the gradient of the straight line that links h and C). It is also called “the rate of
change of C with respect to h”.
This brings us to two important facts about a linear graph. The first one is the
gradient, which is given as
gradient =
change in 𝑦
change in 𝑥
.
We have seen that in the fridge example, as 𝑥 (hours) changes by 1, 𝑦 (cost)
50
changes by 50, so the gradient is 1 , or just 50. The gradient measures how
steep the line is.
4
The other fact is called the 𝑦 -intercept. This is the value where the line
crosses the vertical axis (or 𝑦-axis). In the fridge example, the value of the 𝑦intercept is 40. This is the amount the repair company charges if the repair
person comes to your house but doesn’t stay there – the fridge is already
fixed!
You will always be able to read off the gradient and the 𝑦-intercept from an
equation. In fact, we generalise a linear equation because it always follows
the same form:
𝑦 = 𝑚𝑥 + 𝑏, where 𝑚 is the gradient and 𝑏 is the 𝑦-intercept.
𝑚 tells us the slope (or gradient) of the line, or how steep it is. 𝑚 can be
positive, where the line increases from left to right:
or 𝑚 can be negative, where the line decreases from left to
right:
What is the gradient and the 𝑦 -intercept of the equation in the water and
apples example?
(Answers: gradient = 2.98, -intercept = 2)
One last example: draw the graph of 𝑦 = 3𝑥 − 2. Also write down the
gradient and the 𝑦-intercept of the line.
You need at least 3 pairs of points in your table to draw a straight line. This is
to ensure you do not make an error. (If you only draw 2 points one of them
may be incorrect. If you draw 3 points, the line should go through all 3
points.) The table is over the page.
5
−1
−5
𝑥
𝑦
0
−2
1
1
This time we will not have a title for our graph, and the only labels we can
make are for the 𝑥 and 𝑦 axes. We can label the line with its equation. I
have used Excel again to draw the graph:
6
y
4
y = 3x - 2
2
-3
-2
-1
0
-2
-4
0
1
2
3
x
-6
-8
-10
(gradient = 3, -intercept = -2).
You can continue the graph in both directions after (–1, –5) and (1, 1). This is
because we can use ANY values of 𝑥 to find the values of 𝑦. (When I drew
this in Excel, I used two extra points as well.)
Here’s one for you to try.
Draw the graph of 𝑦 = 4𝑥 + 1. Write down the gradient and 𝑦-intercept of
the line.
(Answer over page)
If you need help with any of the Maths covered in this resource (or any other
Maths topics), you can make an appointment with Learning Development
through Reception: phone (02) 4221 3977, or Level 3 (top floor), Building 11,
or through your campus.
6
10
y
y = 4x + 1
8
6
4
2
-2
-1
0
-2
0
1
-4
Gradient = 4, 𝑦-intercept = 1
7
2
x
3