Guide
Finding the equation of a straight line from two points
Given two points on a line, the two-point formula gives you the gradient m, and putting one point back in gives you c. Here is the whole method, and why the formula looks the way it does.
Often we need the gradient of a linear function, and we are not told what it is. There are several ways to find it, and it depends entirely on what information we have, but typically we have been given two points. This guide shows the formula that gives the gradient from two points, why it works, and how to find afterwards, so we end up with the whole equation of the line.
When do I use this?
Whenever a question gives you two points on a straight line, as coordinates or as points you can read off a graph, and asks for the equation of the line. The same method also covers the case where you are given one point and the gradient: then you skip straight to the second half, finding .
The two-point formula
If we have two points
that lie on the line, we can find the gradient with the formula, which funnily enough is called the two-point formula:
The formula says that we find the difference between the two points' -values, and divide it by the difference between the -values.
Worked example: the line through (2, 4) and (5, 8)
Here we can see that we have two points on the graph:
Here 2 is , 4 is , 5 is and 8 is . All we do now is put the numbers into the formula:
So we have found that with these two points, the gradient is , about 1.33.
Why does the formula look like that?
Why does the formula look the way it does? After all, we want to find out how much we go up the y-axis when we go 1 along the x-axis (that is the gradient).
In the example we saw that we went 4 up the y-axis while we went 3 along the x-axis. We need to find out how much we go up when we only go 1 along. So we divide 4 by 3. See it as scaling the whole thing down: we need to know how far up we go for 1 along instead of 3. We can do that by dividing by 3, because 3 divided by 3 is 1. And of course that means we have to divide 4 by 3 as well.
What we did was really just to scale this triangle down, so that we go 1 along the x-axis instead of 3.
To find the gradient, then, we actually took the difference between the two -values, which in our example was 4, and divided it by the difference between the -values, which in our example was 3. That is to say, to find the gradient we divide the difference in the -values by the difference in the -values:
That is how the formula comes about.
Sometimes you might see the formula written as
But this delta sign, , is just a sign we use to show a difference between two things. Here it is the difference in divided by the difference in .
Finding c
All we need to do to find is to get it on its own in the equation of a linear function:
We subtract from both sides, and get:
So to find we need to know the gradient and an , which is any point that lies on the graph. If we take the example from before, where we have the gradient and two points, we can find . Here we actually have two points, which is fine, but we can easily make do with just one. We choose ourselves which point we use. I'll take the first point. Then we simply put it into the formula we have just made:
We have now found and can actually write down the whole equation of the line:
or, with decimals, roughly .
One point and a gradient
If a question gives you a gradient and one point instead of two points, you already have , so you go straight to . Had we been told and the point , we would do exactly the last step above: , and the line is again.
Common mistakes
- "The gradient is just how far up the line went." No, it is how far up for exactly 1 along. Between and the line went 4 up, but over 3 along, so the gradient is , not 4. The division by the -difference is the whole point of the formula.
- "I need both points to find c." One is enough. Both points lie on the line, so either works in . You choose.
- "Which point I use for c changes the answer." It doesn't. Both points lie on the line, so they give the same . We choose ourselves which one to use.
Related
- Back to the pillar: linear functions and straight-line graphs.
- What and mean once you have them: gradient and y-intercept.
- Getting on its own is the same move as in any equation: do the opposite on both sides.
Frequently asked questions
Read next
Want to get good at maths?
Mathara explains every topic step by step with videos, exercises and personal feedback.
π Get started for free