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?
    (188 votes)
    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!
      (38 votes)
  • orange juice squid orange style avatar for user E-V
    Why does "b" represent the y-intercept? Did someone just choose a random letter to represent it? Who chose what the y-intercept would be represented by?
    (36 votes)
    Default Khan Academy avatar avatar for user
    • piceratops ultimate style avatar for user jimstanley49
      I think it's because y and b are both the second letter in the oft used groups: a, b, c, and x, y, z. b is the point on the line that falls on the y-axis, but we can't call it 'y' so we call it 'b' instead.
      Some of this is pretty arbitrary. I'm working with a system right now that calibrates using slope and intercept, and for whatever reason we call them 'm' and 'n' (iNtercept?).
      At this point don't get too hung up on the deeper meaning behind the letters (I honestly never thought about why they used 'b' until you asked, and I've taken calculus) and focus on what they represent. It's like learning English; you can explore the deeper meaning of WHY a pig is called a pig, but when you're starting out, it's enough to know that it's spelled p-i-g and represents a farm animal. The deeper meaning can wait until you are studying agriculture.
      Hope it helped.
      (61 votes)
  • spunky sam red style avatar for user anellytan
    I don't get it, how does B= 4/3 on A?
    (27 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
      (38 votes)
  • duskpin sapling style avatar for user 1_Lazarus, Lauren
    I would like to give a little advice to anyone who needs it for khan academy. In one tab, I keep the video for the lesson. In the other tab, I keep the questions, and complete them while watching the video. Just a little advice that really works well for me. Have a great day!
    (26 votes)
    Default Khan Academy avatar avatar for user
  • starky sapling style avatar for user Nadia Masiero
    What would you do if you had something like x=0? or y= -5
    (12 votes)
    Default Khan Academy avatar avatar for user
  • piceratops seed style avatar for user pouvsocheata
    Can someone summarize the main points of this video? It's kind of confusing!
    (12 votes)
    Default Khan Academy avatar avatar for user
  • winston default style avatar for user TaJee
    Ok yes I understand this, but what does it have to do with linear equations on a graph, yes, I know how to find the slope and the y-intercept and how to take slope intercept form and make a graph, but say you have a problem like 5y=-45,which in this case does not have a x so you would have to divide by five in which y would then equal -9 so then my question is how would you plot that on a graph? Because I have tried many times and am getting the right y intercept but not the right coordinates. Thank you for your time -Tj
    (8 votes)
    Default Khan Academy avatar avatar for user
  • duskpin sapling style avatar for user Khang Tran Minh - Grade 7
    I have watched this for over 30 minutes and I still haven't understood anything
    (6 votes)
    Default Khan Academy avatar avatar for user
    • boggle green style avatar for user Aeternum
      When you try to write a slope-intercept equation from a graph, there are three steps you need to take:

      1. Slope
      Remember that slope is rise/run, or change in y over change in x. Find two points on the line that have clean, whole numbers as coordinates. Then use the following expression to find the slope: (y2-y1)/(x2-x1). Or, you can physically draw the lines and count the units like Sal does in the video.

      Take a look at what Sal does for line A. He chooses the coordinates (-1, 2) and (2, 0).
      Change in y --> 0 - 2 = -2
      Change in x --> 2 - (-1) = 3
      Change in y / change in x --> -2/3
      Thus -2/3 is the slope.

      2. Y-intercept
      This is usually the easiest. Look at the point where the line intersects the y axis, or the axis going in the vertical direction. But sometimes it's not so clear as to where the point is. This is my strategy:

      First take a look at the slope-intercept form: y = mx + b. We already known what m is = -2/3 (the slope.) We now have y = (-2/3)x + b.

      Then find a point on the line--literally any point with whole coordinates will do. We'll choose (2, 0). Plug the x and y into our equation:
      y = (-2/3)x + b
      0 = (-2/3)(2) + b
      Now we solve for b:
      0 = -4/3 + b
      4/3 = b
      Ta-da! b, our y-intercept, is equal to 4/3.

      3. Put it together
      Now we can just put everything in our slope-intercept equation:
      y = mx + b
      y = (-2/3)x + 4/3

      Hope this helps!
      (14 votes)
  • aqualine ultimate style avatar for user ShevrillHD
    Isn't negative number in denominator incorrect?
    (5 votes)
    Default Khan Academy avatar avatar for user
    • stelly blue style avatar for user Kim Seidel
      It's not the preferred place for the sign.
      The preferred placement for a sign in a fraction is in front of the fraction (not in the numerator or denominator.
      For example: -(1/2) = (-1)/2 = 1/(-2). The preferred form would be -(1/2)
      Hope this helps.
      (15 votes)
  • duskpin ultimate style avatar for user Levi Kowalski
    Do these things work with exponets and square roots? Also do they work with porablo graghs?
    (11 votes)
    Default Khan Academy avatar avatar for user

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.