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 of a horizontal line

When two points have the same y-value, it means they lie on a horizontal line. The slope of such a line is 0, and you will also find this by using the slope formula. Created by Sal Khan and Monterey Institute for Technology and Education.

Want to join the conversation?

  • piceratops ultimate style avatar for user Brandyn Dudley
    why is it called rise over run
    (10 votes)
    Default Khan Academy avatar avatar for user
    • leafers ultimate style avatar for user Ben
      Simply put, the slope is called "rise over run" because to get from point A to point B, we rise (move vertically) a certain amount of units and then run (move horizontally) a certain amount of units.

      Example: If we have a slope of 2 on the line (y = 2x + 1), we rise 2 units and run 1 unit to get from one point to another. Note: 2 can be thought of 2/1 -- they are the same thing, right? Start at the point (0, 1). The next point on the graph would be (1, 3). How did we get there? We first started by moving 2 units up in the y direction then got to our destination by moving 1 unit in the x direction.

      Example: If we have a slope of 3/4 on the line (y = (3/4)x), we rise 3 units in the y direction and then 4 units in the x direction. Start at point (0,0). How would we find a second point on the graph? Well, we rise 3 units giving us a y value of (3) and run 4 units giving us an x value of (4); that gives us an ordered pair of (4,3).

      What would be our third point? Well, from our second point at (4,3), we rise 3 units and run 4 units; that gives us a point at (8,6).
      (2 votes)
  • leaf red style avatar for user Annalie
    can someone explain to me how to get slope of parallel and perpendicular lines?
    (2 votes)
    Default Khan Academy avatar avatar for user
  • scuttlebug blue style avatar for user The Travelling Twit
    Why when I do the questions/quiz/practice is the correct answer sometimes 'Undefined' and not 0?
    (4 votes)
    Default Khan Academy avatar avatar for user
    • hopper cool style avatar for user Seed Something
      Great question!
      It's something we definitely need to know, and we can calculate the answer as well!

      ★↔️ Horizontal lines, (flat side to side), always have Zero Slopes.

      When we calculate the slope…
      Difference of y ÷ Difference of x
      ∆y/∆x
      the Numerator will always equal zero, because the y value subtraction on a Horizontal line is always the same number minus itself.

      So…
      Horizontal ↔️ Lines
      the slope math: ∆y/∆x
      will always = 0/∆x←zero on top
      no matter what the Change in x is, it will always divide into zero, zero times.

      Which is why a Horizontal line always has a Zero slope!

      ★↕️ Vertical lines, (straight up and down), always have Undefined Slopes.

      When we calculate the slope…
      Change in y ÷ by Change in x
      ∆y/∆x
      the x subtraction in the Denominator always equals zero, (a number minus itself), so it becomes a divide by zero situation, in arithmetic we learned is Undefined.

      So…
      Vertical ↕️ Lines…
      the slope math: ∆y/∆x
      always = ∆y/0←zero on bottom
      It doesn't matter what the y-difference is because it's divided by the x-difference (that is always zero), and division by zero is 'Undefined'.

      Which is why a Vertical line always has an Undefined slope!

      ★So if we forget which is which, we can calculate the slope and see for ourselves!

      (≧▽≦) I hope that helps someone!
      (5 votes)
  • blobby green style avatar for user Johanna  Lopez
    To make an equation with a horizontal line of a slope of 0 would it be y= or x=?
    (5 votes)
    Default Khan Academy avatar avatar for user
  • hopper jumping style avatar for user Andrew Entwistle
    Is this question answerable: Find the slope of the line that goes through ordered pairs
    (8,7) and (8,9). I know it is a vertical line but does that mean its impossible to calculate.
    (4 votes)
    Default Khan Academy avatar avatar for user
    • duskpin ultimate style avatar for user Israel Zinns
      For the purpose of demonstration you can calculate it using rise over run: (7 - 9)/(8 - 8) = -2/0 <------hence a slope of infinity or undefined as mightygoose suggested because you can't divide by zero. So yes the question is answerable if you consider "undefined" to be an answer.
      (3 votes)
  • piceratops ultimate style avatar for user Vladimir Kostov
    I know this question is "dumb" but can someone explain me why is Y/X and not X/Y? explain me like im 5 :)
    (2 votes)
    Default Khan Academy avatar avatar for user
    • duskpin ultimate style avatar for user I am who I am
      Also because if you put the X over the Y the larger the slope number the the flatter the line and the smaller the slope number the steeper for example a line with the ordered pairs (1,2) and (2,4) its slope traditionally with Y over X would be 2 but with X over Y it would be 1/2
      (3 votes)
  • duskpin ultimate style avatar for user DumDumLollyPOP
    what if the Line is a diagnol that goes up then down but ends on -1 and starts on -1. Is the Slope still 0?
    (3 votes)
    Default Khan Academy avatar avatar for user
  • hopper cool style avatar for user Kush Patel-(Inactive)
    I am a bit confuzzled sal says at that the horizontal line would be 0/10 and that is 0 i understand that but is it possible to have a horizontal line to be a different answer than 0?
    (2 votes)
    Default Khan Academy avatar avatar for user
  • male robot hal style avatar for user BAWC
    At the practice of this, they say that the slope of a vertical line is always undefined.
    why ?
    (3 votes)
    Default Khan Academy avatar avatar for user
    • aqualine ultimate style avatar for user Apple
      Because there is no change in x which also mean there is no change in y, it won't be considered to have a slope. (It's a line but It has no slope)
      In mathematical way: slope = y/0 = undefined

      Also if you learn trigonometry, slope = tan a (opposite over adjacent)
      vertical line is 90 degree, tan 90 = undefined

      Edit:
      My mistake, there's actually change in y, you can check the explanation in this answer comment.

      Also, you can compare it with horizontal lines, it has a slope because there is a change of x but since it doesn't change y value, slope in horizontal line is 0
      While in vertical, there is no change on x so we call it undefined.

      This happen because slope is rate of change in line. In math, we usually define rate of change as: change of vertical over change of horizontal.
      (2 votes)
  • duskpin seed style avatar for user marielecap3803
    I've been trying the excersises but I can't get some answers? What am I doing wrong? I am doing the same thing you are doing?
    (1 vote)
    Default Khan Academy avatar avatar for user

Video transcript

Find the slope of the line that goes through the ordered pairs 7, negative 1 and negative 3, negative 1. Let me just do a quick graph of these just so we can visualize what they look like. So let me draw a quick graph over here. So our first point is 7, negative 1. So 1, 2, 3, 4, 5, 6, 7. This is the x-axis. 7, negative 1. So it's 7, negative 1 is right over there. 7, negative 1. This, of course, is the y-axis. And then the next point is negative 3, negative 1. So we go back 3 in the horizontal direction. Negative 3 for the y-coordinate is still negative 1. So the line that connects these two points will look like this. It will look like that. Now, they're asking us to find the slope of the line that goes through the ordered pairs. Find the slope of this line. And just to give a little bit of intuition here, slope is a measure of a line's inclination. And the way that it's defined-- slope is defined as rise over run, or change in y over change in x, or sometimes you'll see it defined as the variable m. And then they'll define change in y as just being the second y-coordinate minus the first y-coordinate and then the change in x as the second x-coordinate minus the first x-coordinate. These are all different variations in slope, but hopefully you'll appreciate that these are measuring inclination. If I rise a ton when I run a little bit, if I move a little bit in the x direction, and I rise a bunch, then I have a very steep line. I have a very steep upward-sloping line. If I don't change at all when I run a bit, then I have a very low slope. And that's actually what's happening here. I'm going from-- you could either view this as the starting point or view this as the starting point. But let's view this as the starting point. So this negative 3, 1. If I go from negative 3, negative 1 to 7, negative 1, I'm running a good bit. I'm going from negative 3. My x value is negative 3 here, and it goes all the way to 7. So my change in x here is 10. To go from negative 3 to 7, I changed my x value by 10. But what's my change in y? Well, my y value here is negative 1, and my y value over here is still negative 1. So my change in y is a 0. My change in y is going to be 0. My y value does not change no matter how much I change my x value. So the slope here is going to be-- when we run 10, what was our rise? How much did we change in y? Well, we didn't rise at all. We didn't go up or down. So the slope here is 0. Or another way to think about is this line has no inclination. It's a completely flat-- it's a completely horizontal line. So this should make sense. This is a 0. The slope here is 0. And just to make sure that this gels with all of these other formulas that you might know-- but I want to make it very clear. These are all just telling you rise over run or change in y over change in x, a way to measure inclination. But let's just apply them just so, hopefully, it all makes sense to you. So we could also say slope is change in y over change in x. If we take this to be our start and if we take this to be our end point, then we would call this over here x1. And then this is over here. This is y1. And then we would call this x2 and we would call this y2, if this is our start point and that is our end point. And so the slope here, the change in y, y2 minus y1. So it's negative 1 minus negative 1, all of that over x2, negative 3, minus x1, minus 7. So the numerator, negative 1 minus negative 1, that's the same thing as negative 1 plus 1. And our denominator is negative 3 minus 7, which is negative 10. So once again, negative 1 plus 1 is 0 over negative 10. And this is still going to be 0. And the only reason why we got a negative 10 here and a positive 10 there is because we swapped the starting and the ending point. In this example right over here, we took this as the start point and made this coordinate over here as the end point. Over here, we swapped them around. 7, negative 1 was our start point, and negative 3, negative 1 is our end point. So if we start over here, our change in x is going to be negative 10. But our change in y is still going to be 0. So regardless of how you do it, the slope of this line is 0. It's a horizontal line.