If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Slope-intercept equation from two points

Given two points on a line, we can write an equation for that line by finding the slope between those points, then solving for the y-intercept in the slope-intercept equation y=mx+b. In this example, we write an equation of the line that passes through the points (-1,6) and (5,-4). Created by Sal Khan and Monterey Institute for Technology and Education.

Want to join the conversation?

Video transcript

A line goes through the points (-1, 6) and (5, -4). What is the equation of the line? Let's just try to visualize this. So that is my x axis. And you don't have to draw it to do this problem but it always help to visualize That is my y axis. And the first point is (-1,6) So (-1, 6). So negative 1 coma, 1, 2, 3, 4 ,5 6. So it's this point, rigth over there, it's (-1, 6). And the other point is (5, -4). So 1, 2, 3, 4, 5. And we go down 4, So 1, 2, 3, 4 So it's right over there. So the line connects them will looks something like this. Line will draw a rough approximation. I can draw a straighter than that. I will draw a dotted line maybe Easier do dotted line. So the line will looks something like that. So let's find its equation. So good place to start is we can find its slope. Remember, we want, we can find the equation y is equal to mx plus b. This is the slope-intercept form where m is the slope and b is the y-intercept. We can first try to solve for m. We can find the slope of this line. So m, or the slope is the change in y over the change in x. Or, we can view it as the y value of our end point minus the y value of our starting point over the x-value of our end point minus the x-value of our starting point. Let me make that clear. So this is equal to change in y over change in x wich is the same thing as rise over run wich is the same thing as the y-value of your ending point minus the y-value of your starting point. This is the same exact thing as change in y and that over the x value of your ending point minus the x-value of your starting point This is the exact same thing as change in x. And you just have to pick one of these as the starting point and one as the ending point. So let's just make this over here our starting point and make that our ending point. So what is our change in y? So our change in y, to go we started at y is equal to six, we started at y is equal to 6. And we go down all the way to y is equal to negative 4 So this is rigth here, that is our change in y You can look at the graph and say, oh, if I start at 6 and I go to negative 4 I went down 10. or if you just want to use this formula here it will give you the same thing We finished at negative 4, we finished at negative 4 and from that we want to subtract, we want to subtract 6. This right here is y2, our ending y and this is our beginning y This is y1. So y2, negative 4 minus y1, 6. or negative 4 minus 6. That is equal to negative 10. And all it does is tell us the change in y you go from this point to that point We have to go down, our rise is negative we have to go down 10. That's where the negative 10 comes from. Now we just have to find our change in x. So we can look at this graph over here. We started at x is equal to negative 1 and we go all the way to x is equal to 5. So we started at x is equal to negative 1, and we go all the way to x is equal to 5. So it takes us one to go to zero and then five more. So are change in x is 6. You can look at that visually there or you can use this formula same exact idea, our ending x-value, our ending x-value is 5 and our starting x-value is negative 1. 5 minus negative 1. 5 minus negative 1 is the same thing as 5 plus 1. So it is 6. So our slope here is negative 10 over 6. wich is the exact same thing as negative 5 thirds. as negative 5 over 3 I divided the numerator and the denominator by 2. So we now know our equation will be y is equal to negative 5 thirds, that's our slope, x plus b. So we still need to solve for y-intercept to get our equation. And to do that, we can use the information that we know in fact we have several points of information We can use the fact that the line goes through the point (-1,6) you could use the other point as well. We know that when is equal to negative 1, So y is eqaul to 6. So y is equal to six when x is equal to negative 1 So negative 5 thirds times x, when x is equal to negative 1 y is equal to 6. So we literally just substitute this x and y value back into this and know we can solve for b. So let's see, this negative 1 times negative 5 thirds. So we have 6 is equal to positive five thirds plus b. And now we can subtract 5 thirds from both sides of this equation. so we have subtracted the left hand side. From the left handside and subtracted from the rigth handside And then we get, what's 6 minus 5 thirds. So that's going to be, let me do it over here We take a common denominator. So 6 is the same thing as Let's do it over here. So 6 minus 5 over 3 is the same thing as 6 is the same thing as 18 over 3 minus 5 over 3 6 is 18 over 3. And this is just 13 over 3. And this is just 13 over 3. And then of course, these cancel out. So we get b is equal to 13 thirds. So we are done. We know We know the slope and we know the y-intercept. The equation of our line is y is equal to negative 5 thirds x plus our y-intercept which is 13 which is 13 over 3. And we can write these as mixed numbers. if it's easier to visualize. 13 over 3 is four and 1 thirds. So this y-intercept right over here. this y-intercept right over here. That's 0 coma 13 over 3 or 0 coma 4 and 1 thirds. And even with my very roughly drawn diagram it those looks like this. And the slope negative 5 thirds that's the same thing as negative 1 and 2 thirds. You can see here the slope is downward because the slope is negative. It's a little bit steeper than a slope of 1. It's not quite a negative 2. It's negative 1 and 2 thirds. if you write this as a negative, as a mixed number. So, hopefully, you found that entertaining.