In short: To find the equation of a line from two points, first work out the gradient with m = (change in y) ÷ (change in x). Then substitute that gradient and one of the points into y = mx + c to solve for c. Write the final answer in the form y = mx + c.
Finding the equation of a line from two points is one of the most reliable mark-earners on the GCSE Higher maths paper. If you can read two coordinates off a graph or a question, you can produce the full equation of the straight line that joins them. This guide gives a method that works every time, a fully worked example, and the slips that quietly cost marks in the exam.
The reliable method
Suppose you are given two points, A (x₁, y₁) and B (x₂, y₂). Follow these steps in order.
- Find the gradient. Use m = (y₂ − y₁) ÷ (x₂ − x₁). This is the change in y divided by the change in x. Subtract in the same order on the top and bottom.
- Write the partial equation. Put your gradient into y = mx + c. At this stage you know m but not yet c.
- Substitute one point. Choose either point — both give the same answer — and put its x and y values into the equation. This leaves one unknown, c.
- Solve for c. Rearrange to find the y-intercept, then write the complete equation y = mx + c. Check it by substituting the other point; both sides should match.
The order matters. Get the gradient first, because everything else depends on it.
A worked example
Find the equation of the straight line that passes through the points (2, 3) and (6, 11).
Step 1 — gradient. Label (2, 3) as point A and (6, 11) as point B.
m = (11 − 3) ÷ (6 − 2) = 8 ÷ 4 = 2
Step 2 — partial equation. With m = 2:
y = 2x + c
Step 3 — substitute a point. Use (2, 3), so x = 2 and y = 3:
3 = 2 × 2 + c 3 = 4 + c
Step 4 — solve for c.
c = 3 − 4 = −1
So the equation is y = 2x − 1.
Check with the other point. Substitute (6, 11): 2 × 6 − 1 = 12 − 1 = 11. That matches the y-value, so the equation is correct.
This works because every point on a straight line obeys the same rule y = mx + c. Once you have the gradient and force the line through one known point, the line is completely fixed — and the second point confirms it.
Common mistakes to avoid
- Subtracting in different orders. If you do y₂ − y₁ on the top, you must do x₂ − x₁ on the bottom. Mixing the order flips the sign of the gradient. Reading a negative gradient as positive (or the reverse) is a frequent slip — see [negative gradient sign blindness explained](/misconceptions/negative-gradient-sign-blindness).
- Putting Δx over Δy. The gradient is the change in y over the change in x, not the other way round. Writing it upside down gives the reciprocal and loses the marks.
- Forgetting to find c. Some students stop at y = 2x, treating the gradient as the whole answer. The y-intercept c is part of the equation and must be calculated.
- Sign errors when rearranging. When solving 3 = 4 + c, students sometimes write c = 4 − 3. Move the number across the equals sign and change its sign carefully.
- Not checking with the second point. The free check is the second coordinate. If it does not satisfy your equation, you have made an error — fix it before moving on.
Frequently asked questions
How do you find the equation of a straight line from two coordinates? Work out the gradient using m = (change in y) ÷ (change in x), substitute the gradient and one coordinate into y = mx + c, then solve for c. The result is the full equation in the form y = mx + c.
What is the formula for the gradient between two points? The gradient is m = (y₂ − y₁) ÷ (x₂ − x₁). It measures how much y changes for each unit increase in x. Always subtract the coordinates in the same order top and bottom.
Do I need the y-intercept to write the equation? Yes. The equation y = mx + c needs both the gradient m and the y-intercept c. You find c by substituting one of your two points into the equation after working out the gradient.
Does it matter which point I substitute? No. Both points lie on the same line, so either one gives the same value of c. Using the second point afterwards is a useful way to check your answer.
What if the two points have the same x-coordinate? Then the line is vertical and its equation is x = a number (for example x = 4). You cannot use y = mx + c because the gradient is undefined — the change in x would be zero, and you cannot divide by zero.
Practise this
See which slips cost you marks — [take the free diagnostic](/diagnostic). Related: [negative gradient sign blindness explained](/misconceptions/negative-gradient-sign-blindness).