Skip to the page
Home Campus
Start free

Finding the Equation of a Line from Its Graph

Write the equation y=mx+cy = mx + c of a straight line from its gradient and yy-intercept, read mm and cc 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 y=mx+cy = mx + c: the gradient is mm, and the yy-intercept is cc, because the line cuts the yy-axis at (0,c)(0, c). For example, y=−23x+4y = -\frac{2}{3}x + 4 has gradient −23-\frac{2}{3} and yy-intercept 44: it cuts the yy-axis at (0,4)(0, 4). 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 y=ky = k (gradient 00) and the vertical line x=hx = h, which has no gradient and cannot be written in the form y=mx+cy = mx + c.
  • 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 m=y2−y1x2−x1.m = \frac{y_2 - y_1}{x_2 - x_1}\text{.}

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 yy-axis. So if you know mm and cc, you know the line: put the two numbers into y=mx+cy = mx + c.

The equation from the gradient and the y-intercept

The straight line with gradient mm and yy-intercept cc has the equation y=mx+cy = mx + c.

If m=0m = 0, the equation is y=cy = c: the horizontal line of Secondary 2.

Example 1: Writing the equation

Write down the equation of the straight line with (a) gradient 55 and yy-intercept 33, (b) gradient −2-2 and yy-intercept 77, (c) gradient 12\frac{1}{2}, cutting the yy-axis at (0,−4)(0, -4), (d) gradient −1-1, passing through the origin.

Solution

(a) m=5m = 5 and c=3c = 3, so y=5x+3y = 5x + 3.

(b) m=−2m = -2 and c=7c = 7, so y=−2x+7y = -2x + 7.

(c) The line cuts the yy-axis at (0,−4)(0, -4), so c=−4c = -4. With m=12m = \frac{1}{2}: y=12x+(−4)y = \frac{1}{2}x + (-4), which is written y=12x−4y = \frac{1}{2}x - 4.

(d) The origin (0,0)(0, 0) is on the yy-axis, so c=0c = 0. With m=−1m = -1: y=−1x+0y = -1x + 0, which is written y=−xy = -x.

(a) y=5x+3y = 5x + 3 (b) y=−2x+7y = -2x + 7 (c) y=12x−4y = \frac{1}{2}x - 4 (d) y=−xy = -x

Reading m and c from a Graph

To find the equation of a drawn line, find its yy-intercept and its gradient from the graph, then write y=mx+cy = mx + c. 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 cc: read where the line cuts the yy-axis. If it cuts it at (0,c)(0, c), the yy-intercept is cc.

2. Find mm: 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 m=y2−y1x2−x1.m = \frac{y_2 - y_1}{x_2 - x_1}\text{.}

3. Write y=mx+cy = mx + c.

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.

A straight line on a grid with one square for 1 unit on both axes, going up from left to right and cutting the y-axis above the originxy−2−11234−2−112345678910O

Solution

Step 1: the line cuts the yy-axis at (0,2)(0, 2), so c=2c = 2.

Step 2: the line also passes through the corner (4,10)(4, 10). From (0,2)(0, 2) to (4,10)(4, 10) the step is 44 across and 88 up.

The line through (0, 2) and (4, 10), with the step from (0, 2): 4 across, then 8 up; the point (1, 4) is also on itxy48−2−11234−2−112345678910O(0, 2)(4, 10)(1, 4)

m=84=2m = \frac{8}{4} = 2. (By the formula: 10−24−0=84=2.)\frac{10 - 2}{4 - 0} = \frac{8}{4} = 2\text{.)}

Step 3: y=2x+2y = 2x + 2.

Step 4: the line also passes through (1,4)(1, 4). Check: 2(1)+2=42(1) + 2 = 4.

The equation of the line is y=2x+2y = 2x + 2.

Example 3: A line going down, with a fractional gradient

Find the equation of the straight line drawn below.

A straight line on a grid with one square for 1 unit on both axes, going down from left to right and cutting the y-axis below the originxy−5−4−3−2−112345678−6−5−4−3−2−1123O

Solution

Step 1: the line cuts the yy-axis at (0,−1)(0, -1), so c=−1c = -1.

Step 2: going to the right from (0,−1)(0, -1), the line next passes through a corner of the grid at (3,−3)(3, -3): a step of 33 across and 22 down. A step down is negative.

The line through (0, −1) and (3, −3), with the step from (0, −1): 3 across, then 2 down; the point (−3, 1) is also on itxy3−2−5−4−3−2−112345678−6−5−4−3−2−1123O(0, −1)(3, −3)(−3, 1)

m=−23=−23m = \frac{-2}{3} = -\frac{2}{3}

Step 3: y=−23x−1y = -\frac{2}{3}x - 1.

Step 4: the line also passes through (−3,1)(-3, 1). Check: −23(−3)−1=2−1=1.-\frac{2}{3}(-3) - 1 = 2 - 1 = 1\text{.}

The equation of the line is y=−23x−1y = -\frac{2}{3}x - 1.

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 yy-intercept is read from the numbers too.

Example 4: Unequal scales

Find the equation of the straight line drawn below. On the xx-axis one square is 11 unit; on the yy-axis one square is 55 units.

A straight line going up steeply from left to right, on axes where one square across is 1 unit and one square up is 5 unitsxy−11234−10−55101520253035404550O

Solution

Step 1: the line cuts the yy-axis at the grid line marked −5-5, at (0,−5)(0, -5). So c=−5c = -5.

Step 2: the line passes through the corners (1,10)(1, 10) and (3,40)(3, 40). From (1,10)(1, 10) to (3,40)(3, 40): across, 3−1=23 - 1 = 2; up, 40−10=3040 - 10 = 30.

The line through (0, −5), (1, 10) and (3, 40) on axes where one square across is 1 unit and one square up is 5 units, with the step from (1, 10): 2 across, then 30 up to (3, 40); the point (2, 25) is also on itxy230−11234−10−55101520253035404550O(0, −5)(1, 10)(3, 40)(2, 25)

m=302=15m = \frac{30}{2} = 15

The step is 22 squares across and 66 squares up. Counting squares would give 62=3\frac{6}{2} = 3, which is wrong: each square up is 55 units.

Step 3: y=15x−5y = 15x - 5.

Step 4: the line passes through (2,25)(2, 25). Check: 15(2)−5=30−5=25.15(2) - 5 = 30 - 5 = 25\text{.}

The equation of the line is y=15x−5y = 15x - 5.

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 CC for a cost and dd for a distance, and the equation is written with those letters: C=0.6d+4C = 0.6d + 4, for example, in place of y=0.6x+4y = 0.6x + 4. Since there is no yy-axis, say "the value of CC when d=0d = 0" rather than "the yy-intercept".

m and c in a real setting

The value of the vertical variable when the horizontal variable is 00 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, CC dollars, for a taxi ride of dd km, for rides of up to 2020 km. (a) Find the value of CC when d=0d = 0, 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 CC and dd. (d) Find the fare for a ride of 1515 km.

The taxi fare, C dollars, for a ride of d km, drawn for d from 0 to 20: a straight line going up from left to right; one square across is 2 km and one square up is $2Distance, d (km)Fare, C ($)246810121416182024681012141618O

Solution

(a) The line starts on the vertical axis at C=4C = 4. So C=4C = 4 when d=0d = 0: there is a fixed charge of $44 before the taxi moves.

(b) The line passes through the corners (0,4)(0, 4) and (10,10)(10, 10). Across: 10−0=1010 - 0 = 10 km. Up: 10−4=610 - 4 = 6 dollars.

The taxi fare line with the step from (0, 4): 10 km across, then $6 up to (10, 10)Distance, d (km)Fare, C ($)10 km$6246810121416182024681012141618O(0, 4)(10, 10)

Gradient =610=0.6= \frac{6}{10} = 0.6 dollars per km: the fare goes up by $0.600.60 for every kilometre.

(c) C=0.6d+4C = 0.6d + 4.

Check with (20,16)(20, 16), the end of the line: 0.6(20)+4=12+4=16.0.6(20) + 4 = 12 + 4 = 16\text{.}

(d) d=15d = 15: C=0.6(15)+4=9+4=13.C = 0.6(15) + 4 = 9 + 4 = 13\text{.}

(a) C=4C = 4: a fixed charge of $44. (b) 0.60.6 dollars per km: $0.600.60 for each kilometre. (c) C=0.6d+4C = 0.6d + 4 (d) $1313

Example 6: Prepaid phone credit

Mei Ling has a prepaid phone plan. The graph shows the credit left, AA dollars, after tt minutes of calls. (a) Find the value of AA when t=0t = 0, and say what it means. (b) Find the gradient, with its unit, and say what it means. (c) Write down an equation connecting AA and tt. (d) After how many minutes of calls is the credit used up? Check with your equation.

The credit left, A dollars, after t minutes of calls: a straight line going down from left to right until it meets the t-axis; one square across is 10 minutes and one square up is $5Time, t (minutes)Credit, A ($)10203040506070809010051015202530O

Solution

(a) The line starts on the vertical axis at A=25A = 25. So A=25A = 25 when t=0t = 0: the plan starts with $2525 of credit.

(b) The line passes through the corners (0,25)(0, 25) and (40,15)(40, 15). Across: 40−0=4040 - 0 = 40 minutes. Down: 15−25=−1015 - 25 = -10 dollars.

Gradient =−1040=−0.25= \frac{-10}{40} = -0.25 dollars per minute: the credit goes down by $0.250.25 (25 cents) for every minute of calls.

(c) A=−0.25t+25A = -0.25t + 25.

(d) The line meets the tt-axis at t=100t = 100. Check: A=−0.25(100)+25=−25+25=0.A = -0.25(100) + 25 = -25 + 25 = 0\text{.}

(a) A=25A = 25: $2525 of credit at the start. (b) −0.25-0.25 dollars per minute: the credit falls by 25 cents a minute. (c) A=−0.25t+25A = -0.25t + 25 (d) After 100100 minutes.

Common Mistakes

  • Counting squares on axes with different scales. In Example 4, counting squares gives 33 instead of 1515. 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 mm.
  • Reading cc where the line cuts the xx-axis. The yy-intercept is where the line cuts the yy-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 mm and cc. 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 yy-intercept" when the axes are not xx and yy.

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 44 and yy-intercept −1-1, (b) gradient −34-\frac{3}{4} and yy-intercept 22, (c) gradient 0.50.5, cutting the yy-axis at (0,−4)(0, -4), (d) gradient 33, passing through the origin.

ShowHide solution

(a) y=4x−1y = 4x - 1

(b) y=−34x+2y = -\frac{3}{4}x + 2

(c) c=−4c = -4, so y=0.5x−4y = 0.5x - 4.

(d) c=0c = 0, so y=3xy = 3x.

(a) y=4x−1y = 4x - 1 (b) y=−34x+2y = -\frac{3}{4}x + 2 (c) y=0.5x−4y = 0.5x - 4 (d) y=3xy = 3x

Question 2

Find the gradient and the yy-intercept of each line drawn below, and write down its equation.

(a)

Line (a): a straight line going up from left to right, one square for 1 unit on both axesxy−3−2−1123−3−2−1123456789O

(b)

Line (b): a straight line going down from left to right, one square for 1 unit on both axesxy−4−3−2−11234−5−4−3−2−1123O

(c)

Line (c): a straight line going steeply down from left to right, one square for 1 unit on both axesxy−2−1123−4−3−2−112345O
ShowHide solution

(a) The line cuts the yy-axis at (0,3)(0, 3), so c=3c = 3. It passes through (2,7)(2, 7): from (0,3)(0, 3) the step is 22 across and 44 up, so m=42=2m = \frac{4}{2} = 2. Check with (−3,−3)(-3, -3): 2(−3)+3=−32(-3) + 3 = -3.

(b) The line cuts the yy-axis at (0,−1)(0, -1), so c=−1c = -1. It passes through (4,−5)(4, -5): from (0,−1)(0, -1) the step is 44 across and 44 down, so m=−44=−1m = \frac{-4}{4} = -1. Check with (−4,3)(-4, 3): −(−4)−1=3-(-4) - 1 = 3.

(c) The line cuts the yy-axis at (0,2)(0, 2), so c=2c = 2. It passes through (1,−1)(1, -1): from (0,2)(0, 2) the step is 11 across and 33 down, so m=−31=−3m = \frac{-3}{1} = -3. Check with (2,−4)(2, -4): −3(2)+2=−4-3(2) + 2 = -4.

(a) m=2m = 2, c=3c = 3: y=2x+3y = 2x + 3 (b) m=−1m = -1, c=−1c = -1: y=−x−1y = -x - 1 (c) m=−3m = -3, c=2c = 2: y=−3x+2y = -3x + 2

Question 3

Find the equation of the straight line drawn below.

A straight line going up from left to right and cutting the y-axis below the origin, one square for 1 unit on both axesxy−3−2−112345−6−5−4−3−2−1123456O
ShowHide solution

The line cuts the yy-axis at (0,−2)(0, -2), so c=−2c = -2.

Going to the right from (0,−2)(0, -2), the line next passes through a corner of the grid at (2,1)(2, 1): a step of 22 across and 33 up. So m=32m = \frac{3}{2}.

y=32x−2y = \frac{3}{2}x - 2

Check with (4,4)(4, 4): 32(4)−2=6−2=4.\frac{3}{2}(4) - 2 = 6 - 2 = 4\text{.}

y=32x−2y = \frac{3}{2}x - 2

Question 4

Find the equation of the straight line drawn below. Read the scales on the axes first.

A straight line going down from left to right, on axes where one square across is 1 unit and one square up is 10 unitsxy−11234−30−20−1010203040506070O
ShowHide solution

One square across is 11 unit; one square up is 1010 units.

The line cuts the yy-axis at (0,50)(0, 50), so c=50c = 50.

It passes through (2,10)(2, 10). From (0,50)(0, 50): across 2−0=22 - 0 = 2; down 10−50=−4010 - 50 = -40. So m=−402=−20m = \frac{-40}{2} = -20. (Counting squares would give −42=−2\frac{-4}{2} = -2.)

y=−20x+50y = -20x + 50

Check with (3,−10)(3, -10): −20(3)+50=−60+50=−10.-20(3) + 50 = -60 + 50 = -10\text{.}

y=−20x+50y = -20x + 50

Question 5

Wei Jie is asked for the equation of the line drawn below. He says: "It cuts the yy-axis at 11, and from there it goes 11 square across and 11 square up, so its equation is y=x+1y = x + 1." Explain his mistake, find the correct equation, and use the point (4,3)(4, 3) to show which equation is right.

A straight line going up from left to right, on axes where one square across is 2 units and one square up is 1 unitxy−6−4−2246−3−2−112345O
ShowHide solution

One square across is 22 units, not 11. His step of 11 square across and 11 square up is 22 units across and 11 unit up.

So m=12m = \frac{1}{2}, and with c=1c = 1 the equation is y=12x+1y = \frac{1}{2}x + 1.

The point (4,3)(4, 3) is on the line. In y=12x+1y = \frac{1}{2}x + 1: 12(4)+1=3\frac{1}{2}(4) + 1 = 3. In y=x+1y = x + 1: 4+1=5≠34 + 1 = 5 \ne 3.

He counted squares, but one square across is 2 units. The equation is y=12x+1y = \frac{1}{2}x + 1: (4,3)(4, 3) satisfies it and does not satisfy y=x+1y = x + 1.

Question 6

A water bath in the school laboratory is heated. The graph shows the temperature of its water, TT °C, tt minutes after the heater is switched on, for the first 1010 minutes. (a) Find the value of TT when t=0t = 0, and say what it means. (b) Find the gradient, with its unit, and say what it means. (c) Write down an equation connecting TT and tt. (d) Use your equation to find when the temperature reaches 6060 °C.

The temperature of the water, T °C, t minutes after the water bath's heater is switched on, for t from 0 to 10: a straight line going up from left to right; one square across is 1 minute and one square up is 10 °CTime, t (minutes)Temperature, T (°C)123456789101020304050607080O
ShowHide solution

(a) The line starts at T=20T = 20 when t=0t = 0: the water is at 2020 °C when the heater is switched on.

(b) The line passes through (0,20)(0, 20) and (4,40)(4, 40). Gradient =40−204−0=204=5= \frac{40 - 20}{4 - 0} = \frac{20}{4} = 5 °C per minute: the water gets 55 °C hotter every minute.

(c) T=5t+20T = 5t + 20. Check with (10,70)(10, 70): 5(10)+20=705(10) + 20 = 70.

(d) 5t+20=605t + 20 = 60, so 5t=405t = 40 and t=8t = 8. The graph agrees: it reaches 6060 °C at t=8t = 8.

(a) T=20T = 20: the water starts at 2020 °C. (b) 55 °C per minute (c) T=5t+20T = 5t + 20 (d) After 88 minutes.

Question 7

A candle burns down at a steady rate. The graph shows its height, hh cm, tt 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 hh and tt. (c) Find how long after it is lit the candle is 66 cm tall.

The height of a candle, h cm, t hours after it is lit: a straight line going down from left to right until it meets the t-axis; one square across is 2 hours and one square up is 4 cmTime, t (hours)Height, h (cm)246810121416481216202428O
ShowHide solution

(a) The line passes through the corners (0,24)(0, 24) and (8,12)(8, 12). Gradient =12−248−0=−128=−1.5= \frac{12 - 24}{8 - 0} = \frac{-12}{8} = -1.5 cm per hour: the candle gets 1.51.5 cm shorter every hour.

(b) The value of hh when t=0t = 0 is 2424 (the candle is 2424 cm tall when it is lit), so h=−1.5t+24h = -1.5t + 24. Check with (16,0)(16, 0): −1.5(16)+24=−24+24=0.-1.5(16) + 24 = -24 + 24 = 0\text{.}

(c) −1.5t+24=6-1.5t + 24 = 6, so −1.5t=−18-1.5t = -18 and t=12t = 12.

(a) −1.5-1.5 cm per hour: the candle burns down 1.51.5 cm each hour. (b) h=−1.5t+24h = -1.5t + 24 (c) 1212 hours after it is lit.

Question 8

Two phone plans charge for calls each month. The graph shows the monthly bill, CC dollars, for nn minutes of calls on Plan A and on Plan B. (a) Write down an equation connecting CC and nn 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 250250 minutes of calls, and by how much?

The monthly bill, C dollars, for n minutes of calls on two plans: Plan A starts above the origin and Plan B starts at the origin and is steeper; the lines cross; one square across is 50 minutes and one square up is $5Calls, n (minutes)Bill, C ($)501001502002503005101520253035OPlan APlan B
ShowHide solution

(a) Plan A: the value of CC when n=0n = 0 is 1010. It passes through (200,20)(200, 20), so its gradient is 20−10200−0=10200=0.05.\frac{20 - 10}{200 - 0} = \frac{10}{200} = 0.05\text{.} So C=0.05n+10C = 0.05n + 10.

Plan B: the line starts at the origin, so the value of CC when n=0n = 0 is 00. It passes through (200,20)(200, 20), so its gradient is 20−0200−0=0.1.\frac{20 - 0}{200 - 0} = 0.1\text{.} So C=0.1nC = 0.1n.

(b) Plan A charges 0.050.05 dollars (5 cents) per minute on top of a fixed $1010 a month; Plan B charges 0.10.1 dollars (10 cents) per minute and nothing fixed.

(c) The lines cross at (200,20)(200, 20). Check: 0.05(200)+10=10+10=200.05(200) + 10 = 10 + 10 = 20 and 0.1(200)=200.1(200) = 20.

(d) Plan A: 0.05(250)+10=12.5+10=22.5.0.05(250) + 10 = 12.5 + 10 = 22.5\text{.} Plan B: 0.1(250)=250.1(250) = 25. On the graph, at n=250n = 250 Plan A is the lower line.

(a) Plan A: C=0.05n+10C = 0.05n + 10; Plan B: C=0.1nC = 0.1n (b) Plan A: 5 cents a minute plus $1010; Plan B: 10 cents a minute. (c) 200200 minutes (both $2020) (d) Plan A, by $2.502.50 ($22.5022.50 against $2525).

Question 9

(a) Find the equation of the straight line drawn below. (b) Use your equation to find the value of yy when x=10x = 10, and the value of xx when y=−15y = -15, which are beyond the graph.

A straight line going down from left to right, one square for 1 unit on both axesxy−2−112345−7−6−5−4−3−2−11234567O
ShowHide solution

(a) The line cuts the yy-axis at (0,3)(0, 3), so c=3c = 3. It passes through (2,−1)(2, -1): from (0,3)(0, 3), 22 across and 44 down, so m=−42=−2m = \frac{-4}{2} = -2. So y=−2x+3y = -2x + 3. Check with (5,−7)(5, -7): −2(5)+3=−7-2(5) + 3 = -7.

(b) x=10x = 10: y=−2(10)+3=−20+3=−17.y = -2(10) + 3 = -20 + 3 = -17\text{.}

y=−15y = -15: −2x+3=−15-2x + 3 = -15, so −2x=−18-2x = -18 and x=9x = 9.

(a) y=−2x+3y = -2x + 3 (b) y=−17y = -17 when x=10x = 10; x=9x = 9 when y=−15y = -15.

Key Points

  • The straight line with gradient mm and yy-intercept cc is y=mx+cy = mx + c.
  • From a graph: read cc where the line cuts the yy-axis, find mm from two corners of the grid, write y=mx+cy = mx + c, 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 00 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 y=ky = k has gradient 00; a vertical line x=hx = h has no gradient and is not of the form y=mx+cy = mx + c.

Previous lesson4.2 Length of a Line Segment Next lesson4.4 Finding the Equation of a Line Through Two Points

All Secondary 3 (Grade 9) lessons

Home Campus has lessons for Primary 3 to Secondary 4, and practice questions with worked solutions and worksheets for Primary 3 to Secondary 2. Register free to practise and keep track of progress.

This lesson follows the Singapore Secondary 3 syllabus and was checked question by question before it was published. Spotted a mistake? Tell us.