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?

  • duskpin sapling style avatar for user keilah.mora
    I do not get this...
    Can someone please help me ?
    (14 votes)
    Default Khan Academy avatar avatar for user
    • hopper cool style avatar for user Liuxiuqi
      this video is to find the equation of a line in the form of slope-intercept equation, where "Y" = "the slope of the line (Y minus Y divided by X minus X from two different random point in the line)" times "X" plus "the Y intercept (where the line touches the Y-axis)". This is showing us how to calculate each of the "elements" of the equation shown above when we only know two points
      (7 votes)
  • leaf green style avatar for user Larry Moheng
    Can anyone tell me what ! <--- that means regarding a problem that looks like this: 5!
    (1 vote)
    Default Khan Academy avatar avatar for user
  • ohnoes default style avatar for user Alyssa is the Corona Virus
    How does this make any sense?
    (6 votes)
    Default Khan Academy avatar avatar for user
  • piceratops ultimate style avatar for user Brendan Coyle
    I'm having issues with two negative points, ie. in the equation y2-y1 / x2 - x1

    when y2 = -1 and y1 = -3 / x2 = -3 and x1= -2

    I get stumped, I dont know if i'm suppose to be adding the doouble negatives to get a positive or what. my equations don't add up, please help!
    (11 votes)
    Default Khan Academy avatar avatar for user
  • piceratops seedling style avatar for user mary_936_
    What would be the slope to y = 4 and x = 3
    (3 votes)
    Default Khan Academy avatar avatar for user
  • male robot donald style avatar for user Bayern Munich 0309
    Couldn't Sal just multiply the whole equation by 3 to get -
    3y = -5x + 13 ?
    (4 votes)
    Default Khan Academy avatar avatar for user
  • mr pink red style avatar for user RoniJIMJAM
    At did he use 6 as y for the line equation because it was "y1" , thus making it the original y? How come he did not use the -10 from both y values?
    (3 votes)
    Default Khan Academy avatar avatar for user
    • leaf green style avatar for user Jex
      He used 6 because it was one of the points for y on the line. He could not use -10, because -10 isn't necessarily a point on the line, because it's the change in y. If -10 from the slope were to be a valid option for a point in this equation, that means that the change in x would also have to be the accompanying point on the line to go with the change in y. However if Sal were to use -10, the x value he would have to be different.

      This is seen when you compare the points and the slope. The change in y over the change in x equals out to -10/6, or -5/3. We also know from the given points that when y equals 6, x is equal to -1.

      Now to compare this to when y equal to -10, we would have this:

      -10 = 5/3x + 13/3 and from this, we can solve for x in this situation.

      So first, we subtract 13/3 from both sides.

      -13/3 - 10/3 = 5/3x + 13/3 - 13/3 and we are left with:

      -23/3 = 5/3x, so now we divide both sides by 5/3

      -23/3 / 5/3 = 5/3x / 5/3 The right hand side cancels out

      -23/3 / 5/3 = x As for the left hand side, we know that dividing by a fraction is the same thing as multiplying by it's reciprocal, so it becomes

      -23/3 * 3/5 = x And multiplying this out will give us...

      -69/15 = x And lastly, dividing -69 by 15 gives us...

      -4.6 = x

      Alright, so we know that when y is equal to -10, then x is equal to -4.6. This means that it is an ENTIRELY different point on the line, as the change in y over change in x is equal to -10/6, or -5/3.
      (5 votes)
  • blobby green style avatar for user Ardan337
    This isnt helping at all! Khan academy doesnt teach me how to find an equation such a y=-2/3x-4 using nothing but a graph! Somebody help me out!
    (4 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user Omi
    One thing I'm confusing with is; in practice, when we have to find for b we have to use one point from the question to fit in the formula of y=mx+b. Mostly the answer got right with first point but sometimes the answer got right with the second point (I mean the question give two points from the graph to find b) so does that means we have to draw a rough graph first to find which point is fit to be put in the formula to find b?
    Sry if my question is a bit confusing.
    (2 votes)
    Default Khan Academy avatar avatar for user
    • female robot grace style avatar for user loumast17
      Any point will work to find b actually, because the y=mx+b form is meant to correspond to every pair of points on the graph.

      You never have to draw or sketch a graph but I find it tends to help. The graph though will not tell you which point you should use, since you can use either.

      Let me know if this was not the answer you were looking for.
      (4 votes)
  • duskpin seedling style avatar for user Kaleb
    How would I do this with the points ( 5/12 , -1 ) and ( -3/4 , 1/6 )?
    (1 vote)
    Default Khan Academy avatar avatar for user
    • primosaur seed style avatar for user Ian Pulizzotto
      The change in y is 1/6 - (-1) = 1 1/6 = 7/6.
      The change in x is -3/4 - (5/12) = -9/12 - 5/12 = -14/12 = -7/6.

      m = slope
      = change in y / change in x
      = (7/6) / (-7/6)
      = 7/6 * (-6/7)
      = -1.

      So the equation is of the form y = -x + b.

      Substitute either point to solve for b. Using the point (5/12, -1) gives

      -1 = -5/12 + b
      b = -1 + 5/12 = -7/12.

      The equation is y = -x - 7/12.

      It’s a good idea to check that both points make the equation true.

      -1 = -5/12 - 7/12 is true, so the point (5/12, -1) makes the equation true.

      1/6 = -(-3/4) - 7/12 is true, so (-3/4, 1/6) makes the equation true.

      The equation y = -x - 7/12 works.

      Have a blessed, wonderful day!
      (6 votes)

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.