Horizontal and Vertical Lines

A horizontal line goes straight across, and its equation is y = b, where b is the y-value of every point on it. A vertical line goes straight up and down, and its equation is x = a. Horizontal lines have a slope of 0. Vertical lines have an undefined slope.

Before this lesson: You should know how to plot points on the coordinate plane and how to find slope from two points.

What Are Horizontal and Vertical Lines?

A horizontal line is flat, like the horizon. Look at these points: (−3, 2), (0, 2) and (4, 2). The x-values change, but every y-value is 2. So the line through them is y = 2.

A vertical line stands straight up, like a flagpole. Look at these points: (1, −2), (1, 0) and (1, 5). The y-values change, but every x-value is 1. So the line through them is x = 1.

The horizontal line y = 3 and the vertical line x = −2 on a coordinate grid. They cross at the point (−2, 3).
The line y = 3 goes across. The line x = −2 goes up and down. They cross at (−2, 3).

Here is a simple way to remember it. The equation tells you which value stays the same.

  • y = 3 means “y is always 3.” The x-values can be anything, so the line goes sideways.
  • x = -2 means “x is always −2.” The y-values can be anything, so the line goes up and down.

Equations of Horizontal and Vertical Lines

LineEquationSlopeWhere it crosses an axis
Horizontaly = b0Crosses the y-axis at (0, b)
Verticalx = aUndefinedCrosses the x-axis at (a, 0)

Two special lines are worth knowing:

  • The x-axis is the horizontal line y = 0.
  • The y-axis is the vertical line x = 0.

Why Their Slopes Are 0 and Undefined

Use the slope formula on two points from each line.

For the horizontal line through (−3, 2) and (4, 2):

m = \frac{2 - 2}{4 - (-3)} = \frac{0}{7} = 0

The rise is 0, so the slope is 0.

For the vertical line through (1, −2) and (1, 5):

m = \frac{5 - (-2)}{1 - 1} = \frac{7}{0}

The run is 0, and you can’t divide by 0. So the slope of a vertical line is undefined.

Worked Examples

Example 1: Horizontal line through a point

Write the equation of the horizontal line through (4, −5).

Step 1. On a horizontal line, every point has the same y-value.

Step 2. The y-value of this point is −5.

Answer: y = -5

Example 2: Vertical line through a point

Write the equation of the vertical line through (−3, 6).

Step 1. On a vertical line, every point has the same x-value.

Step 2. The x-value of this point is −3.

Answer: x = -3

Example 3: Line through two points

Write the equation of the line through (2, 7) and (2, −1). What is its slope?

Step 1. Compare the points. Both x-values are 2, but the y-values are different.

Step 2. When the x-values match, the line is vertical. So the equation is x = 2.

Answer: x = 2. The slope is undefined.

Example 4: Where two lines cross

Graph y = -2 and x = 4. Where do they cross?

The horizontal line y = −2 and the vertical line x = 4 cross at the point (4, −2).
The lines y = −2 and x = 4 cross at the point (4, −2).

Step 1. Draw y = -2 as a flat line through −2 on the y-axis.

Step 2. Draw x = 4 as an up-and-down line through 4 on the x-axis.

Step 3. The crossing point has the x-value from one line and the y-value from the other.

Answer: They cross at (4, −2).

Example 5: Word problem

A parking garage charges $12 to park for any amount of time up to 8 hours. Write an equation for the cost C after h hours. What is the slope, and what does it mean?

Step 1. The cost is $12 no matter how many hours you park. So C is always 12.

Step 2. Write the equation: C = 12.

Answer: C = 12, for up to 8 hours. The graph is a horizontal line, so the slope is 0. The cost goes up by $0 for each extra hour.

Common Mistakes

MistakeWhat it looks likeHow to fix it
Using the wrong valueHorizontal line through (2, 5) written as x = 2A horizontal line keeps y the same: y = 5.
Mixing up the slopes“The slope of x = 3 is 0.”Vertical lines have undefined slope. Horizontal lines have slope 0.
Graphing in the wrong directionDrawing y = 4 up and down through 4 on the x-axisy = 4 crosses the y-axis at 4 and goes across.
Thinking it’s one point“x = 3 is the point (3, 0).”x = 3 is a whole line of points like (3, 0), (3, 1) and (3, −8).

Horizontal and Vertical Lines in Slope-Intercept Form

A horizontal line fits the form y = mx + b with a slope of 0. For example, y = 0x + 4 is the same as y = 4.

A vertical line does not fit that form. It has no slope to put in for m, so you always write it as x = a. You’ll use this form in the next lesson, Slope-Intercept Form.

A horizontal line and a vertical line always meet at a right angle, so they are perpendicular.

Practice Problems

Write each equation, or answer the question.

  1. The horizontal line through (3, 8)
  2. The vertical line through (−6, 1)
  3. The line through (−4, 9) and (5, 9). What is its slope?
  4. The line through (0, −3) and (0, 7). What is its slope?
  5. What is the slope of y = -7?
  6. Is x = -1 horizontal or vertical?
  7. Where do y = 6 and x = -2 cross?
  8. The line through (7, −4) that is parallel to the y-axis
  9. The line through (−5, 2) that is parallel to the x-axis
  10. A hot-air balloon floats at a steady height of 300 feet for 10 minutes. Write an equation for its height h after t minutes. What is the slope?
Show answers
  1. y = 8. A horizontal line keeps the y-value.
  2. x = -6. A vertical line keeps the x-value.
  3. Both y-values are 9, so the line is y = 9. The slope is 0.
  4. Both x-values are 0, so the line is x = 0, which is the y-axis. The slope is undefined.
  5. The slope is 0, because y = -7 is a horizontal line.
  6. Vertical. It is the line where x is always −1.
  7. At (−2, 6). Take the x-value from x = -2 and the y-value from y = 6.
  8. A line parallel to the y-axis is vertical, so the equation is x = 7.
  9. A line parallel to the x-axis is horizontal, so the equation is y = 2.
  10. The height stays 300 feet, so h = 300 for 0 \le t \le 10. The slope is 0 feet per minute, because the height doesn’t change.

Horizontal and Vertical Lines FAQ

Is y = 5 a horizontal or vertical line?

The line y = 5 is horizontal. Every point on it has a y-value of 5, so it runs straight across.

What is the slope of a vertical line?

The slope of a vertical line is undefined. The run between any two points is 0, and you can’t divide by 0.

What is the equation of the x-axis?

The x-axis is the line y = 0, and the y-axis is the line x = 0.

Are horizontal and vertical lines perpendicular?

Yes. A horizontal line and a vertical line always cross at a right angle.

Summary

  • A horizontal line has the equation y = b and a slope of 0.
  • A vertical line has the equation x = a and an undefined slope.
  • The equation names the value that stays the same: y for horizontal lines, x for vertical lines.
  • The x-axis is y = 0, and the y-axis is x = 0.
  • A horizontal line and a vertical line cross at (a, b).

Previous lesson: Slope

Next lesson: Slope-Intercept Form

Back to the Algebra 1 Index

Similar Posts