A linear function gives a straight-line graph. In Sec 1 you'll plot these lines, find their gradient (steepness) and write their equation in the form y = mx + c.

Coordinates

A point is written (x, y): go across first, then up or down. The origin is (0, 0). The x-axis is horizontal and the y-axis is vertical.

The equation y = mx + c

  • m is the gradient: how much y changes when x increases by 1.
  • c is the y-intercept: where the line crosses the y-axis.

For y = −3x + 6: the gradient is −3 and the y-intercept is 6. The line crosses the x-axis where y = 0: −3x + 6 = 0, so x = 2.

Gradient

Gradient = rise ÷ run = (y₂ − y₁) ÷ (x₂ − x₁)

LineGradient
Slopes up from left to rightPositive
Slopes down from left to rightNegative
Horizontal, e.g. y = 40
Vertical, e.g. x = 3Undefined

For a step-by-step visual, see our Gradient of a Straight Line note.

Worked example 1

Find the equation of the line through A(1, 3) and B(4, 9).

Gradient m = (9 − 3) ÷ (4 − 1) = 6 ÷ 3 = 2, so y = 2x + c.
Substitute A(1, 3): 3 = 2(1) + c, so c = 1.
The equation is y = 2x + 1. Check with B: 2(4) + 1 = 9 ✓

Graph of y = 2x + 1 through A(1, 3) and B(4, 9), showing a run of 3 and a rise of 6

Drawing a straight-line graph

Make a table of values with at least three points, plot them and join with a ruler.

For y = 2x − 1:

x−10123
y−3−1135

If your points don't line up, recheck the table: one of the values is wrong.

Lines in real life

A delivery service charges a fixed $4 plus $0.50 per km. The cost is C = 0.5d + 4, where d is the distance in km. The gradient (0.5) is the cost per km and the intercept (4) is the fixed charge.

Common mistakes

  • Plotting (y, x) instead of (x, y).
  • Subtracting the coordinates in a different order on the top and bottom of the gradient formula.
  • Reading the y-intercept from the x-axis.

Try these

  1. Find the gradient of the line through (−2, 5) and (3, −5).
  2. Find the equation of that line.
  3. Does the point (4, −7) lie on the line in question 2?
Show answers
  1. (−5 − 5) ÷ (3 − (−2)) = −10 ÷ 5 = −2
  2. y = −2x + c; 5 = −2(−2) + c, so c = 1 and y = −2x + 1
  3. Yes: −2(4) + 1 = −7