Nagwa uses cookies to ensure you get the best experience on our website. Learn more about our Privacy Policy.

Video: Determine the Equation of the Line Through Two Given Points

Tim Burnham

We show you how to calculate the equation of a straight line if you are given two pairs of coordinates that it passes through. We use a range of examples with positive and/or negative coordinates and positive and/or negative slopes.

14:60

Video Transcript

In this video we’re gonna learn how to find the equation of a line that runs through two points. If you’re given the coordinates of the points, you can create a slope triangle to calculate the slope of the line. And then we’ll look at how to go on and work out the value of the 𝑦-intercept so that we can write down the equation of the line.

Let’s start with a specific example: find the equation of the line that passes through points A five, eleven and B ten, twenty-one. Now we’re given a diagram which is gonna help us to visualise this situation.

So what I’m gonna do first of all is to create myself a nice little slope triangle on the diagram. And onto our slope triangle, we can map the difference in the 𝑦-coordinates between the two points, that’s this vertical distance here, and the difference between the 𝑥-coordinates in those two points, and that’s this horizontal distance here.

And at A, the 𝑥-coordinate was five; and at B, the 𝑥-coordinate was ten. So the difference between those two coordinates is ten minus five; that’s five. So in moving from point A to point B along that line there, the 𝑥-coordinate of A has increased by five to be the 𝑥-coordinate at B.

And the difference in 𝑦-coordinates, well we’ve gone from a 𝑦-coordinate of eleven up to a 𝑦-coordinate of twenty-one. So if I do twenty-one take away eleven, that gives me ten. The 𝑦-coordinate has increased by ten in going from point A to point B along that line.

Now one definition of slope is if I increase my 𝑥-coordinate by one, by how much does my 𝑦-coordinate change. And this slope triangle shows us that by increasing our 𝑥-coordinate by five, this generates a- an increase in 𝑦-coordinate of ten. So what I’d like to do is divide both of those by five.

So I’m only going a fifth as far in the 𝑥-direction. In other words, I’m going one; I’m adding one to my 𝑥-coordinate. So if I’m only going a fifth as far in the 𝑥-direction, I’ll only be going a fifth as far in the 𝑦-direction. So ten divided by five is positive two.

So an increase of one in the 𝑥-coordinate generates an increase of two in the 𝑦-coordinate; that is our slope. Now understanding that definition of slope, we can see a little bit of a pattern which is gonna be a bit of a shortcut for us when we’re doing future calculations.

So in order to generate that slope of two, what I did was I took the 𝑦-coordinate difference, so positive ten difference, and divided it by the difference in 𝑥-coordinates. In other words, the reason for doing that was to say what would be the difference in 𝑦-coordinates if there is a difference in 𝑥-coordinates of one. So we’ve taken the difference in 𝑦 and divided it by the difference in 𝑥-coordinates. and that generates the slope.

And the difference in 𝑦-coordinates was ten; the difference in 𝑥-coordinates was five; and ten divided by five is two. Now the general format of the equation for a straight line is 𝑦 equals 𝑚𝑥 plus 𝑏. And this multiplier of 𝑥, the 𝑚 value, tells us the slope of the line. So we’ve worked out that the slope is two, so we know that the 𝑚 value is two.

So we’ve started to work out the equation of our straight line out: 𝑦 equals two 𝑥 plus something. Now that something is the intercept of the of the 𝑦-axis. Where does it cut the 𝑦-axis?

So how are we gonna work that out. Well we don’t know where it cuts the 𝑦-axis from the diagram or from the information of the question, but we do have the coordinate of this point here and we have the coordinate of this point here. And a coordinate, an ordered pair, tells us a given 𝑥-value that corresponds to a given 𝑦-value. So we can put those values in for 𝑥 and 𝑦 in our equation, and then that would enable us to work out the value of this 𝑏, this intercept value here. Now I can pick either point A or point B. Either would work just as well. I’m gonna pick point A here, five, eleven because the numbers are smaller, so that’ll be slightly easier to work with.

So the 𝑦-coordinate at point A is eleven, so I can replace the 𝑦 with eleven. And the 𝑥-coordinate is five so I can replace 𝑥 with five So now I can use this information to work out 𝑏. So eleven is equal to two times five, so eleven is equal to ten plus 𝑏.

And if I take away ten from each side of my equation, on the left-hand side I’ve got eleven minus ten is one and on the right-hand side ten minus ten is nothing, so I still just got my 𝑏. So 𝑏 is equal to one; that’s where it cuts the 𝑦-axis.

So putting that value for 𝑏 back into my equation here, I now know that 𝑦 is equal to two 𝑥 plus one. That’s the equation of the line. It cuts the 𝑦-axis at one and it has a slope of two. Now I can check my answer because I know that the point B is also on the line. So when 𝑥 is equal to ten, then 𝑦 is equal to twenty-one. So I can put those values in for 𝑥 and 𝑦 and see that everything still balances up.

So putting those values in, 𝑦 is twenty-one, 𝑥 is ten, so twenty-one is equal to two times ten plus one. Well two times ten is obviously twenty, so twenty plus one is twenty-one, so twenty-one is equal to twenty-one. Yeah that does match the equation, so it looks like we got the right answer.

So in this example, we worked out a bit of a shortcut way of working out the slope. We can just basically look at the difference in the 𝑦-coordinates between the two points on the line and the difference in the 𝑥-coordinates and simply divide the difference in 𝑦 by the difference in 𝑥. That tells us the slope straight away, and then we were able to use that result in order to calculate the value of b, the 𝑦-intercept, and ultimately to generate our equation.

Okay let’s do another question then: write the equation of the line that passes through the points indicated in this table of values. And we’ve got when 𝑥 is three, 𝑦 is twelve; and when 𝑥 is seven, 𝑦 is zero. So we weren’t given a diagram here and you don’t have to draw a diagram if you don’t want to; you don’t draw a sketch of the other line. But it really does help you and avoid- to avoid silly mistakes.

So our ordered pairs are three, twelve and seven, zero. So when we sketch that, we’ve got the — all the coordinate points are positive, so we only have to draw this bit of the 𝑥𝑦-axes. And we’ve got the points three, twelve and seven, zero. And if we draw the line between those two points, that’s roughly what it’s gonna look like. Now this sketch doesn’t have to be completely accurate, but it just gives you a general sense that it’s gonna be a downhill line because the second point at seven, zero has got a lower 𝑦-coordinate than the first one, and you’ve got one point on the left; three, twelve is to the left of seven, zero because the 𝑥-coordinate is smaller.

Now drawing our slope triangle, we’ve got the distance from here to here is the difference in the 𝑥-coordinates of those two points, and the distance from here to here is the difference in the 𝑦-coordinates between those two points. And remember, we’re trying to work out the slope which is the difference in the 𝑦-coordinates divided by the difference in the 𝑥-coordinates.

Now in order to find the slope, it doesn’t really matter in some ways whether you take the left-hand coordinates away from the right-hand or the right-hand coordinates away from the left-hand, so long you do it the same way round for both the 𝑥- and the 𝑦-coordinates Now I always imagine myself going from left to right in the graph, moving towards the positive 𝑥-direction. So it always makes sense to me to take the left-hand coordinates away from the right-hand coordinates in working out how much each co-ordinate has increased or decreased along the way.

So my calculation the right-hand 𝑦-coordinate is zero, and I’m gonna take away the left-hand 𝑦-coordinate, which is twelve. And correspondingly, I’m gonna take the right-hand 𝑥-coordinate is seven and I’m gonna take away the left hand 𝑥-coordinate, which is three.

And this makes sense. So my 𝑦-coordinate started off at twelve and it’s gone down to zero, so that’s a negative twelve change. And the 𝑥-coordinate is going from three and it’s going all the way up to seven, so that’s a positive four change. And negative twelve divided by four is negative three, so the slope of my line is negative three; every time I increase my 𝑥-coordinate by one, the 𝑦-coordinate is gonna go down by three.

So we started to make some progress on working out the equation of our line. We plugged in the slope, so 𝑦 equals negative three 𝑥. And we’ve now got to calculate the value of 𝑏 where it cuts the 𝑦-axis. Now we’ve got two ordered pairs: three, twelve and seven, zero. Remember, this is the 𝑥-coordinate; this is the 𝑦-coordinate. So we can use one of those, plug that into an equation to evaluate the value of 𝑏. Now in this particular case, I’m gonna take the second one seven, zero because I think they’re slightly easier numbers to work with; a 𝑦-value of zero is gonna be easier than working with a 𝑦-value of twelve.

So plugging in 𝑦 equals zero and 𝑥 equals seven, I’ve got zero is equal to negative three times seven plus 𝑏. And negative three times seven is negative twenty-one. So now I’ve got zero is equal to negative twenty-one plus 𝑏. I wanna get 𝑏 on its own, so I’m gonna add twenty-one to both sides of that equation, which leaves me with twenty-one is equal to 𝑏. So I now know the 𝑦-intercept and I can plug that into my final equation.

𝑦 equals negative three 𝑥 plus twenty-one. So again I can check that using the other coordinate pair. And that tells me that when 𝑥 is equal to three, 𝑦 is equal to twelve. And if the equation is right, then that means that twelve is equal to minus three times three plus twenty-one. Well negative three times three is negative nine, and negative nine plus twenty-one is the same as twenty-one take away nine. And that is in fact equal to twelve, so that’s correct. So it looks like we’ve got the correct equation.

So we’re now gonna do another question. And in this case, it actually turns out to be an easier question even though it looks more difficult to start off with. Find the equation of the line through points negative ten, two and zero, five. So the thing with this question although we got no diagram, we’re told that this point here zero, five is on the line. Now this means that the 𝑥-coordinate is zero when the 𝑦-coordinate is five; that’s telling us what the 𝑦-intercept is.

So it cuts the 𝑦-axis when 𝑦 is five. So the value of 𝑏 in our equation is five. So that makes our life a little bit easier. So now we do a quick sketch of the situation there. We’ve got negative ten, two and zero, five on the line.

We can do a little slope triangle, and we can work out the difference in the 𝑦-coordinates. And the right-hand 𝑦-coordinate is five and the left-hand 𝑦-coordinate is two, so the difference is five minus two, which is three. And that makes sense, going from the first point of the second point, we’ve gone up the distance of three along the 𝑦-axis.

And then we can calculate the difference in the 𝑥-coordinates. Well we’ve gone from negative ten up to zero, which is obviously an increase of ten. But to write it as we did there, we’d have to do the right-hand coordinate, zero, and take away the left-hand coordinate, negative ten, and zero take-away negative ten is ten. So whichever way you do it, doesn’t really matter so long as you come up with the right answer. Now clearly the slope then becomes three over ten; that’s a positive value. And that make sense because in going from the first point to the second point along here, we have gone uphill; it’s a positive value.

And we can then finish off our equation, so it’s the slope times 𝑥. So that’s 𝑦 is equal to three-tenths times 𝑥. And the 𝑏 value is positive five, so we’re adding five to our equation. So the equation is 𝑦 equals three-tenths of 𝑥 plus five.

Now we used this point here, the second point on the right, to tell us where it cut the 𝑦-axis, so we’re gonna use the other coordinate to help us to check our equation. So when 𝑥 is equal to negative ten, then 𝑦 is equal to two. And plugging those values in, two is equal to three-tenths of negative ten plus five. Well three-tenths of negative ten is negative three. And negative three plus five is equal to two, and that is correct. So we’re happy that our equation is the right one.

So to summarise what we’ve learned, first always draw a diagram from the information you’ve been given. It gives you time to think about and interpret the information that’s in the question. Secondly, the slope is the difference in the 𝑦-coordinates and the difference in the 𝑥-coordinates between two points. And a top tip is when you’re working at the slope, always do the coordinates in the same order. So for example, always do the right-hand minus the left-hand coordinates

So for example, if we had coordinates two, five and seven, fifteen, we’ve got fifteen take away five and we’ve got seven take away two. And that gives us a slope of two. And lastly, use the slope and one pair of coordinates to calculate the 𝑦-intercept.

So for instance we’ve worked out the slope was two, so we can use 𝑚 is two; and using this coordinate here, always go for the easier numbers if you can, the 𝑦-coordinate is five so we can put that in here and the 𝑥-coordinate is two so we can put that in here. And then we can rearrange that to work out the 𝑏-value

And that gives us our final equation. And it’s always a good idea to check your answer using the other coordinate pair. Now we used two, five to help us to work out the intercept, so we’re gonna use the other coordinate pair here where 𝑥 is seven and 𝑦 is fifteen to check our answer. And fifteen is equal to two times seven plus one. Well two times seven is fourteen plus one is fifteen, so that looks correct. So we look like we got the right answer.