Undefined Slope: Definition, Equation & Examples

#Geometry
TL;DR
An undefined slope is the slope of a vertical line, where every point shares the same x-coordinate, so the slope formula divides by zero. This article covers why a vertical line's slope is undefined, the equation x = a, the graph, how undefined slope differs from zero slope, and six worked examples.
BT
Bhanzu TeamLast updated on June 7, 20269 min read

What Is an Undefined Slope?

An undefined slope is the slope of a vertical line, a line that runs straight up and down, parallel to the y-axis. On such a line, every point has the same x-coordinate while the y-coordinate is free to change. As you trace the line, you move only up or down, never left or right.

The slope of any line measures steepness as rise over run, the change in y divided by the change in x. For a vertical line the run, the change in x, is zero. Dividing by zero has no answer in mathematics, so the slope has no value at all. We do not call it "infinite" or "zero"; we call it precisely undefined, because the operation that would produce it is not allowed. (For the general slope idea, see Slope of a Line.)

Why Is the Slope of a Vertical Line Undefined?

This is the question at the centre of the topic, and the slope formula answers it in one line. For any two points $(x_1, y_1)$ and $(x_2, y_2)$:

$$m = \frac{y_2 - y_1}{x_2 - x_1}.$$

On a vertical line, both points share the same x-coordinate, so $x_1 = x_2$ and the denominator becomes:

$$x_2 - x_1 = 0.$$

That leaves:

$$m = \frac{y_2 - y_1}{0}.$$

Division by zero is undefined: there is no number that, multiplied by $0$, gives a non-zero numerator. So the slope simply does not exist as a value. The geometry says the same thing in plain words: the line is infinitely steep, climbing without moving sideways at all, and "infinitely steep" is not a number you can write down. That is why a vertical line's slope is undefined, not large, not infinite, just undefined.

The Equation of a Line With Undefined Slope

Because a vertical line holds its x-coordinate constant, its equation names that fixed value and nothing else:

$$x = a,$$

where $a$ is the constant x-value the line sits at. There is no $y$ in the equation, because the line accepts every y-value, so $y$ never needs to be specified. A few examples make the pattern clear:

  • $x = 3$ passes through every point with x-coordinate $3$, such as $(3, 0)$, $(3, 5)$, and $(3, -2)$.

  • $x = -4$ is the vertical line four units left of the y-axis.

  • $x = 0$ is the y-axis itself, a special vertical line.

Notice a vertical line cannot be written in slope-intercept form $y = mx + b$, because there is no value of $m$ to put in; the slope is undefined. The form $x = a$ is the only way to write it.

What Does an Undefined Slope Look Like on a Graph?

The graph is the easiest part to recognise once you know the rule: a line with undefined slope is always a straight vertical line. To draw $x = a$:

  1. Mark the constant x-value on the x-axis (say, $a = 2$, so mark $(2, 0)$).

  2. Draw a straight line through that mark running straight up and down, parallel to the y-axis.

  3. Every point you cross, such as $(2, -3)$, $(2, 1)$, and $(2, 4)$, shares the x-coordinate $2$, which confirms the line is vertical.

If a line on a graph rises straight up with no sideways lean, its slope is undefined. Any lean at all, however slight, gives a defined (very large) slope instead.

Undefined Slope vs Zero Slope

This is the comparison that causes the most trouble, so it is worth pinning down. The two are opposites, not two names for the same thing.

Feature

Zero slope

Undefined slope

Type of line

horizontal

vertical

Equation

$y = b$

$x = a$

Slope value

$m = 0$

no value (undefined)

What stays constant

y-coordinate

x-coordinate

Slope formula gives

$\dfrac{0}{\text{non-zero}} = 0$

$\dfrac{\text{non-zero}}{0}$ = undefined

Angle with x-axis

$0^\circ$

$90^\circ$

The whole distinction lives in which part of the fraction is zero. A horizontal line has a zero numerator (rise $= 0$), and zero divided by a real number is just $0$, a perfectly good slope. A vertical line has a zero denominator (run $= 0$), and dividing by zero is not allowed, so the slope is undefined. The pairing to memorise: zero on top is flat (slope 0); zero on the bottom is vertical (undefined). A horizontal line's full treatment lives in Horizontal Line.

Examples of Undefined Slope

With the definition, the division-by-zero reason, and the equation in place, here is the concept doing real work. The problems build from naming a line up to telling undefined from zero slope.

Example 1 - What is the slope of the line $x = 5$?

It is a vertical line, every point has x-coordinate $5$, so the slope is undefined.

Final answer: undefined.

Example 2 - Find the slope of the line through $(2, -5)$ and $(2, -3)$

A common first move is to compute $\dfrac{-3 - (-5)}{2 - 2} = \dfrac{2}{0}$ and then record the slope as $0$, reading the zero in the denominator as if the whole fraction were zero. Check that reading: $\dfrac{2}{0}$ is not $0$. Zero comes from $\dfrac{0}{2}$, a zero on top. A zero on the bottom means the division cannot be done at all.

Done correctly: $m = \dfrac{-3 - (-5)}{2 - 2} = \dfrac{2}{0}$, which is undefined. The two points share x-coordinate $2$, so the line is vertical with undefined slope.

Example 3 - Write the equation of the vertical line passing through $(7, -1)$

A vertical line holds its x-coordinate constant, and here that value is $7$. The equation is $x = 7$.

Final answer: $x = 7$.

Example 4 - A line passes through $(-4, 2)$ and $(-4, 9)$. Find its slope and equation

Both points have x-coordinate $-4$, so the line is vertical: equation $x = -4$. Slope check: $m = \dfrac{9 - 2}{-4 - (-4)} = \dfrac{7}{0}$, which is undefined, confirming the vertical line.

Final answer: equation $x = -4$; slope undefined.

Example 5 - Can the line $x = 6$ be written in slope-intercept form $y = mx + b$?

No. Slope-intercept form needs a slope value for $m$, but a vertical line's slope is undefined, so there is no $m$ to use. The line can only be written as $x = 6$.

Final answer: no, only $x = 6$.

Example 6 - A line through $(3, 4)$ and $(8, 4)$ is claimed to have undefined slope. Is that right?

Check the coordinates: the y-values match ($4$ and $4$), not the x-values. So this is a horizontal line, with $m = \dfrac{4 - 4}{8 - 3} = \dfrac{0}{5} = 0$. The slope is $0$, not undefined.

Final answer: no; the slope is $0$ (horizontal line).

Where Undefined Slope Shows Up

A vertical line, and its undefined slope, is the picture for "no horizontal change at all," which turns up the moment one quantity is fixed while another varies freely.

  • Instant change. On a graph of any quantity over time, a vertical segment would mean a value jumping between two readings in zero time, which is why true vertical lines flag idealised, instantaneous changes rather than real continuous processes.

  • Boundaries and limits. A vertical line on a chart often marks a fixed cutoff, a deadline date, a price ceiling, a temperature threshold, where one axis is pinned and the other runs free.

  • Surveying and construction. A plumb line hanging from a weight is a physical vertical line; its undefined slope is exactly why builders use it as the reference for "perfectly upright."

  • Function tests. The vertical-line test uses these lines to check whether a graph is a function at all: if any vertical line hits a curve more than once, one input has two outputs, and it is not a function.

The coordinate framework that lets us write a vertical line as $x = a$ and reason about its slope traces back to RenΓ© Descartes and his 1637 union of algebra and geometry, the same system behind every graph you plot.

Where Students Trip Up on Undefined Slope

Mistake 1: Calling an undefined slope "zero"

Where it slips in: The slope calculation gives $\dfrac{2}{0}$, and the student records the slope as $0$.

Don't do this: Read a zero in the denominator as if the whole fraction equals zero.

The correct way: $\dfrac{2}{0}$ is undefined, not $0$. Zero slope comes from $\dfrac{0}{\text{non-zero}}$. The pairing: zero on top is flat; zero on the bottom is vertical and undefined.

Mistake 2: Writing the equation as $y = a$ instead of $x = a$

Where it slips in: Asked for a vertical line at $x = 5$, a student writes $y = 5$.

Don't do this: Reach for $y$ out of habit.

The correct way: A vertical line keeps x constant, so it is $x = 5$. The missing variable names the direction: no $y$ means vertical; no $x$ means horizontal.

Mistake 3: Saying a vertical line has "no slope" and stopping there

Where it slips in: A student reports "no slope" and treats it as the same as a slope of $0$.

Don't do this: Blur "undefined slope" together with "slope of zero."

The correct way: "Undefined slope" and "slope of zero" describe opposite lines, vertical and horizontal. Saying a vertical line has "no defined slope value" is fine, but it must never be confused with the flat line whose slope is the number $0$.

Key Takeaways

  • An undefined slope belongs to a vertical line; its equation is $x = a$, with no $y$ in it.

  • The slope is undefined because all points share an x-coordinate, so rise over run divides by zero.

  • Undefined slope (vertical, run $= 0$) is the opposite of zero slope (horizontal, rise $= 0$).

  • A vertical line cannot be written in slope-intercept form, since there is no slope value to use.

  • Reading the slope fraction aloud, "non-zero over zero," makes "undefined" clear.

Practice These Problems to Solidify Your Understanding

  1. What is the slope of the line $x = -2$?

  2. Find the slope of the line through $(5, 1)$ and $(5, 8)$, then write its equation.

  3. Is the slope of the line through $(0, 3)$ and $(6, 3)$ undefined or zero?

Answer to Question 1: undefined (vertical line). Answer to Question 2: undefined, since the run is $5 - 5 = 0$; equation $x = 5$. Answer to Question 3: zero, since the rise is $3 - 3 = 0$ and $\dfrac{0}{6} = 0$ (a horizontal line). If Question 2 gave "$0$," recheck which coordinate stays constant.

Want a live Bhanzu trainer to walk your child through slope and line equations? Book a free demo class β€” online globally.

Book a Free Demo

Was this article helpful?

Your feedback helps us write better content

Frequently Asked Questions

What is an undefined slope?
The slope of a vertical line. Every point on the line shares one x-coordinate, so the run is zero and the slope formula divides by zero, which has no value.
What is the equation of a line with undefined slope?
$x = a$, where $a$ is the constant x-value. Examples include $x = 3$, $x = -4$, and $x = 0$ (the y-axis). It cannot be written as $y = mx + b$.
Is a zero slope the same as an undefined slope?
No. A zero slope is a horizontal line ($y = b$), where the rise is zero so the slope is the number $0$. An undefined slope is a vertical line ($x = a$), where the run is zero so the slope has no value. The companion topic for the flat case is the Horizontal Line.
Do you have an undefined slope when a line is parallel to the y-axis?
Yes. A line parallel to the y-axis is vertical, so all its points share an x-coordinate and its slope is undefined.
Why is the slope of a vertical line undefined and not infinite?
Because the slope formula divides by zero, and division by zero produces no number, not even infinity. "Infinitely steep" describes the picture, but the value itself is undefined rather than equal to any number, including $\infty$.
✍️ Written By
BT
Bhanzu Team
Content Creator and Editor
Bhanzu’s editorial team, known as Team Bhanzu, is made up of experienced educators, curriculum experts, content strategists, and fact-checkers dedicated to making math simple and engaging for learners worldwide. Every article and resource is carefully researched, thoughtfully structured, and rigorously reviewed to ensure accuracy, clarity, and real-world relevance. We understand that building strong math foundations can raise questions for students and parents alike. That’s why Team Bhanzu focuses on delivering practical insights, concept-driven explanations, and trustworthy guidance-empowering learners to develop confidence, speed, and a lifelong love for mathematics.
Related Articles
Book a FREE Demo ClassBook Now β†’