Part 9 of 10 · LinesSee the whole course
Slope of horizontal and vertical lines
A horizontal line has slope 0 and an equation like y = 3. A vertical line has undefined slope, because you would have to divide by 0, and an equation like x = 2.
Flat lines: slope 0
On a flat line, you go across but never up or down. The rise is 0, so the slope is rise ÷ run = 0 ÷ run = 0.
Every point on a flat line has the same height, so the equation is just that height: y = c.
Points (1, 3) and (5, 3)
Rise: 3 − 3 = 0
Run: 5 − 1 = 4
Slope: 0 ÷ 4 = 0, and the line is y = 3
Upright lines: undefined slope
On an upright line, you go up but never across. The run is 0, and the slope is rise ÷ 0. Dividing by 0 is not possible, so the slope is undefined. It is not 0, and it is not “infinity” either.
Every point on an upright line has the same x, so the equation is that x: x = c.
Points (2, 1) and (2, 7)
Rise: 7 − 1 = 6
Run: 2 − 2 = 0
Slope: 6 ÷ 0 = undefined, and the line is x = 2
See it happen
Point A is fixed. Point B is A plus a run across and a rise up. Slide the run down towards 0: the slope gets bigger and bigger, and at 0 it breaks. Then set the rise to 0 and see the flat line.
How to remember which is which
- Horizontal: zero. A flat line has nothing to climb, so the slope is 0.
- Vertical: undefined. You cannot walk up a wall in steps, so the slope has no value.
And for the equations: y = 3 says “y is always 3”, so the height never changes and the line is flat. x = 3 says “x is always 3”, so the line is upright through 3 on the x-axis.
A vertical line is not a function
On the line x = 2, the single input 2 goes with every output at once. That is the opposite of a function, which gives exactly one output for each input. It fails the vertical line test from our post on what a function is. A horizontal line, on the other hand, is a perfectly good function: every input gives the same output.
Watch it explained in under a minute
The five mistakes to avoid
- Saying a vertical line has slope 0. A horizontal line has slope 0. A vertical line has no slope.
- Mixing up y = 3 and x = 3. The first is flat, the second is upright.
- Writing “the slope is infinity”. The slope of a vertical line is undefined.
- Thinking a horizontal line has no slope. It does: the slope is 0.
- Trying to write a vertical line as y = mx + b. It cannot be done, because it has no slope. Write x = c instead.
Try it yourself
Tap a question to see the answer.
1. Find the slope and the equation of the line through (1, 3) and (5, 3)
Rise 0, run 4: slope 0 ÷ 4 = 0. The line is flat: y = 3.
2. Find the slope and the equation of the line through (2, 1) and (2, 7)
Run 0, so the slope is undefined. The line is upright: x = 2.
3. Which one is the vertical line: y = 4 or x = 4?
x = 4. In x = 4 the x-value is always 4, so the line is upright through 4 on the x-axis.
Where this fits in
These are the two cases that do not fit y = mx + b, so keep them in mind next to slope-intercept form and finding the equation from two points. Next in this course, we use lines to solve something new: how to solve a linear equation.