Lines and Linear Equations

Horizontal and Vertical Lines: y = c and x = c

A horizontal line has the equation y = c: every point has the same y-value, the slope is 0, and it crosses the y-axis at (0, c). A vertical line has the equation x = c: every point has the same x-value, its slope is undefined, and it crosses the x-axis at (c, 0). Vertical lines are not functions.

The horizontal line y = 2 and the vertical line x = −3 crossing at (−3, 2).

Check it yourself: every example here can be loaded into the Slope Intercept Form Calculator.

Open the Slope Intercept Form Calculator

Horizontal lines: y = c

A horizontal line is flat. Every point on it has the same y-coordinate, so its equation simply states that value:

y = c
  • Slope: 0, because the rise between any two points is 0.
  • y-intercept: (0, c).
  • x-intercept: none, unless c = 0 (the line is then the x-axis itself).

It fits slope-intercept form with m = 0: y = 0·x + c.

Vertical lines: x = c

A vertical line goes straight up and down. Every point has the same x-coordinate:

x = c
  • Slope: undefined, because the run between any two points is 0 and you cannot divide by zero.
  • x-intercept: (c, 0).
  • y-intercept: none, unless c = 0 (the line is the y-axis).

It cannot be written as y = mx + b, but it fits standard form: 1·x + 0·y = c.

Two panels. Left: the points (−2, 3), (0, 3) and (2, 3) all have y = 3 and lie on the horizontal line y = 3. Right: the points (4, −2), (4, 0) and (4, 2) all have x = 4 and lie on the vertical line x = 4.
The equation names the coordinate that never changes.
Text description of this figure

Two panels. Left: the points (−2, 3), (0, 3) and (2, 3) all have y = 3 and lie on the horizontal line y = 3. Right: the points (4, −2), (4, 0) and (4, 2) all have x = 4 and lie on the vertical line x = 4.

  1. Horizontal: all points share the same y. Equation y = c, slope 0.
  2. Vertical: all points share the same x. Equation x = c, slope undefined.

Graphing them

To graph y = 2, find 2 on the y-axis and draw a horizontal line through it. To graph x = −3, find −3 on the x-axis and draw a vertical line through it. The two lines cross at (−3, 2) — the point whose x is −3 and whose y is 2.

Try it in the calculator

Writing the equation from two points

If two points have the same y-value, the line is horizontal: (−5, 7) and (2, 7) give y = 7.

If two points have the same x-value, the line is vertical: (4, −2) and (4, 2) give x = 4. The slope formula confirms it: (2 − (−2)) ⁄ (4 − 4) = 4 ⁄ 0, undefined.

Try it in the calculator

Memory tricks

  • The equation names the coordinate that stays fixed. “y = 3” fixes y; the line runs left–right.
  • “Horizontal” contains the “horizon” — flat, like y = c.
  • Slope 0 is a flat road you could walk; an undefined slope is a wall you could not climb.

Where they appear

  • Asymptotes: horizontal asymptotes y = c and vertical asymptotes x = c of rational functions — see asymptotes.
  • Inequalities: x ≥ −2 shades everything to the right of a vertical line.
  • Domain and range on a graph: vertical lines mark where a domain starts or stops; horizontal lines mark the bounds of a range.

Common mistakes

  • Graphing x = 3 as a horizontal line. x = 3 is vertical.
  • Saying a vertical line has slope 0. Its slope is undefined; horizontal lines have slope 0.
  • Calling x = 3 a function. It fails the vertical line test.
  • Typing x = 3 into a y = … box. In the graphing calculator, type x = 3 on its own line and it is recognised as a vertical line.

Questions

Is the x-axis a horizontal line?

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

Why is a vertical line not a function?

A function gives one output for each input. The line x = 4 pairs the input 4 with every y-value, so it fails the vertical line test.

Are horizontal and vertical lines perpendicular?

Always. Any horizontal line meets any vertical line at a right angle, even though the slope rule m₁·m₂ = −1 cannot be used (one slope is undefined).

Graph your own example with the Slope Intercept Form Calculator — free, in your browser.

Try it now

Sources and further reading

Worked examples and figures were produced and checked with the Graphing Calculator Lab engine. See the editorial policy.

Related guides

More in Lines and Linear Equations · All guides