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 form from a table

Learn how to write an equation of the line that matches up to a table of values. Created by Sal Khan.

Want to join the conversation?

Video transcript

A line goes through the following points, and the equation of that line is written in y equals mx plus b form. Also known as slope-intercept form. What is the equation of the line? So the first thing we want to think about, what is the slope of this line? What is m here? So what is our change in y for given change in x? So this is an interesting example here. And I encourage you to pause the video and try it out yourself. Because no matter how much we change x, y is not changing. y is a constant, 2. So your change in y between any two points is going to be 0. It doesn't matter what your change in x is, your change in x could be 1, your change in x could be 4, your change in y is always 0. So y is not changing as you change x. So your slope for this relationship is actually 0. Y is equal to 0x plus-- and then, you could just realize that the equation of this is just that y is always equal to 2. So it's 0x plus 2, which is the same thing as y is equal to 2. You could substitute back in. You could say OK, well, if y is equal to 0x plus b, that means that y is equal to b. Well, y is always equal to 2, no matter what thing you pick, so b is equal to 2. So either way, this just boils down to y is equal to 0x plus 2, or y is just equal to 2. Let's do another one of these. Maybe one where the y is actually changing. So here, the y is clearly actually changing. So let me copy and paste this. I want to put on my scratch pad. We can work it out. So we'll stick it right over here. And then we are told a line goes through the-- OK, so same thing. The line goes through these points with the equation of a line. So the main idea here is, you only need 2 points for an equation of line. They've given us more than necessary. So I'd like to pick the two points that make things a little bit simpler. So I'll pick the point 4, 2 and 7, 0. I just picked those two points because they have nice, clean numbers associated with it. So what is our change in x here? So our change in x here, if we go from 4 to 7, our change in x is equal to 3. And what's our change in y here? So we went up from 4 to 7. We increased by 3. Our y decreased by 2. Change in y is equal to negative 2. So our slope, which is equal to change in y over change in x, is equal to negative 2/3. And if you wanted to relate that to the formulas that you normally see for slope, you're just looking at your end point. So this is y2 minus y1, which is negative 2 over x2 minus x1, which is 7 minus 4. But that just boils down to negative 2/3. And so our equation is going to be y is equal to negative 2/3 x plus b. So let's substitute one of these points in here, to figure out what our b must be. And once again, I want to figure out something where this is going to become nice and clean. But this isn't going to be really clean for any of these numbers right over here. If we had a 3 for x, or a 6 for x, or a 0 for x, then things would work out nicely. But they don't give us any of those. So let's just try the 7 and the 0. So when x is equal to 0-- sorry, when x is equal to 7-- y is equal to 0. So when x is equal to 7, I'll just do it in the same color, y is equal to 0. So 0 is equal to negative 2/3 times 7 plus b, or 0 is equal to negative 14/3 plus b. Add 14/3 to both sides, you get 14/3 is equal to b. So this is going to be y is equal to negative-- I'm going to go back to the other screen-- so y is equal to negative 2/3 x plus 14/3. So let me do that. So y is equal to negative 2/3 x plus 14/3. Let's check our answer. We got it right.