Sitonce
Country: US
Show exams for United States Hong Kong
Sign in

Slope of a Vertical Line

Updated 6 min read
Key takeaway

A vertical line has undefined slope.

More key points
  • Between any two distinct points on it, the change in x is zero, so m = change in y divided by change in x would require division by zero.
  • Its equation is x = a for a constant a.
On this page7 sections
  1. See it in the slope formula
  2. Recognize a vertical line from its equation
  3. Find the equation from points or a graph
  4. Connect slope to rate of change
  5. Common mistakes
  6. Exam takeaway
  7. Recognize vertical and horizontal lines from coordinates

Slope measures vertical change divided by horizontal change: m = (y₂ − y₁)/(x₂ − x₁). A vertical line changes y while x stays fixed. Its horizontal change, or run, is zero, so the slope formula would divide by zero. Division by zero is undefined; therefore a vertical line has undefined slope, sometimes informally called no slope.

See it in the slope formula

Take the points (4, 1) and (4, 7) on the vertical line x = 4. The change in y is 7 − 1 = 6, while the change in x is 4 − 4 = 0. The slope calculation is 6/0, which is undefined. Reversing the order of the points gives −6/0, also undefined. The issue is not the size or sign of the rise; it is the zero run.

A horizontal line behaves differently. Between (1, 3) and (8, 3), the change in y is zero and the change in x is 7, so slope is 0/7 = 0. The horizontal line is level. A vertical line is upright, with x fixed. Remember: horizontal has zero slope; vertical has undefined slope.

Recognize a vertical line from its equation

A vertical line has the form x = a, where a is a constant. Every point on x = 4 has x-coordinate 4, while the y-coordinate can vary. The equation does not solve for y as a function of x, because the same x-value is paired with many y-values. By contrast, a horizontal line has equation y = b.

A vertical line cannot be written in slope-intercept form y = mx + b with a finite slope. Substituting a fixed x into y = mx + b would produce one y-value, not every point on a vertical line. This is why trying to assign a very large number as the vertical slope does not work mathematically: no finite slope describes it, and infinity is not a real-number slope value.

Find the equation from points or a graph

If two points have the same x-coordinate, they lie on a vertical line. The equation is x equal to that shared coordinate. For (−2, 5) and (−2, −3), the line is x = −2. Do not use the y-coordinate in the equation; it varies along the line.

On a graph, look for a straight path that goes up and down without moving left or right. Every plotted point on it should have the same x-coordinate. If the line passes through the tick mark x = 6, its equation is x = 6. This can be checked by testing two visible points: each should have x = 6 even if their y-values differ.

When a graph includes several lines, trace a vertical candidate across the grid: it should cross each vertical gridline position at only one x-value. A line that is nearly upright but shifts from x = 2 to x = 2.1 is steep rather than vertical and has a large finite slope. Only a line with exactly zero horizontal change has undefined slope. Graphs drawn by hand may not be to scale, so use plotted coordinates or the equation instead of visual steepness alone.

Connect slope to rate of change

Slope is a rate of change: how much the output y changes for a change in input x. On a vertical line there is no change in x available to compare with a change in y. If a function were to assign multiple y-values to the same x, it would fail the vertical line test. The undefined slope is consistent with the fact that the graph is not a function y = f(x).

This does not mean a vertical line has no points or that it cannot be graphed. It contains infinitely many points and has a simple equation. 'Undefined slope' refers only to the slope calculation, which has zero in its denominator.

The vertical line test is a separate way to determine whether a graph represents y as a function of x: imagine drawing any vertical line. If one such line crosses the graph more than once, the same x-value is paired with multiple y-values, so the relation is not a function. The line x = 4 itself fails this test at every point on it. A vertical line can still represent a relation and can still be a useful boundary, such as x = 4 separating two regions.

Common mistakes

  • Calling the vertical slope zero; zero slope belongs to a horizontal line.
  • Calling it infinity; the standard slope is undefined because the formula divides by zero.
  • Writing y = a for a vertical line; use x = a.
  • Subtracting coordinates in inconsistent order and thinking it changes the result. Use the same point order in numerator and denominator.
  • Assuming any line that looks steep is vertical; verify whether the x-coordinate is actually constant.

A reliable check is to inspect the denominator of the slope formula. If x₂ − x₁ = 0 for distinct points, the line is vertical and its slope is undefined. If y₂ − y₁ = 0 but x₂ − x₁ is nonzero, the line is horizontal and its slope is zero.

Exam takeaway

Vertical means constant x, equation x = a, and undefined slope because the run is zero. Horizontal means constant y, equation y = b, and slope zero because the rise is zero. The two cases are easy to distinguish by checking which coordinate stays fixed.

Recognize vertical and horizontal lines from coordinates

A vertical line keeps the x-coordinate fixed while y changes. Points (4, −2) and (4, 7) therefore lie on x = 4; the denominator in the slope formula is 4 − 4 = 0, so the slope is undefined. A horizontal line keeps y fixed: (−3, 5) and (6, 5) produce a zero numerator and slope 0, with equation y = 5. Both lines have direction, but their algebraic slopes are different.

A quick sketch can expose a mistaken answer. Vertical lines run up and down and fail the vertical-line test for being a function of x because one x-value has many y-values. Horizontal lines pass that test and have one output for every x. In a line equation, x = c is vertical and cannot be rearranged into y = mx + b; y = c is horizontal and has slope zero. If a problem gives two identical points, the usual slope formula is 0 divided by 0 and does not determine a unique line; first verify that the points are distinct.

Common questions

Why is the slope of a vertical line undefined?

Its run is zero, so the slope formula divides by zero.

Is the slope of a vertical line zero or infinity?

Neither: its slope is undefined. A horizontal line has slope zero.

What is the equation of a vertical line through x = −3?

x = −3. The y-coordinate varies along the line.

Can a vertical line be written as y = mx + b?

No finite value of m describes a vertical line in slope-intercept form.