Two kinds of lines look too simple to need a lesson, yet they trip people up: flat ones and straight-up ones. They are the special cases of standard form $Ax + By = C$ where $A$ or $B$ is $0$.
Why it works
On a horizontal line every point has the same height. Through $(2, 3)$, that height is $3$, so every point satisfies $y = 3$, whatever $x$ is. The rise between any two points is $0$, so the slope is $\frac{0}{\text{run}} = 0$. On a vertical line every point has the same $x$: through $(2, 3)$ it is $x = 2$. Now the run is $0$, and $\frac{\text{rise}}{0}$ is not a number: a vertical line has no slope (its slope is undefined). It is also not a function, since one input, $x = 2$, has many outputs.
| Line | Equation | Slope | Every point looks like |
|---|---|---|---|
| horizontal through $(a, b)$ | $y = b$ | $0$ | $(\text{anything}, b)$ |
| vertical through $(a, b)$ | $x = a$ | undefined | $(a, \text{anything})$ |
Key idea
$y = k$ is horizontal with slope $0$. $x = h$ is vertical with no (undefined) slope. Name the coordinate that never changes.
Worked examples
Worked example: Through two points
Write the equation of the line through $(-4, 1)$ and $(-4, 6)$.
- Both points have $x = -4$, so the run is $0$ and the line is vertical.
- Every point on it has $x = -4$.
Answer: $x = -4$
Worked example: Perpendicular to a horizontal line
Write the line through $(5, -2)$ perpendicular to $y = 7$.
- $y = 7$ is horizontal, so a perpendicular line is vertical.
- The vertical line through $(5, -2)$ is $x = 5$.
Answer: $x = 5$
Common mistake
Graphing $x = 3$ as a horizontal line, and saying a vertical line has slope $0$. The equation $x = 3$ fixes $x$, so the points are $(3, 0)$, $(3, 1)$, $(3, -2)$: they stack vertically. Its run is $0$, so the slope is undefined; slope $0$ belongs to horizontal lines.