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 graph

Learn to write equations in slope-intercept form for three different lines. Created by Sal Khan.

Want to join the conversation?

  • marcimus pink style avatar for user nmadden
    can someone please explain linear equations?
    (1 vote)
    Default Khan Academy avatar avatar for user
    • winston default style avatar for user Pandan04
      All that the slope-intercept form (the equation to describe linear equations) is, is an equation (y=mx+b) where m (the number that multiples x) is the slope and b (the number that is not multiplying a variable on the right-hand side of the equation) is the y-intercept. The x and the y don't really do anything in this case so you can ignore them. An easy way to see this equation is y=(the slope)x+the y-intercept. Hope this helps!
      (1 vote)
  • spunky sam red style avatar for user anellytan
    I don't get it, how does B= 4/3 on A?
    (18 votes)
    Default Khan Academy avatar avatar for user
    • starky ultimate style avatar for user TJ
      Because the slope is -2/3, so when the x value increases by one, the y-value decreases by 2/3. That's why moving from an x-value of -1 to 0 will move you down by 2/3 (from a y-value 2 to 4/3, because 2 - 2/3 is 4/3. This can also be written as 6/3 - 2/3 = 4/3)

      Another way to do this is by plugging the slope and a point to the slope-intercept equation (y = mx + b) to solve for the y-intercept. I'll use the point (-1, 2).
      y = mx + b
      2 = -2/3(-1) + b
      2 = 2/3 + b
      2 - 2/3 = b
      4/3 = b
      (17 votes)
  • starky sapling style avatar for user Nadia Masiero
    What would you do if you had something like x=0? or y= -5
    (2 votes)
    Default Khan Academy avatar avatar for user
  • aqualine ultimate style avatar for user ShevrillHD
    Isn't negative number in denominator incorrect?
    (2 votes)
    Default Khan Academy avatar avatar for user
  • cacteye green style avatar for user 22grifinn.chamorro
    wait but isn't slope = rise
    __
    run
    (5 votes)
    Default Khan Academy avatar avatar for user
  • scuttlebug blue style avatar for user Nickname
    At - , how did he get b= 4/3?
    (5 votes)
    Default Khan Academy avatar avatar for user
    • stelly blue style avatar for user Kim Seidel
      Sal has a point on the line as (-1, 2)
      The slope of the line is -2/3. So, as the line moves to the right 1 unit, the y-value will decrease by 2/3
      2 - 2/3 = 6/3 - 2/3 = 4/3. This creates the new point (0, 4/3). Since the x-value = 0, the point is the y-intercept.

      FYI - Get in the habit of looking at the top rated questions and answers. Your question already has an answer posted close to the top of the list of questions.

      Hope this helps.
      (2 votes)
  • blobby green style avatar for user 丂卂Ꮆ乇(雨王乙)
    Is there an easier way to do this, or is this it?
    (5 votes)
    Default Khan Academy avatar avatar for user
  • leaf green style avatar for user Lydia Ashenafie
    I still don't get how to find x and how you know that it is automatically zero based on something else at and why is it that when y=-x that equeals M but when y=3.75 that equeals b. is x always zero?
    (3 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user toofan.sh.92
    I've just finished 7th and 8th grade and I'm trying to learn high school math but I've got a problem here. back then in 7 and 8th grades everything was very neat and in order but here in high school section i dont really know where I should start from, i mean there is one content i've studied then one i havn't then one i studied then one i havn't again ! i'm confused . i wish there was a playlist in order and starting from after 8th grade. can anybody help please
    (3 votes)
    Default Khan Academy avatar avatar for user
  • female robot ada style avatar for user Arlene
    So a vertical line on the graph is undefined and a horizontal line on the graph is 0?
    (2 votes)
    Default Khan Academy avatar avatar for user
    • duskpin ultimate style avatar for user Victor
      Yes that is correct. Vertical slope equation: rise/run. Rise can be anything (vertical) but there's no run. You've been taught that you cannot divide anything by 0, so it's undefined. However, for a horizontal line, it's slope is rise/run = 0/x, where x is a real number. And yes, you can divide by anything other than 0, so it's zero. I hope this helped!
      (3 votes)

Video transcript

So you may or may not already know that any linear equation can be written in the form y is equal to mx plus b. Where m is the slope of the line. The same slope that we've been dealing with the last few videos. The rise over run of the line. Or the inclination of the line. And b is the y-intercept. I think it's pretty easy to verify that b is a y-intercept. The way you verify that is you substitute x is equal to 0. If you get x is equal to 0-- remember x is equal to 0, that means that's where we're going to intercept at the y-axis. If x is equal to 0, this equation becomes y is equal to m times 0 plus b. m times 0 is just going to be 0. I don't care what m is. So then y is going to be equal to b. So the point 0, b is going to be on that line. The line will intercept the y-axis at the point y is equal to b. We'll see that with actual numbers in the next few videos. Just to verify for you that m is really the slope, let's just try some numbers out. We know the point 0, b is on the line. What happens when x is equal to 1? You get y is equal to m times 1. Or it's equal to m plus b. So we also know that the point 1, m plus b is also on the line. Right? This is just the y value. So what's the slope between that point and that point? Let's take this as the end point, so you have m plus b, our change in y, m plus b minus b over our change in x, over 1 minus 0. This is our change in y over change in x. We're using two points. That's our end point. That's our starting point. So if you simplify this, b minus b is 0. 1 minus 0 is 1. So you get m/1, or you get it's equal to m. So hopefully you're satisfied and hopefully I didn't confuse you by stating it in the abstract with all of these variables here. But this is definitely going to be the slope and this is definitely going to be the y-intercept. Now given that, what I want to do in this exercise is look at these graphs and then use the already drawn graphs to figure out the equation. So we're going to look at these, figure out the slopes, figure out the y-intercepts and then know the equation. So let's do this line A first. So what is A's slope? Let's start at some arbitrary point. Let's start right over there. We want to get even numbers. If we run one, two, three. So if delta x is equal to 3. Right? One, two, three. Our delta y-- and I'm just doing it because I want to hit an even number here-- our delta y is equal to-- we go down by 2-- it's equal to negative 2. So for A, change in y for change in x. When our change in x is 3, our change in y is negative 2. So our slope is negative 2/3. When we go over by 3, we're going to go down by 2. Or if we go over by 1, we're going to go down by 2/3. You can't exactly see it there, but you definitely see it when you go over by 3. So that's our slope. We've essentially done half of that problem. Now we have to figure out the y-intercept. So that right there is our m. Now what is our b? Our y-intercept. Well where does this intersect the y-axis? Well we already said the slope is 2/3. So this is the point y is equal to 2. When we go over by 1 to the right, we would have gone down by 2/3. So this right here must be the point 1 1/3. Or another way to say it, we could say it's 4/3. That's the point y is equal to 4/3. Right there. A little bit more than 1. About 1 1/3. So we could say b is equal to 4/3. So we'll know that the equation is y is equal to m, negative 2/3, x plus b, plus 4/3. That's equation A. Let's do equation B. Hopefully we won't have to deal with as many fractions here. Equation B. Let's figure out its slope first. Let's start at some reasonable point. We could start at that point. Let me do it right here. B. Equation B. When our delta x is equal to-- let me write it this way, delta x. So our delta x could be 1. When we move over 1 to the right, what happens to our delta y? We go up by 3. delta x. delta y. Our change in y is 3. So delta y over delta x, When we go to the right, our change in x is 1. Our change in y is positive 3. So our slope is equal to 3. What is our y-intercept? Well, when x is equal to 0, y is equal to 1. So b is equal to 1. So this was a lot easier. Here the equation is y is equal to 3x plus 1. Let's do that last line there. Line C Let's do the y-intercept first. You see immediately the y-intercept-- when x is equal to 0, y is negative 2. So b is equal to negative 2. And then what is the slope? m is equal to change in y over change in x. Let's start at that y-intercept. If we go over to the right by one, two, three, four. So our change in x is equal to 4. What is our change in y? Our change in y is positive 2. So change in y is 2 when change in x is 4. So the slope is equal to 1/2, 2/4. So the equation here is y is equal to 1/2 x, that's our slope, minus 2. And we're done. Now let's go the other way. Let's look at some equations of lines knowing that this is the slope and this is the y-intercept-- that's the m, that's the b-- and actually graph them. Let's do this first line. I already started circling it in orange. The y-intercept is 5. When x is equal to 0, y is equal to 5. You can verify that on the equation. So when x is equal to 0, y is equal to one, two, three, four, five. That's the y-intercept and the slope is 2. That means when I move 1 in the x-direction, I move up 2 in the y-direction. If I move 1 in the x-direction, I move up 2 in the y-direction. If I move 1 in the x-direction, I move up 2 in the y-direction. If I move back 1 in the x-direction, I move down 2 in the y-direction. If I move back 1 in the x-direction, I move down 2 in the y-direction. I keep doing that. So this line is going to look-- I can't draw lines too neatly, but this is going to be my best shot. It's going to look something like that. It'll just keep going on, on and on and on. So that's our first line. I can just keep going down like that. Let's do this second line. y is equal to negative 0.2x plus 7. Let me write that. y is equal to negative 0.2x plus 7. It's always easier to think in fractions. So 0.2 is the same thing as 1/5. We could write y is equal to negative 1/5 x plus 7. We know it's y-intercept at 7. So it's one, two, three, four, five, six. That's our y-intercept when x is equal to 0. This tells us that for every 5 we move to the right, we move down 1. We can view this as negative 1/5. The delta y over delta x is equal to negative 1/5. For every 5 we move to the right, we move down 1. So every 5. One, two, three, four, five. We moved 5 to the right. That means we must move down 1. We move 5 to the right. One, two, three, four, five. We must move down 1. If you go backwards, if you move 5 backwards-- instead of this, if you view this as 1 over negative 5. These are obviously equivalent numbers. If you go back 5-- that's negative 5. One, two, three, four, five. Then you move up 1. If you go back 5-- one, two, three, four, five-- you move up 1. So the line is going to look like this. I have to just connect the dots. I think you get the idea. I just have to connect those dots. I could've drawn it a little bit straighter. Now let's do this one, y is equal to negative x. Where's the b term? I don't see any b term. You remember we're saying y is equal to mx plus b. Where is the b? Well, the b is 0. You could view this as plus 0. Here is b is 0. When x is 0, y is 0. That's our y-intercept, right there at the origin. And then the slope-- once again you see a negative sign. You could view that as negative 1x plus 0. So slope is negative 1. When you move to the right by 1, when change in x is 1, change in y is negative 1. When you move up by 1 in x, you go down by 1 in y. Or if you go down by 1 in x, you're going to go up by 1 in y. x and y are going to have opposite signs. They go in opposite directions. So the line is going to look like that. You could almost imagine it's splitting the second and fourth quadrants. Now I'll do one more. Let's do this last one right here. y is equal to 3.75. Now you're saying, gee, we're looking for y is equal to mx plus b. Where is this x term? It's completely gone. Well the reality here is, this could be rewritten as y is equal to 0x plus 3.75. Now it makes sense. The slope is 0. No matter how much we change our x, y does not change. Delta y over delta x is equal to 0. I don't care how much you change your x. Our y-intercept is 3.75. So 1, 2, 3.75 is right around there. You want to get close. 3 3/4. As I change x, y will not change. y is always going to be 3.75. It's just going to be a horizontal line at y is equal to 3.75. Anyway, hopefully you found this useful.