y = mx + c

m is the slope, c is where it crosses.

Where the line crosses the y-axis

Every straight line that is not vertical has an equation of the form y = mx + c, where m and c are numbers.

Start with y = x + 2. Every point on the y-axis has x = 0, and putting x = 0 into the equation gives y = 0 + 2 = 2. So the line crosses the y-axis at (0, 2). This height is called the y-intercept.

The same happens for any line y = mx + c: when x = 0, the mx term is 0 and y = c. So c is the y-intercept.

xyy = x + 2(0, 2)

The line y = x + 2 crosses the y-axis at (0, 2), so its y-intercept is c = 2.

The gradient is the steepness

Now take y = 2x + 1. When x = 0, y = 1. When x = 1, y = 3. When x = 2, y = 5. Each step of 1 to the right adds 2 to y, because 2x grows by 2 each time x grows by 1.

So the line rises 2 for every 1 across. This number is the gradient of the line: how far it goes up for each 1 it goes across. In y = mx + c, the gradient is m, the number multiplying x. A bigger m makes a steeper line.

xyy = 2x + 1run 1rise 2

From the marked point (1, 3), a run of 1 across comes with a rise of 2 up the line y = 2x + 1: the gradient is 2.

Lines that fall have a negative gradient

In y = −2x + 6, each step of 1 to the right takes 2 away from y: when x = 0, y = 6; when x = 1, y = 4; when x = 2, y = 2. The line falls from left to right, and its gradient is −2.

The gradient is the rise divided by the run, measured left to right. A line that goes down has a negative rise, so its gradient is negative. A level line has no rise at all, so its gradient is 0: the line y = 3 is y = 0x + 3.

Δx = 2.6Δy = 1.8(0, 2)m = Δy / Δx = 1.8 / 2.6 = 0.69

moving right is Δx > 0, and the line climbs, so Δy > 0 and m = Δy/Δx = 0.69 is positive

Swing the point until the line is level

The line turns about (0, 2). Δx is the run and Δy is the rise, and the gradient is m = Δy / Δx. Swing the point down: the rise becomes negative and so does m. Make the line level and m = 0.

Reading m and c from an equation

In y = 3x − 2, the gradient is 3 and the y-intercept is −2, because y = 3x − 2 is y = 3x + (−2). The line crosses the y-axis at (0, −2) and rises 3 for every 1 across.

Keep the sign with each number. In y = 5 − x, the x term is −x, so the gradient is −1, and the y-intercept is 5.

Read m and c only when y is on its own on one side. 2y = 4x + 6 does not have gradient 4: divide every term by 2 to get y = 2x + 3, and the gradient is 2 and the y-intercept is 3.

12345−224xy

passing through (2, 3) forces 2m + c = 3, so each intercept c fixes m = (3 − c) / 2

Make the line pass through (2, 3)

One handle sits where the line meets the y-axis and sets c. The other sets the gradient m, which the handle calls the slope, another name for it. Make the line pass through (2, 3): each value of c needs its own gradient to get there.

The equation from two points

A line passes through (1, 5) and (3, 9). From the first point to the second, x goes from 1 to 3, a run of 3 − 1 = 2, and y goes from 5 to 9, a rise of 9 − 5 = 4. The gradient is the rise divided by the run: m = 4 / 2 = 2.

So the line is y = 2x + c, and c is still to be found. The point (1, 5) is on the line, so x = 1 and y = 5 make the equation true: 5 = 2 × 1 + c, which gives c = 3. The line is y = 2x + 3.

Check it with the other point: 2 × 3 + 3 = 9, which is the y-coordinate of (3, 9).

xyy = 2x + 3run 2rise 4

From the marked point (1, 5) to (3, 9) is a run of 2 and a rise of 4, so the gradient is 4 ÷ 2 = 2. The line meets the y-axis at 3.

The usual mistakes

Swapping m and c. In y = 4x + 3 the gradient is 4, the number multiplying x, and the y-intercept is 3, the number added on.

Adding m and c. In y = 4x + 3, the value 7 is y at x = 1, one step along the line. The y-intercept is y at x = 0, which is 3.

Dividing the run by the rise. The gradient is the change in y divided by the change in x: for (1, 5) and (3, 9) it is 4 ÷ 2 = 2, not 2 ÷ 4.

Writing a line from one point and its gradient

Looking ahead: a line can also be written straight from one point and its gradient, in point-slope form. A line with gradient m through the point (x₁, y₁) is y − y₁ = m(x − x₁), where x₁ and y₁ are the coordinates of that point.

The graph of a taxi fare has gradient 1.5 and passes through (2, 7), so its equation is y − 7 = 1.5(x − 2). Expand the bracket: y − 7 = 1.5x − 3. Add 7 to both sides: y = 1.5x + 4.

Substituting the point into y = 1.5x + c gives the same answer: 7 = 1.5 × 2 + c = 3 + c, so c = 4.

Worked example: A Taxi Fare Read from a Straight-Line Graph

Question The graph of a taxi fare, y dollars, against the distance traveled, x km, is a straight line. It passes through (2, 7) and (6, 13). (a) Find the equation of the line, and say what its gradient and its y-intercept mean for a passenger. (b) A journey costs $19. How long is the journey?

  1. 1.Find the gradient from the two points. From (2, 7) to (6, 13) the line rises 13 − 7 = 6 while it runs 6 − 2 = 4, so m = 64 = 1.5.

    04812162024024681012distance (km), xfare ($), yrun 4rise 6(2, 7)(6, 13)gradient = rise over runm = (13 − 7)/(6 − 2) = 6/4 = 1.5
    04812162024024681012distance (km), xfare ($), yrun 4rise 6(2, 7)(6, 13)gradient = rise over runm = (13 − 7)/(6 − 2) = 6/4 = 1.5
    From (2, 7) to (6, 13) the line rises 6 while it runs 4, so the gradient is m = 64 = 1.5.
  2. 2.Use the point-slope form with the point (2, 7): y − 7 = 1.5(x − 2). Expand the bracket: y − 7 = 1.5x − 3, so y = 1.5x + 4.

    04812162024024681012distance (km), xfare ($), yrun 4rise 6(2, 7)(6, 13)y − 7 = 1.5(x − 2)y = 1.5x − 3 + 7, so y = 1.5x + 4
    04812162024024681012distance (km), xfare ($), yrun 4rise 6(2, 7)(6, 13)y − 7 = 1.5(x − 2)y = 1.5x − 3 + 7, so y = 1.5x + 4
    Use the point (2, 7) in the point-slope form: y − 7 = 1.5(x − 2), which simplifies to y = 1.5x + 4.
  3. 3.(a) The equation is y = 1.5x + 4. The gradient 1.5 means that each kilometer adds $1.50 to the fare. The y-intercept 4 means that every journey starts with a charge of $4. Check with the other point: 1.5 × 6 + 4 = 13.

    04812162024024681012distance (km), xfare ($), yrun 4rise 6(2, 7)(6, 13)c = 4m = 1.5: each km adds $1.50 to the farec = 4: the fare starts at $4
    04812162024024681012distance (km), xfare ($), yrun 4rise 6(2, 7)(6, 13)c = 4m = 1.5: each km adds $1.50 to the farec = 4: the fare starts at $4
    (a) The gradient 1.5 is the charge for each kilometer, $1.50. The y-intercept 4 is the $4 charged at the start of every journey.
  4. 4.For a fare of $19, put y = 19 into the equation: 19 = 1.5x + 4. Subtract 4 from both sides: 1.5x = 15. Divide both sides by 1.5: x = 10.

    04812162024024681012distance (km), xfare ($), yrun 4rise 6(2, 7)(6, 13)c = 419 = 1.5x + 41.5x = 15, so x = 10
    04812162024024681012distance (km), xfare ($), yrun 4rise 6(2, 7)(6, 13)c = 419 = 1.5x + 41.5x = 15, so x = 10
    Put y = 19 into the equation: 19 = 1.5x + 4, so 1.5x = 15 and x = 10.
  5. 5.(b) The journey is 10 km long. Check: 1.5 × 10 + 4 = 19, so the point (10, 19) is on the line.

    04812162024024681012distance (km), xfare ($), yrun 4rise 6(2, 7)(6, 13)c = 4(10, 19)a fare of $19 is a journey of 10 kmcheck: 1.5 × 10 + 4 = 19
    04812162024024681012distance (km), xfare ($), yrun 4rise 6(2, 7)(6, 13)c = 4(10, 19)a fare of $19 is a journey of 10 kmcheck: 1.5 × 10 + 4 = 19
    (b) The journey is 10 km long. The point (10, 19) is on the line.

Answer: (a) y = 1.5x + 4: each kilometer costs $1.50 and every journey starts at $4; (b) 10 km

Common mistakes

  • Dividing the run by the rise, which gives 46. The gradient is the change in y divided by the change in x, because it measures how many dollars are added for each kilometer.
  • Dividing $19 by 1.5 to find the distance. That treats the whole fare as a charge for distance. The $4 starting charge must be subtracted first, which leaves $15 for the distance.

More graphs of equations problems, worked step by step →

Practice y = mx + c in the app