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

Horizontal & vertical lines

Worked examples identifying the equations and slope of horizontal and vertical lines.

Want to join the conversation?

  • piceratops ultimate style avatar for user Philosopher King
    Why is an equation in which you only have the value of y considered to have a slope of 0 (for example the equation at ) but an equation in which you only have the slope of x (for example the equation at ) considered to be undefined?
    (33 votes)
    Default Khan Academy avatar avatar for user
  • duskpin ultimate style avatar for user CHEYENNE
    So if the line is vertical the slope is undefined and if the line is horizontal the slope is 0. Am I understanding it right?
    (10 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user 355144
    Why does a horizontal line have a slope of O, and a vertical line has an undefined slope?
    (0 votes)
    Default Khan Academy avatar avatar for user
    • stelly blue style avatar for user Kim Seidel
      Remember, the slope of a line is "change in Y / change in X". You need to think of the slope as a fraction. The numerator tells you the change in Y -- how fast the Y coordinate is changing (how fast the line is going up/down). The denominator tells you the change in X -- how fast the X coordinate is changing (how fast the line is moving left/right).

      Horizontal lines do not go up/down. They just move left to right. This means the change in Y = 0, while the change in X = 1. 0/1 = 0 as a slope.

      Vertical lines go up/down, but they never go left or right. This means the change in Y = 1, while the change in X = 0. 1/0 = undefined.

      Hope this helps.
      (15 votes)
  • winston baby style avatar for user Samuel Lee
    At , isn't it a change of -4 because y=-4?
    (5 votes)
    Default Khan Academy avatar avatar for user
  • primosaur ultimate style avatar for user Steve
    ehh so if we have the equation of a vertical line, like X=4...it has the possibility for Y to have any value.. but why isn't the Y represented in the equation at all? Couldn't you say x=4 + y(any real numbers) ?
    (3 votes)
    Default Khan Academy avatar avatar for user
  • aqualine sapling style avatar for user Victor Chavez
    What's the difference between "0" and "undefined" as slope?
    (3 votes)
    Default Khan Academy avatar avatar for user
    • mr pink green style avatar for user David Severin
      Since the slope intercept general equation is y = mx + b, if you substitute 0 in for m, then 0x = 0 which disappears, so y = b. Zero slope gives a horizontal line that crosses the x axis at a given y value.
      Then, if we tried to substitute an "undefined" value for m, we really could not, but lets just imagine that we try. 1/0 is the simplest undefined number. So y = 1/0 x + b
      and once again imagining that I could multiply by 0 to get rid of it on the bottom (but 0/0 is still undefined), we would have 0y = 1x +ob, or just x=0. Thus, this would be a vertical line, but x is not limited to just 0, it could be any number. This vertical line will cross the y axis at a given x value. This would mean that it would also is not a function.
      (5 votes)
  • blobby green style avatar for user hellobeccy123
    is there any difference between gradient and slope?
    (4 votes)
    Default Khan Academy avatar avatar for user
  • winston default style avatar for user Anderson Le
    What does it mean when Sal said "It doesn't matter what the change in x is and that the change in y will always equal zero" at . Why would it equal zero if slope is rise over run or y/x and y would always equal -4 because it runs in a horizontal line and is consistent? If x could be any number possible on the x axis, why does the slope equal zero?
    (2 votes)
    Default Khan Academy avatar avatar for user
  • male robot hal style avatar for user RN
    What are Quadrants on the coordinate plane?
    (2 votes)
    Default Khan Academy avatar avatar for user
    • cacteye blue style avatar for user Jerry Nilsson
      The coordinate axes divide the coordinate plane into four parts called quadrants.

      Quadrant 1 is in the top right
      Quadrant 2 is in the top left
      Quadrant 3 is in the bottom left
      Quadrant 4 is in the bottom right

      The quadrants are often denoted with the Roman numerals I, II, III, and IV.
      (2 votes)
  • mr pants teal style avatar for user Ruben Miranda
    I'll assume when given both the coordinates for an X and Y for a vertical line the slope is the X point. As well as it not mattering what that values are on a horizontal line because a straight one will always match-up to undefined.
    (1 vote)
    Default Khan Academy avatar avatar for user

Video transcript

- [Instructor] What is the equation of the horizontal line through the point negative four comma six? So let's just visualize this. Once you get the hang of it, you might not have to draw a graph, but for explanatory purposes, it might be useful. So negative four comma six, that's going to be in the second quadrant. So if this is my x-axis, That is my y-axis. I'm going to go negative four in the x direction. So one, two, three, four. Negative four. And then one, two, three, four, five, six, in the y direction. So the point that we care about is going to be right over there. Negative four comma six. And what is the equation of the horizontal line? It is a horizontal line. So it's just going to go straight left, right like this. That is what the line would actually look like. So what is that equation? Well, for any x, y is going to be equal to six. This is the equation, y is equal to six. Doesn't matter what x you input here, you're gonna get y equals six. It just stays constant right over there. So the equation is y is equal to six. Let's do another one of these. So here we are asked what is the slope of the line y is equal to negative four? So let's visualize it and then in the future, you might not have to draw it like this. But let's just draw our axis again. X-axis y-axis and the slope of line y equals negative four. So for whatever x you have, y is going to be negative four. Let's say that's negative four right over there. And so, the line is y the line is y equals negative four. So I can draw it like this. So what's the slope of that? Well, slope is change in y for given change in x. And here, no matter what I change my x, y doesn't change. It stays at negative four. My change in y over change in x. Doesn't matter what my change in x is. My change in y is always going to be zero. It's constant. So the slope here is going to be equal to zero. Y doesn't change, no matter how much you change x. Let's do another one of these. This is fun. So now they are asking us, what is the slope of the line x equals negative three? Let me graph that one. So, I'm just going to draw my axis real fast. X-axis y-axis X is equal to negative three. So negative one, negative two, negative three. And so, this line is going to look let me, it's going to look like this. No matter what y or you can say no matter what y is. X is going to be equal to negative three. So, it would look like this. X is equal to negative three. So what's the slope here? Well, it's undefined. A vertical line has an undefined slope. Remember, you want to do what's your change in y or change in x. Change in y or change in x. Well, you can think about what's the slope as you approach this but once again, that could be, some people would say, maybe it's infinite, maybe it's negative infinity. But that's why it's undefined. A vertical line is going to have an undefined slope. So we'll go with undefined. Let's do one more. What is the equation of the vertical line through negative five comma negative two? So, let me do this without even drawing it. I'll draw it right after that. So, if we're talking about a vertical. If we're talking about a vertical line, that means that x doesn't change. X doesn't change. If we were talking about a horizontal line, then we'd say y doesn't change. So if x doesn't change, that means that x is just going to be equal to some constant value. Well, if it contains the points negative five comma negative two, so if it has a point where x is equal to negative five and if x never changes, it's a vertical line, well that means its equation has to be x is equal to negative five. And we can draw that out, if it helps. So let me draw that out. So, I need to make sure that's a straight line. Okay, so we have x, and we have y, so we have the point negative five comma negative two. So negative one, two, three, four, five, negative one, two so we want to go have a vertical line that goes through that point. So a vertical line, well that just goes straight up and down. So it's just going to look like this. And so notice, x never changes. No matter what y is, x is equal to negative five. This has an undefined slope. It is a vertical line. Its equation is x is equal to negative five.