Horizontal and Vertical Lines
A horizontal line has equation y = b because every point has the same y-coordinate; its slope is zero.
More key points
- A vertical line has equation x = a because every point has the same x-coordinate; its slope is undefined.
- The coordinate held constant determines the equation.
On this page9 sections
The coordinate that stays fixed
The line y = 4 consists of every point whose second coordinate equals 4. Points such as (−3, 4), (0, 4), and (5, 4) all lie on it. The x-coordinate can change freely, so the line stretches left and right at the same height. That makes it horizontal.
The line x = −2 consists of every point whose first coordinate equals −2. Examples include (−2, −5), (−2, 0), and (−2, 3). Here the y-coordinate can change freely while the horizontal position stays fixed. The line runs vertically through x = −2.
Remembering which coordinate stays fixed is more dependable than trying to associate the letter x with a horizontal line. The x-axis is horizontal, but the equation x = a describes a vertical line. The equation names the unchanged coordinate, not the direction in which the line extends.
Plot a line using two points
To graph y = −3, select any two different x-values and pair each with −3. For example, plot (−2, −3) and (4, −3), then draw the horizontal line through them. Add arrows if the graph represents an entire line rather than a limited segment.
To graph x = 5, pair 5 with two different y-values, such as (5, −1) and (5, 4). Draw the vertical line through those points. A third point can check the drawing, but two distinct points already determine the line.
If an answer option slopes slightly upward or downward, it cannot represent y = a constant. A change in height would mean a change in y. Likewise, a line that moves sideways as it rises cannot represent x = a constant. Use coordinate labels instead of judging a diagram solely by its appearance.
Zero slope for horizontal lines
Slope is change in y divided by change in x: m = (y₂ − y₁)/(x₂ − x₁). For a horizontal line, the numerator is zero because the two y-values match. The denominator is nonzero when the points are distinct, so the slope is zero.
Using (−2, 6) and (3, 6), the calculation is (6 − 6)/(3 − (−2)) = 0/5 = 0. There is horizontal movement with no vertical change. This is why a flat distance-versus-time graph, for example, indicates no change in the displayed distance during that interval.
A horizontal line fits slope-intercept form y = mx + b. Setting m = 0 gives y = 0x + b, which simplifies to y = b. The absent x-term therefore does not mean there is no equation. It means x has no effect on the y-value.
Undefined slope for vertical lines
For a vertical line, distinct points have identical x-values. Using (4, −2) and (4, 5), the slope expression is (5 − (−2))/(4 − 4) = 7/0. Division by zero is undefined, so the slope is undefined.
Do not label it zero. Zero divided by a nonzero number is zero; a nonzero number divided by zero is undefined. The position of the zero is the entire distinction. A vertical line also cannot be written as y = mx + b with a finite real value of m, because one x-value corresponds to many y-values.
Calling the slope infinity can be a visual shorthand for steepness, but it is not the standard numerical answer for a slope calculation. On an algebra question, use undefined. The slope formula does not produce a real number when the denominator is zero.
Intercepts and the coordinate axes
A horizontal line y = b crosses the y-axis at (0, b). If b is not zero, it never reaches the x-axis, so it has no x-intercept. For example, y = 7 crosses the vertical axis at height 7 and remains above the horizontal axis everywhere.
A vertical line x = a crosses the x-axis at (a, 0). If a is not zero, it has no y-intercept. For example, x = −4 stays left of the y-axis and crosses the x-axis at (−4, 0).
The axes themselves are special cases. The x-axis has equation y = 0 and zero slope. The y-axis has equation x = 0 and undefined slope. Each axis contains the origin. Rather than forcing these cases into the usual one-intercept description, recognize that an axis is a complete set of points where one coordinate equals zero.
Parallel, perpendicular, and intersecting lines
Two different horizontal lines are parallel because they maintain different constant y-values and never meet. Two different vertical lines are parallel for the same reason with their x-values. A horizontal line and a vertical line meet at a right angle, so they are perpendicular.
The intersection of x = −3 and y = 8 is (−3, 8). Both coordinate requirements must hold at once. There is no substitution work beyond combining them. An answer such as (8, −3) reverses the coordinate order and fails both equations.
The negative-reciprocal slope rule for perpendicular lines needs special care here. It applies directly to nonzero finite slopes. For a horizontal and vertical pair, one slope is zero and the other is undefined, so identify perpendicularity from their directions instead of attempting to calculate −1/0.
Intersecting a slanted line
Find the intersection of y = 5 and y = 2x − 1. Set the y-expressions equal: 5 = 2x − 1. Add 1 and divide by 2 to get x = 3. The intersection is (3, 5). Check by substituting into the slanted line: 2(3) − 1 = 5.
For x = −2 and y = 3x + 4, substitute the fixed x-value directly. Then y = 3(−2) + 4 = −2, so the intersection is (−2, −2). Knowing which coordinate is already fixed makes these systems faster than treating both equations as general expressions.
Some systems have no solution. The equations y = 2 and y = 6 cannot hold for the same point. If the equations are y = 2 and 3y = 6, they describe the same line and have infinitely many solutions. Simplify each equation before deciding whether two lines are distinct.
Functions, domain, and range
An unrestricted horizontal line y = b is a function of x. Every input x has exactly one output, b. Its domain is all real numbers and its range contains only b. The fact that many x-values share the same y-value does not violate the definition of a function.
A vertical line x = a is not a function of x when it contains multiple points. The same input a would need to produce many different y-values. Its set of x-values contains only a, while its set of y-values can be all real numbers for a complete line.
Restrictions matter. A horizontal segment can have a limited domain, and a vertical segment can have a limited range. Read endpoints and any stated interval before assuming the line extends forever. Open and closed endpoints also determine whether boundary values belong to the relation.
A quick diagnostic exercise
The points (1, −4), (3, −4), and (9, −4) belong to the same horizontal line y = −4. Its slope is zero and its y-intercept is (0, −4). The points (−6, 2), (−6, 5), and (−6, 11) belong to x = −6, a vertical line with undefined slope.
For each set, first identify the repeated coordinate. Write that coordinate as the constant equation, then check the direction and slope. This sequence connects the table, equation, and graph without relying on a memorized picture.
Common questions
Is x = 0 horizontal or vertical?
It is vertical and describes the y-axis. Every point has an x-coordinate of zero.
Why is a vertical slope undefined?
Distinct points on a vertical line have the same x-coordinate, so the slope formula requires division by zero.
Can a horizontal line be a function?
Yes. An unrestricted horizontal line assigns the same single y-value to every real x-value.