Sub topic 7
Vertical and Horizontal Lines
Prerequisites and the key distinction
Assume you know how to plot coordinates, calculate slope, simplify fractions, and solve basic linear equations. This chapter focuses on the two special line directions that do not always fit the usual slope rules.
A horizontal line goes left and right. Every point on it has the same \(y\)-coordinate. A vertical line goes up and down. Every point on it has the same \(x\)-coordinate.
| Line type | Coordinate that stays constant | Equation form | Slope |
|---|---|---|---|
| Horizontal | \(y\) | \(y=b\) | \(0\) |
| Vertical | \(x\) | \(x=a\) | Undefined |
For example, \(y=4\) is a horizontal line through all points whose \(y\)-coordinate is 4. The equation \(x=-2\) is a vertical line through all points whose \(x\)-coordinate is \(-2\).
Why vertical slope is undefined
Slope is calculated as
\[ m=\frac{\text{change in }y}{\text{change in }x} =\frac{y2-y1}{x2-x1}. \]
For a horizontal line, the change in \(y\) is zero. Therefore,
\[ m=\frac{0}{x2-x1}=0. \]
For a vertical line, the change in \(x\) is zero. Division by zero is undefined, so a vertical line has no numerical slope.
Consider the points \((3,1)\) and \((3,7)\). Their slope would be
\[ m=\frac{7-1}{3-3}=\frac{6}{0}. \]
This expression is undefined. Do not call the slope zero. Zero slope describes a horizontal line, not a vertical one.
Using special cases to compare lines
Two distinct vertical lines are parallel because they never meet. For example, \(x=1\) and \(x=5\) are parallel.
Two horizontal lines are also parallel. The lines \(y=-3\) and \(y=2\) never meet.
A vertical line and a horizontal line are perpendicular. They meet at a right angle. For example, \(x=4\) and \(y=-1\) are perpendicular.
These facts complete the usual slope tests:
- Equal defined slopes indicate parallel lines.
- Slopes whose product is \(-1\) indicate perpendicular lines.
- Two vertical lines are parallel, even though their slopes are undefined.
- A vertical line and a horizontal line are perpendicular.
- Two horizontal lines are parallel, not perpendicular.
Writing a line through a point
To write a horizontal line through \((x0,y0)\), keep the \(y\)-coordinate:
\[ y=y_0. \]
The horizontal line through \((-2,6)\) is \(y=6\).
To write a vertical line through \((x0,y0)\), keep the \(x\)-coordinate:
\[ x=x_0. \]
The vertical line through \((-2,6)\) is \(x=-2\).
This also helps with perpendicular lines. A line perpendicular to \(y=3x+1\) has slope \(-\frac13\), but a line perpendicular to the horizontal line \(y=8\) must be vertical. Through \((5,-2)\), that line is \(x=5\).
Likewise, a line perpendicular to \(x=-4\) must be horizontal. Through \((7,9)\), it is \(y=9\).
Checking special cases with Python
The value None can represent an undefined slope in a program.
from fractions import Fraction
def slope(p, q):
x1, y1 = p
x2, y2 = q
if x1 == x2:
return None
return Fraction(y2 - y1, x2 - x1)
print(slope((3, 1), (3, 7))) # None: vertical
print(slope((-2, 6), (4, 6))) # 0: horizontalExercise
Classify the lines x = -1 and y = 4 as parallel, perpendicular, or neither. Then write the vertical line through (6, -3) and the horizontal line through (6, -3).
Show answer
The lines x = -1 and y = 4 are perpendicular. The vertical line is x = 6, and the horizontal line is y = -3.