Gradient of a line through two points

Compute slope carefully with signs, then write the line equation.

Key formulas

m = (y₂ − y₁) / (x₂ − x₁)
y − y₁ = m(x − x₁)

Formula and signs

Gradient m measures rise over run. Keep the same order in numerator and denominator. A negative gradient means the line falls as x increases.

Worked example

Points A(1, 2) and B(5, 10). m = (10 − 2) / (5 − 1) = 8/4 = 2. Using point A: y − 2 = 2(x − 1) → y − 2 = 2x − 2 → y = 2x. Check with B: 2 × 5 = 10, correct.

Vertical and horizontal lines

If x₁ = x₂, the line is vertical and the gradient is undefined; write x = constant. If y₁ = y₂, the line is horizontal and m = 0; write y = constant.

Worked example

Worked example

Problem. Find the gradient of the line through A(2, −1) and B(6, 5).

Solution. m = (y₂ − y₁)/(x₂ − x₁) = (5 − (−1))/(6 − 2) = 6/4 = 3/2. The gradient is 3/2.

Negative gradient

From (2, 7) to (6, 1): m = (1 − 7)/(6 − 2) = (−6)/4 = −3/2.

Review quiz

Gradient through (−1,3) and (3,11) is:

Practice questions

  1. Find the gradient from (−3, 4) to (1, −2).
  2. Write the equation of the line through (0, 5) with gradient −1.

Study notes

Does order matter?

You may swap the points, but swap both coordinates the same way.

How do I know a calculation error?

Substitute both given points into the finished equation.

More in Coordinates & Vectors