Finding the Equation of a Line from Its Graph
Write the equation of a straight line from its gradient and -intercept, read and off a drawn line (also on axes with different scales), and find and interpret the equation of a line drawn from real data.
Before you start
- In Secondary 2 you wrote straight lines in the form : the gradient is , and the -intercept is , because the line cuts the -axis at . For example, has gradient and -intercept : it cuts the -axis at . In a real setting, the intercept is the amount of one thing when there is none of the other, and the gradient says how much one amount changes as the other goes up.
- You also met the horizontal line (gradient ) and the vertical line , which has no gradient and cannot be written in the form .
- In Secondary 1 you found a gradient from a step on a graph, reading each change from the numbers on the axes; in lesson 4.1 you found it from two points with
Writing y = mx + c from m and c
A straight line that is not vertical is fixed by its gradient and the point where it cuts the -axis. So if you know and , you know the line: put the two numbers into .
The equation from the gradient and the y-intercept
The straight line with gradient and -intercept has the equation .
If , the equation is : the horizontal line of Secondary 2.
Example 1: Writing the equation
Write down the equation of the straight line with (a) gradient and -intercept , (b) gradient and -intercept , (c) gradient , cutting the -axis at , (d) gradient , passing through the origin.
Solution
(a) and , so .
(b) and , so .
(c) The line cuts the -axis at , so . With : , which is written .
(d) The origin is on the -axis, so . With : , which is written .
(a) (b) (c) (d)
Reading m and c from a Graph
To find the equation of a drawn line, find its -intercept and its gradient from the graph, then write . Use points where the line passes exactly through a corner of the grid, so that their coordinates can be read exactly.
Finding y = mx + c from a graph
1. Find : read where the line cuts the -axis. If it cuts it at , the -intercept is .
2. Find : choose two points on the line at corners of the grid, far apart. Read the vertical change and the horizontal change from the numbers on the axes, going to the right (a step down is negative), or put their coordinates into
3. Write .
4. Check with a third point on the line, one you did not use: its coordinates must satisfy the equation.
Example 2: A line going up
Find the equation of the straight line drawn below.
Solution
Step 1: the line cuts the -axis at , so .
Step 2: the line also passes through the corner . From to the step is across and up.
. (By the formula:
Step 3: .
Step 4: the line also passes through . Check: .
The equation of the line is .
Example 3: A line going down, with a fractional gradient
Find the equation of the straight line drawn below.
Solution
Step 1: the line cuts the -axis at , so .
Step 2: going to the right from , the line next passes through a corner of the grid at : a step of across and down. A step down is negative.
Step 3: .
Step 4: the line also passes through . Check:
The equation of the line is .
Axes with Different Scales
On many graphs one square across and one square up stand for different amounts. Then a step must be read from the numbers on the axes, never by counting squares. The -intercept is read from the numbers too.
Example 4: Unequal scales
Find the equation of the straight line drawn below. On the -axis one square is unit; on the -axis one square is units.
Solution
Step 1: the line cuts the -axis at the grid line marked , at . So .
Step 2: the line passes through the corners and . From to : across, ; up, .
The step is squares across and squares up. Counting squares would give , which is wrong: each square up is units.
Step 3: .
Step 4: the line passes through . Check:
The equation of the line is .
Lines from Real Data
Many straight-line graphs come from real settings: a fare that grows with the distance, credit that falls as it is used. The variables then have their own letters, such as for a cost and for a distance, and the equation is written with those letters: , for example, in place of . Since there is no -axis, say "the value of when " rather than "the -intercept".
m and c in a real setting
The value of the vertical variable when the horizontal variable is is the starting amount: a fixed charge, the credit at the start, the height at the start.
The gradient is a rate. Its unit is the unit of the vertical axis per unit of the horizontal axis: dollars per kilometre, cents per minute. A positive gradient is an amount added for each unit; a negative gradient is an amount taken away for each unit.
The line is drawn only over the values that make sense in the setting: there is no fare for a negative distance.
Example 5: A taxi fare
The graph shows the fare, dollars, for a taxi ride of km, for rides of up to km. (a) Find the value of when , and say what it means. (b) Find the gradient of the line, with its unit, and say what it means. (c) Write down an equation connecting and . (d) Find the fare for a ride of km.
Solution
(a) The line starts on the vertical axis at . So when : there is a fixed charge of $ before the taxi moves.
(b) The line passes through the corners and . Across: km. Up: dollars.
Gradient dollars per km: the fare goes up by $ for every kilometre.
(c) .
Check with , the end of the line:
(d) :
(a) : a fixed charge of $. (b) dollars per km: $ for each kilometre. (c) (d) $
Example 6: Prepaid phone credit
Mei Ling has a prepaid phone plan. The graph shows the credit left, dollars, after minutes of calls. (a) Find the value of when , and say what it means. (b) Find the gradient, with its unit, and say what it means. (c) Write down an equation connecting and . (d) After how many minutes of calls is the credit used up? Check with your equation.
Solution
(a) The line starts on the vertical axis at . So when : the plan starts with $ of credit.
(b) The line passes through the corners and . Across: minutes. Down: dollars.
Gradient dollars per minute: the credit goes down by $ (25 cents) for every minute of calls.
(c) .
(d) The line meets the -axis at . Check:
(a) : $ of credit at the start. (b) dollars per minute: the credit falls by 25 cents a minute. (c) (d) After minutes.
Common Mistakes
- Counting squares on axes with different scales. In Example 4, counting squares gives instead of . Read each change from the numbers on the axes.
- Losing the sign of the gradient. Go to the right along the line: if it goes down, the vertical change is negative, and so is .
- Reading where the line cuts the -axis. The -intercept is where the line cuts the -axis.
- Using a point that is not exactly on a corner of the grid. Its coordinates can only be guessed, and so can the gradient.
- Checking only with a point you used to find and . It fits whenever your arithmetic is right, so it cannot show a misread point or a wrong gradient. Check with a third point read from the line.
- Leaving out the unit of a rate, or calling the starting amount "the -intercept" when the axes are not and .
Practice Questions
Work each question on paper before you open its solution. On every graph, read the numbers on the axes before you count. The questions get harder as you go.
Question 1
Write down the equation of the straight line with (a) gradient and -intercept , (b) gradient and -intercept , (c) gradient , cutting the -axis at , (d) gradient , passing through the origin.
ShowHide solution
(a)
(b)
(c) , so .
(d) , so .
(a) (b) (c) (d)
Question 2
Find the gradient and the -intercept of each line drawn below, and write down its equation.
(a)
(b)
(c)
ShowHide solution
(a) The line cuts the -axis at , so . It passes through : from the step is across and up, so . Check with : .
(b) The line cuts the -axis at , so . It passes through : from the step is across and down, so . Check with : .
(c) The line cuts the -axis at , so . It passes through : from the step is across and down, so . Check with : .
(a) , : (b) , : (c) , :
Question 3
Find the equation of the straight line drawn below.
ShowHide solution
The line cuts the -axis at , so .
Going to the right from , the line next passes through a corner of the grid at : a step of across and up. So .
Check with :
Question 4
Find the equation of the straight line drawn below. Read the scales on the axes first.
ShowHide solution
One square across is unit; one square up is units.
The line cuts the -axis at , so .
It passes through . From : across ; down . So . (Counting squares would give .)
Check with :
Question 5
Wei Jie is asked for the equation of the line drawn below. He says: "It cuts the -axis at , and from there it goes square across and square up, so its equation is ." Explain his mistake, find the correct equation, and use the point to show which equation is right.
ShowHide solution
One square across is units, not . His step of square across and square up is units across and unit up.
So , and with the equation is .
The point is on the line. In : . In : .
He counted squares, but one square across is 2 units. The equation is : satisfies it and does not satisfy .
Question 6
A water bath in the school laboratory is heated. The graph shows the temperature of its water, °C, minutes after the heater is switched on, for the first minutes. (a) Find the value of when , and say what it means. (b) Find the gradient, with its unit, and say what it means. (c) Write down an equation connecting and . (d) Use your equation to find when the temperature reaches °C.
ShowHide solution
(a) The line starts at when : the water is at °C when the heater is switched on.
(b) The line passes through and . Gradient °C per minute: the water gets °C hotter every minute.
(c) . Check with : .
(d) , so and . The graph agrees: it reaches °C at .
(a) : the water starts at °C. (b) °C per minute (c) (d) After minutes.
Question 7
A candle burns down at a steady rate. The graph shows its height, cm, hours after it is lit, until it has burnt away. (a) Find the gradient of the line, with its unit, and say what it means. (b) Write down an equation connecting and . (c) Find how long after it is lit the candle is cm tall.
ShowHide solution
(a) The line passes through the corners and . Gradient cm per hour: the candle gets cm shorter every hour.
(b) The value of when is (the candle is cm tall when it is lit), so . Check with :
(c) , so and .
(a) cm per hour: the candle burns down cm each hour. (b) (c) hours after it is lit.
Question 8
Two phone plans charge for calls each month. The graph shows the monthly bill, dollars, for minutes of calls on Plan A and on Plan B. (a) Write down an equation connecting and for each plan. (b) What do the gradients tell you? (c) For how many minutes of calls do the two plans cost the same? Check with your equations. (d) Which plan is cheaper for minutes of calls, and by how much?
ShowHide solution
(a) Plan A: the value of when is . It passes through , so its gradient is So .
Plan B: the line starts at the origin, so the value of when is . It passes through , so its gradient is So .
(b) Plan A charges dollars (5 cents) per minute on top of a fixed $ a month; Plan B charges dollars (10 cents) per minute and nothing fixed.
(c) The lines cross at . Check: and .
(d) Plan A: Plan B: . On the graph, at Plan A is the lower line.
(a) Plan A: ; Plan B: (b) Plan A: 5 cents a minute plus $; Plan B: 10 cents a minute. (c) minutes (both $) (d) Plan A, by $ ($ against $).
Question 9
(a) Find the equation of the straight line drawn below. (b) Use your equation to find the value of when , and the value of when , which are beyond the graph.
ShowHide solution
(a) The line cuts the -axis at , so . It passes through : from , across and down, so . So . Check with : .
(b) :
: , so and .
(a) (b) when ; when .
Key Points
- The straight line with gradient and -intercept is .
- From a graph: read where the line cuts the -axis, find from two corners of the grid, write , and check with a third point.
- Read every change from the numbers on the axes, never by counting squares; go to the right, and a step down is negative.
- In a real setting, use the setting's letters: the value of the vertical variable when the other is is the starting amount, and the gradient is a rate with a unit.
- A line from real data is drawn only over the values that make sense in the setting.
- A horizontal line has gradient ; a vertical line has no gradient and is not of the form .