Gradient of a Line
The gradient between two points (x₁,y₁) and (x₂,y₂), with a graph.
What is a gradient?
The gradient (m) — also called the slope in American usage — measures how much a line "rises" or "falls" relative to the x-axis. Mathematically: m = change in y / change in x = Δy / Δx. If you move 1 unit to the right along the line, the gradient tells you how far up (or down) you move on the vertical axis.
To find the gradient between two points (x₁, y₁) and (x₂, y₂), use the formula m = (y₂ − y₁) / (x₂ − x₁). The order matters: the numerator and denominator must use the same point first — if you take y₂ in the numerator, x₂ must appear in the denominator.
The four types of gradient
- Positive gradient (m > 0):the line "rises" — as you move right, y increases.
- Negative gradient (m < 0):the line "falls" — as you move right, y decreases.
- Zero gradient (m = 0): the line is horizontal — y stays constant. For example (1,3)→(5,3).
- Undefined gradient: the line is vertical, x₁ = x₂. You cannot divide by 0, so the gradient is undefined.
Three worked examples
- (1, 2) and (4, 5): m = (5 − 2) / (4 − 1) = 3 / 3 = 1. Positive gradient, the line rises by 1 for every unit to the right.
- (0, 10) and (5, 0): m = (0 − 10) / (5 − 0) = −10 / 5 = −2. Negative gradient, the line falls by 2 for every unit to the right.
- (0, 0) and (2, 1): m = (1 − 0) / (2 − 0) = 1/2 = 0.5. The gradient is a half — for every 2 units to the right, it rises by 1 unit.
Common mistakes
- Swapping the order! Calculating (y₁ − y₂) / (x₂ − x₁) instead of (y₂ − y₁) / (x₂ − x₁) gives a gradient with the wrong sign.
- Mixing up numerator and denominator.Remember: y is the "rise", x is the "run". Gradient = rise over run.
- Not spotting an undefined gradient.If x₁ = x₂, don't write "m = 0" — that is a vertical line and the gradient is undefined!
- Getting negative signs wrong. When subtracting a negative number, the sign flips: 3 − (−2) = 5.
How to use it
- Enter the coordinates of the two points: (x₁, y₁) and (x₂, y₂).
- The tool works out the gradient using the formula m = (y₂ − y₁) / (x₂ − x₁).
- When x₁ = x₂ the line is vertical and the gradient is undefined.
- The graph shows both points and the line through them.
Related tools
✍️ Written by the MathsUK teamChecked against the National Curriculum and GCSE specifications