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 formula

Learn how to write the slope formula from scratch and how to apply it to find the slope of a line from two points.
It's kind of annoying to have to draw a graph every time we want to find the slope of a line, isn't it?
We can avoid this by writing a general formula for slope. Before we start, let's remember how slope is defined:
start text, S, l, o, p, e, end text, equals, start fraction, start color #e07d10, start text, C, h, a, n, g, e, space, i, n, space, y, end text, end color #e07d10, divided by, start color #1fab54, start text, C, h, a, n, g, e, space, i, n, space, x, end text, end color #1fab54, end fraction
Let's draw a line through two general points left parenthesis, start color #1fab54, x, start subscript, 1, end subscript, end color #1fab54, comma, start color #e07d10, y, start subscript, 1, end subscript, end color #e07d10, right parenthesis and left parenthesis, start color #1fab54, x, start subscript, 2, end subscript, end color #1fab54, comma, start color #e07d10, y, start subscript, 2, end subscript, end color #e07d10, right parenthesis.
An expression for start color #1fab54, start text, c, h, a, n, g, e, space, i, n, space, x, end text, end color #1fab54 is start color #1fab54, x, start subscript, 2, end subscript, minus, x, start subscript, 1, end subscript, end color #1fab54:
Similarly, an expression for start color #e07d10, start text, c, h, a, n, g, e, space, i, n, space, y, end text, end color #e07d10 is start color #e07d10, y, start subscript, 2, end subscript, minus, y, start subscript, 1, end subscript, end color #e07d10:
Now we can write a general formula for slope:
start text, S, l, o, p, e, end text, equals, start fraction, start color #e07d10, start text, C, h, a, n, g, e, space, i, n, space, y, end text, end color #e07d10, divided by, start color #1fab54, start text, C, h, a, n, g, e, space, i, n, space, x, end text, end color #1fab54, end fraction, equals, start fraction, start color #e07d10, y, start subscript, 2, end subscript, minus, y, start subscript, 1, end subscript, end color #e07d10, divided by, start color #1fab54, x, start subscript, 2, end subscript, minus, x, start subscript, 1, end subscript, end color #1fab54, end fraction
That's it! We did it!

Using the slope formula

Let's use the slope formula to find the slope of the line that goes through the points left parenthesis, 2, comma, 1, right parenthesis and left parenthesis, 4, comma, 7, right parenthesis.
Step 1: Identify the values of x, start subscript, 1, end subscript, x, start subscript, 2, end subscript, y, start subscript, 1, end subscript, and y, start subscript, 2, end subscript.
x, start subscript, 1, end subscript, equals, 2
y, start subscript, 1, end subscript, equals, 1
x, start subscript, 2, end subscript, equals, 4
y, start subscript, 2, end subscript, equals, 7, space, space, space, space, space, space, space, space
Step 2: Plug in these values to the slope formula to find the slope.
start text, S, l, o, p, e, end text, equals, start fraction, y, start subscript, 2, end subscript, minus, y, start subscript, 1, end subscript, divided by, x, start subscript, 2, end subscript, minus, x, start subscript, 1, end subscript, end fraction, equals, start fraction, 7, minus, 1, divided by, 4, minus, 2, end fraction, equals, start fraction, 6, divided by, 2, end fraction, equals, 3
Step 3: Gut check. Make sure this slope makes sense by thinking about the points on the coordinate plane.
Yup! This slope seems to make sense since the slope is positive, and the line is increasing.

Using the slope formula walkthrough

Let's use the slope formula to find the slope of the line that goes through the points left parenthesis, 6, comma, minus, 3, right parenthesis and left parenthesis, 1, comma, 7, right parenthesis.
Step 1: Identify the values of x, start subscript, 1, end subscript, x, start subscript, 2, end subscript, y, start subscript, 1, end subscript, and y, start subscript, 2, end subscript.
x, start subscript, 1, end subscript, equals
  • Your answer should be
  • an integer, like 6
  • a simplified proper fraction, like 3, slash, 5
  • a simplified improper fraction, like 7, slash, 4
  • a mixed number, like 1, space, 3, slash, 4
  • an exact decimal, like 0, point, 75
  • a multiple of pi, like 12, space, start text, p, i, end text or 2, slash, 3, space, start text, p, i, end text
y, start subscript, 1, end subscript, equals
  • Your answer should be
  • an integer, like 6
  • a simplified proper fraction, like 3, slash, 5
  • a simplified improper fraction, like 7, slash, 4
  • a mixed number, like 1, space, 3, slash, 4
  • an exact decimal, like 0, point, 75
  • a multiple of pi, like 12, space, start text, p, i, end text or 2, slash, 3, space, start text, p, i, end text
x, start subscript, 2, end subscript, equals
  • Your answer should be
  • an integer, like 6
  • a simplified proper fraction, like 3, slash, 5
  • a simplified improper fraction, like 7, slash, 4
  • a mixed number, like 1, space, 3, slash, 4
  • an exact decimal, like 0, point, 75
  • a multiple of pi, like 12, space, start text, p, i, end text or 2, slash, 3, space, start text, p, i, end text
y, start subscript, 2, end subscript, equals
  • Your answer should be
  • an integer, like 6
  • a simplified proper fraction, like 3, slash, 5
  • a simplified improper fraction, like 7, slash, 4
  • a mixed number, like 1, space, 3, slash, 4
  • an exact decimal, like 0, point, 75
  • a multiple of pi, like 12, space, start text, p, i, end text or 2, slash, 3, space, start text, p, i, end text

Step 2: Plug in these values to the slope formula to find the slope.
start text, S, l, o, p, e, end text, equals, start fraction, y, start subscript, 2, end subscript, minus, y, start subscript, 1, end subscript, divided by, x, start subscript, 2, end subscript, minus, x, start subscript, 1, end subscript, end fraction, equals
  • Your answer should be
  • an integer, like 6
  • a simplified proper fraction, like 3, slash, 5
  • a simplified improper fraction, like 7, slash, 4
  • a mixed number, like 1, space, 3, slash, 4
  • an exact decimal, like 0, point, 75
  • a multiple of pi, like 12, space, start text, p, i, end text or 2, slash, 3, space, start text, p, i, end text

Step 3: Gut check. Make sure this slope makes sense by thinking about the points on the coordinate plane.
Does this slope make sense?
Choose 1 answer:
Choose 1 answer:

Let's practice!

1) Use the slope formula to find the slope of the line that goes through the points left parenthesis, 2, comma, 5, right parenthesis and left parenthesis, 6, comma, 8, right parenthesis.
  • Your answer should be
  • an integer, like 6
  • a simplified proper fraction, like 3, slash, 5
  • a simplified improper fraction, like 7, slash, 4
  • a mixed number, like 1, space, 3, slash, 4
  • an exact decimal, like 0, point, 75
  • a multiple of pi, like 12, space, start text, p, i, end text or 2, slash, 3, space, start text, p, i, end text

2) Use the slope formula to find the slope of the line that goes through the points left parenthesis, 2, comma, minus, 3, right parenthesis and left parenthesis, minus, 4, comma, 3, right parenthesis.
  • Your answer should be
  • an integer, like 6
  • a simplified proper fraction, like 3, slash, 5
  • a simplified improper fraction, like 7, slash, 4
  • a mixed number, like 1, space, 3, slash, 4
  • an exact decimal, like 0, point, 75
  • a multiple of pi, like 12, space, start text, p, i, end text or 2, slash, 3, space, start text, p, i, end text

3) Use the slope formula to find the slope of the line that goes through the points left parenthesis, minus, 5, comma, minus, 7, right parenthesis and left parenthesis, minus, 2, comma, minus, 1, right parenthesis.
  • Your answer should be
  • an integer, like 6
  • a simplified proper fraction, like 3, slash, 5
  • a simplified improper fraction, like 7, slash, 4
  • a mixed number, like 1, space, 3, slash, 4
  • an exact decimal, like 0, point, 75
  • a multiple of pi, like 12, space, start text, p, i, end text or 2, slash, 3, space, start text, p, i, end text

Something to think about

What happens in the slope formula when x, start subscript, 2, end subscript, equals, x, start subscript, 1, end subscript?
As a reminder, here is the slope formula:
start text, S, l, o, p, e, end text, equals, start fraction, y, start subscript, 2, end subscript, minus, y, start subscript, 1, end subscript, divided by, x, start subscript, 2, end subscript, minus, x, start subscript, 1, end subscript, end fraction
Feel free to discuss in the comments below!

Want to join the conversation?

  • purple pi teal style avatar for user Adrian Ambrosetti
    I think that when X2 = X1, the slope is undefined
    (13 votes)
    Default Khan Academy avatar avatar for user
  • marcimus purple style avatar for user Eileen Chao
    For the last one, if x_1 equals x_2 it is undefined, this is because, from the other videos, it was said that if the two points have the same x when drawing the line, it will be straight up and down, with no slope, but those are called undefined as there really is an undefined slope to it
    (4 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user sp6356
    Using the slope​ formula, find the slope of the line through the points (0,0) and(3,6) . Use pencil and paper. Explain how you can use mental math to find the slope of the line. The slope of the line is enter your response here. ​(Type an integer or a simplified​ fraction.)
    (3 votes)
    Default Khan Academy avatar avatar for user
  • male robot hal style avatar for user Sean Chai
    Something to Think About:
    When x1 = x2, it means that x1-x2=0. So therefore the formula will simplify to y/0. And as x/0 is undefined, the slope should also be undefined.
    (4 votes)
    Default Khan Academy avatar avatar for user
  • winston default style avatar for user Samuel Bernhardt
    In the very last part, why is the formula for slope delta y/delta x instead of delta x/ delta y?
    (1 vote)
    Default Khan Academy avatar avatar for user
    • leafers tree style avatar for user Tams Fletcher
      This is because the equation that describes a line is y=mx+c.
      If we have the y and x values (as in the coordinates), and c is constant for both points (which if it is two point on one line, we know it is) than we can solve for m with algebra.
      If we have two coordinates on a line (x1,y1 =1,2) and (x2, y2 =3,6) we can solve for m as follows.
      (x2,y2) 6=m3+c
      -
      (x1,y1) 2=m1+c

      1st step: c-c =0
      we are left with
      6=m3
      -
      2=m1
      The first equation minus the second =
      4=2m
      But we want the slope (m) on one side so we can solve for M.
      4/2=m
      2=m which is your slope

      What you have done here is take y2 from y1 on the left, x2 from x1 on the right, then divided by x to get m on its own. We can do this in one step instead to get the slope by the equation
      (y2-y1)/(x2-x1)=m
      That is why you divide by x rather than Y.
      (6 votes)
  • duskpin tree style avatar for user Joy Young
    in the formula mx+b=y, I understand that "m" is the slope and "b" is the y-intercept, but what is x and y?
    (2 votes)
    Default Khan Academy avatar avatar for user
    • hopper happy style avatar for user Alan Wang
      when you graph the line, mx+b=y and fill in the slope and y-intercept, the x and y represent points that are on the line that you graphed. For example, if the equation was 5x+10=y, you could create pairs of (x,y) coordinates by plugging in numbers for x and y. In this case, if x was 5, y would be 35 or vice versa. Based on this, you could say that (5,35) is a point on the line, 5x+10=y.
      (3 votes)
  • spunky sam blue style avatar for user Sena Gakpanuvor
    I am assuming that since there is no y variable in said equation that the slope would just be undefined. i don't fully understand it so it would be nice to have an explanation.

    thanks to anyone that answers.
    (3 votes)
    Default Khan Academy avatar avatar for user
  • duskpin ultimate style avatar for user Jack Smith
    Why is the slope formula y/x? Why not y-x or y+x?

    Thanks to anyone who answers.
    Jack.
    (2 votes)
    Default Khan Academy avatar avatar for user
    • starky ultimate style avatar for user Sanjana Gurram
      Slope is something that is also referred to as the rate of change. For example, if you had a savings account that you deposited no money into initially but you deposit 20$ weekly, your rate of change, or slope for this problem would be 20. This is because your x-value in this situation would be the number of weeks passed since you have created your bank account, and the y-value is how much money you have deposited into your account, fully. Since you are looking at the rate of change between the weeks, you divide the change in y per week, 20, by 1 for the number of weeks. I hope this somewhat answers your question.
      (1 vote)
  • leaf green style avatar for user Isaiah  softhal
    bro im honestly so gone
    (3 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user edric.wang
    gonna ask can someone prove the slope definition is real
    (1 vote)
    Default Khan Academy avatar avatar for user