Equation of a Line Through 2 Points
y = mx + c automatically, from (x₁,y₁) to (x₂,y₂).
How do you find the equation of a line through 2 points?
Every line in the plane has a unique equation, and two different points are enough to pin it down completely. The most common form is y = mx + c, where m is the gradient (also called the slope — how much y rises for every unit of x) and c is the y-value where the line crosses the y-axis.
y = mx + c — the standard gradient-intercept form of a line's equation. To find it from two points you do two steps: first work out the gradient m = (y₂ − y₁) / (x₂ − x₁), then substitute one of the points into the equation and solve for c: c = y − m·x.
Three worked examples
m = (5 − 3) / (2 − 1) = 2 / 1 = 2; c = 3 − 2·1 = 1; y = 2x + 1.
m = (−2 − 4) / (3 − 0) = −6 / 3 = −2; c = 4 − (−2)·0 = 4; y = −2x + 4.
m = (−3 − 5) / (2 − (−2)) = −8 / 4 = −2; c = 5 − (−2)·(−2) = 5 − 4 = 1; y = −2x + 1.
Common mistake
Guessing c incorrectly— many students try to read off c just by eye. Always substitute one of the points after you've found m: once you know the gradient, take (x₁, y₁) or (x₂, y₂) and substitute it into y = mx + c. Both points must give the same c — a great way to check you haven't made a mistake.
How to use it
- Enter the two coordinates (x₁, y₁) and (x₂, y₂).
- The tool works out m = (y₂−y₁)/(x₂−x₁) and then c = y₁ − m·x₁.
- When x₁ = x₂ the line is vertical, so the gradient is undefined — it shows x = c.
- Forms shown: gradient-intercept, standard, and point-gradient.
Related tools
✍️ Written by the MathsUK teamChecked against the National Curriculum and GCSE specifications