Most lines slant up or down, but two kinds don’t slant at all: horizontal lines and vertical lines. Their slopes behave differently from every other line.
Horizontal lines: slope 0
Take two points on a flat line, such as (−4, 3) and (5, 3). The rise is 3 − 3 = 0 and the run is 5 − (−4) = 9.
Slope = 0 ÷ 9 = 0. Zero divided by any number is zero.
Every point on this line has y = 3, so its equation is y = 3. In slope-intercept form it is y = 0x + 3.
See the horizontal line in Slope Finder →
Vertical lines: undefined slope
Take two points on a vertical line, such as (2, −4) and (2, 5). The rise is 5 − (−4) = 9 and the run is 2 − 2 = 0.
Slope = 9 ÷ 0. Dividing by zero has no answer, so the slope is undefined.
Every point on this line has x = 2, so its equation is x = 2. It can’t be written as y = mx + b, because there is no number m.
See the vertical line in Slope Finder →
Remembering which is which
- Horizontal: walking along it is like walking on flat ground. No climb at all, so the slope is 0. The equation is y = a number.
- Vertical: it is like a wall you can’t walk up. The slope can’t be given a value, so it is undefined. The equation is x = a number.
Some students use the memory aid HOY VUX: Horizontal, slope 0, y = number. Vertical, Undefined slope, x = number.
Be careful with “no slope”
Some books say a vertical line has “no slope”, and people sometimes say a horizontal line has “no slope” because it is flat. That’s confusing, so it is clearer to say zero slope for horizontal lines and undefined slope for vertical lines.
How they relate
A horizontal line and a vertical line always meet at a right angle, so they are perpendicular. This is the one perpendicular pair where the usual rule, that the slopes multiply to −1, doesn’t apply, because one slope is undefined.