The constant is the one coordinate that never changes along the line. Everything else about these lines, from graphs to function tests to the places where familiar formulas break, follows from that single fact.
What Is the Equation of a Horizontal or Vertical Line?
Read as a rule: the height is , whatever you choose. The points , and all obey it, and together they form a flat line. The variable that is missing from the equation is free to take any value. That is the whole idea.
The trap that costs the most points is thinking the equation names the direction. It does not. The equation gives the place where the line crosses the -axis, and the line runs parallel to the -axis. A quick mental check: the line is parallel to the axis of the variable that is missing from the equation. In the is missing, so the line is parallel to the -axis, which means vertical.
This also pins down the axes themselves. The -axis is the horizontal line , and the -axis is the vertical line . If you are shaky on how coordinates are read, plotting points on the coordinate plane is worth a quick pass first.
| Horizontal line | Vertical line | |
|---|---|---|
| Equation | ||
| Slope | undefined | |
| Parallel to | -axis | -axis |
| Function of ? | yes | no |
Quick check
Answer:
Why Horizontal Lines Have Slope 0 and Vertical Lines Do Not
Take two points on a horizontal line, and . Their heights are identical, so the rise is :
Now take two points on a vertical line, and . This time the run is the part that vanishes:
Why “undefined” and not “infinite” or “zero”? Division is the reverse of multiplication. Saying would require , and no number does that. There is also a visual reason: tilt a line toward vertical from one side and its slope grows toward positive infinity, tilt it from the other side and the slope heads toward negative infinity. With no single value to settle on, the slope is left undefined. Using the slope formula on any two points of a vertical line always ends with a zero in the denominator, which is itself a quick test for “vertical”.
The same reason explains why a vertical line cannot be written in slope-intercept form. The form needs a slope, and a vertical line has none to offer. A horizontal line fits perfectly with , since simplifies to . Students often mix up “zero slope” and “no slope”. Zero slope is flat and perfectly fine. No slope (undefined) is a wall.
How Do You Graph Horizontal and Vertical Lines?
Graphing needs no table and no slope. Use these steps:
- Find the variable in the equation. If it is , the line is horizontal. If it is , the line is vertical.
- Mark that value on the matching axis. For , find on the -axis. For , find on the -axis.
- Draw a line through that mark, parallel to the other axis, with arrows on both ends.
- Spot-check by reading off two points and confirming the fixed coordinate.
Negatives behave as you would expect: lies four units below the -axis, and lies three units left of the -axis. The common slip is swapping the two, drawing as a flat line because the feels like a height. Whenever you hesitate, write one point from the line. For , a point is , which sits on the -axis, so the line must stand upright there.
A horizontal line with never touches the -axis, so it has no -intercept. A vertical line with has no -intercept. See finding x and y intercepts for the usual method and why it needs this exception.
Try this: Sketch and on one grid. Then list three points on each line and circle the coordinate that stayed the same in every point.
How Do You Write the Equation of a Line Through Two Points?
For ordinary lines, the equation of a line through two points starts with the slope. For these special lines, a faster method is to compare coordinates first. If the -values match, the line is that value. If the -values match, the line is that value. Only when neither pair matches do you need the full slope calculation.
Example 1. Find the line through and .
The -values match, so the line is vertical. To confirm:
The slope is undefined, and the equation is . Check by substituting: both points have , so both satisfy the equation.
Example 2. Find the line through and .
The -values match. Confirming with the slope:
Now apply point-slope form with the point :
Notice that point-slope form works for horizontal lines but breaks for vertical ones, because there is no slope to substitute. That is why vertical lines always need to be handled by inspection.
Are Horizontal and Vertical Lines Functions?
A horizontal line is a function. Every input produces exactly one output, . It is called a constant function. Its domain is all real numbers, and its range is the single value .
A vertical line is not a function of . The single input is paired with every real number as an output. Its domain is only , and its range is all real numbers. This is exactly what the vertical line test detects: a vertical line drawn through a graph should never hit it twice, and the graph of is itself a vertical line that hits itself everywhere.
The relation is not a function of , but it is a function if you treat as the input and as the output. Whether something is a function depends on which variable you call the input.
Quick check
Answer:
Horizontal and Vertical Lines in Standard Form and Inequalities
In standard form, , these lines are the cases where one coefficient is zero. If the term vanishes and the line is horizontal. If the term vanishes and the line is vertical. So the standard form hides a clue: a missing variable always means a line parallel to an axis.
Example 3. Identify and graph and .
For the first, subtract and divide by :
This is a horizontal line five units below the -axis. For the second, divide by :
This is a vertical line three units left of the -axis.
The same ideas carry over to graphing linear inequalities. For , draw a dashed vertical line at and shade to the right, where is larger. For , draw a solid horizontal line at and shade below. The rule that prevents mistakes: inequalities in shade left or right, and inequalities in shade up or down.
Are Horizontal and Vertical Lines Parallel or Perpendicular?
Any two horizontal lines are parallel, and so are any two vertical lines. Any horizontal line is perpendicular to any vertical line. The familiar rule from slopes of parallel and perpendicular lines says perpendicular slopes multiply to , but that rule cannot be applied here, since a vertical line has no slope to multiply. Treat horizontal and vertical lines as the exception, decided by sight rather than by slope.
This makes intersections almost free. The lines and meet at exactly , with no equations to solve. Distances become simple too. The distance between parallel lines and is , and the distance formula collapses to that same absolute difference whenever two points share a coordinate.
Example 4. Find the perimeter of the rectangle bounded by , , and .
The width is . The height is . The perimeter is:
Subtracting the negative is where most errors appear: , not .
Quick check
Answer:
Where Do Horizontal and Vertical Lines Appear in Real Life?
On a graph of distance against time, a horizontal segment means standing still: the position does not change while the clock runs. This matches the idea of average rate of change, where a horizontal line is a rate of exactly zero. A speed-against-time graph shows a horizontal line for cruise control. A vertical segment on a time graph would mean being in two places at one instant, which is why real motion never produces one.
Vertical lines are useful the other way around. In data charts, a vertical line often marks an event, such as a policy change or a product launch, while a horizontal line marks a target, an average or a threshold. City grids work the same way: streets running east to west are horizontal lines, and avenues running north to south are vertical lines, so an address is really an intersection .
One practical catch: graphing calculators and many spreadsheet tools expect as a function of , so typing often fails. Use the tool’s vertical line feature, or enter a very steep line such as as a rough stand-in. The reason is the same one from earlier: a vertical line is not a function.
Practice problems
0 of 5 solved
- Write the equation of the horizontal line through .
Answer:
A horizontal line keeps one -value for every point. The given point has . The line is , and its slope is . - Find the slope and the equation of the line through and .
Answer: Slope undefined;
Both points have . The slope is , which is undefined. A line with a constant -value is vertical, so the equation is . - Rewrite as a simple line equation and state its slope.
Answer: , slope
Subtract from both sides: . Divide by : . This is a horizontal line, so the slope is . - Where do the lines and intersect?
Answer:
Solve the second line: , so . The vertical line and the horizontal line cross where both hold. The point is . - The lines , and form a triangle. Find its area.
Answer: square units
The vertices are , (put into ) and (put into ). The right angle sits at . Both legs have length , so the area is .
Common questions
What is the slope of a horizontal line?
The slope of a horizontal line is . Every point has the same -value, so the rise between any two points is , and divided by a nonzero run is .
Why is the slope of a vertical line undefined?
Every point on a vertical line has the same -value, so the run is . Slope is rise divided by run, and dividing by has no meaning, so the slope is called undefined.
Is a vertical line a function?
No. A vertical line pairs one input with infinitely many outputs, so it fails the vertical line test. A horizontal line is a function, called a constant function.
How do you write the equation of a horizontal line through a point?
Take the -coordinate of the point and set equal to it. For the horizontal line is . For the vertical line through the same point, use the -coordinate: .
Are horizontal and vertical lines perpendicular?
Yes. Every horizontal line meets every vertical line at a right angle. The negative reciprocal rule cannot show it, because a vertical slope is undefined, but the axes themselves are the standard example.
Do horizontal and vertical lines have intercepts?
A horizontal line with has a -intercept at and no -intercept. A vertical line with has an -intercept at and no -intercept.